Joedb 10.4.6
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
tutorial::Writable_Database Class Reference

A Database that contains a joedb::Writable_Journal and keeps them in sync. More...

#include <tutorial/Writable_Database.h>

Inheritance diagram for tutorial::Writable_Database:
Collaboration diagram for tutorial::Writable_Database:

Public Member Functions

 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_city_table ()
id_of_city new_city ()
void insert_city (id_of_city id)
id_of_city new_vector_of_city (size_t size)
id_of_city new_city (std::string_view field_value_of_name)
void delete_city (id_of_city record)
void delete_vector_of_city (id_of_city v, size_t size)
void set_name (id_of_city record, std::string_view field_value_of_name)
template<typename F>
void update_vector_of_name (id_of_city record, size_t size, F f)
void clear_person_table ()
id_of_person new_person ()
void insert_person (id_of_person id)
id_of_person new_vector_of_person (size_t size)
id_of_person new_person (std::string_view field_value_of_first_name, std::string_view field_value_of_last_name, id_of_city field_value_of_home)
void delete_person (id_of_person record)
void delete_vector_of_person (id_of_person v, size_t size)
void set_first_name (id_of_person record, std::string_view field_value_of_first_name)
template<typename F>
void update_vector_of_first_name (id_of_person record, size_t size, F f)
void set_last_name (id_of_person record, std::string_view field_value_of_last_name)
template<typename F>
void update_vector_of_last_name (id_of_person record, size_t size, F f)
void set_home (id_of_person record, id_of_city field_value_of_home)
template<typename F>
void update_vector_of_home (id_of_person record, size_t size, F f)
Public Member Functions inherited from tutorial::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 tutorial::Database
bool is_valid (id_of_city id) const
bool is_valid (id_of_person id) const
container_of_city get_city_table () const
id_of_city next (id_of_city id) const
id_of_city previous (id_of_city id) const
template<class Comparator>
std::vector< id_of_city > sorted_city (Comparator comparator) const
const std::string & get_name (id_of_city record) const
container_of_person get_person_table () const
id_of_person next (id_of_person id) const
id_of_person previous (id_of_person id) const
template<class Comparator>
std::vector< id_of_person > sorted_person (Comparator comparator) const
const std::string & get_first_name (id_of_person record) const
const std::string & get_last_name (id_of_person record) const
id_of_city get_home (id_of_person record) const
const type_of_index_of_city_by_name & get_index_of_city_by_name ()
const type_of_index_of_person_by_name & get_index_of_person_by_name ()
id_of_city next_city_by_name (id_of_city id) const
id_of_city previous_city_by_name (id_of_city id) const
id_of_city find_city_by_name (std::string_view field_value_of_name) const
range_of_person_by_name find_person_by_name (std::string_view field_value_of_last_name, std::string_view field_value_of_first_name) 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_int32 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int32_t value)
virtual void update_int64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, int64_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_blob (Table_Id table_id, Record_Id record_id, Field_Id field_id, joedb::Blob value)
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
virtual void update_vector_int64 (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const int64_t *value)
virtual int64_t * get_own_int64_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
const int64_t * get_own_int64_const_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) const
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
virtual void update_vector_blob (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const joedb::Blob *value)
virtual joedb::Blob * get_own_blob_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity)
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

Friends

class Client
class Multiplexer
class Memory_Database

Additional Inherited Members

