Joedb 10.5.0
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
joedb::db::encoded_file::Memory_Database Class Reference

Shortcut to directly build a Writable_Database with a Memory_File. More...

#include <joedb/db/encoded_file/Memory_Database.h>

Inheritance diagram for joedb::db::encoded_file::Memory_Database:
Collaboration diagram for joedb::db::encoded_file::Memory_Database:

Public Member Functions

 Memory_Database ()
void pull ()
Public Member Functions inherited from joedb::Memory_File
 Memory_File (Open_Mode mode=Open_Mode::create_new)
void resize (size_t size)
std::string & get_data ()
const std::string & get_data () const
std::string move_data ()
int64_t get_size () const override
 Get the size of the file, or -1 if it is unknown.
size_t pread (char *buffer, size_t size, int64_t offset) const override
 Read a range of bytes.
void pwrite (const char *buffer, size_t size, int64_t offset) override
 Write a range of bytes. Extend file size if necessary.
Public Member Functions inherited from joedb::Abstract_File
 Abstract_File (Open_Mode mode)
bool is_shared () const noexcept
bool is_readonly () const noexcept
Open_Mode get_mode () const noexcept
void full_pread (char *data, size_t size, int64_t offset) const
 Fill the buffer, or throw if the end of the file is reached.
virtual void sync ()
 Write data durably (including file-size change).
virtual void datasync ()
 Write data durably (no file-size change).
virtual void shared_lock (int64_t start, int64_t size)
 Lock a range of bytes for reading (prevents writes, not reads).
virtual void exclusive_lock (int64_t start, int64_t size)
 Lock a range of bytes for writing (prevents both writes and reads).
virtual void unlock (int64_t start, int64_t size) noexcept
 Remove a lock. The range should match the range of a corresponding lock.
void exclusive_lock_tail ()
void unlock_tail () noexcept
void exclusive_lock_head ()
void shared_lock_head ()
void unlock_head () noexcept
std::string read_blob (Blob blob, int64_t max_size=std::numeric_limits< int64_t >::max()) const
virtual void copy_to (Abstract_File &destination, int64_t start, int64_t size) const
virtual bool equal_to (const Abstract_File &destination, int64_t from, int64_t until) const
void copy_to (Abstract_File &destination) const
virtual ~Abstract_File ()=default
Public Member Functions inherited from joedb::db::encoded_file::Writable_Database
 Writable_Database (joedb::Abstract_File &file)
 Writable_Database (joedb::Abstract_File &file, joedb::Recovery recovery)
const joedb::Readonly_Journal & get_journal () const
std::string read_blob (joedb::Blob blob) const
joedb::Blob write_blob (std::string_view data) override
int64_t ahead_of_checkpoint () const
void soft_checkpoint () override
void hard_checkpoint () override
void write_comment (const std::string &comment)
void write_timestamp ()
void write_timestamp (int64_t timestamp)
void write_valid_data ()
void flush () override
void clear_buffer_table ()
id_of_buffer new_buffer ()
void insert_buffer (id_of_buffer id)
id_of_buffer new_vector_of_buffer (size_t size)
id_of_buffer new_buffer (joedb::Blob field_value_of_data, int64_t field_value_of_size, int64_t field_value_of_offset)
void delete_buffer (id_of_buffer record)
void delete_vector_of_buffer (id_of_buffer v, size_t size)
void set_data (id_of_buffer record, joedb::Blob field_value_of_data)
template<typename F>
void update_vector_of_data (id_of_buffer record, size_t size, F f)
void set_size (id_of_buffer record, int64_t field_value_of_size)
template<typename F>
void update_vector_of_size (id_of_buffer record, size_t size, F f)
void set_offset (id_of_buffer record, int64_t field_value_of_offset)
template<typename F>
void update_vector_of_offset (id_of_buffer record, size_t size, F f)
Public Member Functions inherited from joedb::db::encoded_file::Database_Writable
 Database_Writable ()
