Struct block_array_cow::BArrayStore [] [src]

pub struct BArrayStore { /* fields omitted */ }

Main storage for all states

Methods

impl BArrayStore
[src]

Main Array Storage API

Create a new array store, which can store any number of arrays as long as their stride matches.

  • stride the sizeof() each element,

Note while a stride of 1 will always work, its less efficient since duplicate chunks of memory will be searched at positions unaligned with the array data.

  • chunk_count Number of elements to split each chunk into.

    • A small value increases the ability to de-duplicate chunks, but adds overhead by increasing the number of chunks to look-up when searching for duplicates, as well as some overhead constructing the original array again, with more calls to memcpy.
    • Larger values reduce the book keeping overhead, but increase the chance a small, isolated change will cause a larger amount of data to be duplicated.

Return a new array store.

[src]

[src]

Clear all contents, allowing reuse of self.

[src]

BArrayStore Statistics

return the total amount of memory that would be used by getting the arrays for all states.

[src]

return the amount of memory used by all BChunk.data (duplicate chunks are only counted once).

[src]

BArrayState Access

  • data Data used to create.

  • state_reference The state to use as a reference when adding the new state, typically this is the previous state, however it can be any previously created state from this self.

Returns the new state, which is used by the caller as a handle to get back the contents of data. This may be removed using BArrayStore.state_remove, otherwise it will be removed with BArrayStore.destroy.

[src]

Remove a state and free any unused BChunk data.

The states can be freed in any order.

[src]

return the expanded size of the array, use this to know how much memory to allocate BArrayStore.state_data_get 's argument.

[src]

Fill in existing allocated memory with the contents of state.

[src]

Allocate an array for state and return it.

[src]

Trait Implementations

impl Drop for BArrayStore
[src]

[src]

Executes the destructor for this type. Read more