Static Public Member Functions inherited from tutorial::Database
template<typename E = joedb::Exception>
static void throw_exception (std::string_view message)
static id_of_city null_city ()
static id_of_person null_person ()
Protected Member Functions inherited from tutorial::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_string (Table_Id table_id, Record_Id record_id, Field_Id field_id, std::string_view value) override
void update_reference (Table_Id table_id, Record_Id record_id, Field_Id field_id, joedb::Record_Id value) override
void update_vector_string (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const std::string *value) override
void update_vector_reference (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t size, const joedb::Record_Id *value) override
std::string * get_own_string_storage (Table_Id table_id, Record_Id record_id, Field_Id field_id, size_t &capacity) override
joedb::Record_Id * get_own_reference_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 tutorial::Database
bool is_valid_record_id_for_city (Record_Id record_id) const
bool is_valid_record_id_for_person (Record_Id record_id) const
void remove_index_of_city_by_name (Record_Id record_id)
void add_index_of_city_by_name (Record_Id record_id)
void remove_index_of_person_by_name (Record_Id record_id)
void add_index_of_person_by_name (Record_Id record_id)
void internal_delete_city (Record_Id record_id)
void internal_delete_person (Record_Id record_id)
void internal_insert_city (Record_Id record_id)
void internal_vector_insert_city (Record_Id record_id, size_t size)
void internal_insert_person (Record_Id record_id)
void internal_vector_insert_person (Record_Id record_id, size_t size)
void internal_update_city__name (Record_Id record_id, std::string_view field_value_of_name)
void internal_update_vector_city__name (Record_Id record_id, size_t size, const std::string *value)
void internal_update_person__first_name (Record_Id record_id, std::string_view field_value_of_first_name)
void internal_update_vector_person__first_name (Record_Id record_id, size_t size, const std::string *value)
void internal_update_person__last_name (Record_Id record_id, std::string_view field_value_of_last_name)
void internal_update_vector_person__last_name (Record_Id record_id, size_t size, const std::string *value)
void internal_update_person__home (Record_Id record_id, id_of_city field_value_of_home)
void internal_update_vector_person__home (Record_Id record_id, size_t size, const id_of_city *value)
Protected Attributes inherited from tutorial::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 tutorial::Database
detail::data_of_city storage_of_city
detail::data_of_person storage_of_person
type_of_index_of_city_by_name index_of_city_by_name
type_of_index_of_person_by_name index_of_person_by_name

Detailed Description

Definition at line 31 of file Writable_Database.h.

Constructor & Destructor Documentation

◆ Writable_Database() [1/2]

tutorial::Writable_Database::Writable_Database ( joedb::Abstract_File & file)

Definition at line 111 of file Writable_Database.cpp.

◆ Writable_Database() [2/2]

tutorial::Writable_Database::Writable_Database ( joedb::Abstract_File & file,
joedb::Recovery recovery )

Definition at line 118 of file Writable_Database.cpp.

Member Function Documentation

◆ ahead_of_checkpoint()

int64_t tutorial::Writable_Database::ahead_of_checkpoint ( ) const
inline

Definition at line 75 of file Writable_Database.h.

◆ clear_city_table()

void tutorial::Writable_Database::clear_city_table ( )

Definition at line 135 of file Writable_Database.cpp.

◆ clear_person_table()

void tutorial::Writable_Database::clear_person_table ( )

Definition at line 143 of file Writable_Database.cpp.

◆ delete_city()

void tutorial::Writable_Database::delete_city ( id_of_city record)
inline

Definition at line 135 of file Writable_Database.h.

◆ delete_person()

void tutorial::Writable_Database::delete_person ( id_of_person record)
inline

Definition at line 206 of file Writable_Database.h.

◆ delete_vector_of_city()

void tutorial::Writable_Database::delete_vector_of_city ( id_of_city v,
size_t size )
inline

Definition at line 141 of file Writable_Database.h.

◆ delete_vector_of_person()

void tutorial::Writable_Database::delete_vector_of_person ( id_of_person v,
size_t size )
inline

Definition at line 212 of file Writable_Database.h.

◆ flush()

void tutorial::Writable_Database::flush ( )
inlineoverridevirtual

Reimplemented from joedb::Writable.

Definition at line 94 of file Writable_Database.h.

◆ get_journal()

const joedb::Readonly_Journal & tutorial::Writable_Database::get_journal ( ) const
inline

Definition at line 63 of file Writable_Database.h.

◆ hard_checkpoint()

void tutorial::Writable_Database::hard_checkpoint ( )
inlineoverridevirtual

Reimplemented from joedb::Writable.

Definition at line 85 of file Writable_Database.h.

◆ insert_city()

void tutorial::Writable_Database::insert_city ( id_of_city id)
inline

Definition at line 108 of file Writable_Database.h.

◆ insert_person()

void tutorial::Writable_Database::insert_person ( id_of_person id)
inline

Definition at line 175 of file Writable_Database.h.

◆ new_city() [1/2]

