Skip to end of metadata
Go to start of metadata

The StorageEngine implementation provides scheme functionality, which can be used to obtain meta-information about the tables and virtual files inside the database instance.

There are several IStorageEngine methods and properties

IDescriptor this[string name] { get; }
IDescriptor Find(long id);
void Delete(string name);
void Rename(string name, string newName);
bool Exists(string name);
int Count { get; }
int CacheSize { get; set; }

The usage of the scheme is shown in the following short examples. If we have a user table:

    ITable<int, Tick> table = engine.OpenXTable<int, Tick>("table");

Obtaining a table’s IDescriptor can be done in the following ways:

  1. Via the this property of the storage engine instance:

        IDescriptor descriptor1 = engine["table"];
  2. Via the method IDescriptor Find(long id)

        IDescriptor descriptor2 = Find(id);

The specified id here is a unique number internally assigned on table creation. Each table and file in STSdb 4.0 has its unique id which is never changed. Even if a table is deleted and recreated again with the same name, key and record types, it will receive a brand new (incremental) id. These IDs are used by the engine, but are visible to the users. They can be used as unique table identifiers.

The engine also provides the following scheme methods and properties:

  1. Delete a table:


    NOTE: After deleting a table, inserting records in it is still possible (while the user has the table reference). But when the storage engine is committed and disposed, the table will be deleted and it used space will be gradually recycled.

  2. Rename a table

        engine.Rename("table", "table_NewName");
  3. Check if a table exists

    	bool exists = engine.Exists("table");
  4. Obtain the number of tables and virtual files the storage engine holds

    	int tablesCount = engine.Count;
  5. Obtain the size of the database

    	long databaseSize = engine.Size;
  6. Obtain the cache capacity of the engine. The returned value represents the number of tree nodes that are kept in RAM:

        long databaseSize = engine.Size;


OpenXTablePortable<TKey, TRecord>()    Go to Home    IDescriptor

  • No labels