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-17 21:45:53 +02:00
|
|
|
{ "bottom", 128_KiB, 0 },
|
|
|
|
{ "low", 128_KiB, 0 },
|
|
|
|
{ "high", 128_KiB, 0 },
|
2018-08-16 13:48:21 +02:00
|
|
|
}};
|
|
|
|
|
|
|
|
state(database *const &d)
|
|
|
|
:d{*d}
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
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
|
|
|
};
|