rippled
Factory.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_FACTORY_H_INCLUDED
21 #define RIPPLE_NODESTORE_FACTORY_H_INCLUDED
22 
23 #include <ripple/beast/utility/Journal.h>
24 #include <ripple/nodestore/Backend.h>
25 #include <ripple/nodestore/Scheduler.h>
26 #include <nudb/store.hpp>
27 
28 namespace ripple {
29 
30 namespace NodeStore {
31 
33 class Factory
34 {
35 public:
36  virtual ~Factory() = default;
37 
39  virtual std::string
40  getName() const = 0;
41 
52  size_t keyBytes,
53  Section const& parameters,
55  Scheduler& scheduler,
56  beast::Journal journal) = 0;
57 
69  size_t keyBytes,
70  Section const& parameters,
71  std::size_t burstSize,
72  Scheduler& scheduler,
73  nudb::context& context,
74  beast::Journal journal)
75  {
76  return {};
77  }
78 };
79 
80 } // namespace NodeStore
81 } // namespace ripple
82 
83 #endif
ripple::Section
Holds a collection of configuration values.
Definition: BasicConfig.h:42
ripple::NodeStore::Factory
Base class for backend factories.
Definition: Factory.h:33
std::string
STL class.
ripple::NodeStore::Factory::createInstance
virtual std::unique_ptr< Backend > createInstance(size_t keyBytes, Section const &parameters, std::size_t burstSize, Scheduler &scheduler, nudb::context &context, beast::Journal journal)
Create an instance of this factory's backend.
Definition: Factory.h:68
ripple::NodeStore::Factory::getName
virtual std::string getName() const =0
Retrieve the name of this factory.
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::SizedItem::burstSize
@ burstSize
ripple::NodeStore::Scheduler
Scheduling for asynchronous backend activity.
Definition: ripple/nodestore/Scheduler.h:60
ripple::NodeStore::Factory::createInstance
virtual std::unique_ptr< Backend > createInstance(size_t keyBytes, Section const &parameters, std::size_t burstSize, Scheduler &scheduler, beast::Journal journal)=0
Create an instance of this factory's backend.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::NodeStore::Factory::~Factory
virtual ~Factory()=default
std::size_t
std::unique_ptr
STL class.