Struct db_core::Instance [−][src]
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]
path: &str,
block_size: usize,
desc_set: &[FileDesc]
) -> Result<(), Error>
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]
&self,
file_type: FileType,
extent_size: u16,
extent_num: u16,
max_extent_num: u16
) -> Result<(), Error>
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]
&self,
obj_id: &ObjectId,
t: &Transaction<'_>
) -> Result<Object<'_>, Error>
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]
&'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 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]
&'a self,
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 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]
&self,
obj_id: &ObjectId,
t: &mut Transaction<'_>,
timeout: i64
) -> Result<(), Error>
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
impl !RefUnwindSafe for Instance
[src]
impl !Send for Instance
[src]
impl !Sync for Instance
[src]
impl Unpin for Instance
[src]
impl !UnwindSafe for Instance
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,