rippled
Loading...
Searching...
No Matches
xrpld
peerfinder
detail
Store.h
1
2
//------------------------------------------------------------------------------
3
/*
4
This file is part of rippled: https://github.com/ripple/rippled
5
Copyright (c) 2012, 2013 Ripple Labs Inc.
6
7
Permission to use, copy, modify, and/or distribute this software for any
8
purpose with or without fee is hereby granted, provided that the above
9
copyright notice and this permission notice appear in all copies.
10
11
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
//==============================================================================
20
21
#ifndef RIPPLE_PEERFINDER_STORE_H_INCLUDED
22
#define RIPPLE_PEERFINDER_STORE_H_INCLUDED
23
24
namespace
ripple
{
25
namespace
PeerFinder {
26
28
class
Store
29
{
30
public
:
31
virtual
~Store
()
32
{
33
}
34
35
// load the bootstrap cache
36
using
load_callback
=
std::function
<void(
beast::IP::Endpoint
,
int
)>;
37
virtual
std::size_t
38
load
(
load_callback
const
& cb) = 0;
39
40
// save the bootstrap cache
41
struct
Entry
42
{
43
explicit
Entry
() =
default
;
44
45
beast::IP::Endpoint
endpoint
;
46
int
valence
;
47
};
48
virtual
void
49
save
(
std::vector<Entry>
const
& v) = 0;
50
};
51
52
}
// namespace PeerFinder
53
}
// namespace ripple
54
55
#endif
beast::IP::Endpoint
A version-independent IP address and port combination.
Definition
IPEndpoint.h:38
ripple::PeerFinder::Store
Abstract persistence for PeerFinder data.
Definition
Store.h:29
ripple::PeerFinder::Store::save
virtual void save(std::vector< Entry > const &v)=0
ripple::PeerFinder::Store::~Store
virtual ~Store()
Definition
Store.h:31
ripple::PeerFinder::Store::load
virtual std::size_t load(load_callback const &cb)=0
std::function
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:25
std::size_t
ripple::PeerFinder::Store::Entry
Definition
Store.h:42
ripple::PeerFinder::Store::Entry::endpoint
beast::IP::Endpoint endpoint
Definition
Store.h:45
ripple::PeerFinder::Store::Entry::valence
int valence
Definition
Store.h:46
ripple::PeerFinder::Store::Entry::Entry
Entry()=default
std::vector
Generated by
1.9.8