Skip to end of metadata
Go to start of metadata

All XTable classes implement the ITable interface. The interface provides the following methods:

public interface ITable
public interface ITable<TKey, TRecord> : ITable, IEnumerable<KeyValuePair<TKey, TRecord>>
    TRecord this[TKey key] { get; set; }
    void Replace(TKey key, TRecord record);
    void InsertOrIgnore(TKey key, TRecord record);
    void Delete(TKey key);
    void Delete(TKey fromKey, TKey toKey);
    void Clear();
    bool Exists(TKey key);
    bool TryGet(TKey key, out TRecord record);
    TRecord Find(TKey key);
    TRecord TryGetOrDefault(TKey key, TRecord defaultRecord);
    KeyValuePair<TKey, TRecord>? FindNext(TKey key);
    KeyValuePair<TKey, TRecord>? FindAfter(TKey key);
    KeyValuePair<TKey, TRecord>? FindPrev(TKey key);
    KeyValuePair<TKey, TRecord>? FindBefore(TKey key);
    IEnumerable<KeyValuePair<TKey, TRecord>> Forward();
    IEnumerable<KeyValuePair<TKey, TRecord>> Forward(TKey from, bool hasFrom, TKey to, bool hasTo);
    IEnumerable<KeyValuePair<TKey, TRecord>> Backward();
    IEnumerable<KeyValuePair<TKey, TRecord>> Backward(TKey to, bool hasTo, TKey from, bool hasFrom);
    KeyValuePair<TKey, TRecord> FirstRow { get; }
    KeyValuePair<TKey, TRecord> LastRow { get; }
    IDescriptor Descriptor { get; }
    long Count();

In all XTable implementations the default enumerator enumerates the table rows in ascending (forward) order.

  • Forward() method enumerates the table rows in ascending order.
  • Backward() method enumerates the table rows in descending order.
  • FindNext() returns the first row (if exists) with key greater than or equal to the specified.
  • FindAfter() returns the first row (if exists) with key greater than the specified.
  • FindPrev() returns the first row (if exists) with key less than or equal to the specified.
  • FindBefore() returns the first row (if exists) with key less than the specified.
  • FirstRow returns the row with the smallest key.
  • LastRow returns the row with the greatest key.

Methods that change XTable content are:

  • this[TKey key] – get & set
  • Replace(TKey key, TRecord record)
  • InsertOrIgnore(TKey key, TRecord record)
  • Delete(TKey key)
  • Delete(TKey fromKey, TKey toKey)
  • Clear()

NOTE: You may note that in the ITable interface there is no Count property. Instead there is a Count() method. This is no accident. In W-tree the only slow operation is taking the number of records for a table. W-tree works with asynchronous operations which are accumulated in its internal nodes. If there are such operations, they must be flushed down the tree in order to obtain a proper record count. After all operations reach their leaf nodes a proper count value can be returned. The accumulation of operations in the nodes (which is one of the reasons for the blazing WaterfallTree speed) is actually what slows down the count calculation. That’s why we changed it from property to method – to remind the users, that this is not a fast operation. In the future versions we will improve this calculation with intelligent tree monitoring system.

Examples    Go to Home    IData technology

  • No labels