log

package
v0.0.0-...-7cd50c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkpoints

func Checkpoints() chan *pb.StableCheckpoint

Creates and returns a new channel to which all the new stable checkpoints will be pushed. It is possible that a chackpoint will be pushed to this channel without all the entries of that checkpoint being committed. This might happen if other peers are faster at producing a checkpoint than this peer is at committing entries. If the caller needs the entries to be committed, it can always call log.WaitForEntry(checkpoint.Sn) using the returned checkpoint.

func CommitCheckpoint

func CommitCheckpoint(c *pb.StableCheckpoint)

If c has a higher sequence number than the most recent stable checkpoint committed so far, CommitCheckpoint() replaces the most recent stable checkpoint by c and notifies all subscribers, if any.

func CommitEntry

func CommitEntry(entry *Entry)

CommitEntry a decided value to the log. This is the final decision that will never be reverted. If this is the first empty slot of the log, push the Entry (and potentially other previously committed entries with higher sequence numbers) to the subscribers.

func Entries

func Entries() chan *Entry

Creates and returns a new channel to which all the new log entries will be pushed in order.

func EntriesOutOfOrder

func EntriesOutOfOrder() chan *Entry

Creates and returns a new channel to which all the new log entries will be pushed as they are committed, out of order (regardless of potential "holes" in the log).

func GetCheckpoint

func GetCheckpoint() *pb.StableCheckpoint

Returns the latest stable checkpoint, or nil when there is no stable checkpoint.

func Missing

func Missing(until int32) []int32

Returns the sequence numbers of all empty log entries up to (and including) until

func WaitForEntry

func WaitForEntry(sn int32)

Blocks until entry with sequence number sn and all previous entries are committed. TODO: Do we really want to wait until all previous entries are committed too?

This can unnecessarily delay a segment just because there is a hole somewhere in the past.
(Move the notification to CommitEntry instead of PublishEntries?, If yes, watch out for the lock!)
Added after changes to the SimpleCheckpointer:
  SimpleCheckpointer relies on the absence of holes guaranteed by WaitForEntry.
  The Manager relies on the absence of holes for consistent watermark advancement.

Types

type Entry

type Entry struct {
	Sn        int32
	Batch     *pb.Batch
	Digest    []byte
	Aborted   bool
	Suspect   int32 // If aborted then this is the first leader of the segment
	ProposeTs int64
	CommitTs  int64
}

TODO: Consider making this a protobuf message, as it may need to be contained in the missing entry response.

func GetEntry

func GetEntry(sn int32) *Entry

Retrieve Entry with sequence number sn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL