client

package
v0.0.0-...-a582c34 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Code generated by protoc-gen-gogo. DO NOT EDIT. source: session.proto

Package client implements the client Session struct for identifying proposal
clients and their progress. Together with the LRU based session store on the
server side, client Session helps to implement the at-most-once semantic. It
ensures that when retrying a prviously timed out proposal, the retried
proposal will not be applied twice if the previous proposal attempt actually
succeed. See section 6.3 of Diego Ongaro's PhD thesis for more details.

Index

Constants

View Source
const (
	// NotSessionManagedClientID is a special client id used to indicate
	// that the entry is not managed by a client session. This is used when
	// the entry is not generated by the user, e.g. the blank entry proposed
	// after becoming the leader.
	NotSessionManagedClientID uint64 = 0
	// NoOPSeriesID is a special series ID used to indicate that the client
	// session is a NOOP client session.
	NoOPSeriesID uint64 = 0
	// SeriesIDForRegister is the special series id used for registering
	// a new client session.
	SeriesIDForRegister uint64 = math.MaxUint64 - 1
	// SeriesIDForUnregister is the special series id used for unregistering
	// client session.
	SeriesIDForUnregister uint64 = math.MaxUint64
	// SeriesIDFirstProposal is the first series id to be used for making
	// proposals.
	SeriesIDFirstProposal uint64 = 1
)

Variables

View Source
var (
	ErrInvalidLengthSession = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSession   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type Session

type Session struct {
	ClusterID   uint64
	ClientID    uint64
	SeriesID    uint64
	RespondedTo uint64
}

Session is the struct used to keep tracking the progress of a client.

func NewNoOPSession

func NewNoOPSession(clusterID uint64, rng random.Source) *Session

NewNoOPSession creates a new NoOP client session ready to be used for making proposals. This function is not expected to be directly invoked by application.

func NewSession

func NewSession(clusterID uint64, rng random.Source) *Session

NewSession returns a new client session not registered yet. This function is not expected to be directly invoked by application.

func (*Session) ClusterIDMustMatch

func (m *Session) ClusterIDMustMatch(clusterID uint64)

ClusterIDMustMatch asserts that the input cluster id matches the cluster id of the client session.

func (*Session) IsNoOPSession

func (m *Session) IsNoOPSession() bool

IsNoOPSession returns a boolean flag indicating whether the session instance is a NoOP session.

func (*Session) Marshal

func (m *Session) Marshal() (dAtA []byte, err error)

func (*Session) MarshalTo

func (m *Session) MarshalTo(dAtA []byte) (int, error)

func (*Session) PrepareForPropose

func (m *Session) PrepareForPropose()

PrepareForPropose sets the series id to the first series id that can be used for making proposals.

func (*Session) PrepareForRegister

func (m *Session) PrepareForRegister()

PrepareForRegister sets the series id to the special series id for registering client session.

func (*Session) PrepareForUnregister

func (m *Session) PrepareForUnregister()

PrepareForUnregister sets the series id to the special series id for unregistering client session.

func (*Session) ProposalCompleted

func (m *Session) ProposalCompleted()

ProposalCompleted increases the series id and the RespondedTo value. ProposalCompleted is expected to be called by the application every time when a proposal is completed or aborted by the application.

func (*Session) ProtoMessage

func (*Session) ProtoMessage()

func (*Session) Reset

func (m *Session) Reset()

func (*Session) Size

func (m *Session) Size() (n int)

func (*Session) String

func (m *Session) String() string

func (*Session) Unmarshal

func (m *Session) Unmarshal(dAtA []byte) error

func (*Session) ValidForProposal

func (m *Session) ValidForProposal(clusterID uint64) bool

ValidForProposal checks whether the client session object is valid for making proposals.

func (*Session) ValidForSessionOp

func (m *Session) ValidForSessionOp(clusterID uint64) bool

ValidForSessionOp checks whether the client session is valid for making client session related proposals, e.g. registering or unregistering a client session.

Jump to

Keyboard shortcuts

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