remove nf7::File and unify data iface into subsys
This commit is contained in:
parent
f2099f7628
commit
692e1511aa
@ -52,10 +52,10 @@ std::shared_ptr<File> File::Make(
|
||||
File::File(Env& env,
|
||||
std::string_view path,
|
||||
uvw::file_req::file_open_flags open_flags)
|
||||
try : data::FiniteBuffer("nf7::core::uv::File::Finite"),
|
||||
data::ResizableBuffer("nf7::core::uv::File::Resizable"),
|
||||
data::ReadableBuffer("nf7::core::uv::File::Readable"),
|
||||
data::WritableBuffer("nf7::core::uv::File::Writable"),
|
||||
try : subsys::FiniteBuffer("nf7::core::uv::File::Finite"),
|
||||
subsys::ResizableBuffer("nf7::core::uv::File::Resizable"),
|
||||
subsys::ReadableBuffer("nf7::core::uv::File::Readable"),
|
||||
subsys::WritableBuffer("nf7::core::uv::File::Writable"),
|
||||
logger_(env.GetOr<subsys::Logger>(NullLogger::instance())),
|
||||
delete_(env.Get<Context>()->Make<uvw::async_handle>()),
|
||||
path_(path),
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "iface/common/future.hh"
|
||||
#include "iface/common/mutex.hh"
|
||||
#include "iface/common/void.hh"
|
||||
#include "iface/data/buffer.hh"
|
||||
#include "iface/subsys/buffer.hh"
|
||||
#include "iface/subsys/logger.hh"
|
||||
#include "iface/env.hh"
|
||||
|
||||
@ -23,10 +23,10 @@ namespace nf7::core::uv {
|
||||
|
||||
class File :
|
||||
public std::enable_shared_from_this<File>,
|
||||
public data::FiniteBuffer,
|
||||
public data::ResizableBuffer,
|
||||
public data::ReadableBuffer,
|
||||
public data::WritableBuffer {
|
||||
public subsys::FiniteBuffer,
|
||||
public subsys::ResizableBuffer,
|
||||
public subsys::ReadableBuffer,
|
||||
public subsys::WritableBuffer {
|
||||
private:
|
||||
class Finite;
|
||||
class Resizable;
|
||||
@ -34,7 +34,7 @@ class File :
|
||||
class Writable;
|
||||
|
||||
public:
|
||||
using ReadResult = data::ReadableBuffer::Result;
|
||||
using ReadResult = subsys::ReadableBuffer::Result;
|
||||
|
||||
public:
|
||||
static std::shared_ptr<File> Make(
|
||||
@ -69,10 +69,10 @@ class File :
|
||||
Future<Void> Resize(uint64_t n) noexcept override { return Truncate(n); }
|
||||
|
||||
public:
|
||||
std::shared_ptr<data::FiniteBuffer> MakeFinite();
|
||||
std::shared_ptr<data::ResizableBuffer> MakeResizable();
|
||||
std::shared_ptr<data::ReadableBuffer> MakeReadable();
|
||||
std::shared_ptr<data::WritableBuffer> MakeWritable();
|
||||
std::shared_ptr<subsys::FiniteBuffer> MakeFinite();
|
||||
std::shared_ptr<subsys::ResizableBuffer> MakeResizable();
|
||||
std::shared_ptr<subsys::ReadableBuffer> MakeReadable();
|
||||
std::shared_ptr<subsys::WritableBuffer> MakeWritable();
|
||||
|
||||
private:
|
||||
const std::shared_ptr<subsys::Logger> logger_;
|
||||
|
@ -23,16 +23,12 @@ target_sources(nf7_iface
|
||||
common/task_context.hh
|
||||
common/value.hh
|
||||
common/void.hh
|
||||
data/buffer.hh
|
||||
data/interface.hh
|
||||
data/wrap.hh
|
||||
subsys/concurrency.hh
|
||||
subsys/database.hh
|
||||
subsys/interface.hh
|
||||
subsys/logger.hh
|
||||
subsys/parallelism.hh
|
||||
env.hh
|
||||
file.hh
|
||||
lambda.hh
|
||||
version.hh
|
||||
)
|
||||
|
@ -1,23 +0,0 @@
|
||||
// No copyright
|
||||
#pragma once
|
||||
|
||||
namespace nf7::data {
|
||||
|
||||
class Interface {
|
||||
public:
|
||||
Interface() = delete;
|
||||
explicit Interface(const char* name) : name_(name) { }
|
||||
virtual ~Interface() = default;
|
||||
|
||||
Interface(const Interface&) = delete;
|
||||
Interface(Interface&&) = delete;
|
||||
Interface& operator=(const Interface&) = delete;
|
||||
Interface& operator=(Interface&&) = delete;
|
||||
|
||||
const char* name() const noexcept { return name_; }
|
||||
|
||||
private:
|
||||
const char* name_;
|
||||
};
|
||||
|
||||
} // namespace nf7::data
|
@ -1,11 +0,0 @@
|
||||
// No copyright
|
||||
#pragma once
|
||||
|
||||
#include "iface/common/container.hh"
|
||||
#include "iface/data/interface.hh"
|
||||
|
||||
namespace nf7 {
|
||||
|
||||
using File = Container<data::Interface>;
|
||||
|
||||
} // namespace nf7
|
@ -6,9 +6,9 @@
|
||||
|
||||
#include "iface/common/future.hh"
|
||||
#include "iface/common/void.hh"
|
||||
#include "iface/data/interface.hh"
|
||||
#include "iface/subsys/interface.hh"
|
||||
|
||||
namespace nf7::data {
|
||||
namespace nf7::subsys {
|
||||
|
||||
class FiniteBuffer : public Interface {
|
||||
public:
|
||||
@ -54,4 +54,5 @@ class WritableBuffer : public Interface {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace nf7::data
|
||||
} // namespace nf7::subsys
|
||||
|
@ -1,14 +1,14 @@
|
||||
// No copyright
|
||||
#pragma once
|
||||
|
||||
#include "iface/data/interface.hh"
|
||||
#include "iface/subsys/interface.hh"
|
||||
|
||||
namespace nf7::data {
|
||||
namespace nf7::subsys {
|
||||
|
||||
template <typename T>
|
||||
class Wrap : public Interface {
|
||||
class Wrapper : public Interface {
|
||||
protected:
|
||||
Wrap(const char* name, T& data) noexcept
|
||||
Wrapper(const char* name, T& data) noexcept
|
||||
: Interface(name), data_(data) { }
|
||||
|
||||
public:
|
||||
@ -18,4 +18,4 @@ class Wrap : public Interface {
|
||||
T& data_;
|
||||
};
|
||||
|
||||
} // namespace nf7::data
|
||||
} // namespace nf7::subsys
|
Loading…
x
Reference in New Issue
Block a user