mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 22:41:12 +01:00
ircd::db: Plug remaining filesystem operations into ircd::fs / AIO.
This commit is contained in:
parent
e0024b82ea
commit
1450678b83
3 changed files with 1049 additions and 212 deletions
|
@ -21,8 +21,11 @@ struct ircd::db::database::env::random_rw_file final
|
||||||
using Status = rocksdb::Status;
|
using Status = rocksdb::Status;
|
||||||
using Slice = rocksdb::Slice;
|
using Slice = rocksdb::Slice;
|
||||||
|
|
||||||
|
static const fs::fd::opts default_opts;
|
||||||
|
|
||||||
database &d;
|
database &d;
|
||||||
std::unique_ptr<RandomRWFile> defaults;
|
fs::fd::opts opts;
|
||||||
|
fs::fd fd;
|
||||||
|
|
||||||
bool use_direct_io() const noexcept override;
|
bool use_direct_io() const noexcept override;
|
||||||
size_t GetRequiredBufferAlignment() const noexcept override;
|
size_t GetRequiredBufferAlignment() const noexcept override;
|
||||||
|
@ -33,6 +36,6 @@ struct ircd::db::database::env::random_rw_file final
|
||||||
Status Fsync() noexcept override;
|
Status Fsync() noexcept override;
|
||||||
Status Close() noexcept override;
|
Status Close() noexcept override;
|
||||||
|
|
||||||
random_rw_file(database *const &d, const std::string &name, const EnvOptions &, std::unique_ptr<RandomRWFile> defaults);
|
random_rw_file(database *const &d, const std::string &name, const EnvOptions &);
|
||||||
~random_rw_file() noexcept;
|
~random_rw_file() noexcept;
|
||||||
};
|
};
|
||||||
|
|
30
include/ircd/db/database/env/writable_file.h
vendored
30
include/ircd/db/database/env/writable_file.h
vendored
|
@ -23,27 +23,33 @@ struct ircd::db::database::env::writable_file final
|
||||||
using IOPriority = rocksdb::Env::IOPriority;
|
using IOPriority = rocksdb::Env::IOPriority;
|
||||||
|
|
||||||
database &d;
|
database &d;
|
||||||
std::unique_ptr<rocksdb::WritableFile> defaults;
|
ctx::mutex mutex;
|
||||||
|
rocksdb::EnvOptions env_opts;
|
||||||
|
fs::fd::opts opts;
|
||||||
|
fs::fd fd;
|
||||||
|
IOPriority prio {IO_LOW};
|
||||||
|
size_t preallocation_block_size {0};
|
||||||
|
size_t preallocation_last_block {0};
|
||||||
|
|
||||||
Status Append(const Slice& data) noexcept override;
|
Status Allocate(uint64_t offset, uint64_t len) noexcept override;
|
||||||
Status PositionedAppend(const Slice& data, uint64_t offset) noexcept override;
|
void PrepareWrite(size_t offset, size_t len) noexcept override;
|
||||||
|
void GetPreallocationStatus(size_t* block_size, size_t* last_allocated_block) noexcept override;
|
||||||
|
void SetPreallocationBlockSize(size_t size) noexcept override;
|
||||||
Status Truncate(uint64_t size) noexcept override;
|
Status Truncate(uint64_t size) noexcept override;
|
||||||
Status Close() noexcept override;
|
|
||||||
Status Flush() noexcept override;
|
|
||||||
Status Sync() noexcept override;
|
|
||||||
Status Fsync() noexcept override;
|
|
||||||
bool IsSyncThreadSafe() const noexcept override;
|
bool IsSyncThreadSafe() const noexcept override;
|
||||||
void SetIOPriority(IOPriority pri) noexcept override;
|
void SetIOPriority(IOPriority pri) noexcept override;
|
||||||
IOPriority GetIOPriority() noexcept override;
|
IOPriority GetIOPriority() noexcept override;
|
||||||
uint64_t GetFileSize() noexcept override;
|
uint64_t GetFileSize() noexcept override;
|
||||||
void GetPreallocationStatus(size_t* block_size, size_t* last_allocated_block) noexcept override;
|
|
||||||
size_t GetUniqueId(char* id, size_t max_size) const noexcept override;
|
size_t GetUniqueId(char* id, size_t max_size) const noexcept override;
|
||||||
Status InvalidateCache(size_t offset, size_t length) noexcept override;
|
Status InvalidateCache(size_t offset, size_t length) noexcept override;
|
||||||
void SetPreallocationBlockSize(size_t size) noexcept override;
|
Status PositionedAppend(const Slice& data, uint64_t offset) noexcept override;
|
||||||
void PrepareWrite(size_t offset, size_t len) noexcept override;
|
Status Append(const Slice& data) noexcept override;
|
||||||
Status Allocate(uint64_t offset, uint64_t len) noexcept override;
|
|
||||||
Status RangeSync(uint64_t offset, uint64_t nbytes) noexcept override;
|
Status RangeSync(uint64_t offset, uint64_t nbytes) noexcept override;
|
||||||
|
Status Fsync() noexcept override;
|
||||||
|
Status Sync() noexcept override;
|
||||||
|
Status Flush() noexcept override;
|
||||||
|
Status Close() noexcept override;
|
||||||
|
|
||||||
writable_file(database *const &d, const std::string &name, const EnvOptions &, std::unique_ptr<WritableFile> defaults);
|
writable_file(database *const &d, const std::string &name, const EnvOptions &, const bool &trunc);
|
||||||
~writable_file() noexcept;
|
~writable_file() noexcept;
|
||||||
};
|
};
|
||||||
|
|
1140
ircd/db.cc
1140
ircd/db.cc
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue