Interface ITransactionalZoneTree<TKey, TValue>
The interface for the core functionality of a transactional ZoneTree.
Inherited Members
Namespace: Tenray.ZoneTree
Assembly: ZoneTree.dll
Syntax
public interface ITransactionalZoneTree<TKey, TValue> : IDisposable
  Type Parameters
| Name | Description | 
|---|---|
| TKey | The key type  | 
      
| TValue | The value type  | 
      
Properties
| Improve this Doc View SourceIsReadOnly
Enables read-only mode.
Declaration
bool IsReadOnly { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
Logger
ZoneTree Logger.
Declaration
ILogger Logger { get; }
  Property Value
| Type | Description | 
|---|---|
| ILogger | 
Maintenance
Returns maintenance object belongs to this TransactionalZoneTree.
Declaration
ITransactionalZoneTreeMaintenance<TKey, TValue> Maintenance { get; }
  Property Value
| Type | Description | 
|---|---|
| ITransactionalZoneTreeMaintenance<TKey, TValue> | 
Methods
| Improve this Doc View SourceBeginFluentTransaction()
Creates a fluent transaction.
Declaration
FluentTransaction<TKey, TValue> BeginFluentTransaction()
  Returns
| Type | Description | 
|---|---|
| FluentTransaction<TKey, TValue> | Fluent transaction.  | 
      
BeginTransaction()
Begins the transaction. Creates a transaction id and informs the transaction manager that a new transaction started.
Declaration
long BeginTransaction()
  Returns
| Type | Description | 
|---|---|
| long | Transaction Id  | 
      
Commit(long)
Commits if the transaction is in ready to commit state. It is necessary to call PrepareCommit before calling this method.
Declaration
CommitResult Commit(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | 
Returns
| Type | Description | 
|---|---|
| CommitResult | 
Exceptions
| Type | Condition | 
|---|---|
| TransactionIsNotReadyToCommitException | |
| TransactionAbortedException | 
CommitNoThrow(long)
Commits if the transaction is in ready to commit state. It is necessary to call PrepareCommit before calling this method. This method does not throw transaction aborted exception.
Declaration
CommitResult CommitNoThrow(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | 
Returns
| Type | Description | 
|---|---|
| CommitResult | 
Exceptions
| Type | Condition | 
|---|---|
| TransactionIsNotReadyToCommitException | 
ContainsKey(long, in TKey)
Contains Key query.
Declaration
bool ContainsKey(long transactionId, in TKey key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
ContainsKeyNoThrow(long, in TKey)
Contains Key query without abort exception.
Declaration
TransactionResult<bool> ContainsKeyNoThrow(long transactionId, in TKey key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
Returns
| Type | Description | 
|---|---|
| TransactionResult<bool> | 
CreateMaintainer()
Creates the default ZoneTree Maintainer.
Declaration
IMaintainer CreateMaintainer()
  Returns
| Type | Description | 
|---|---|
| IMaintainer | 
Delete(long, in TKey)
Deletes the key.
Declaration
void Delete(long transactionId, in TKey key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
DeleteAutoCommit(in TKey)
Starts a transaction, deletes the key-value, and commits the transaction.
Declaration
void DeleteAutoCommit(in TKey key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | Key  | 
      
DeleteNoThrow(long, in TKey)
Deletes the key without abort exception.
Declaration
TransactionResult DeleteNoThrow(long transactionId, in TKey key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
Returns
| Type | Description | 
|---|---|
| TransactionResult | 
GetTransactionState(long)
Retrieves transaction state of given transaction id.
Declaration
TransactionState GetTransactionState(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
Returns
| Type | Description | 
|---|---|
| TransactionState | Transaction State  | 
      
Prepare(long)
Prepares to Commit. Aborts transaction if needed.
Declaration
CommitResult Prepare(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
Returns
| Type | Description | 
|---|---|
| CommitResult | 
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
PrepareAndCommit(long)
Prepares to Commit. Aborts transaction if needed. If commit is possible does the commit.
Declaration
CommitResult PrepareAndCommit(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
Returns
| Type | Description | 
|---|---|
| CommitResult | 
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
PrepareAndCommitNoThrow(long)
Prepares to Commit. Aborts transaction if needed. If commit is possible does the commit. This method does not throw transaction aborted exception.
Declaration
CommitResult PrepareAndCommitNoThrow(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
Returns
| Type | Description | 
|---|---|
| CommitResult | 
PrepareNoThrow(long)
Prepares to Commit. Aborts transaction if needed. This method does not throw transaction aborted exception.
Declaration
CommitResult PrepareNoThrow(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
Returns
| Type | Description | 
|---|---|
| CommitResult | 
ReadCommittedContainsKey(in TKey, long)
Contains Key query without a transaction. This method avoids dirty reads. The query is executed on committed data. If current transaction id given, this method reads uncommitted key for given transaction and committed keys for other transactions.
Declaration
bool ReadCommittedContainsKey(in TKey key, long currentTransactionId = -1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | Key  | 
      
| long | currentTransactionId | Current transaction.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
ReadCommittedTryGet(in TKey, out TValue, long)
Tries to get the value of given key without a transaction. This method avoids dirty reads. The query is executed on committed data. If current transaction id given, this method reads uncommitted key for given transaction and committed keys for other transactions.
Declaration
bool ReadCommittedTryGet(in TKey key, out TValue value, long currentTransactionId = -1)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
| long | currentTransactionId | Current transaction.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | 
Rollback(long)
Rollbacks the transaction by undoing all writes by this transaction.
Declaration
void Rollback(long transactionId)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | 
TryGet(long, in TKey, out TValue)
Tries to get the value of given key.
Declaration
bool TryGet(long transactionId, in TKey key, out TValue value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if key is found, otherwise false.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
TryGetNoThrow(long, in TKey, out TValue)
Tries to get the value of given key without abort exception.
Declaration
TransactionResult<bool> TryGetNoThrow(long transactionId, in TKey key, out TValue value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
Returns
| Type | Description | 
|---|---|
| TransactionResult<bool> | true if key is found, otherwise false.  | 
      
Upsert(long, in TKey, in TValue)
Upserts the key and value.
Declaration
bool Upsert(long transactionId, in TKey key, in TValue value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if the key/value pair was inserted; false if the key/value pair was updated.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| TransactionAbortedException | 
UpsertAutoCommit(in TKey, in TValue)
Starts a transaction, upserts the key-value, and commits the transaction.
Declaration
void UpsertAutoCommit(in TKey key, in TValue value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
UpsertNoThrow(long, in TKey, in TValue)
Upserts the key and value without abort exception.
Declaration
TransactionResult<bool> UpsertNoThrow(long transactionId, in TKey key, in TValue value)
  Parameters
| Type | Name | Description | 
|---|---|---|
| long | transactionId | Transaction Id  | 
      
| TKey | key | Key  | 
      
| TValue | value | Value  | 
      
Returns
| Type | Description | 
|---|---|
| TransactionResult<bool> | true if the key/value pair was inserted; false if the key/value pair was updated.  |