rippled
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 <ripple/nodestore/Factory.h>
24 #include <ripple/nodestore/DatabaseRotating.h>
25 #include <ripple/nodestore/DatabaseShard.h>
26 
27 namespace ripple {
28 namespace NodeStore {
29 
31 class Manager
32 {
33 public:
34  virtual ~Manager () = default;
35  Manager() = default;
36  Manager(Manager const&) = delete;
37  Manager& operator=(Manager const&) = delete;
38 
40  static
41  Manager&
42  instance();
43 
45  virtual
46  void
47  insert (Factory& factory) = 0;
48 
50  virtual
51  void
52  erase (Factory& factory) = 0;
53 
58  virtual
59  Factory*
60  find(std::string const& name) = 0;
61 
63  virtual
65  make_Backend (Section const& parameters,
66  Scheduler& scheduler, beast::Journal journal) = 0;
67 
92  virtual
94  make_Database (std::string const& name, Scheduler& scheduler,
95  int readThreads, Stoppable& parent,
96  Section const& backendParameters,
97  beast::Journal journal) = 0;
98 };
99 
100 //------------------------------------------------------------------------------
101 
104 make_Backend (Section const& config,
105  Scheduler& scheduler, beast::Journal journal);
106 
107 }
108 }
109 
110 #endif
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:43
ripple::NodeStore::Manager
Singleton for managing NodeStore factories and back ends.
Definition: Manager.h:31
ripple::NodeStore::Factory
Base class for backend factories.
Definition: Factory.h:32
std::string
STL class.
ripple::NodeStore::Manager::erase
virtual void erase(Factory &factory)=0
Remove a factory.
ripple::NodeStore::Manager::make_Backend
virtual std::unique_ptr< Backend > make_Backend(Section const &parameters, Scheduler &scheduler, beast::Journal journal)=0
Create a backend.
ripple::NodeStore::Manager::operator=
Manager & operator=(Manager const &)=delete
ripple::Stoppable
Provides an interface for starting and stopping.
Definition: Stoppable.h:200
ripple::NodeStore::Manager::insert
virtual void insert(Factory &factory)=0
Add a factory.
ripple::NodeStore::Manager::~Manager
virtual ~Manager()=default
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:60
ripple::NodeStore::Scheduler
Scheduling for asynchronous backend activity.
Definition: ripple/nodestore/Scheduler.h:57
ripple::NodeStore::Manager::find
virtual Factory * find(std::string const &name)=0
Return a pointer to the matching factory if it exists.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeStore::make_Backend
std::unique_ptr< Backend > make_Backend(Section const &config, Scheduler &scheduler, beast::Journal journal)
Create a Backend.
Definition: ManagerImp.cpp:125
ripple::NodeStore::Manager::make_Database
virtual std::unique_ptr< Database > make_Database(std::string const &name, Scheduler &scheduler, int readThreads, Stoppable &parent, Section const &backendParameters, beast::Journal journal)=0
Construct a NodeStore database.
ripple::NodeStore::Manager::instance
static Manager & instance()
Returns the instance of the manager singleton.
Definition: ManagerImp.cpp:117
std::unique_ptr
STL class.
ripple::NodeStore::Manager::Manager
Manager()=default