Struct db_core::Instance[][src]

pub struct Instance { /* fields omitted */ }

Instance provides interface for the client to interact with the system: initiate and complete transaction, write and read data, etc.

Implementations

impl Instance[src]

System instance

pub fn new(conf: ConfigMt) -> Result<Instance, Error>[src]

pub fn initialize_datastore(
    path: &str,
    block_size: usize,
    desc_set: &[FileDesc]
) -> Result<(), Error>
[src]

Initialize datastore: create data, checkpoint, versioning store files, and lock file.

pub fn add_datafile(
    &self,
    file_type: FileType,
    extent_size: u16,
    extent_num: u16,
    max_extent_num: u16
) -> Result<(), Error>
[src]

Add a new file to datastore.

pub fn begin_transaction(&self) -> Result<Transaction<'_>, Error>[src]

begin a new transaction return tns of newely started transaction on success

pub fn commit(self, t: Transaction<'_>) -> Result<(), Error>[src]

commit transaction

pub fn rollback(self, t: Transaction<'_>) -> Result<(), Error>[src]

rollback transaction

pub fn open_read(
    &self,
    obj_id: &ObjectId,
    t: &Transaction<'_>
) -> Result<Object<'_>, Error>
[src]

open an existing object for read after object is opened it is possible to read and seek through object data

pub fn open_write<'a>(
    &'a self,
    obj_id: &ObjectId,
    t: &'a mut Transaction<'_>,
    timeout: i64
) -> Result<ObjectWrite<'_>, Error>
[src]

open an existing object for modification by its id after object is opened it is possible to read, write and seek through object data operation puts lock on the object which is released after commit or rollback. if timeout is -1 then wait indefinitely, otherwise wait for requested time in ms before returning error.

pub fn open_create<'a>(
    &'a self,
    t: &'a mut Transaction<'_>,
    initial_size: usize
) -> Result<ObjectWrite<'_>, Error>
[src]

create a new object and open it for write after object is opened it is possible to read, write and seek object data operation puts lock on the object which is released after commit or rollback

pub fn delete(
    &self,
    obj_id: &ObjectId,
    t: &mut Transaction<'_>,
    timeout: i64
) -> Result<(), Error>
[src]

Delete object

pub fn from_shared_state(ss: InstanceSharedState) -> Result<Self, Error>[src]

Build instance using shared state.

pub fn get_shared_state(&self) -> Result<InstanceSharedState, Error>[src]

Return shared state that can be shared between threads.

pub fn terminate(self)[src]

Terminate the instance. If several instances are running and sharing state then function has no effect for any of them but the last one. It is up to client to make sure all transactions are finished, otherwise unfinished transactions will be rolled back on the next start.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.