Struct persy::Persy
[−]
[src]
pub struct Persy { /* fields omitted */ }
Methods
impl Persy
[src]
fn create<P: Into<String>>(path: P) -> PRes<()>
fn open<P: Into<String>>(path: P, config: Config) -> PRes<Persy>
Open a database file.
The file should have been created with Persy::create
Errors
if the file does not exist fail.
fn begin(&self) -> PRes<Transaction>
Begin a new transaction.
The isolation level is 'read_commited', for commit it call prepare_commit
and
commit
fn create_segment(&self, tx: &mut Transaction, segment: &str) -> PRes<()>
fn drop_segment(&self, tx: &mut Transaction, segment: &str) -> PRes<()>
fn exists_segment(&self, segment: &str) -> PRes<bool>
fn exists_segment_tx(&self, tx: &Transaction, segment: &str) -> PRes<bool>
fn insert_record(
&self,
tx: &mut Transaction,
segment: &str,
rec: &Vec<u8>
) -> PRes<RecRef>
&self,
tx: &mut Transaction,
segment: &str,
rec: &Vec<u8>
) -> PRes<RecRef>
create a new record
This function return an id that can be used by read_record
and read_record_tx
,
the record content can be read only with the read_record_tx
till the transacion is commited.
fn read_record_tx(
&self,
tx: &Transaction,
segment: &str,
rec_ref: &RecRef
) -> PRes<Option<Vec<u8>>>
&self,
tx: &Transaction,
segment: &str,
rec_ref: &RecRef
) -> PRes<Option<Vec<u8>>>
Read the record content considering eventual in transaction changes.
fn read_record(&self, segment: &str, rec_ref: &RecRef) -> PRes<Option<Vec<u8>>>
Read the record content from persistent data.
fn scan_records(&self, segment: &str) -> PRes<RecordScanner>
Scan for persistent records
fn update_record(
&self,
tx: &mut Transaction,
segment: &str,
rec_ref: &RecRef,
rec: &Vec<u8>
) -> PRes<()>
&self,
tx: &mut Transaction,
segment: &str,
rec_ref: &RecRef,
rec: &Vec<u8>
) -> PRes<()>
update the record content.
This updated content can be read only with the read_record_tx
till the transacion is commited.
fn delete_record(
&self,
tx: &mut Transaction,
segment: &str,
rec_ref: &RecRef
) -> PRes<()>
&self,
tx: &mut Transaction,
segment: &str,
rec_ref: &RecRef
) -> PRes<()>
delete a record.
The record will result deleted only reading it whit read_record_tx
till the transacion is commited.
fn rollback(&self, tx: Transaction) -> PRes<()>
Rollback a not yet prepared transaction.
fn prepare_commit(&self, tx: Transaction) -> PRes<TransactionFinalize>
Prepare to commit a transaction, it will lock all the records involved in the transaction
till a commit
or rollback_prepared
is called.
fn rollback_prepared(&self, finalizer: TransactionFinalize) -> PRes<()>
Rollback a prepared commit.
fn commit(&self, finalizer: TransactionFinalize) -> PRes<()>
Finalize the commit result of a prepared commit.
Trait Implementations
impl Clone for Persy
[src]
fn clone(&self) -> Persy
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more