C# Класс LightningDB.LightningTransaction

Represents a transaction.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

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

Приватные методы

Метод Описание
LightningTransaction ( LightningEnvironment environment, LightningTransaction parent, TransactionBeginFlags flags ) : System

Created new instance of LightningTransaction

OnParentStateChanging ( LightningTransactionState state ) : void

Описание методов

Abort() публичный Метод

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
Результат void

BeginTransaction() публичный Метод

Begins a child transaction.
public BeginTransaction ( ) : LightningTransaction
Результат LightningTransaction

BeginTransaction() публичный Метод

Begin a child transaction.
public BeginTransaction ( TransactionBeginFlags beginFlags ) : LightningTransaction
beginFlags TransactionBeginFlags Options for a new transaction.
Результат LightningTransaction

Commit() публичный Метод

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
Результат void

ContainsKey() публичный Метод

Check whether data exists in database.
public ContainsKey ( LightningDatabase db, byte key ) : bool
db LightningDatabase Database.
key byte Key.
Результат bool

CreateCursor() публичный Метод

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.
Результат LightningDB.LightningCursor

Delete() публичный Метод

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
Результат void

Delete() публичный Метод

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)
Результат void

Dispose() публичный Метод

Dispose this transaction and deallocate all resources associated with it (including databases).
public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Abort this transaction and deallocate all resources associated with it (including databases).
protected Dispose ( bool disposing ) : void
disposing bool True if called from Dispose.
Результат void

DropDatabase() публичный Метод

Drops the database.
public DropDatabase ( LightningDatabase database ) : void
database LightningDatabase
Результат void

Equals() публичный Метод

public Equals ( object obj ) : bool
obj object
Результат bool

Get() публичный Метод

Get value from a database.
public Get ( LightningDatabase db, byte key ) : byte[]
db LightningDatabase Database
key byte Key byte array.
Результат byte[]

GetEntriesCount() публичный Метод

The number of items in the database.
public GetEntriesCount ( LightningDatabase db ) : long
db LightningDatabase The database we are counting items in.
Результат long

GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int

Handle() публичный Метод

public Handle ( ) : IntPtr
Результат System.IntPtr

OpenDatabase() публичный Метод

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.
Результат LightningDatabase

Put() публичный Метод

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).
Результат void

Renew() публичный Метод

Renew current transaction.
public Renew ( ) : void
Результат void

Reset() публичный Метод

Reset current transaction.
public Reset ( ) : void
Результат void

TruncateDatabase() публичный Метод

Truncates all data from the database.
public TruncateDatabase ( LightningDatabase database ) : void
database LightningDatabase
Результат void

TryGet() публичный Метод

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.
Результат bool