mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 16:34:13 +01:00
ircd::db: Remove unnecessary shared_ptr for column instance.
This commit is contained in:
parent
e46faaf882
commit
cbdd176819
2 changed files with 24 additions and 26 deletions
|
@ -98,7 +98,7 @@ struct ircd::db::column
|
||||||
using iterator = const_iterator;
|
using iterator = const_iterator;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<database::column> c;
|
database::column *c;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit operator const database &() const;
|
explicit operator const database &() const;
|
||||||
|
@ -134,7 +134,6 @@ struct ircd::db::column
|
||||||
void operator()(const sopts &, const std::initializer_list<delta> &);
|
void operator()(const sopts &, const std::initializer_list<delta> &);
|
||||||
void operator()(const delta &, const sopts & = {});
|
void operator()(const delta &, const sopts & = {});
|
||||||
|
|
||||||
explicit column(std::shared_ptr<database::column> c);
|
|
||||||
column(database::column &c);
|
column(database::column &c);
|
||||||
column(database &, const string_view &column);
|
column(database &, const string_view &column);
|
||||||
column() = default;
|
column() = default;
|
||||||
|
@ -178,12 +177,12 @@ struct ircd::db::column::const_iterator
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gopts opts;
|
gopts opts;
|
||||||
std::shared_ptr<database::column> c;
|
database::column *c;
|
||||||
std::unique_ptr<rocksdb::Iterator> it;
|
std::unique_ptr<rocksdb::Iterator> it;
|
||||||
mutable value_type val;
|
mutable value_type val;
|
||||||
|
|
||||||
friend class column;
|
friend class column;
|
||||||
const_iterator(std::shared_ptr<database::column>, std::unique_ptr<rocksdb::Iterator> &&, gopts = {});
|
const_iterator(database::column *const &, std::unique_ptr<rocksdb::Iterator> &&, gopts = {});
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit operator const database::snapshot &() const;
|
explicit operator const database::snapshot &() const;
|
||||||
|
|
43
ircd/db.cc
43
ircd/db.cc
|
@ -343,12 +343,16 @@ ircd::db::shared_from(const database::column &column)
|
||||||
//
|
//
|
||||||
// database
|
// database
|
||||||
//
|
//
|
||||||
|
namespace ircd::db
|
||||||
|
{
|
||||||
|
database::description default_description;
|
||||||
|
}
|
||||||
|
|
||||||
ircd::db::database::database(std::string name,
|
ircd::db::database::database(std::string name,
|
||||||
std::string optstr)
|
std::string optstr)
|
||||||
:database
|
:database
|
||||||
{
|
{
|
||||||
std::move(name), std::move(optstr), {}
|
std::move(name), std::move(optstr), default_description
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1933,25 +1937,6 @@ ircd::db::name(const column &column)
|
||||||
return name(c);
|
return name(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// column
|
|
||||||
//
|
|
||||||
|
|
||||||
ircd::db::column::column(database::column &c)
|
|
||||||
:c{shared_from(c)}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ircd::db::column::column(std::shared_ptr<database::column> c)
|
|
||||||
:c{std::move(c)}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ircd::db::column::column(database &d,
|
|
||||||
const string_view &column_name)
|
|
||||||
:c{shared_from(d[column_name])}
|
|
||||||
{}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::db::flush(column &column,
|
ircd::db::flush(column &column,
|
||||||
const bool &blocking)
|
const bool &blocking)
|
||||||
|
@ -2101,6 +2086,20 @@ ircd::db::has(column &column,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// column
|
||||||
|
//
|
||||||
|
|
||||||
|
ircd::db::column::column(database::column &c)
|
||||||
|
:c{&c}
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::db::column::column(database &d,
|
||||||
|
const string_view &column_name)
|
||||||
|
:c{&d[column_name]}
|
||||||
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
ircd::db::column::operator()(const delta &delta,
|
ircd::db::column::operator()(const delta &delta,
|
||||||
const sopts &sopts)
|
const sopts &sopts)
|
||||||
|
@ -2274,11 +2273,11 @@ ircd::db::column::const_iterator::const_iterator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::db::column::const_iterator::const_iterator(std::shared_ptr<database::column> c,
|
ircd::db::column::const_iterator::const_iterator(database::column *const &c,
|
||||||
std::unique_ptr<rocksdb::Iterator> &&it,
|
std::unique_ptr<rocksdb::Iterator> &&it,
|
||||||
gopts opts)
|
gopts opts)
|
||||||
:opts{std::move(opts)}
|
:opts{std::move(opts)}
|
||||||
,c{std::move(c)}
|
,c{c}
|
||||||
,it{std::move(it)}
|
,it{std::move(it)}
|
||||||
{
|
{
|
||||||
//if(!has_opt(this->opts, get::READAHEAD))
|
//if(!has_opt(this->opts, get::READAHEAD))
|
||||||
|
|
Loading…
Reference in a new issue