0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-30 02:32:43 +01:00
construct/include/ircd/db/database/env/state.h

48 lines
1.2 KiB
C++

// 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
{
struct task;
/// Backreference to database
database &d;
/// 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
{ "rdb bott", 128_KiB, 0 },
{ "rdb low", 128_KiB, 0 },
{ "rdb high", 128_KiB, 0 },
}};
state(database *const &d);
~state() noexcept;
};
struct ircd::db::database::env::state::task
{
void (*func)(void *arg);
void (*cancel)(void *arg);
void *arg;
};