class Storage::KeyValueStore

Defined in:

storage/kv.cr
storage/migrations.cr

Constant Summary

HARD_DURABILITY = RocksDB::WriteOptions.new

Hard durability: data is written on disk always. This is the default and this is paranoic. No data will be lost, ever.

MINIMAL_DURABILITY = RocksDB::WriteOptions.new

Minimal durability: data it stored in memory only and flushed to disk at some later point. A process crash might cause data loss. A graceful server close (calling .close()) won't lose data. Note: The data might be lost, but it won't be corrupted. This is the fastest option.

PREFIX_DATABASES = 1_u8
PREFIX_INDICES = 3_u8
PREFIX_SYSTEM_INFO = 0_u8
PREFIX_TABLES = 2_u8
SOFT_DURABILITY = RocksDB::WriteOptions.new

Soft durability: data is sent to the operating system memory and will be synced to disk later. Only a kernel panic or hardware failure might cause data loss. Crashing the process won't lose any data.

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class Object

!=(other : RethinkDB::DSL::R) !=, %(other : RethinkDB::DSL::R) %, &(other : RethinkDB::DSL::R) &, *(other : RethinkDB::DSL::R) *, +(other : RethinkDB::DSL::R) +, -(other : RethinkDB::DSL::R) -, /(other : RethinkDB::DSL::R) /, <(other : RethinkDB::DSL::R) <, <=(other : RethinkDB::DSL::R) <=, ==(other : RethinkDB::DSL::R) ==, >(other : RethinkDB::DSL::R) >, >=(other : RethinkDB::DSL::R) >=, |(other : RethinkDB::DSL::R) |

Constructor Detail

def self.new(database_path : String) #

[View source]

Class Method Detail

def self.decompose_index_entry_key(index_entry_key : Bytes) #

[View source]
def self.key_for_database(id : UUID) #

[View source]
def self.key_for_system_info #

[View source]
def self.key_for_table(id : UUID) #

[View source]
def self.key_for_table_index(table_id : UUID, index_id : UUID) #

[View source]
def self.key_for_table_index_end(table_id : UUID) #

[View source]
def self.key_for_table_index_entry(index_value : Bytes, counter : Int32, primary_key : Bytes) #

[View source]
def self.key_for_table_index_entry_end(index_value : Bytes) #

[View source]
def self.key_for_table_index_entry_start(index_value : Bytes) #

[View source]
def self.key_for_table_index_start(table_id : UUID) #

[View source]

Instance Method Detail

def build_index(table_id : UUID, index_id : UUID, &) #

[View source]
def close #

[View source]
def create_batch #

[View source]
def database_path : String #

[View source]
def delete_index_entry(table_id : UUID, index_id : UUID, index_value : Bytes, counter : Int32, primary_key : Bytes) #

[View source]
def delete_row(table_id : UUID, primary_key : Bytes, durability : ReQL::Durability = ReQL::Durability::Soft) : Bytes | Nil #

[View source]
def drop_index_data(index_id : UUID) #

[View source]
def each_db(&) #

[View source]
def each_index(table_id : UUID, &) #

[View source]
def each_index_entry(table_id : UUID, index_id : UUID, index_value_start : Bytes, index_value_end : Bytes, snapshot : RocksDB::BaseSnapshot | Nil = nil, &) #

[View source]
def each_row(table_id : UUID, &) #

[View source]
def each_table(&) #

[View source]
def estimated_table_count(table_id : UUID) #

[View source]
def get_db(id : UUID) #

[View source]
def get_row(table_id : UUID, primary_key : Bytes, snapshot : RocksDB::BaseSnapshot | Nil = nil, &) #

[View source]
def get_table(id : UUID) #

[View source]
def save_db(db : DatabaseInfo) #

[View source]
def save_index(index : IndexInfo) #

[View source]
def save_table(table : TableInfo) #

[View source]
def set_index_entry(table_id : UUID, index_id : UUID, index_value : Bytes, counter : Int32, primary_key : Bytes) #

[View source]
def set_row(table_id : UUID, primary_key : Bytes, data : Bytes, durability : ReQL::Durability = ReQL::Durability::Soft) #

[View source]
def snapshot #

[View source]

[View source]
def system_info=(system_info : Storage::KeyValueStore::SystemInfo) #

[View source]
def table_data_family(table_id : UUID) #

[View source]
def table_index_family(index_id : UUID) #

[View source]
def write_batch(batch, durability : ReQL::Durability = ReQL::Durability::Soft) #

[View source]