synology_apm_repo.sdk.dedup.segment_buffers module¶
Where BufferedExportSink keeps each segment while it is filled and
flushed: a Slot of a SlotPool — one shared-memory block
(SharedPool) or one sparse temporary file (Spool) holding every
slot side by side, so a worker process can write into its slot directly.
- class synology_apm_repo.sdk.dedup.segment_buffers.SlotPool(segment_size)¶
Bases:
ABCEvery slot of one export side by side: slot
kis the bytes[k * segment_size, (k + 1) * segment_size). Offsets below are pool-relative; aSlotadds its own base.- async create(slots)¶
- take()¶
Hands out the lowest free slot; the caller checked one is free.
- async close()¶
Releases the storage, once a cancelled
create’s thread is done (the storage it made is ours to release).
- abstractmethod async write_at(offset, data)¶
- abstractmethod async write_zero(offset, length)¶
- abstractmethod async read(offset, length)¶
- abstractmethod async clear(offset, length)¶
Zeroes a whole slot again for its next segment.
- abstractmethod descriptor()¶
How a worker process opens the pool for writing.
- class synology_apm_repo.sdk.dedup.segment_buffers.Slot(pool, index)¶
Bases:
objectWhere one segment’s bytes live while it is filled and flushed. A slot reads as zero until written, and is zero again when it is handed out.
- caps = SinkCaps(supports_sparse=True)¶
- preallocated = True¶
- async write_at(offset, data)¶
- async write_zero(offset, length)¶
- async read(offset, length)¶
- worker_target()¶
- note_worker_write()¶
- async release()¶
Takes the slot back, leaving it zero for the next segment.
- discard()¶
Takes the slot back without caring what it holds (the export is over).
Bases:
objectSinkDescriptorfor a block of shared memory the parent created: a worker process attaches to it by name and writes into it directly.
Bases:
SlotPoolSlots in one block of shared memory, which worker processes attach to by name and write into directly.
Zeroes a whole slot again for its next segment.
How a worker process opens the pool for writing.
- class synology_apm_repo.sdk.dedup.segment_buffers.Spool(directory, segment_size)¶
Bases:
SlotPoolSlots in one sparse temporary file, which worker processes open by path and write into directly.
- async run(call, *args, **kwargs)¶
Runs a blocking call on the spool’s fd in a thread that
closewaits for, so a cancelled caller can never leave one writing to a closed (and perhaps reused) descriptor.
- async write_at(offset, data)¶
- async write_zero(offset, length)¶
- async read(offset, length)¶
- async clear(offset, length)¶
Zeroes a whole slot again for its next segment.
- descriptor()¶
How a worker process opens the pool for writing.