Search Results for

    Show / Hide Table of Contents

    Class OptimisticZoneTree<TKey, TValue>

    Inheritance
    object
    OptimisticZoneTree<TKey, TValue>
    Implements
    ITransactionalZoneTree<TKey, TValue>
    IDisposable
    ITransactionalZoneTreeMaintenance<TKey, TValue>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Tenray.ZoneTree.Transactional
    Assembly: ZoneTree.dll
    Syntax
    public sealed class OptimisticZoneTree<TKey, TValue> : ITransactionalZoneTree<TKey, TValue>, IDisposable, ITransactionalZoneTreeMaintenance<TKey, TValue>
    Type Parameters
    Name Description
    TKey
    TValue

    Constructors

    | Improve this Doc View Source

    OptimisticZoneTree(ZoneTreeOptions<TKey, TValue>, ITransactionLog<TKey, TValue>, IZoneTree<TKey, TValue>)

    Declaration
    public OptimisticZoneTree(ZoneTreeOptions<TKey, TValue> options, ITransactionLog<TKey, TValue> transactionLog, IZoneTree<TKey, TValue> zoneTree = null)
    Parameters
    Type Name Description
    ZoneTreeOptions<TKey, TValue> options
    ITransactionLog<TKey, TValue> transactionLog
    IZoneTree<TKey, TValue> zoneTree

    Properties

    | Improve this Doc View Source

    IsReadOnly

    Enables read-only mode.

    Declaration
    public bool IsReadOnly { get; set; }
    Property Value
    Type Description
    bool
    | Improve this Doc View Source

    Logger

    ZoneTree Logger.

    Declaration
    public ILogger Logger { get; }
    Property Value
    Type Description
    ILogger
    | Improve this Doc View Source

    Maintenance

    Returns maintenance object belongs to this TransactionalZoneTree.

    Declaration
    public ITransactionalZoneTreeMaintenance<TKey, TValue> Maintenance { get; }
    Property Value
    Type Description
    ITransactionalZoneTreeMaintenance<TKey, TValue>
    | Improve this Doc View Source

    TransactionLog

    Transaction Log instance.

    Declaration
    public ITransactionLog<TKey, TValue> TransactionLog { get; }
    Property Value
    Type Description
    ITransactionLog<TKey, TValue>
    | Improve this Doc View Source

    UncommittedTransactionIds

    Retrieves uncommitted transaction ids.

    Declaration
    public IReadOnlyList<long> UncommittedTransactionIds { get; }
    Property Value
    Type Description
    IReadOnlyList<long>
    | Improve this Doc View Source

    ZoneTree

    Underlying non-transactional ZoneTree.

    Declaration
    public IZoneTree<TKey, TValue> ZoneTree { get; }
    Property Value
    Type Description
    IZoneTree<TKey, TValue>

    Methods

    | Improve this Doc View Source

    BeginFluentTransaction()

    Creates a fluent transaction.

    Declaration
    public FluentTransaction<TKey, TValue> BeginFluentTransaction()
    Returns
    Type Description
    FluentTransaction<TKey, TValue>

    Fluent transaction.

    | Improve this Doc View Source

    BeginTransaction()

    Begins the transaction. Creates a transaction id and informs the transaction manager that a new transaction started.

    Declaration
    public long BeginTransaction()
    Returns
    Type Description
    long

    Transaction Id

    | Improve this Doc View Source

    Commit(long)

    Commits if the transaction is in ready to commit state. It is necessary to call PrepareCommit before calling this method.

    Declaration
    public CommitResult Commit(long transactionId)
    Parameters
    Type Name Description
    long transactionId
    Returns
    Type Description
    CommitResult
    Exceptions
    Type Condition
    TransactionIsNotReadyToCommitException
    TransactionAbortedException
    | Improve this Doc View Source

    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
    public CommitResult CommitNoThrow(long transactionId)
    Parameters
    Type Name Description
    long transactionId
    Returns
    Type Description
    CommitResult
    Exceptions
    Type Condition
    TransactionIsNotReadyToCommitException
    | Improve this Doc View Source

    ContainsKey(long, in TKey)

    Contains Key query.

    Declaration
    public 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
    | Improve this Doc View Source

    ContainsKeyNoThrow(long, in TKey)

    Contains Key query without abort exception.

    Declaration
    public TransactionResult<bool> ContainsKeyNoThrow(long transactionId, in TKey key)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    TKey key

    Key

    Returns
    Type Description
    TransactionResult<bool>
    | Improve this Doc View Source

    CreateMaintainer()

    Creates the default ZoneTree Maintainer.

    Declaration
    public IMaintainer CreateMaintainer()
    Returns
    Type Description
    IMaintainer
    | Improve this Doc View Source

    Delete(long, in TKey)

    Deletes the key.

    Declaration
    public void Delete(long transactionId, in TKey key)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    TKey key

    Key

    Exceptions
    Type Condition
    TransactionAbortedException
    | Improve this Doc View Source

    DeleteAutoCommit(in TKey)

    Starts a transaction, deletes the key-value, and commits the transaction.

    Declaration
    public void DeleteAutoCommit(in TKey key)
    Parameters
    Type Name Description
    TKey key

    Key

    | Improve this Doc View Source

    DeleteNoThrow(long, in TKey)

    Deletes the key without abort exception.

    Declaration
    public TransactionResult DeleteNoThrow(long transactionId, in TKey key)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    TKey key

    Key

    Returns
    Type Description
    TransactionResult
    | Improve this Doc View Source

    DestroyTree()

    Removes the transactional tree from the universe. Destroys the tree, transaction logs, entire data and WAL store or folder.

    Declaration
    public void DestroyTree()
    | Improve this Doc View Source

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    GetTransactionState(long)

    Retrieves transaction state of given transaction id.

    Declaration
    public TransactionState GetTransactionState(long transactionId)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    Returns
    Type Description
    TransactionState

    Transaction State

    | Improve this Doc View Source

    Prepare(long)

    Prepares to Commit. Aborts transaction if needed.

    Declaration
    public CommitResult Prepare(long transactionId)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    Returns
    Type Description
    CommitResult
    Exceptions
    Type Condition
    TransactionAbortedException
    | Improve this Doc View Source

    PrepareAndCommit(long)

    Prepares to Commit. Aborts transaction if needed. If commit is possible does the commit.

    Declaration
    public CommitResult PrepareAndCommit(long transactionId)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    Returns
    Type Description
    CommitResult
    Exceptions
    Type Condition
    TransactionAbortedException
    | Improve this Doc View Source

    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
    public CommitResult PrepareAndCommitNoThrow(long transactionId)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    Returns
    Type Description
    CommitResult
    | Improve this Doc View Source

    PrepareNoThrow(long)

    Prepares to Commit. Aborts transaction if needed. This method does not throw transaction aborted exception.

    Declaration
    public CommitResult PrepareNoThrow(long transactionId)
    Parameters
    Type Name Description
    long transactionId

    Transaction Id

    Returns
    Type Description
    CommitResult
    | Improve this Doc View Source

    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
    public bool ReadCommittedContainsKey(in TKey key, long currentTransactionId = -1)
    Parameters
    Type Name Description
    TKey key

    Key

    long currentTransactionId

    Current transaction.

    Returns
    Type Description
    bool
    | Improve this Doc View Source

    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
    public 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
    | Improve this Doc View Source

    Rollback(long)

    Rollbacks the transaction by undoing all writes by this transaction.

    Declaration
    public void Rollback(long transactionId)
    Parameters
    Type Name Description
    long transactionId
    | Improve this Doc View Source

    RollbackAllUncommitted()

    Rollbacks all uncommitted transactions.

    Declaration
    public int RollbackAllUncommitted()
    Returns
    Type Description
    int

    Count of rollbacked transactions.

    | Improve this Doc View Source

    RollbackUncommittedTransactionIdsBefore(DateTime)

    Rollbacks all uncommitted transaction ids started before given date-time. Transaction log memory usage increases by state uncommitted transaction ids. Those must be rollbacked.

    Declaration
    public int RollbackUncommittedTransactionIdsBefore(DateTime dateTime)
    Parameters
    Type Name Description
    DateTime dateTime

    Max start time (exclusive)

    Returns
    Type Description
    int

    Count of rollbacked transactions.

    | Improve this Doc View Source

    RollbackUncommittedTransactions()

    Declaration
    public void RollbackUncommittedTransactions()
    | Improve this Doc View Source

    SaveMetaData()

    Saves tree meta data and clears the meta wal record. After calling this method, the JSON meta file contains up to date tree meta data.

    Saving meta file helps following:

    1. Reduce the size of meta wal file.
    2. Make Json meta file up to date to analyze parts of the LSM tree. Because Meta WAL file is not human readable.

    It is up to user to decide when and how frequently save the meta file.

    Declaration
    public void SaveMetaData()
    | Improve this Doc View Source

    TryGet(long, in TKey, out TValue)

    Tries to get the value of given key.

    Declaration
    public 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
    | Improve this Doc View Source

    TryGetNoThrow(long, in TKey, out TValue)

    Tries to get the value of given key without abort exception.

    Declaration
    public 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.

    | Improve this Doc View Source

    Upsert(long, in TKey, in TValue)

    Upserts the key and value.

    Declaration
    public 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
    | Improve this Doc View Source

    UpsertAutoCommit(in TKey, in TValue)

    Starts a transaction, upserts the key-value, and commits the transaction.

    Declaration
    public void UpsertAutoCommit(in TKey key, in TValue value)
    Parameters
    Type Name Description
    TKey key

    Key

    TValue value

    Value

    | Improve this Doc View Source

    UpsertNoThrow(long, in TKey, in TValue)

    Upserts the key and value without abort exception.

    Declaration
    public 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.

    Implements

    ITransactionalZoneTree<TKey, TValue>
    IDisposable
    ITransactionalZoneTreeMaintenance<TKey, TValue>
    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2022 Tenray.io