forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathISequencer.h
More file actions
79 lines (63 loc) · 2.72 KB
/
ISequencer.h
File metadata and controls
79 lines (63 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <memory>
#include <initializer_list>
#include <iosfwd>
#include "Disruptor/ICursored.h"
#include "Disruptor/IHighestPublishedSequenceProvider.h"
#include "Disruptor/ISequenced.h"
namespace Disruptor
{
template <class T> class EventPoller;
template <class T> class IDataProvider;
class ISequence;
class ISequenceBarrier;
/**
* Coordinator for claiming sequences for access to a data structure while tracking dependent Sequences
*/
template <class T>
class ISequencer : public ISequenced, public ICursored, public IHighestPublishedSequenceProvider
{
public:
virtual ~ISequencer() = default;
/**
* Claim a specific sequence when only one publisher is involved.
*
* \param sequence sequence to be claimed.
*/
virtual void claim(std::int64_t sequence) = 0;
/**
* Confirms if a sequence is published and the event is available for use; non-blocking.
*
* \param sequence sequence of the buffer to check
* \returns true if the sequence is available for use, false if not
*/
virtual bool isAvailable(std::int64_t sequence) = 0;
/**
* Add the specified gating sequences to this instance of the Disruptor. They will safely and atomically added to the list of gating sequences.
*
* \param gatingSequences The sequences to add.
*/
virtual void addGatingSequences(const std::vector< std::shared_ptr< ISequence > >& gatingSequences) = 0;
/**
* Remove the specified sequence from this sequencer.
*
* \param sequence to be removed.
* \returns true if this sequence was found, false otherwise.
*/
virtual bool removeGatingSequence(const std::shared_ptr< ISequence >& sequence) = 0;
/**
* Create a ISequenceBarrier that gates on the the cursor and a list of Sequences
*
* \param sequencesToTrack
*/
virtual std::shared_ptr< ISequenceBarrier > newBarrier(const std::vector< std::shared_ptr< ISequence > >& sequencesToTrack) = 0;
/**
* Get the minimum sequence value from all of the gating sequences added to this ringBuffer.
*
* \returns The minimum gating sequence or the cursor sequence if no sequences have been added.
*/
virtual std::int64_t getMinimumSequence() = 0;
virtual std::shared_ptr< EventPoller< T > > newPoller(const std::shared_ptr< IDataProvider< T > >& provider, const std::vector< std::shared_ptr< ISequence > >& gatingSequences) = 0;
virtual void writeDescriptionTo(std::ostream& stream) const = 0;
};
} // namespace Disruptor