jprovider

package
v4.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint uint64

type JournalIterator

type JournalIterator interface {
	Next() bool
	Value() (*JournalRecord, Checkpoint, bte.BTE)
}

type JournalMeta

type JournalMeta struct {
	// contains filtered or unexported fields
}

type JournalProvider

type JournalProvider interface {
	//Used by a node that is inserting
	Insert(ctx context.Context, rng *configprovider.MashRange, jr *JournalRecord) (checkpoint Checkpoint, err bte.BTE)
	WaitForCheckpoint(ctx context.Context, checkpoint Checkpoint) bte.BTE

	//Used by a node taking control of a range
	//The context MUST be cancelled when done with the iterator
	//The iterator MUST return records in order
	ObtainNodeJournals(ctx context.Context, nodename string) (JournalIterator, bte.BTE)

	//Used by both the recovering nodes and the generating nodes
	//Given that the same journal can be processed by two different nodes
	//across different ranges, it is important that the provider only frees resources
	//associated with old checkpoints if they have been released across the entire range
	//of the journal. The checkpoint is INCLUSIVE.
	ReleaseJournalEntries(ctx context.Context, nodename string, upto Checkpoint, rng *configprovider.MashRange) bte.BTE

	//This is a niche operation and generally is only useful for tests. It ensures that any
	//new records are stored in a separate place from the old ones. A release journal entries
	//is only guaranteed to release space up to a barrier, the content after the barrier may
	//not be freed because it shares a file or object with other records after the upto
	//parameter
	Barrier(ctx context.Context, upto Checkpoint) bte.BTE

	//from is inclusive, upto is exclusive. The range is considered "this node" so the caller must ensure
	//that only appropriate checkpoints are released
	ReleaseDisjointCheckpoint(ctx context.Context, cp Checkpoint) bte.BTE

	//Get the current checkpoint for determining what an "old" checkpoint number is
	GetLatestCheckpoint() Checkpoint

	//If there is any information (such as journals) stored for this node name, forget it
	//It is not an error if it does not exist
	ForgetAboutNode(ctx context.Context, nodename string) bte.BTE

	//A bit like forget about node, but keep the node name tombstone
	ReleaseAllOurJournals(ctx context.Context) bte.BTE
}

type JournalRecord

type JournalRecord struct {
	//The stream UUID
	UUID []byte `msgpack:"u"`
	//The version of the stream that this would appear in
	MajorVersion uint64 `msgpack:"f"`
	//The microversion that this represents
	MicroVersion uint32 `msgpack:"m"`
	//Data point times
	Times []int64 `msgpack:"t"`
	//Data point valuez
	Values []float64 `msgpack:"v"`
}

func (*JournalRecord) DecodeMsg

func (z *JournalRecord) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*JournalRecord) EncodeMsg

func (z *JournalRecord) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*JournalRecord) MarshalMsg

func (z *JournalRecord) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*JournalRecord) Msgsize

func (z *JournalRecord) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*JournalRecord) UnmarshalMsg

func (z *JournalRecord) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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