mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::db: Move database::descriptor out to db::descriptor.
This commit is contained in:
parent
d13ed5854b
commit
53651ad808
9 changed files with 70 additions and 67 deletions
|
@ -18,7 +18,7 @@ namespace ircd::db
|
|||
// Information about a column
|
||||
uint32_t id(const column &);
|
||||
const std::string &name(const column &);
|
||||
const database::descriptor &describe(const column &);
|
||||
const descriptor &describe(const column &);
|
||||
size_t file_count(const column &);
|
||||
size_t bytes(const column &);
|
||||
|
||||
|
@ -107,7 +107,7 @@ struct ircd::db::column
|
|||
public:
|
||||
explicit operator const database &() const;
|
||||
explicit operator const database::column &() const;
|
||||
explicit operator const database::descriptor &() const;
|
||||
explicit operator const descriptor &() const;
|
||||
|
||||
explicit operator database &();
|
||||
explicit operator database::column &();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/// points to an internally managed database::column.
|
||||
namespace ircd::db
|
||||
{
|
||||
const database::descriptor &describe(const database::column &);
|
||||
const descriptor &describe(const database::column &);
|
||||
const std::string &name(const database::column &);
|
||||
uint32_t id(const database::column &);
|
||||
|
||||
|
@ -34,7 +34,7 @@ struct ircd::db::database::column final
|
|||
database *d;
|
||||
std::type_index key_type;
|
||||
std::type_index mapped_type;
|
||||
database::descriptor descriptor;
|
||||
db::descriptor descriptor;
|
||||
comparator cmp;
|
||||
prefix_transform prefix;
|
||||
compaction_filter cfilter;
|
||||
|
@ -50,7 +50,7 @@ struct ircd::db::database::column final
|
|||
operator rocksdb::ColumnFamilyHandle *();
|
||||
operator database &();
|
||||
|
||||
explicit column(database *const &d, const database::descriptor &);
|
||||
explicit column(database *const &d, const db::descriptor &);
|
||||
column() = delete;
|
||||
column(column &&) = delete;
|
||||
column(const column &) = delete;
|
||||
|
|
|
@ -67,7 +67,6 @@ struct ircd::db::database
|
|||
:std::enable_shared_from_this<database>
|
||||
,instance_list<database>
|
||||
{
|
||||
struct descriptor;
|
||||
struct options;
|
||||
struct events;
|
||||
struct stats;
|
||||
|
@ -81,8 +80,6 @@ struct ircd::db::database
|
|||
struct env;
|
||||
struct cache;
|
||||
|
||||
using description = std::vector<descriptor>;
|
||||
|
||||
std::string name;
|
||||
uint64_t checkpoint;
|
||||
std::string optstr;
|
||||
|
|
|
@ -64,9 +64,9 @@ enum class ircd::db::pos
|
|||
#include "compactor.h"
|
||||
#include "prefix.h"
|
||||
#include "merge.h"
|
||||
#include "descriptor.h"
|
||||
#include "database/rocksdb.h"
|
||||
#include "database/database.h"
|
||||
#include "database/descriptor.h"
|
||||
#include "database/options.h"
|
||||
#include "database/snapshot.h"
|
||||
#include "cache.h"
|
||||
|
|
|
@ -11,9 +11,15 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_DB_DATABASE_DESCRIPTOR_H
|
||||
|
||||
namespace ircd::db
|
||||
{
|
||||
struct descriptor;
|
||||
using description = std::vector<descriptor>;
|
||||
}
|
||||
|
||||
/// Descriptor of a column when opening database. Database must be opened with
|
||||
/// a consistent set of descriptors describing what will be found upon opening.
|
||||
struct ircd::db::database::descriptor
|
||||
struct ircd::db::descriptor
|
||||
{
|
||||
using typing = std::pair<std::type_index, std::type_index>;
|
||||
|
|
@ -90,7 +90,7 @@ struct ircd::m::dbs::write_opts
|
|||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
// Full description
|
||||
extern const database::description events;
|
||||
extern const db::description events;
|
||||
|
||||
//
|
||||
// Direct columns
|
||||
|
@ -99,82 +99,82 @@ namespace ircd::m::dbs::desc
|
|||
extern conf::item<size_t> events__auth_events__block__size;
|
||||
extern conf::item<size_t> events__auth_events__cache__size;
|
||||
extern conf::item<size_t> events__auth_events__cache_comp__size;
|
||||
extern const database::descriptor events_auth_events;
|
||||
extern const db::descriptor events_auth_events;
|
||||
|
||||
extern conf::item<size_t> events__content__block__size;
|
||||
extern conf::item<size_t> events__content__cache__size;
|
||||
extern conf::item<size_t> events__content__cache_comp__size;
|
||||
extern const database::descriptor events_content;
|
||||
extern const db::descriptor events_content;
|
||||
|
||||
extern conf::item<size_t> events__depth__block__size;
|
||||
extern conf::item<size_t> events__depth__cache__size;
|
||||
extern conf::item<size_t> events__depth__cache_comp__size;
|
||||
extern const database::descriptor events_depth;
|
||||
extern const db::descriptor events_depth;
|
||||
|
||||
extern conf::item<size_t> events__event_id__block__size;
|
||||
extern conf::item<size_t> events__event_id__cache__size;
|
||||
extern conf::item<size_t> events__event_id__cache_comp__size;
|
||||
extern const database::descriptor events_event_id;
|
||||
extern const db::descriptor events_event_id;
|
||||
|
||||
extern conf::item<size_t> events__hashes__block__size;
|
||||
extern conf::item<size_t> events__hashes__cache__size;
|
||||
extern conf::item<size_t> events__hashes__cache_comp__size;
|
||||
extern const database::descriptor events_hashes;
|
||||
extern const db::descriptor events_hashes;
|
||||
|
||||
extern conf::item<size_t> events__membership__block__size;
|
||||
extern conf::item<size_t> events__membership__cache__size;
|
||||
extern conf::item<size_t> events__membership__cache_comp__size;
|
||||
extern const database::descriptor events_membership;
|
||||
extern const db::descriptor events_membership;
|
||||
|
||||
extern conf::item<size_t> events__origin__block__size;
|
||||
extern conf::item<size_t> events__origin__cache__size;
|
||||
extern conf::item<size_t> events__origin__cache_comp__size;
|
||||
extern const database::descriptor events_origin;
|
||||
extern const db::descriptor events_origin;
|
||||
|
||||
extern conf::item<size_t> events__origin_server_ts__block__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache__size;
|
||||
extern conf::item<size_t> events__origin_server_ts__cache_comp__size;
|
||||
extern const database::descriptor events_origin_server_ts;
|
||||
extern const db::descriptor events_origin_server_ts;
|
||||
|
||||
extern conf::item<size_t> events__prev_events__block__size;
|
||||
extern conf::item<size_t> events__prev_events__cache__size;
|
||||
extern conf::item<size_t> events__prev_events__cache_comp__size;
|
||||
extern const database::descriptor events_prev_events;
|
||||
extern const db::descriptor events_prev_events;
|
||||
|
||||
extern conf::item<size_t> events__prev_state__block__size;
|
||||
extern conf::item<size_t> events__prev_state__cache__size;
|
||||
extern conf::item<size_t> events__prev_state__cache_comp__size;
|
||||
extern const database::descriptor events_prev_state;
|
||||
extern const db::descriptor events_prev_state;
|
||||
|
||||
extern conf::item<size_t> events__redacts__block__size;
|
||||
extern conf::item<size_t> events__redacts__cache__size;
|
||||
extern conf::item<size_t> events__redacts__cache_comp__size;
|
||||
extern const database::descriptor events_redacts;
|
||||
extern const db::descriptor events_redacts;
|
||||
|
||||
extern conf::item<size_t> events__room_id__block__size;
|
||||
extern conf::item<size_t> events__room_id__cache__size;
|
||||
extern conf::item<size_t> events__room_id__cache_comp__size;
|
||||
extern const database::descriptor events_room_id;
|
||||
extern const db::descriptor events_room_id;
|
||||
|
||||
extern conf::item<size_t> events__sender__block__size;
|
||||
extern conf::item<size_t> events__sender__cache__size;
|
||||
extern conf::item<size_t> events__sender__cache_comp__size;
|
||||
extern const database::descriptor events_sender;
|
||||
extern const db::descriptor events_sender;
|
||||
|
||||
extern conf::item<size_t> events__signatures__block__size;
|
||||
extern conf::item<size_t> events__signatures__cache__size;
|
||||
extern conf::item<size_t> events__signatures__cache_comp__size;
|
||||
extern const database::descriptor events_signatures;
|
||||
extern const db::descriptor events_signatures;
|
||||
|
||||
extern conf::item<size_t> events__state_key__block__size;
|
||||
extern conf::item<size_t> events__state_key__cache__size;
|
||||
extern conf::item<size_t> events__state_key__cache_comp__size;
|
||||
extern const database::descriptor events_state_key;
|
||||
extern const db::descriptor events_state_key;
|
||||
|
||||
extern conf::item<size_t> events__type__block__size;
|
||||
extern conf::item<size_t> events__type__cache__size;
|
||||
extern conf::item<size_t> events__type__cache_comp__size;
|
||||
extern const database::descriptor events_type;
|
||||
extern const db::descriptor events_type;
|
||||
|
||||
//
|
||||
// Metadata columns
|
||||
|
@ -184,19 +184,19 @@ namespace ircd::m::dbs::desc
|
|||
extern conf::item<size_t> events__event_idx__block__size;
|
||||
extern conf::item<size_t> events__event_idx__cache__size;
|
||||
extern conf::item<size_t> events__event_idx__cache_comp__size;
|
||||
extern const database::descriptor events__event_idx;
|
||||
extern const db::descriptor events__event_idx;
|
||||
|
||||
// events blacklist
|
||||
extern conf::item<size_t> events__event_bad__block__size;
|
||||
extern conf::item<size_t> events__event_bad__cache__size;
|
||||
extern conf::item<size_t> events__event_bad__cache_comp__size;
|
||||
extern const database::descriptor events__event_bad;
|
||||
extern const db::descriptor events__event_bad;
|
||||
|
||||
// room head mapping sequence
|
||||
extern conf::item<size_t> events__room_head__block__size;
|
||||
extern conf::item<size_t> events__room_head__cache__size;
|
||||
extern const db::prefix_transform events__room_head__pfx;
|
||||
extern const database::descriptor events__room_head;
|
||||
extern const db::descriptor events__room_head;
|
||||
|
||||
// room events sequence
|
||||
extern conf::item<size_t> events__room_events__block__size;
|
||||
|
@ -204,27 +204,27 @@ namespace ircd::m::dbs::desc
|
|||
extern conf::item<size_t> events__room_events__cache_comp__size;
|
||||
extern const db::prefix_transform events__room_events__pfx;
|
||||
extern const db::comparator events__room_events__cmp;
|
||||
extern const database::descriptor events__room_events;
|
||||
extern const db::descriptor events__room_events;
|
||||
|
||||
// room present joined members sequence
|
||||
extern conf::item<size_t> events__room_joined__block__size;
|
||||
extern conf::item<size_t> events__room_joined__cache__size;
|
||||
extern conf::item<size_t> events__room_joined__cache_comp__size;
|
||||
extern const db::prefix_transform events__room_joined__pfx;
|
||||
extern const database::descriptor events__room_joined;
|
||||
extern const db::descriptor events__room_joined;
|
||||
|
||||
// room present state mapping sequence
|
||||
extern conf::item<size_t> events__room_state__block__size;
|
||||
extern conf::item<size_t> events__room_state__cache__size;
|
||||
extern conf::item<size_t> events__room_state__cache_comp__size;
|
||||
extern const db::prefix_transform events__room_state__pfx;
|
||||
extern const database::descriptor events__room_state;
|
||||
extern const db::descriptor events__room_state;
|
||||
|
||||
// state btree node key-value store
|
||||
extern conf::item<size_t> events__state_node__block__size;
|
||||
extern conf::item<size_t> events__state_node__cache__size;
|
||||
extern conf::item<size_t> events__state_node__cache_comp__size;
|
||||
extern const database::descriptor events__state_node;
|
||||
extern const db::descriptor events__state_node;
|
||||
}
|
||||
|
||||
// Internal interface; not for public.
|
||||
|
|
10
ircd/db.cc
10
ircd/db.cc
|
@ -593,7 +593,7 @@ ircd::db::name(const database &d)
|
|||
|
||||
namespace ircd::db
|
||||
{
|
||||
extern const database::description default_description;
|
||||
extern const description default_description;
|
||||
}
|
||||
|
||||
// Instance list linkage
|
||||
|
@ -1369,7 +1369,7 @@ ircd::db::name(const database::column &c)
|
|||
return c.name;
|
||||
}
|
||||
|
||||
const ircd::db::database::descriptor &
|
||||
const ircd::db::descriptor &
|
||||
ircd::db::describe(const database::column &c)
|
||||
{
|
||||
return c.descriptor;
|
||||
|
@ -1380,7 +1380,7 @@ ircd::db::describe(const database::column &c)
|
|||
//
|
||||
|
||||
ircd::db::database::column::column(database *const &d,
|
||||
const database::descriptor &descriptor)
|
||||
const db::descriptor &descriptor)
|
||||
:rocksdb::ColumnFamilyDescriptor
|
||||
(
|
||||
descriptor.name, database::options{descriptor.options}
|
||||
|
@ -7316,7 +7316,7 @@ ircd::db::name(const column &column)
|
|||
return name(c);
|
||||
}
|
||||
|
||||
const ircd::db::database::descriptor &
|
||||
const ircd::db::descriptor &
|
||||
ircd::db::describe(const column &column)
|
||||
{
|
||||
const database::column &c(column);
|
||||
|
@ -7679,7 +7679,7 @@ const
|
|||
}
|
||||
|
||||
ircd::db::column::operator
|
||||
const database::descriptor &()
|
||||
const descriptor &()
|
||||
const
|
||||
{
|
||||
return c->descriptor;
|
||||
|
|
|
@ -606,7 +606,7 @@ ircd::m::dbs::desc::events__event_idx__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__event_idx
|
||||
{
|
||||
// name
|
||||
|
@ -676,7 +676,7 @@ ircd::m::dbs::desc::events__event_bad__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__event_bad
|
||||
{
|
||||
// name
|
||||
|
@ -810,7 +810,7 @@ ircd::m::dbs::room_head_key(const string_view &amalgam)
|
|||
/// At that time the prev_events of that event will be iterated and DELETE
|
||||
/// ops will be appended in the transaction.
|
||||
///
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__room_head
|
||||
{
|
||||
// name
|
||||
|
@ -1070,7 +1070,7 @@ ircd::m::dbs::room_events_key(const string_view &amalgam)
|
|||
/// for the time being, we pay the cost of an extra query to events_depth and
|
||||
/// find that missing piece to make the exact query with all three key parts.
|
||||
///
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__room_events
|
||||
{
|
||||
// name
|
||||
|
@ -1217,7 +1217,7 @@ ircd::m::dbs::room_joined_key(const string_view &amalgam)
|
|||
};
|
||||
}
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__room_joined
|
||||
{
|
||||
// name
|
||||
|
@ -1365,7 +1365,7 @@ ircd::m::dbs::room_state_key(const string_view &amalgam)
|
|||
};
|
||||
}
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__room_state
|
||||
{
|
||||
// name
|
||||
|
@ -1447,7 +1447,7 @@ ircd::m::dbs::desc::events__state_node__cache_comp__size
|
|||
/// of the value, which serves as the ID of the node when referenced in
|
||||
/// the tree. see: m/state.h for details.
|
||||
///
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__state_node
|
||||
{
|
||||
// name
|
||||
|
@ -1531,7 +1531,7 @@ ircd::m::dbs::desc::events__event_id__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_event_id
|
||||
{
|
||||
// name
|
||||
|
@ -1619,7 +1619,7 @@ ircd::m::dbs::desc::events__type__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_type
|
||||
{
|
||||
// name
|
||||
|
@ -1708,7 +1708,7 @@ ircd::m::dbs::desc::events__content__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_content
|
||||
{
|
||||
// name
|
||||
|
@ -1797,7 +1797,7 @@ ircd::m::dbs::desc::events__redacts__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_redacts
|
||||
{
|
||||
// name
|
||||
|
@ -1880,7 +1880,7 @@ ircd::m::dbs::desc::events__room_id__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_room_id
|
||||
{
|
||||
// name
|
||||
|
@ -1968,7 +1968,7 @@ ircd::m::dbs::desc::events__sender__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_sender
|
||||
{
|
||||
// name
|
||||
|
@ -2056,7 +2056,7 @@ ircd::m::dbs::desc::events__state_key__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_state_key
|
||||
{
|
||||
// name
|
||||
|
@ -2146,7 +2146,7 @@ ircd::m::dbs::desc::events__origin__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_origin
|
||||
{
|
||||
// name
|
||||
|
@ -2231,7 +2231,7 @@ ircd::m::dbs::desc::events__origin_server_ts__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_origin_server_ts
|
||||
{
|
||||
// name
|
||||
|
@ -2320,7 +2320,7 @@ ircd::m::dbs::desc::events__signatures__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_signatures
|
||||
{
|
||||
// name
|
||||
|
@ -2403,7 +2403,7 @@ ircd::m::dbs::desc::events__auth_events__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_auth_events
|
||||
{
|
||||
// name
|
||||
|
@ -2485,7 +2485,7 @@ ircd::m::dbs::desc::events__depth__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_depth
|
||||
{
|
||||
// name
|
||||
|
@ -2567,7 +2567,7 @@ ircd::m::dbs::desc::events__hashes__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_hashes
|
||||
{
|
||||
// name
|
||||
|
@ -2649,7 +2649,7 @@ ircd::m::dbs::desc::events__membership__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_membership
|
||||
{
|
||||
// name
|
||||
|
@ -2731,7 +2731,7 @@ ircd::m::dbs::desc::events__prev_events__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_prev_events
|
||||
{
|
||||
// name
|
||||
|
@ -2813,7 +2813,7 @@ ircd::m::dbs::desc::events__prev_state__cache_comp__size
|
|||
}
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events_prev_state
|
||||
{
|
||||
// name
|
||||
|
@ -2858,10 +2858,10 @@ ircd::m::dbs::desc::events_prev_state
|
|||
|
||||
namespace ircd::m::dbs::desc
|
||||
{
|
||||
extern const ircd::database::descriptor events__default;
|
||||
extern const ircd::db::descriptor events__default;
|
||||
};
|
||||
|
||||
const ircd::database::descriptor
|
||||
const ircd::db::descriptor
|
||||
ircd::m::dbs::desc::events__default
|
||||
{
|
||||
// name
|
||||
|
@ -2899,7 +2899,7 @@ ircd::m::dbs::desc::events__default
|
|||
false,
|
||||
};
|
||||
|
||||
const ircd::database::description
|
||||
const ircd::db::description
|
||||
ircd::m::dbs::desc::events
|
||||
{
|
||||
// Requirement of RocksDB/LevelDB
|
||||
|
|
|
@ -16,8 +16,8 @@ extern conf::item<bool> media_blocks_cache_enable;
|
|||
extern conf::item<bool> media_blocks_cache_comp_enable;
|
||||
extern conf::item<size_t> media_blocks_cache_size;
|
||||
extern conf::item<size_t> media_blocks_cache_comp_size;
|
||||
extern const db::database::descriptor media_blocks_descriptor;
|
||||
extern const db::database::description media_description;
|
||||
extern const db::descriptor media_blocks_descriptor;
|
||||
extern const db::description media_description;
|
||||
extern std::shared_ptr<db::database> media;
|
||||
extern db::column blocks;
|
||||
|
||||
|
|
Loading…
Reference in a new issue