0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01:00

ircd::db: cleanup: database::column section to column.h; rocksdb fwdecls to file.

This commit is contained in:
Jason Volk 2018-01-23 15:30:48 -08:00
parent d2f887f778
commit 755783ade8
4 changed files with 61 additions and 42 deletions

View file

@ -11,6 +11,19 @@
#pragma once
#define HAVE_IRCD_DB_DATABASE_COLUMN_H
/// 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
{
std::shared_ptr<const database::column> shared_from(const database::column &);
std::shared_ptr<database::column> shared_from(database::column &);
const database::descriptor &describe(const database::column &);
const std::string &name(const database::column &);
uint32_t id(const database::column &);
void drop(database::column &); // Request to erase column from db
}
// This file is not part of the standard include stack because it requires
// RocksDB symbols which we cannot forward declare. It is used internally
// and does not need to be included by general users of IRCd.

View file

@ -11,26 +11,6 @@
#pragma once
#define HAVE_IRCD_DB_DATABASE_H
/// Forward declarations for rocksdb because we do not include it here.
///
/// These are forward declarations to objects we may carry a pointer to.
/// Users of ircd::db should not have to deal directly with these types.
///
namespace rocksdb
{
struct DB;
struct Cache;
struct Options;
struct DBOptions;
struct ColumnFamilyOptions;
struct PlainTableOptions;
struct BlockBasedTableOptions;
struct Iterator;
struct ColumnFamilyHandle;
struct WriteBatch;
struct Slice;
}
namespace ircd::db
{
struct database;
@ -123,16 +103,3 @@ struct ircd::db::database
static const database &get(const 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
{
std::shared_ptr<const database::column> shared_from(const database::column &);
std::shared_ptr<database::column> shared_from(database::column &);
const database::descriptor &describe(const database::column &);
const std::string &name(const database::column &);
uint32_t id(const database::column &);
void drop(database::column &); // Request to erase column from db
}

View file

@ -0,0 +1,47 @@
// 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. The
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_DB_DATABASE_ROCKSDB_H
/// Forward declarations for rocksdb because we do not include it here.
///
/// These are forward declarations to objects we may carry a pointer to.
/// Users of ircd::db should not have to deal directly with these types.
///
namespace rocksdb
{
struct DB;
struct Cache;
struct Options;
struct DBOptions;
struct ColumnFamilyOptions;
struct PlainTableOptions;
struct BlockBasedTableOptions;
struct Iterator;
struct ColumnFamilyHandle;
struct WriteBatch;
struct Slice;
}
//
// Misc utils
//
namespace ircd::db
{
rocksdb::Slice slice(const string_view &);
string_view slice(const rocksdb::Slice &);
size_t size(const rocksdb::Slice &);
const char *data(const rocksdb::Slice &);
bool valid(const rocksdb::Iterator &);
string_view key(const rocksdb::Iterator &);
string_view val(const rocksdb::Iterator &);
}

View file

@ -75,6 +75,7 @@ enum class ircd::db::pos
#include "comparator.h"
#include "prefix.h"
#include "merge.h"
#include "database/rocksdb.h"
#include "database/database.h"
#include "database/descriptor.h"
#include "database/options.h"
@ -94,15 +95,6 @@ namespace ircd::db
{
extern const char *const version;
rocksdb::Slice slice(const string_view &);
string_view slice(const rocksdb::Slice &);
size_t size(const rocksdb::Slice &);
const char *data(const rocksdb::Slice &);
bool valid(const rocksdb::Iterator &);
string_view key(const rocksdb::Iterator &);
string_view val(const rocksdb::Iterator &);
std::string path(const std::string &name);
std::vector<std::string> available();