Struct db_core::instance::Instance [−][src]
pub struct Instance { /* fields omitted */ }
Expand description
Instance provides interface for the client to interact with the system: initiate and complete transaction, write and read data, etc.
Implementations
Create a new instance with given configuration.
Initialize datastore: create data, checkpoint, versioning store files, and lock file.
Add a new file to datastore and return it’s file_id.
Begin a new transaction.
Open an existing object for read. After object is opened it is possible to read and seek through object’s data.
pub fn open_write<'a>(
&'a self,
obj_id: &ObjectId,
t: &'a mut Transaction<'_>,
timeout: i64
) -> Result<ObjectWrite<'_>, Error>
pub fn open_write<'a>(
&'a self,
obj_id: &ObjectId,
t: &'a mut Transaction<'_>,
timeout: i64
) -> Result<ObjectWrite<'_>, Error>
Open an existing object for modification by its id. After object is opened it is possible to read, write and seek through object data. This operation puts lock on the object which is released after transaction commit or rollback. If timeout is -1 then wait indefinitely, otherwise wait for requested time in ms before returning error, or until transaction holding lock on the object has finished.
pub fn open_create<'a>(
&'a self,
file_id: u16,
t: &'a mut Transaction<'_>,
initial_size: usize
) -> Result<ObjectWrite<'_>, Error>
pub fn open_create<'a>(
&'a self,
file_id: u16,
t: &'a mut Transaction<'_>,
initial_size: usize
) -> Result<ObjectWrite<'_>, Error>
Create a new object and open it for write. After object is opened it is possible to read, write and seek object data. This operation puts lock on the object which is released after transaction commit or rollback.
Delete an object. If object is in use, timeout can be specified, and current transaction will wait given time until transaction holding the lock on the object has finished.
Build instance using shared state.
Return shared state that can be shared between threads.