Struct snapper_box::file::LsmFile[][src]

pub struct LsmFile<T, K> where
    T: Read + Write + Seek,
    K: Key
{ /* fields omitted */ }
Expand description

LSM Abstraction over something File like (i.e. implementing Read, Write, and Seek).

This type maintains a write cache in memory, and you must call the flush method for the changes to be persisted. This type will not automatically flush.l

Implementations

Creates a new LsmFile from the provided, already existing, File like object.

Accepts values for the compression level for the file, the key to be used for encryption/decryption, as well as the maximum number of cache entries before a mandatory flush occurs, which defaults to 100.

Errors
  • Error::EntryIO if an error occurs while reading the entries
  • Will bubble up any segment errors`

Retries a value from the store given a key, if the value exists in the store.

The most recently inserted version of the value will be returned

Errors

Will return an error if any IO error occurs, or if the value fails to deserialize.

Inserts an object into the store

This method will write to the cache, however, if this insertion makes the cache size greater than or equal to the maximum number of entries, the current cache will be flushed.

Errors
  • Will return an error if either the key or value fail to serialize
  • Will bubble up any IO errors that occur, if a flush occurs

Flushes the cache to disk

Errors

Will bubble up any IO errors

Converts the current contents of the store to a HashMap.

Iterates through this LsmFIle’s keys, and insert them all into the returned HashMap. The most up to date value will be used for each key.

Errors

Will bubble up any error that occurs during a get operation

Converts the current contents of the store to a Vec of pairs.

Iterates through this LsmFIle’s keys, and insert them all into the returned Vec]. The most up to date value will be used for each key.

Errors

Will bubble up any error that occurs during a get operation

Consumes self and returns the inner File like object

Opens an existing LsmFile from the provided path.

Will open the file in read/write mode. Will fail if the file does not exists.

Errors
  • If the file does not exist
  • If any other IO occurs
  • If any of the decryption or deserialization of control structures fails

Opens an existing LsmFile from the provided path.

Will create the file in read/write mode, failing if the file exists

Errors
  • If the file already exists
  • If any other IO occurs

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.

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