0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 14:31:11 +01:00

ircd::db: Checkpoint skeleton state structure for env.

This commit is contained in:
Jason Volk 2018-06-09 13:40:21 -07:00
parent a077766812
commit 960553f279
3 changed files with 42 additions and 1 deletions

View file

@ -26,6 +26,7 @@ struct ircd::db::database::env final
struct random_rw_file;
struct directory;
struct file_lock;
struct state;
using Status = rocksdb::Status;
using EnvOptions = rocksdb::EnvOptions;
@ -45,6 +46,8 @@ struct ircd::db::database::env final
*rocksdb::Env::Default()
};
std::unique_ptr<struct state> st;
Status NewSequentialFile(const std::string& f, std::unique_ptr<SequentialFile>* r, const EnvOptions& options) noexcept override;
Status NewRandomAccessFile(const std::string& f, std::unique_ptr<RandomAccessFile>* r, const EnvOptions& options) noexcept override;
Status NewWritableFile(const std::string& f, std::unique_ptr<WritableFile>* r, const EnvOptions& options) noexcept override;

20
include/ircd/db/database/env/state.h vendored Normal file
View file

@ -0,0 +1,20 @@
// 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_ENV_STATE_H
struct ircd::db::database::env::state
{
database &d;
state(database *const &d);
~state() noexcept;
};

View file

@ -44,6 +44,8 @@
#include <ircd/db/database/env/random_rw_file.h>
#include <ircd/db/database/env/directory.h>
#include <ircd/db/database/env/file_lock.h>
#include <ircd/db/database/env/state.h>
// RocksDB port linktime-overriding interfaces (experimental).
#ifdef IRCD_DB_PORT
@ -1742,7 +1744,8 @@ noexcept
//
ircd::db::database::env::env(database *const &d)
:d{*d}
:d{*d},
st{std::make_unique<state>(d)}
{
}
@ -3242,6 +3245,21 @@ rocksdb::port::CondVar::SignalAll()
#endif // IRCD_DB_PORT
///////////////////////////////////////////////////////////////////////////////
//
// db/database/env/state.h
//
ircd::db::database::env::state::state(database *const &d)
:d{*d}
{
}
ircd::db::database::env::state::~state()
noexcept
{
}
///////////////////////////////////////////////////////////////////////////////
//
// db/txn.h