Conventionally database allocation tends to be a mixture of "fixed-size" allocation and "blob" allocation.

Normally this works okay, providing that you know beforehand how big the allocation requirement is.

A Step Back

When data is saved to some storage area, it is typically written to some buffer - which often will have a stream interface.

The buffer is then examined to determine the allocation size required. Data is then copied from the buffer to the store.

Fusion

By having the IStore object creating the output stream we end up both simplifying the buffering process, whilst at the same time enabling the possibility of incremental writes to the store, removing the requirement for potentially unmanageable buffer sizes.

As the PSOutputStream can write incrementally, not only are large in-memory buffers avoided, but also large contiguous storage areas, which would otherwise cause fragmentation problems on reallocation. Instead, the stream interface manages linked allocation blocks.

Linked blocks enable multiple PSOutputStreams to be written concurrently, and for efficient reallocation since new streams will use the parts of old streams.