C# Class LightningDB.LightningTransaction

Represents a transaction.
Inheritance: IDisposable
Afficher le fichier Open project: CoreyKaylor/Lightning.NET Class Usage Examples

Méthodes publiques

Méthode Description
Abort ( ) : void

Abandon all the operations of the transaction instead of saving them. All cursors opened within the transaction will be closed by this call. The cursors and transaction handle will be freed and must not be used again after this call.

BeginTransaction ( ) : LightningTransaction

Begins a child transaction.

BeginTransaction ( TransactionBeginFlags beginFlags ) : LightningTransaction

Begin a child transaction.

Commit ( ) : void

Commit all the operations of a transaction into the database. All cursors opened within the transaction will be closed by this call. The cursors and transaction handle will be freed and must not be used again after this call.

ContainsKey ( LightningDatabase db, byte key ) : bool

Check whether data exists in database.

CreateCursor ( LightningDatabase db ) : LightningDB.LightningCursor

Create a cursor. Cursors are associated with a specific transaction and database and may not span threads.

Delete ( LightningDatabase db, byte key ) : void

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.

Delete ( LightningDatabase db, byte key, byte value ) : void

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.

Dispose ( ) : void

Dispose this transaction and deallocate all resources associated with it (including databases).

DropDatabase ( LightningDatabase database ) : void

Drops the database.

Equals ( object obj ) : bool
Get ( LightningDatabase db, byte key ) : byte[]

Get value from a database.

GetEntriesCount ( LightningDatabase db ) : long

The number of items in the database.

GetHashCode ( ) : int
Handle ( ) : IntPtr
OpenDatabase ( string name = null, DatabaseConfiguration configuration = null ) : LightningDatabase

Opens a database in context of this transaction.

Put ( LightningDatabase db, byte key, byte value, PutOptions options = PutOptions.None ) : void

Put data into a database.

Renew ( ) : void

Renew current transaction.

Reset ( ) : void

Reset current transaction.

TruncateDatabase ( LightningDatabase database ) : void

Truncates all data from the database.

TryGet ( LightningDatabase db, byte key, byte &value ) : bool

Tries to get a value by its key.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Abort this transaction and deallocate all resources associated with it (including databases).

Private Methods

Méthode Description
LightningTransaction ( LightningEnvironment environment, LightningTransaction parent, TransactionBeginFlags flags ) : System

Created new instance of LightningTransaction

OnParentStateChanging ( LightningTransactionState state ) : void

Method Details

Abort() public méthode

Abandon all the operations of the transaction instead of saving them. All cursors opened within the transaction will be closed by this call. The cursors and transaction handle will be freed and must not be used again after this call.
public Abort ( ) : void
Résultat void

BeginTransaction() public méthode

Begins a child transaction.
public BeginTransaction ( ) : LightningTransaction
Résultat LightningTransaction

BeginTransaction() public méthode

Begin a child transaction.
public BeginTransaction ( TransactionBeginFlags beginFlags ) : LightningTransaction
beginFlags TransactionBeginFlags Options for a new transaction.
Résultat LightningTransaction

Commit() public méthode

Commit all the operations of a transaction into the database. All cursors opened within the transaction will be closed by this call. The cursors and transaction handle will be freed and must not be used again after this call.
public Commit ( ) : void
Résultat void

ContainsKey() public méthode

Check whether data exists in database.
public ContainsKey ( LightningDatabase db, byte key ) : bool
db LightningDatabase Database.
key byte Key.
Résultat bool

CreateCursor() public méthode

Create a cursor. Cursors are associated with a specific transaction and database and may not span threads.
public CreateCursor ( LightningDatabase db ) : LightningDB.LightningCursor
db LightningDatabase A database.
Résultat LightningDB.LightningCursor

Delete() public méthode

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.
public Delete ( LightningDatabase db, byte key ) : void
db LightningDatabase A database handle returned by mdb_dbi_open()
key byte The key to delete from the database
Résultat void

Delete() public méthode

Delete items from a database. This function removes key/data pairs from the database. If the database does not support sorted duplicate data items (MDB_DUPSORT) the data parameter is ignored. If the database supports sorted duplicates and the data parameter is NULL, all of the duplicate data items for the key will be deleted. Otherwise, if the data parameter is non-NULL only the matching data item will be deleted. This function will return MDB_NOTFOUND if the specified key/data pair is not in the database.
public Delete ( LightningDatabase db, byte key, byte value ) : void
db LightningDatabase A database handle returned by mdb_dbi_open()
key byte The key to delete from the database
value byte The data to delete (optional)
Résultat void

Dispose() public méthode

Dispose this transaction and deallocate all resources associated with it (including databases).
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Abort this transaction and deallocate all resources associated with it (including databases).
protected Dispose ( bool disposing ) : void
disposing bool True if called from Dispose.
Résultat void

DropDatabase() public méthode

Drops the database.
public DropDatabase ( LightningDatabase database ) : void
database LightningDatabase
Résultat void

Equals() public méthode

public Equals ( object obj ) : bool
obj object
Résultat bool

Get() public méthode

Get value from a database.
public Get ( LightningDatabase db, byte key ) : byte[]
db LightningDatabase Database
key byte Key byte array.
Résultat byte[]

GetEntriesCount() public méthode

The number of items in the database.
public GetEntriesCount ( LightningDatabase db ) : long
db LightningDatabase The database we are counting items in.
Résultat long

GetHashCode() public méthode

public GetHashCode ( ) : int
Résultat int

Handle() public méthode

public Handle ( ) : IntPtr
Résultat System.IntPtr

OpenDatabase() public méthode

Opens a database in context of this transaction.
public OpenDatabase ( string name = null, DatabaseConfiguration configuration = null ) : LightningDatabase
name string Database name (optional). If null then the default name is used.
configuration DatabaseConfiguration Database open options.
Résultat LightningDatabase

Put() public méthode

Put data into a database.
public Put ( LightningDatabase db, byte key, byte value, PutOptions options = PutOptions.None ) : void
db LightningDatabase Database.
key byte Key byte array.
value byte Value byte array.
options PutOptions Operation options (optional).
Résultat void

Renew() public méthode

Renew current transaction.
public Renew ( ) : void
Résultat void

Reset() public méthode

Reset current transaction.
public Reset ( ) : void
Résultat void

TruncateDatabase() public méthode

Truncates all data from the database.
public TruncateDatabase ( LightningDatabase database ) : void
database LightningDatabase
Résultat void

TryGet() public méthode

Tries to get a value by its key.
public TryGet ( LightningDatabase db, byte key, byte &value ) : bool
db LightningDatabase Database.
key byte Key byte array.
value byte Value byte array if exists.
Résultat bool