C# Class LightningDB.LightningEnvironment

LMDB Environment.
Inheritance: IClosingEventSource, IDisposable
Afficher le fichier Open project: CoreyKaylor/Lightning.NET Class Usage Examples

Méthodes publiques

Méthode Description
BeginTransaction ( ) : LightningTransaction

Create a transaction for use with the environment. The transaction handle may be discarded using Abort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.

BeginTransaction ( LightningTransaction parent, TransactionBeginFlags beginFlags ) : LightningTransaction

Create a transaction for use with the environment. The transaction handle may be discarded using Abort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.

BeginTransaction ( TransactionBeginFlags beginFlags ) : LightningTransaction

Create a transaction for use with the environment. The transaction handle may be discarded usingAbort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.

CopyTo ( string path, bool compact = false ) : void

Copy an MDB environment to the specified path. This function may be used to make a backup of an existing environment.

Dispose ( ) : void

Dispose the environment and release the memory map. Only a single thread may call this function. All transactions, databases, and cursors must already be closed before calling this function. Attempts to use any such handles after calling this function will cause a SIGSEGV. The environment handle will be freed and must not be used again after this call.

Flush ( bool force ) : void

Flush the data buffers to disk. Data is always written to disk when LightningTransaction.Commit is called, but the operating system may keep it buffered. MDB always flushes the OS buffers upon commit as well, unless the environment was opened with EnvironmentOpenFlags.NoSync or in part EnvironmentOpenFlags.NoMetaSync.

Handle ( ) : IntPtr
LightningEnvironment ( string path, LightningDB.EnvironmentConfiguration configuration = null ) : System

Creates a new instance of LightningEnvironment.

Open ( EnvironmentOpenFlags openFlags = EnvironmentOpenFlags.None, UnixAccessMode accessMode = UnixAccessMode.Default ) : void

Open the environment.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Disposes the environment and deallocates all resources associated with it.

Private Methods

Méthode Description
EnsureOpened ( ) : void

Method Details

BeginTransaction() public méthode

Create a transaction for use with the environment. The transaction handle may be discarded using Abort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.
public BeginTransaction ( ) : LightningTransaction
Résultat LightningTransaction

BeginTransaction() public méthode

Create a transaction for use with the environment. The transaction handle may be discarded using Abort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.
public BeginTransaction ( LightningTransaction parent, TransactionBeginFlags beginFlags ) : LightningTransaction
parent LightningTransaction /// If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent. /// Transactions may be nested to any level. /// A parent transaction may not issue any other operations besides BeginTransaction, Abort, or Commit while it has active child transactions. ///
beginFlags TransactionBeginFlags /// Special options for this transaction. ///
Résultat LightningTransaction

BeginTransaction() public méthode

Create a transaction for use with the environment. The transaction handle may be discarded usingAbort() or Commit(). Note: Transactions may not span threads; a transaction must only be used by a single thread. Also, a thread may only have a single transaction. Cursors may not span transactions; each cursor must be opened and closed within a single transaction.
public BeginTransaction ( TransactionBeginFlags beginFlags ) : LightningTransaction
beginFlags TransactionBeginFlags /// Special options for this transaction. ///
Résultat LightningTransaction

CopyTo() public méthode

Copy an MDB environment to the specified path. This function may be used to make a backup of an existing environment.
public CopyTo ( string path, bool compact = false ) : void
path string The directory in which the copy will reside. This directory must already exist and be writable but must otherwise be empty.
compact bool Omit empty pages when copying.
Résultat void

Dispose() public méthode

Dispose the environment and release the memory map. Only a single thread may call this function. All transactions, databases, and cursors must already be closed before calling this function. Attempts to use any such handles after calling this function will cause a SIGSEGV. The environment handle will be freed and must not be used again after this call.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

Disposes the environment and deallocates all resources associated with it.
protected Dispose ( bool disposing ) : void
disposing bool True if called from Dispose.
Résultat void

Flush() public méthode

Flush the data buffers to disk. Data is always written to disk when LightningTransaction.Commit is called, but the operating system may keep it buffered. MDB always flushes the OS buffers upon commit as well, unless the environment was opened with EnvironmentOpenFlags.NoSync or in part EnvironmentOpenFlags.NoMetaSync.
public Flush ( bool force ) : void
force bool If true, force a synchronous flush. Otherwise if the environment has the EnvironmentOpenFlags.NoSync flag set the flushes will be omitted, and with MDB_MAPASYNC they will be asynchronous.
Résultat void

Handle() public méthode

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

LightningEnvironment() public méthode

Creates a new instance of LightningEnvironment.
public LightningEnvironment ( string path, LightningDB.EnvironmentConfiguration configuration = null ) : System
path string Directory for storing database files.
configuration LightningDB.EnvironmentConfiguration Configuration for the environment.
Résultat System

Open() public méthode

Open the environment.
public Open ( EnvironmentOpenFlags openFlags = EnvironmentOpenFlags.None, UnixAccessMode accessMode = UnixAccessMode.Default ) : void
openFlags EnvironmentOpenFlags
accessMode UnixAccessMode
Résultat void