Class PackedDeletionSet
open(java.nio.file.Path, java.lang.String) maps the file, checks the magic bytes and format version (v1 and v2 both read),
verifies the whole-file CRC32C, confirms the header's entity type, and lifts the small
prefix-index tables onto the heap (they are hot and reused by every query); the identifier offset
table, identifier data, and Bloom filter stay in the mapping. The mapping is held for the life of
this object — the dataset is immutable and there is no close.
contains(byte[]) reads the mapping by absolute index only and holds no mutable state, so an
instance is safe for concurrent callers.
-
Method Summary
Modifier and TypeMethodDescriptionlongchecksum()Returns this file's CRC32C, as read from its header and already verified against the file's actual bytes byopen(java.nio.file.Path, java.lang.String), as an unsigned 32-bit value in the low bits of the result.booleancontains(byte[] id) Returns whetheridis recorded as deleted for this entity type.Returns the entity type this file holds, as read from its header.intReturns the number of identifiers in this file.static PackedDeletionSetMaps and validates the packed file atpath.
-
Method Details
-
open
Maps and validates the packed file atpath.- Parameters:
path- the packed fileexpectedEntityType- the entity type the caller expects this file to hold (from the manifest)- Returns:
- a queryable view of the file
- Throws:
IOException- if the file cannot be opened or mappedCorruptDatasetException- if the file is truncated, its magic bytes are wrong, its checksum does not match, or its entity type is notexpectedEntityTypeUnsupportedFormatVersionException- if the file's format version is one this build cannot read
-
contains
public boolean contains(byte[] id) Returns whetheridis recorded as deleted for this entity type.When the file has a Bloom filter (format v2), it is consulted first: a "definitely not present" is returned immediately without touching the prefix index or the offset table, which is the common negative-lookup case; a "maybe" falls through to the exact two-level search, so the result is always exact.
- Parameters:
id- the identifier to check, UTF-8 encoded- Returns:
trueifidis present,falseotherwise
-
entityType
Returns the entity type this file holds, as read from its header.- Returns:
- the entity type
-
identifierCount
public int identifierCount()Returns the number of identifiers in this file.- Returns:
- the identifier count
-
checksum
public long checksum()Returns this file's CRC32C, as read from its header and already verified against the file's actual bytes byopen(java.nio.file.Path, java.lang.String), as an unsigned 32-bit value in the low bits of the result.- Returns:
- the file checksum
-