Documentation
¶
Index ¶
- func NewLeaderPolicy(policyName string) leaderPolicy
- type ContiguousSegment
- func (c *ContiguousSegment) BatchSize() int
- func (c *ContiguousSegment) Buckets() *request.BucketGroup
- func (c *ContiguousSegment) FirstSN() int32
- func (c *ContiguousSegment) Followers() []int32
- func (c *ContiguousSegment) LastSN() int32
- func (c *ContiguousSegment) Leaders() []int32
- func (c *ContiguousSegment) Len() int32
- func (c *ContiguousSegment) SNs() []int32
- func (c *ContiguousSegment) SegID() int
- func (c *ContiguousSegment) StartsAfter() int32
- type DummyManager
- type Manager
- type MirManager
- type Segment
- type SkippingSegment
- func (s *SkippingSegment) BatchSize() int
- func (s *SkippingSegment) Buckets() *request.BucketGroup
- func (s *SkippingSegment) FirstSN() int32
- func (s *SkippingSegment) Followers() []int32
- func (s *SkippingSegment) LastSN() int32
- func (s *SkippingSegment) Leaders() []int32
- func (s *SkippingSegment) Len() int32
- func (s *SkippingSegment) SNs() []int32
- func (s *SkippingSegment) SegID() int
- func (s *SkippingSegment) StartsAfter() int32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLeaderPolicy ¶
func NewLeaderPolicy(policyName string) leaderPolicy
Types ¶
type ContiguousSegment ¶
type ContiguousSegment struct {
// contains filtered or unexported fields
}
Represents a segment with a contiguous range of sequence numbers. The representation is concise, but accessing the list of sequence numbers is expensive, as it is generated each time.
func (*ContiguousSegment) BatchSize ¶
func (c *ContiguousSegment) BatchSize() int
func (*ContiguousSegment) Buckets ¶
func (c *ContiguousSegment) Buckets() *request.BucketGroup
func (*ContiguousSegment) FirstSN ¶
func (c *ContiguousSegment) FirstSN() int32
func (*ContiguousSegment) Followers ¶
func (c *ContiguousSegment) Followers() []int32
func (*ContiguousSegment) LastSN ¶
func (c *ContiguousSegment) LastSN() int32
func (*ContiguousSegment) Leaders ¶
func (c *ContiguousSegment) Leaders() []int32
func (*ContiguousSegment) Len ¶
func (c *ContiguousSegment) Len() int32
func (*ContiguousSegment) SNs ¶
func (c *ContiguousSegment) SNs() []int32
Generates the list of sequence numbers based on offset and length.
func (*ContiguousSegment) SegID ¶
func (c *ContiguousSegment) SegID() int
func (*ContiguousSegment) StartsAfter ¶
func (c *ContiguousSegment) StartsAfter() int32
type DummyManager ¶
type DummyManager struct {
// contains filtered or unexported fields
}
Holds the state of the DummyManager.
func NewDummyManager ¶
func NewDummyManager() *DummyManager
Create a new DummyManager with with fresh state
func (*DummyManager) NewDummySegment ¶
func (dm *DummyManager) NewDummySegment(segID int, offset int32, leaderOffset int) Segment
Creates a new log Segment consisting of length contiguous sequence numbers starting at offset. All nodes are involved as followers. The sequence of leaders contains all nodes, starting at leaderOffset and wraps around at the end. This is how PBFT behaves. Creating a new segment here corresponds to advancing the watermarks in PBFT. The segment only has one bucket wrapped in a BucketGroup
func (*DummyManager) Start ¶
func (dm *DummyManager) Start(wg *sync.WaitGroup)
Starts the DummyManager. Afer the call to Start(), the DummyManager starts observing the log and: - Triggers the checkpointing protocol ast the log entries advance. - Issues new segments as the watermark window advances with new stable checkpints. Meant to be run as a separate goroutine. Decrements the provided wait group when done.
func (*DummyManager) SubscribeCheckpointer ¶
func (dm *DummyManager) SubscribeCheckpointer() chan int32
The node is always a potential checkpointer - return channel with all checkpointed sequence numbers.
func (*DummyManager) SubscribeOrderer ¶
func (dm *DummyManager) SubscribeOrderer() chan Segment
The node is always an orderer - return channel to which all issued Segments are pushed.
type Manager ¶
type Manager interface { // Returns a channel to which the Manager pushes all segments in the ordering of which this node is involved. // This function is called by the Orderer in order to know when a new instance of the ordering protocol needs // to be started. SubscribeOrderer() chan Segment // Returns a channel to which the Manager pushes sequence numbers at which a checkpoint should occur. // This function is called by the Checkpointer module to know when a new instance of the checkpoint protocol needs // to be started. SubscribeCheckpointer() chan int32 // Starts the Manager, making it start issuing Segments and sequence numbers for checkpointing. // The Orderer and the Checkpointer need to have subscribed by the time Start() is called. // Meant to be run as a separate goroutine, and thus no critical initialization must be performed here // (e.g. subscribing to log events such as Entries or Checkpoints), as these actions may be delayed arbitrarily. // Decrements the provided wait group when done. Start(group *sync.WaitGroup) }
A Manager orchestrates the interaction between the different modules (Log, Orderer, Checkpointer, ...). The main task of the Manager is to split the log up into Segments that can be ordered independently and in parallel. A Segment groups a subset of (not necessarily contiguous) sequence numbers of the log and lists the nodes that are responsible for agreeing on an order of Entries for these sequence numbers. (See the segment.go file itself.) The Manager informs the corresponding nodes about Segments they are involved in. The Manager also triggers the checkpointing protocol when appropriate. The decisions of the Manager about when to issue a new Segment or when to trigger the checkpointing protocol are mainly based on observing the state of the log.
type MirManager ¶
type MirManager struct {
// contains filtered or unexported fields
}
Holds the state of the MirManager.
func NewMirManager ¶
func NewMirManager() *MirManager
Create a new MirManager with with fresh state The set of leaders is initialized to contain all the nodes
func (*MirManager) Start ¶
func (mm *MirManager) Start(wg *sync.WaitGroup)
Starts the MirManager. Afer the call to Start(), the MirManager starts observing the log and: - Triggers the checkpointing protocol ast the log entries advance. - Issues new segments as the watermark window advances with new stable checkpints. Meant to be run as a separate goroutine. Decrements the provided wait group when done.
func (*MirManager) SubscribeCheckpointer ¶
func (mm *MirManager) SubscribeCheckpointer() chan int32
The node is always a potential checkpointer - return channel with all checkpointed sequence numbers.
func (*MirManager) SubscribeOrderer ¶
func (mm *MirManager) SubscribeOrderer() chan Segment
The node is always an orderer - return channel to which all issued Segments are pushed.
type Segment ¶
type Segment interface { // Globally unique ID of the Segment SegID() int // The sequence of leaders for this Segment. // In case the leader changes len(Leaders) times, we expect the ordering instance to wrap around. Leaders() []int32 // List of followers involved in ordering this Segment. Followers() []int32 // Ordered list of sequence numbers this Segment consists of. SNs() []int32 // Lowest sequence number that //is part of the Segment. FirstSN() int32 // Highest sequence number that is part of the Segment. LastSN() int32 // Number of sequence numbers in this Segment. Len() int32 // Sequence number for which an entry has to be committed before // the leader of this segment can make any propositions. // Used for duplication prevention - so that multiple segments do not propose values from the same bucket. // A value of -1 means that the segment can start immediately. StartsAfter() int32 // Returns a group of request buckets. // The leader of this segment uses exclusively these buckets to obtain batches of requests to propose. Buckets() *request.BucketGroup // Batch size limit for this segment. BatchSize() int }
Represents a Segment of the log that is handled by one ordering instance, independently of and in parallel with other Segments. Segments are created by the Manager and all nodes receive information about Segments they are involved in.
type SkippingSegment ¶
type SkippingSegment struct {
// contains filtered or unexported fields
}
Represents a segment with a non-contiguous ordered range of sequence numbers. Each sequence number has a fixed distance form the previous sequence number.
func (*SkippingSegment) BatchSize ¶
func (s *SkippingSegment) BatchSize() int
func (*SkippingSegment) Buckets ¶
func (s *SkippingSegment) Buckets() *request.BucketGroup
func (*SkippingSegment) FirstSN ¶
func (s *SkippingSegment) FirstSN() int32
func (*SkippingSegment) Followers ¶
func (s *SkippingSegment) Followers() []int32
func (*SkippingSegment) LastSN ¶
func (s *SkippingSegment) LastSN() int32
func (*SkippingSegment) Leaders ¶
func (s *SkippingSegment) Leaders() []int32
func (*SkippingSegment) Len ¶
func (s *SkippingSegment) Len() int32
func (*SkippingSegment) SNs ¶
func (s *SkippingSegment) SNs() []int32
Generates the list of sequence numbers based on offset and length.
func (*SkippingSegment) SegID ¶
func (s *SkippingSegment) SegID() int
func (*SkippingSegment) StartsAfter ¶
func (s *SkippingSegment) StartsAfter() int32