In-memory query engine over typed columns. Tables are filled row by row or loaded from sources (CSV files, folders, the program's own objects) and queried with SQL-like statements; aggregates, Describe() and Finder (file search) are included. Compile with -lib query.
TableStore
A table kept durable on disk: its .otab file, plus a change log beside it ('path.log') that records every insert, change, delete and added column as it happens, one record per statement, flushed before the statement returns. Opening loads the last save and replays the log, so a crash loses at most the statement in progress. Checkpoint folds the log into a new save and empties it.
One process writes at a time: opening takes a lock file ('path.lock') naming this process. A second writer is refused with an error naming the holder, and a lock whose process is gone (a crash) is cleared. Readers open the file with Table->Load and see the last save or checkpoint. Create the file with Save first, then open it here.
Example
store := TableStore->New("runs.otab");
if(store->IsOpen()) {
runs := store->GetTable();
row := runs->Insert();
row->Set("score", FloatRef->New(0.93));
store->Checkpoint();
store->Close();
}
else {
store->GetError()->ErrorLine();
};Operations
Checkpoint #
Folds the change log into a new save of the table and empties the log
method : public : Checkpoint() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if saved, false on error (see GetError) |
Checkpoint #
Folds the change log into a new save, compressing its blocks, and empties the log
method : public : Checkpoint(compression:Compression) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| compression | Compression | NONE, FAST or SMALL |
Return
| Type | Description |
|---|---|
| Bool | true if saved, false on error (see GetError) |
Close #
Stops recording and releases the lock. The changes since the last checkpoint stay in the log, for the next open to replay. The table stays usable in memory.
method : public : Close() ~ NilGetError #
Why opening, a checkpoint or a change failed
method : public : GetError() ~ StringReturn
| Type | Description |
|---|---|
| String | error, Nil if none |
GetReplayed #
Gets the number of statements replayed from the change log when the table was opened
method : public : GetReplayed() ~ IntReturn
| Type | Description |
|---|---|
| Int | statements replayed |
GetTable #
Gets the table. Its changes are recorded until Close.
method : public : GetTable() ~ TableReturn
| Type | Description |
|---|---|
| Table | table, Nil if not open |