void set_max_record_id (joedb::index_t record_id)
int64_t get_schema_checkpoint () const
void initialize_with_readonly_journal (joedb::Readonly_Journal &journal)
Public Member Functions inherited from joedb::db::encoded_file::Database
bool is_valid (id_of_buffer id) const
container_of_buffer get_buffer_table () const
id_of_buffer next (id_of_buffer id) const
id_of_buffer previous (id_of_buffer id) const
template<class Comparator>
std::vector< id_of_buffer > sorted_buffer (Comparator comparator) const
joedb::Blob get_data (id_of_buffer record) const
int64_t get_size (id_of_buffer record) const
int64_t get_offset (id_of_buffer record) const
Public Member Functions inherited from joedb::Writable
virtual int64_t get_position () const
virtual void start_writing (int64_t position)
virtual void end_writing (int64_t position)
virtual void update_string (Table_Id table_id, Record_Id record_id, Field_Id field_id, std::string_view value)
virtual void update_int32 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int32_t value)
virtual void update_boolean (Table_Id table_id, Record_Id record_id, Field_Id field_id, bool value)
virtual void update_float32 (Table_Id table_id, Record_Id record_id, Field_Id field_id, float value)
virtual void update_float64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, double value)
virtual void update_int8 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int8_t value)
virtual void update_int16 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int16_t value)
virtual void update_vector_string (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const std::string *value)
virtual std::string * get_own_string_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const std::string * get_own_string_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_int32 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const int32_t *value)
virtual int32_t * get_own_int32_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const int32_t * get_own_int32_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
const int64_t * get_own_int64_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_reference (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const joedb::Record_Id *value)
virtual joedb::Record_Id * get_own_reference_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const joedb::Record_Id * get_own_reference_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_boolean (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const char *value)
virtual char * get_own_boolean_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const char * get_own_boolean_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_float32 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const float *value)
virtual float * get_own_float32_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const float * get_own_float32_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_float64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const double *value)
virtual double * get_own_float64_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const double * get_own_float64_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_int8 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const int8_t *value)
virtual int8_t * get_own_int8_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const int8_t * get_own_int8_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void update_vector_int16 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const int16_t *value)
virtual int16_t * get_own_int16_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const int16_t * get_own_int16_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
const joedb::Blob * get_own_blob_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
virtual void on_blob (Blob blob)
virtual bool wants_blob_data () const
virtual ~Writable ()=default

Additional Inherited Members

Static Public Member Functions inherited from joedb::Abstract_File
static void reading_past_end_of_file ()
Static Public Member Functions inherited from joedb::db::encoded_file::Database
template<typename E = joedb::Exception>
static void throw_exception (std::string_view message)
static id_of_buffer null_buffer ()
Protected Member Functions inherited from joedb::Abstract_File
void make_readonly ()
void make_writable ()
Protected Member Functions inherited from joedb::db::encoded_file::Database_Writable
void delete_from (Table_Id table_id, Record_Id record_id) override
void insert_into (Table_Id table_id, Record_Id record_id) override
void delete_vector (Table_Id table_id, Record_Id record_id, size_t size) override
void insert_vector (Table_Id table_id, Record_Id record_id, size_t size) override
void update_int64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int64_t value) override
void update_blob (Table_Id table_id, Record_Id record_id, Field_Id field_id, joedb::Blob value) override
void update_vector_int64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const int64_t *value) override
void update_vector_blob (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const joedb::Blob *value) override
int64_t * get_own_int64_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
joedb::Blob * get_own_blob_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
void comment (const std::string &comment) override
void timestamp (int64_t timestamp) override
void valid_data () override
bool requires_schema_upgrade () const
void check_schema ()
void create_table (const std::string &name) override
void drop_table (Table_Id table_id) override
void rename_table (Table_Id table_id, const std::string &name) override
void add_field (Table_Id table_id, const std::string &name, joedb::Type type) override
void drop_field (Table_Id table_id, Field_Id field_id) override
void rename_field (Table_Id table_id, Field_Id field_id, const std::string &name) override
void custom (const std::string &name) override
Protected Member Functions inherited from joedb::db::encoded_file::Database
bool is_valid_record_id_for_buffer (Record_Id record_id) const
void internal_delete_buffer (Record_Id record_id)
void internal_insert_buffer (Record_Id record_id)
void internal_vector_insert_buffer (Record_Id record_id, size_t size)
void internal_update_buffer__data (Record_Id record_id, joedb::Blob field_value_of_data)
void internal_update_vector_buffer__data (Record_Id record_id, size_t size, const joedb::Blob *value)
void internal_update_buffer__size (Record_Id record_id, int64_t field_value_of_size)
void internal_update_vector_buffer__size (Record_Id record_id, size_t size, const int64_t *value)
void internal_update_buffer__offset (Record_Id record_id, int64_t field_value_of_offset)
void internal_update_vector_buffer__offset (Record_Id record_id, size_t size, const int64_t *value)
Protected Attributes inherited from joedb::Memory_File
std::string data
Protected Attributes inherited from joedb::db::encoded_file::Database_Writable
joedb::index_t max_record_id
Table_Id current_table_id = Table_Id{0}
bool upgrading_schema = false
joedb::Memory_File schema_file
joedb::Writable_Journal schema_journal
Protected Attributes inherited from joedb::db::encoded_file::Database
detail::data_of_buffer storage_of_buffer
Static Protected Attributes inherited from joedb::Abstract_File
static constexpr int64_t last_position = (1ULL << 63) - 1

Detailed Description

Definition at line 21 of file Memory_Database.h.

Constructor & Destructor Documentation

◆ Memory_Database()

joedb::db::encoded_file::Memory_Database::Memory_Database ( )
inline

Definition at line 24 of file Memory_Database.h.

Member Function Documentation

◆ pull()

void joedb::db::encoded_file::Memory_Database::pull ( )
inline

Definition at line 28 of file Memory_Database.h.


The documentation for this class was generated from the following file: