BlobPackBuilder

class dsviper.BlobPackBuilder(descriptor)

Bases: object

Fills the regions a BlobPackDescriptor describes, then seals them into a ValueBlob a BlobPack reads.

builder[name] answers a writable memoryview over that region; copy(name, buffer) writes one whole. build() hands the bytes over once, and a blob’s bytes never change afterwards.

build() ValueBlob

Return the ValueBlob of the regions written so far, and empty the builder.

Read it back with BlobPack.from_blob. The bytes are moved, not copied, so a value never shares them with a writer: every later write is refused. Fails while a region buffer of this builder is still exported — release the memoryview, or delete the NumPy array holding it, first.

byte_count(name: str | None = None) int

Return how many bytes the region name occupies, or the whole pack when name is None.

copy(name: str, buffer: Buffer) None

Write buffer over the region name; its size must match that region.

is_built() bool

Return whether build() has handed the bytes over to a blob.