Layout

At construction it is configured with how the snapshots should be organized into buckets. How many and the space in time between them.

It is then updated with the current layout on the storage medium.

The only data that it relies on is the basename of the paths that are pushed to it.

It operates on two passes. During the first pass snapshots are added to the buckets following a best fit algorithm. Snapshots are never discarded at this stage. If a snapshot do not fit in a bucket or is replaced it is moved to a waiting list.

During the second pass the waiting snapshots are mapped back to the buckets via the same best fit algorithm. The difference here is that the buckets "time" is matched against all waiting snapshots. This is the reverse of the first pass.

Members

Functions

bestFitBucket
Nullable!Snapshot bestFitBucket(SysTime time)
finalize
void finalize()

Pass two. Moving waiting to either buckets or discarded.

snapshotTimeInBucket
Nullable!SysTime snapshotTimeInBucket(size_t idx)

Variables

discarded
Snapshot[] discarded;

Snapshots that has been discarded because they do are not the best fit for any bucket.

isFirstBucketEmpty
bool isFirstBucketEmpty;

Based on the first pass of the algoritm.

times
const(SysTime)[] times;

The time of the bucket which a snapshot should try to match.

waiting
Snapshot[] waiting;

Snapshots collected for pass two.

Meta