Struct bonsaidb::core::key::time::limited::BonsaiEpoch[][src]

pub struct BonsaiEpoch;
Expand description

A TimeEpoch implementation that allows storing LimitedResolutionTimestamp relative to the 10-year anniversary of BonsaiDb: March 20, 2031 04:31:47 UTC.

Why use BonsaiEpoch instead of UnixEpoch?

LimitedResolutionTimestamp uses [ordered-varint::Variable] to implement Key, which encodes the underlying value in as few bytes as possible while still preserving the ordering required by Key.

Many applications are not storing timestamps that predate the application being developed. When there is a likelihood that timestamps are closer to “now” than they are to the unix timestamp (January 1, 1970 00:00:00 UTC), the BonsaiEpoch will consistently encode the underlying representation in fewer bytes than when using UnixEpoch.

We hope BonsaiDb is a viable database option for many years. By setting this epoch 10 years from the start of BonsaiDb, it allows the internal representation of timestamps to slowly decrease in size until the 10-year anniversary. Over the following 10 years, the size will grow back to the same size it was at its conception, and then slowly grow as needed from that point on.

Trait Implementations

The offset from UNIX_EPOCH for this epoch.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more