2018-01-19 02:59:22 +01: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_SEQUENTIAL_FILE_H
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
struct ircd::db::database::env::sequential_file final
|
|
|
|
:rocksdb::SequentialFile
|
|
|
|
{
|
|
|
|
using Status = rocksdb::Status;
|
|
|
|
using Slice = rocksdb::Slice;
|
|
|
|
|
2018-08-23 10:10:30 +02:00
|
|
|
static const fs::fd::opts default_opts;
|
|
|
|
|
2018-01-19 02:59:22 +01:00
|
|
|
database &d;
|
2018-12-03 02:18:37 +01:00
|
|
|
ctx::mutex mutex;
|
2018-08-23 10:10:30 +02:00
|
|
|
fs::fd::opts opts;
|
|
|
|
fs::fd fd;
|
2018-10-31 22:09:10 +01:00
|
|
|
size_t _buffer_align;
|
2018-08-23 10:10:30 +02:00
|
|
|
off_t offset;
|
2018-12-16 04:40:07 +01:00
|
|
|
bool aio;
|
2018-01-19 02:59:22 +01:00
|
|
|
|
|
|
|
bool use_direct_io() const noexcept override;
|
|
|
|
size_t GetRequiredBufferAlignment() const noexcept override;
|
|
|
|
Status InvalidateCache(size_t offset, size_t length) noexcept override;
|
|
|
|
Status PositionedRead(uint64_t offset, size_t n, Slice *result, char *scratch) noexcept override;
|
|
|
|
Status Read(size_t n, Slice *result, char *scratch) noexcept override;
|
|
|
|
Status Skip(uint64_t size) noexcept override;
|
|
|
|
|
2018-08-23 10:10:30 +02:00
|
|
|
sequential_file(database *const &d, const std::string &name, const EnvOptions &);
|
2018-01-19 02:59:22 +01:00
|
|
|
~sequential_file() noexcept;
|
|
|
|
};
|