rippled
Loading...
Searching...
No Matches
Manager.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_NODESTORE_MANAGER_H_INCLUDED
21#define RIPPLE_NODESTORE_MANAGER_H_INCLUDED
22
23#include <xrpld/nodestore/DatabaseRotating.h>
24#include <xrpld/nodestore/Factory.h>
25
26namespace ripple {
27
28namespace NodeStore {
29
32{
33public:
34 virtual ~Manager() = default;
35 Manager() = default;
36 Manager(Manager const&) = delete;
37 Manager&
38 operator=(Manager const&) = delete;
39
41 static Manager&
42 instance();
43
45 virtual void
46 insert(Factory& factory) = 0;
47
49 virtual void
50 erase(Factory& factory) = 0;
51
56 virtual Factory*
57 find(std::string const& name) = 0;
58
62 Section const& parameters,
64 Scheduler& scheduler,
65 beast::Journal journal) = 0;
66
98 Scheduler& scheduler,
99 int readThreads,
100 Section const& backendParameters,
101 beast::Journal journal) = 0;
102};
103
104} // namespace NodeStore
105} // namespace ripple
106
107#endif
A generic endpoint for log messages.
Definition: Journal.h:60
Base class for backend factories.
Definition: Factory.h:37
Singleton for managing NodeStore factories and back ends.
Definition: Manager.h:32
virtual std::unique_ptr< Backend > make_Backend(Section const &parameters, std::size_t burstSize, Scheduler &scheduler, beast::Journal journal)=0
Create a backend.
virtual std::unique_ptr< Database > make_Database(std::size_t burstSize, Scheduler &scheduler, int readThreads, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
static Manager & instance()
Returns the instance of the manager singleton.
Definition: ManagerImp.cpp:116
Manager(Manager const &)=delete
virtual Factory * find(std::string const &name)=0
Return a pointer to the matching factory if it exists.
virtual ~Manager()=default
virtual void erase(Factory &factory)=0
Remove a factory.
virtual void insert(Factory &factory)=0
Add a factory.
Manager & operator=(Manager const &)=delete
Scheduling for asynchronous backend activity.
Holds a collection of configuration values.
Definition: BasicConfig.h:45
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26