2018-06-09 22:40:21 +02:00
|
|
|
// 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
|
|
|
|
{
|
2018-08-16 13:48:21 +02:00
|
|
|
struct task;
|
|
|
|
|
|
|
|
/// Backreference to database
|
2018-06-09 22:40:21 +02:00
|
|
|
database &d;
|
|
|
|
|
2018-08-16 13:48:21 +02:00
|
|
|
/// Convenience alias of the number of pools
|
|
|
|
static constexpr const size_t POOLS
|
|
|
|
{
|
|
|
|
rocksdb::Env::Priority::TOTAL
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Track of background tasks.
|
|
|
|
std::array<std::deque<task>, POOLS> tasks;
|
|
|
|
|
|
|
|
/// The background task pools.
|
|
|
|
std::array<ctx::pool, POOLS> pool
|
|
|
|
{{
|
|
|
|
// name of pool stack size initial workers
|
2018-08-19 03:29:00 +02:00
|
|
|
{ "rdb bott", 128_KiB, 0 },
|
|
|
|
{ "rdb low", 128_KiB, 0 },
|
|
|
|
{ "rdb high", 128_KiB, 0 },
|
2018-08-16 13:48:21 +02:00
|
|
|
}};
|
|
|
|
|
2018-08-28 23:04:43 +02:00
|
|
|
state(database *const &d);
|
|
|
|
~state() noexcept;
|
2018-08-16 13:48:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ircd::db::database::env::state::task
|
|
|
|
{
|
|
|
|
void (*func)(void *arg);
|
|
|
|
void (*cancel)(void *arg);
|
|
|
|
void *arg;
|
2018-06-09 22:40:21 +02:00
|
|
|
};
|