Documentation
¶
Index ¶
Constants ¶
const ( // DefaultMaxPackBytes is the byte ceiling for a single uploaded packfile. DefaultMaxPackBytes int64 = 63 * 1024 * 1024 // DefaultMaxBlocksPerPack is the block-count ceiling for one packfile. DefaultMaxBlocksPerPack uint64 = 4096 // DefaultBloomFalsePositiveRate is the target pack bloom false-positive rate. DefaultBloomFalsePositiveRate = 0.008 )
const ValueOrderIterator = "iterator"
ValueOrderIterator records that physical kvfile value order follows the writer iterator order.
Variables ¶
This section is empty.
Functions ¶
func DigestSortedKeys ¶
DigestSortedKeys digests a pack's block keys independent of physical value order.
Types ¶
type BlockIterator ¶
type BlockIterator func() (h *hash.Hash, blk *block.StoredBlock, err error)
BlockIterator yields each block to pack with its hash. It returns a nil hash when exhausted.
type PackResult ¶
type PackResult struct {
// BloomFilter is the serialized bloom filter bytes.
BloomFilter []byte
// BlockCount is the number of blocks packed.
BlockCount uint64
// BytesWritten is the total bytes written.
BytesWritten uint64
// SortedKeyDigest is the v1 digest of the sorted block key set.
SortedKeyDigest []byte
// PackBytesDigest is the SHA-256 digest of the kvfile bytes.
PackBytesDigest []byte
// PolicyTag is the pack construction policy tag used for v1 identity.
PolicyTag string
// ValueOrderPolicy names how physical kvfile values were ordered.
ValueOrderPolicy string
}
PackResult contains the result of packing blocks into a kvfile.
func PackBlocks ¶
func PackBlocks(w io.Writer, iter BlockIterator) (*PackResult, error)
PackBlocks packs blocks from the iterator into a kvfile and computes a bloom filter sized to the packed block count. Each value is the encoded block.BlockObject of the block's bytes and refs, so every block must carry known refs.
type Policy ¶
type Policy struct {
MaxPackBytes int64
MaxBlocksPerPack uint64
BloomFalsePositive float64
RequireBloomFilter bool
RequireBlockCount bool
RequireCreatedAt bool
}
Policy describes pack construction limits and required metadata.
func DefaultPolicy ¶
func DefaultPolicy() Policy
DefaultPolicy returns the shared Spacewave pack construction policy.