id_of_city tutorial::Writable_Database::new_city ( )
inline

Definition at line 98 of file Writable_Database.h.

◆ new_city() [2/2]

id_of_city tutorial::Writable_Database::new_city ( std::string_view field_value_of_name)
inline

Definition at line 125 of file Writable_Database.h.

◆ new_person() [1/2]

id_of_person tutorial::Writable_Database::new_person ( )
inline

Definition at line 165 of file Writable_Database.h.

◆ new_person() [2/2]

id_of_person tutorial::Writable_Database::new_person ( std::string_view field_value_of_first_name,
std::string_view field_value_of_last_name,
id_of_city field_value_of_home )
inline

Definition at line 192 of file Writable_Database.h.

◆ new_vector_of_city()

id_of_city tutorial::Writable_Database::new_vector_of_city ( size_t size)
inline

Definition at line 116 of file Writable_Database.h.

◆ new_vector_of_person()

id_of_person tutorial::Writable_Database::new_vector_of_person ( size_t size)
inline

Definition at line 183 of file Writable_Database.h.

◆ read_blob()

std::string tutorial::Writable_Database::read_blob ( joedb::Blob blob) const
inline

Definition at line 65 of file Writable_Database.h.

◆ set_first_name()

void tutorial::Writable_Database::set_first_name ( id_of_person record,
std::string_view field_value_of_first_name )
inline

Definition at line 219 of file Writable_Database.h.

◆ set_home()

void tutorial::Writable_Database::set_home ( id_of_person record,
id_of_city field_value_of_home )
inline

Definition at line 247 of file Writable_Database.h.

◆ set_last_name()

void tutorial::Writable_Database::set_last_name ( id_of_person record,
std::string_view field_value_of_last_name )
inline

Definition at line 233 of file Writable_Database.h.

◆ set_name()

void tutorial::Writable_Database::set_name ( id_of_city record,
std::string_view field_value_of_name )
inline

Definition at line 148 of file Writable_Database.h.

◆ soft_checkpoint()

void tutorial::Writable_Database::soft_checkpoint ( )
inlineoverridevirtual

Reimplemented from joedb::Writable.

Definition at line 80 of file Writable_Database.h.

◆ update_vector_of_first_name()

template<typename F>
void tutorial::Writable_Database::update_vector_of_first_name ( id_of_person record,
size_t size,
F f )
inline

Definition at line 225 of file Writable_Database.h.

◆ update_vector_of_home()

template<typename F>
void tutorial::Writable_Database::update_vector_of_home ( id_of_person record,
size_t size,
F f )
inline

Definition at line 253 of file Writable_Database.h.

◆ update_vector_of_last_name()

template<typename F>
void tutorial::Writable_Database::update_vector_of_last_name ( id_of_person record,
size_t size,
F f )
inline

Definition at line 239 of file Writable_Database.h.

◆ update_vector_of_name()

template<typename F>
void tutorial::Writable_Database::update_vector_of_name ( id_of_city record,
size_t size,
F f )
inline

Definition at line 154 of file Writable_Database.h.

◆ write_blob()

joedb::Blob tutorial::Writable_Database::write_blob ( std::string_view data)
inlineoverridevirtual

Reimplemented from joedb::Writable.

Definition at line 70 of file Writable_Database.h.

◆ write_comment()

void tutorial::Writable_Database::write_comment ( const std::string & comment)

Definition at line 20 of file Writable_Database.cpp.

◆ write_timestamp() [1/2]

void tutorial::Writable_Database::write_timestamp ( )

Definition at line 27 of file Writable_Database.cpp.

◆ write_timestamp() [2/2]

void tutorial::Writable_Database::write_timestamp ( int64_t timestamp)

Definition at line 34 of file Writable_Database.cpp.

◆ write_valid_data()

void tutorial::Writable_Database::write_valid_data ( )

Definition at line 41 of file Writable_Database.cpp.

◆ Client

friend class Client
friend

Definition at line 34 of file Writable_Database.h.

◆ Memory_Database

friend class Memory_Database
friend

Definition at line 36 of file Writable_Database.h.

◆ Multiplexer

friend class Multiplexer
friend

Definition at line 35 of file Writable_Database.h.


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