0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-01 19:22:53 +01:00

ircd::db: Update copyrights; use doxygen comments; minor cleanup.

This commit is contained in:
Jason Volk 2018-01-17 18:14:13 -08:00
parent 9ba31f77c2
commit e4f6b64fec
15 changed files with 480 additions and 450 deletions

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_CELL_H #define HAVE_IRCD_DB_CELL_H
@ -32,22 +32,22 @@ namespace ircd::db
uint64_t sequence(const cell &); uint64_t sequence(const cell &);
} }
// A cell is a single key-value element existing within a column. This structure /// A cell is a single key-value element existing within a column. This structure
// provides the necessary facilities for working with a single cell. Many simple /// provides the necessary facilities for working with a single cell. Many simple
// operations can also be done through the column interface itself so check column.h /// operations can also be done through the column interface itself so check column.h
// for satisfaction. Cells from different columns sharing the same key are composed /// for satisfaction. Cells from different columns sharing the same key are composed
// into a `row` (see: row.h). /// into a `row` (see: row.h).
// ///
// When composed into a `row` or `object` remember that calls to cell::key() will /// When composed into a `row` or `object` remember that calls to cell::key() will
// all be the same index key -- not the name of the column the cell is representing /// all be the same index key -- not the name of the column the cell is representing
// in the row. You probably want cell::col() when iterating the row to build a /// in the row. You probably want cell::col() when iterating the row to build a
// JSON object's keys when iterating across a row. /// JSON object's keys when iterating across a row.
// ///
// NOTE that this cell struct is type-agnostic. The database is capable of storing /// NOTE that this cell struct is type-agnostic. The database is capable of storing
// binary data in the key or the value for a cell. The string_view will work with /// binary data in the key or the value for a cell. The string_view will work with
// both a normal string and binary data, so this class is not a template and offers /// both a normal string and binary data, so this class is not a template and offers
// no conversions at this level. see: value.h/object.h /// no conversions at this level. see: value.h/object.h
// ///
struct ircd::db::cell struct ircd::db::cell
{ {
struct delta; struct delta;
@ -123,11 +123,11 @@ namespace ircd::db
void write(const cell::delta &, const sopts & = {}); void write(const cell::delta &, const sopts & = {});
} }
// ///
// A delta is an element of a database transaction. You can use this to change /// A delta is an element of a database transaction. You can use this to change
// the values of cells. Use cell deltas to make an all-succeed-or-all-fail /// the values of cells. Use cell deltas to make an all-succeed-or-all-fail
// transaction across many cells in various columns at once. /// transaction across many cells in various columns at once.
// ///
struct ircd::db::cell::delta struct ircd::db::cell::delta
:std::tuple<op, cell *, string_view> :std::tuple<op, cell *, string_view>
{ {

View file

@ -1,55 +1,28 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_COLUMN_H #define HAVE_IRCD_DB_COLUMN_H
// Columns add the ability to run multiple LevelDB's in synchrony under the same
// database (directory). Each column is a fully distinct key/value store; they
// are merely joined for consistency and possible performance advantages for
// concurrent multi-column lookups of the same key.
//
// This class is a handle to the real column instance `database::column` because the
// real column instance has to have a lifetime congruent to the open database. But
// that makes this object easier to work with, pass around, and construct. It will
// find the real `database::column` at any time.
//
// [GET] If the data is not cached, your ircd::context will yield. Note that the
// request may be posted to a separate thread which incurs the time of IO. This is
// because RocksDB has minimalist origins and is not yet asynchronous.
//
// + In the future, your ircd::context will still yield but the internals here will
// interleave pending contexts. If RocksDB is clever enough to expose actual file
// descriptors or something we can interleave on, similar to the pgsql API, we can
// remove the IO/offload thread as well.
//
// [SET] usually occur without yielding your context because the DB is oriented
// around write-log appends. It deals with the heavier tasks later in background.
//
// NOTE that the column and cell structs are type-agnostic. The database is capable of
// storing binary data in the key or the value for a cell. The string_view will work
// with both a normal string and binary data, so this class is not a template and
// offers no conversions at this level. see: value.h/object.h
//
namespace ircd::db namespace ircd::db
{ {
struct column; struct column;
@ -87,6 +60,33 @@ namespace ircd::db
void flush(column &, const bool &blocking = false); void flush(column &, const bool &blocking = false);
} }
/// Columns add the ability to run multiple LevelDB's in synchrony under the same
/// database (directory). Each column is a fully distinct key/value store; they
/// are merely joined for consistency and possible performance advantages for
/// concurrent multi-column lookups of the same key.
///
/// This class is a handle to the real column instance `database::column` because the
/// real column instance has to have a lifetime congruent to the open database. But
/// that makes this object easier to work with, pass around, and construct. It will
/// find the real `database::column` at any time.
///
/// [GET] If the data is not cached, your ircd::context will yield. Note that the
/// request may be posted to a separate thread which incurs the time of IO. This is
/// because RocksDB has minimalist origins and is not yet asynchronous.
///
/// + In the future, your ircd::context will still yield but the internals here will
/// interleave pending contexts. If RocksDB is clever enough to expose actual file
/// descriptors or something we can interleave on, similar to the pgsql API, we can
/// remove the IO/offload thread as well.
///
/// [SET] usually occur without yielding your context because the DB is oriented
/// around write-log appends. It deals with the heavier tasks later in background.
///
/// NOTE that the column and cell structs are type-agnostic. The database is capable of
/// storing binary data in the key or the value for a cell. The string_view will work
/// with both a normal string and binary data, so this class is not a template and
/// offers no conversions at this level. see: value.h/object.h
///
struct ircd::db::column struct ircd::db::column
{ {
struct delta; struct delta;
@ -149,19 +149,18 @@ struct ircd::db::column
column() = default; column() = default;
}; };
// /// Delta is an element of a transaction. Use column::delta's to atomically
// Delta is an element of a transaction. Use column::delta's to atomically /// commit to multiple keys in the same column. Refer to delta.h for the `enum op`
// commit to multiple keys in the same column. Refer to delta.h for the `enum op` /// choices. Refer to cell::delta to transact with multiple cells across different
// choices. Refer to cell::delta to transact with multiple cells across different /// columns. Refer to row::delta to transact with entire rows.
// columns. Refer to row::delta to transact with entire rows. ///
// /// Note, for now, unlike cell::delta and row::delta, the column::delta has
// Note, for now, unlike cell::delta and row::delta, the column::delta has /// no reference to the column in its tuple. This is why these deltas are executed
// no reference to the column in its tuple. This is why these deltas are executed /// through the member column::operator() and not an overload of db::write().
// through the member column::operator() and not an overload of db::write(). ///
// /// It is unlikely you will need to work with column deltas directly because
// It is unlikely you will need to work with column deltas directly because /// you may decohere one column from the others participating in a row.
// you may decohere one column from the others participating in a row. ///
//
struct ircd::db::column::delta struct ircd::db::column::delta
:std::tuple<op, string_view, string_view> :std::tuple<op, string_view, string_view>
{ {
@ -179,12 +178,11 @@ struct ircd::db::column::delta
{} {}
}; };
// /// Iteration over all keys down a column. Default construction is an invalid
// Iteration over all keys down a column. Default construction is an invalid /// iterator, which could be compared against in the style of STL algorithms.
// iterator, which could be compared against in the style of STL algorithms. /// Otherwise, construct an iterator by having it returned from the appropriate
// Otherwise, construct an iterator by having it returned from the appropriate /// function in column::.
// function in column::. ///
//
struct ircd::db::column::const_iterator_base struct ircd::db::column::const_iterator_base
{ {
using key_type = string_view; using key_type = string_view;

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_COMPARATOR_H #define HAVE_IRCD_DB_COMPARATOR_H

View file

@ -1,41 +1,48 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_DATABASE_H #define HAVE_IRCD_DB_DATABASE_H
// /// Forward declarations for rocksdb because we do not include it here.
// Database instance ///
// /// These are forward declarations to objects we may carry a pointer to.
// There can be only one instance of this class for each database, so it is /// Users of ircd::db should not have to deal directly with these types.
// always shared and must be make_shared(). The database is open when an ///
// instance is constructed and closed when the instance destructs. namespace rocksdb
// {
// The construction must have the same consistent descriptor set used every struct DB;
// time otherwise bad things happen. struct Cache;
// struct Options;
// The instance registers and deregisters itself in a global set of open struct DBOptions;
// databases and can be found that way if necessary. struct ColumnFamilyOptions;
// struct PlainTableOptions;
struct BlockBasedTableOptions;
struct Snapshot;
struct Iterator;
struct ColumnFamilyHandle;
struct WriteBatch;
struct Slice;
}
namespace ircd::db namespace ircd::db
{ {
@ -48,6 +55,18 @@ namespace ircd::db
void sync(database &); // Sync the write log (all columns) void sync(database &); // Sync the write log (all columns)
} }
/// Database instance
///
/// There can be only one instance of this class for each database, so it is
/// always shared and must be make_shared(). The database is open when an
/// instance is constructed and closed when the instance destructs.
///
/// The construction must have the same consistent descriptor set used every
/// time otherwise bad things happen.
///
/// The instance registers and deregisters itself in a global set of open
/// databases and can be found that way if necessary.
///
struct ircd::db::database struct ircd::db::database
:std::enable_shared_from_this<database> :std::enable_shared_from_this<database>
{ {
@ -116,6 +135,9 @@ struct ircd::db::database
static database &get(column &); static database &get(column &);
}; };
/// Internal column interface panel. This is db::database::column, not
/// db::column. The latter is a public shared-pointer front-end which
/// points to an internally managed database::column.
namespace ircd::db namespace ircd::db
{ {
std::shared_ptr<const database::column> shared_from(const database::column &); std::shared_ptr<const database::column> shared_from(const database::column &);
@ -126,8 +148,8 @@ namespace ircd::db
void drop(database::column &); // Request to erase column from db void drop(database::column &); // Request to erase column from db
} }
// Descriptor of a column when opening database. Database must be opened with /// Descriptor of a column when opening database. Database must be opened with
// a consistent set of descriptors describing what will be found upon opening. /// a consistent set of descriptors describing what will be found upon opening.
struct ircd::db::database::descriptor struct ircd::db::database::descriptor
{ {
using typing = std::pair<std::type_index, std::type_index>; using typing = std::pair<std::type_index, std::type_index>;
@ -140,7 +162,7 @@ struct ircd::db::database::descriptor
db::prefix_transform prefix {}; db::prefix_transform prefix {};
}; };
// options <-> string /// options <-> string
struct ircd::db::database::options struct ircd::db::database::options
:std::string :std::string
{ {
@ -165,7 +187,7 @@ struct ircd::db::database::options
{} {}
}; };
// options <-> map /// options <-> map
struct ircd::db::database::options::map struct ircd::db::database::options::map
:std::unordered_map<std::string, std::string> :std::unordered_map<std::string, std::string>
{ {
@ -183,21 +205,3 @@ struct ircd::db::database::options::map
:std::unordered_map<std::string, std::string>{std::move(m)} :std::unordered_map<std::string, std::string>{std::move(m)}
{} {}
}; };
struct ircd::db::database::snapshot
{
std::shared_ptr<const rocksdb::Snapshot> s;
public:
operator const rocksdb::Snapshot *() const { return s.get(); }
explicit operator bool() const { return bool(s); }
bool operator !() const { return !s; }
explicit snapshot(database &);
snapshot() = default;
~snapshot() noexcept;
friend uint64_t sequence(const snapshot &); // Sequence of a snapshot
friend uint64_t sequence(const rocksdb::Snapshot *const &);
};

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_H #define HAVE_IRCD_DB_H
@ -34,7 +34,6 @@ namespace ircd::db
struct column; struct column;
struct index; struct index;
struct database; struct database;
enum op :uint8_t;
enum class pos :int8_t; enum class pos :int8_t;
// Errors for the database subsystem. The exceptions that use _HIDENAME // Errors for the database subsystem. The exceptions that use _HIDENAME
@ -61,26 +60,30 @@ namespace ircd::db
extern struct log::log log; extern struct log::log log;
} }
/// Forward declarations for rocksdb because we do not include it here. /// Types of iterator operations
/// enum class ircd::db::pos
/// These are forward declarations to objects we may carry a pointer to. :int8_t
/// Users of ircd::db should not have to deal directly with these types.
///
namespace rocksdb
{ {
struct DB; FRONT = -2, // .front() | first element
struct Slice; PREV = -1, // std::prev() | previous element
struct Options; END = 0, // break; | exit iteration (or past the end)
struct DBOptions; NEXT = 1, // continue; | next element
struct ColumnFamilyOptions; BACK = 2, // .back() | last element
struct PlainTableOptions; };
struct BlockBasedTableOptions;
struct Cache; #include "delta.h"
struct Iterator; #include "comparator.h"
struct ColumnFamilyHandle; #include "prefix.h"
struct Snapshot; #include "merge.h"
struct WriteBatch; #include "database.h"
} #include "snapshot.h"
#include "opts.h"
#include "column.h"
#include "cell.h"
#include "row.h"
#include "index.h"
#include "json.h"
#include "iov.h"
// //
// Misc utils // Misc utils
@ -109,45 +112,12 @@ namespace ircd::db
string_view reflect(const op &); string_view reflect(const op &);
} }
enum class ircd::db::pos
:int8_t
{
FRONT = -2, // .front() | first element
PREV = -1, // std::prev() | previous element
END = 0, // break; | exit iteration (or past the end)
NEXT = 1, // continue; | next element
BACK = 2, // .back() | last element
};
enum ircd::db::op
:uint8_t
{
GET, // no-op sentinel, do not use (debug asserts)
SET, // (batch.Put)
MERGE, // (batch.Merge)
DELETE, // (batch.Delete)
DELETE_RANGE, // (batch.DeleteRange)
SINGLE_DELETE, // (batch.SingleDelete)
};
#include "delta.h"
#include "comparator.h"
#include "prefix.h"
#include "merge.h"
#include "database.h"
#include "opts.h"
#include "column.h"
#include "cell.h"
#include "row.h"
#include "index.h"
#include "json.h"
#include "iov.h"
namespace ircd namespace ircd
{ {
using db::database; using db::database;
} }
/// Database subsystem initialization and destruction
struct ircd::db::init struct ircd::db::init
{ {
init(); init();

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_DELTA_H #define HAVE_IRCD_DB_DELTA_H
@ -26,8 +26,21 @@
namespace ircd::db namespace ircd::db
{ {
struct delta; struct delta;
enum op :uint8_t;
} }
/// Types of delta operations
enum ircd::db::op
:uint8_t
{
GET, // no-op sentinel, do not use (debug asserts)
SET, // (batch.Put)
MERGE, // (batch.Merge)
DELETE, // (batch.Delete)
DELETE_RANGE, // (batch.DeleteRange)
SINGLE_DELETE, // (batch.SingleDelete)
};
/// Update a database cell without `cell`, `column` or row `references`. /// Update a database cell without `cell`, `column` or row `references`.
/// ///
/// The cell is found by name string. This is the least efficient of the deltas /// The cell is found by name string. This is the least efficient of the deltas

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_INDEX_H #define HAVE_IRCD_DB_INDEX_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2017 Charybdis Development Team // Matrix Construct
* Copyright (C) 2017 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_IOV_H #define HAVE_IRCD_DB_IOV_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_JSON_H #define HAVE_IRCD_DB_JSON_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_MERGE_H #define HAVE_IRCD_DB_MERGE_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_OPTS_H #define HAVE_IRCD_DB_OPTS_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_PREFIX_H #define HAVE_IRCD_DB_PREFIX_H

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define HAVE_IRCD_DB_ROW_H #define HAVE_IRCD_DB_ROW_H

View file

@ -0,0 +1,45 @@
//
// Matrix Construct
//
// Copyright (C) Matrix Construct Developers, Authors & Contributors
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice is present in all copies.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
// IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#pragma once
#define HAVE_IRCD_DB_SNAPSHOT_H
/// Database snapshot object. Maintaining this object will maintain a
/// consistent state of access to the database at the sequence number
/// from when it's acquired.
struct ircd::db::database::snapshot
{
std::shared_ptr<const rocksdb::Snapshot> s;
public:
operator const rocksdb::Snapshot *() const { return s.get(); }
explicit operator bool() const { return bool(s); }
bool operator !() const { return !s; }
explicit snapshot(database &);
snapshot() = default;
~snapshot() noexcept;
friend uint64_t sequence(const snapshot &); // Sequence of a snapshot
friend uint64_t sequence(const rocksdb::Snapshot *const &);
};

View file

@ -1,24 +1,24 @@
/* //
* Copyright (C) 2016 Charybdis Development Team // Matrix Construct
* Copyright (C) 2016 Jason Volk <jason@zemos.net> //
* // Copyright (C) Matrix Construct Developers, Authors & Contributors
* Permission to use, copy, modify, and/or distribute this software for any // Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
* purpose with or without fee is hereby granted, provided that the above //
* copyright notice and this permission notice is present in all copies. // Permission to use, copy, modify, and/or distribute this software for any
* // purpose with or without fee is hereby granted, provided that the above
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR // copyright notice and this permission notice is present in all copies.
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED //
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* POSSIBILITY OF SUCH DAMAGE. // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*/ // POSSIBILITY OF SUCH DAMAGE.
#include <rocksdb/version.h> #include <rocksdb/version.h>
#include <rocksdb/db.h> #include <rocksdb/db.h>