[][src]Module kekbit::core

Structs

Header

Defines and validates the metadata associated with a channel.

ShmReader

An implementation of the Reader which access a persistent channel through memory mapping. A ShmReader must be created using the shm_reader function.

ShmWriter

An implementation of the Writer which access a persistent channel through memory mapping, and uses a specific DataFormat. A ShmWriter must be created using the shm_writer function. Any ShmWriter exclusively holds the channel is bound to, and it is not thread safe. If multiple threads must write into a channel they should be externally synchronized.

Enums

ChannelError

Channel Access errors

InvalidPosition

Errors caused by failed move_to operation.

ReadError

Read operation errors

TickUnit

A TickUnit represents a specific time duration but does not maintain time information, it only helps define the time granularity required to used in various contexts by all kekbit components which share a given channel. For each channel it's TickUnit will be spcified at creation and will never be changed

WriteError

Write operation errors

Traits

Reader

The Reader trait allows reading bytes from a kekbit channel. Implementers of this trait are called 'kekbit readers'. Usually a reader is bound to a given channel, and it is expected that multiple readers will safely access the same channel simultaneous.

Writer

The Writer trait allows writing chunk of bytes as records into a kekbit channel. Implementers of this trait are called 'kekbit writers'. Usually a writer is bound to a given channel, and it is expected that there is only one writer which directly writes into the channel, however multiple writers may cooperate during the writing process. For any given channel a DataFormat must be specified.

Functions

shm_reader

Creates a kekbit reader associated to a memory mapped channel.

shm_writer

Creates a file backed memory mapped kekbit channel and a writer associate with it.

storage_path

Returns the path to the file associated with a channel inside a kekbit root folder.

try_shm_reader

Tries multiple times to create a kekbit reader associated to a memory mapped channel. This function will basically call shm_reader up to tries time unless it succeeds. Between two tries the function will spin/sleep for a about duration_millis/tries milliseconds so potentially could be blocking. This should be the preferred method to create a reader when you are willing to wait until the channel is available.