blocks.store.buffer

Buffer stores provide logical block storage which uses two backing stores to implement a buffer. New blocks are written to the buffer store, which can be flushed to write all of the blocks to the primary store. Reads return a unified view of the existing and buffered blocks.

buffer-block-store

(buffer-block-store & {:as opts})

Create a new buffering block store.

  • :buffer Block store to use for new writes.
  • :primary Block store to use for flushed blocks.
  • :predicate (optional) A predicate function which should return false for blocks which should not be buffered; instead, they will be written directly to the primary store.

clear!

(clear! store)

Remove all blocks from the buffer. Returns a deferred which yields a summary of the deleted blocks.

flush!

(flush! store)

Flush the store, writing all buffered blocks to the primary store. Returns a deferred which yields a summary of the flushed blocks.