proto

package
v0.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	INVALID_GEN_NUMBER = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GossipDelegate

type GossipDelegate struct {
	// GossipstoreImpl implements the GossipStoreInterface
	GossipStoreImpl
	// contains filtered or unexported fields
}

func (*GossipDelegate) GetBroadcasts

func (gd *GossipDelegate) GetBroadcasts(overhead, limit int) [][]byte

GetBroadcasts is called when user data messages can be broadcast. It can return a list of buffers to send. Each buffer should assume an overhead as provided with a limit on the total byte size allowed. The total byte size of the resulting data to send must not exceed the limit. Care should be taken that this method does not block, since doing so would block the entire UDP packet receive loop. Note: Currently, we do not use broadcasts and hence this function does nothing

func (*GossipDelegate) InitCurrentState

func (gd *GossipDelegate) InitCurrentState(
	clusterSize uint,
	quorumProvider state.Quorum,
)

func (*GossipDelegate) InitGossipDelegate

func (gd *GossipDelegate) InitGossipDelegate(
	genNumber uint64,
	selfNodeId types.NodeId,
	gossipVersion string,
	quorumTimeout time.Duration,
	clusterId string,
	selfClusterDomain string,
	ping func(types.NodeId, string) (time.Duration, error),
)

func (*GossipDelegate) LocalState

func (gd *GossipDelegate) LocalState(join bool) []byte

LocalState is used for a TCP Push/Pull. This is sent to the remote side in addition to the membership information. Any data can be sent here. See MergeRemoteState as well. The `join` boolean indicates this is for a join instead of a push/pull.

func (*GossipDelegate) MergeRemoteState

func (gd *GossipDelegate) MergeRemoteState(buf []byte, join bool)

MergeRemoteState is invoked after a TCP Push/Pull. This is the state received from the remote side and is the result of the remote side's LocalState call. The 'join' boolean indicates this is for a join instead of a push/pull.

func (*GossipDelegate) NodeMeta

func (gd *GossipDelegate) NodeMeta(limit int) []byte

NodeMeta is used to retrieve meta-data about the current node when broadcasting an alive message. It's length is limited to the given byte size. This metadata is available in the Node structure.

func (*GossipDelegate) NotifyAlive

func (gd *GossipDelegate) NotifyAlive(node *memberlist.Node) error

AliveDelegate is used to involve a client in processing a node "alive" message. TODO/Future-use : Check if we want to add this node in memberlist

func (*GossipDelegate) NotifyJoin

func (gd *GossipDelegate) NotifyJoin(node *memberlist.Node)

NotifyJoin is invoked when a node is detected to have joined. The Node argument must not be modified.

func (*GossipDelegate) NotifyLeave

func (gd *GossipDelegate) NotifyLeave(node *memberlist.Node)

NotifyLeave is invoked when a node is detected to have left. The Node argument must not be modified.

func (*GossipDelegate) NotifyMerge

func (gd *GossipDelegate) NotifyMerge(peers []*memberlist.Node) error

func (*GossipDelegate) NotifyMsg

func (gd *GossipDelegate) NotifyMsg(data []byte)

NotifyMsg is called when a user-data message is received. Care should be taken that this method does not block, since doing so would block the entire UDP packet receive loop. Additionally, the byte slice may be modified after the call returns, so it should be copied if needed. Note: Currently, we do not use broadcasts and hence this function does nothing

func (*GossipDelegate) NotifyUpdate

func (gd *GossipDelegate) NotifyUpdate(node *memberlist.Node)

NotifyUpdate is invoked when a node is detected to have updated, usually involving the meta data. The Node argument must not be modified. Note: Currently we do not use memberlists Node meta or modify it. Probably future use ?

type GossipNode

type GossipNode struct {
	Id types.NodeId
	Ip string
}

type GossipNodeList

type GossipNodeList []GossipNode

func (GossipNodeList) Len

func (nodes GossipNodeList) Len() int

func (GossipNodeList) Less

func (nodes GossipNodeList) Less(i, j int) bool

func (GossipNodeList) Swap

func (nodes GossipNodeList) Swap(i, j int)

type GossipStoreImpl

type GossipStoreImpl struct {
	sync.Mutex

	GenNumber uint64

	GossipVersion string
	ClusterId     string
	// contains filtered or unexported fields
}

func NewGossipStore

func NewGossipStore(id types.NodeId, version, clusterId, selfClusterDomain string) *GossipStoreImpl

func (*GossipStoreImpl) AddNode

func (s *GossipStoreImpl) AddNode(
	id types.NodeId,
	status types.NodeStatus,
	quorumMember bool,
	failureDomain string,
)

func (*GossipStoreImpl) GetClusterId

func (s *GossipStoreImpl) GetClusterId() string

func (*GossipStoreImpl) GetGossipVersion

func (s *GossipStoreImpl) GetGossipVersion() string

func (*GossipStoreImpl) GetLocalNodeInfo

func (s *GossipStoreImpl) GetLocalNodeInfo(id types.NodeId) (types.NodeInfo, error)

func (*GossipStoreImpl) GetLocalState

func (s *GossipStoreImpl) GetLocalState() types.NodeInfoMap

func (*GossipStoreImpl) GetLocalStateInBytes

func (s *GossipStoreImpl) GetLocalStateInBytes() ([]byte, error)

func (*GossipStoreImpl) GetLostQuorumTs

func (s *GossipStoreImpl) GetLostQuorumTs() time.Time

func (*GossipStoreImpl) GetSelfStatus

func (s *GossipStoreImpl) GetSelfStatus() types.NodeStatus

func (*GossipStoreImpl) GetStoreKeyValue

func (s *GossipStoreImpl) GetStoreKeyValue(key types.StoreKey) types.NodeValueMap

func (*GossipStoreImpl) GetStoreKeys

func (s *GossipStoreImpl) GetStoreKeys() []types.StoreKey

func (*GossipStoreImpl) InitStore

func (s *GossipStoreImpl) InitStore(
	id types.NodeId,
	version string,
	status types.NodeStatus,
	clusterId string,
	selfClusterDomain string,
)

func (*GossipStoreImpl) MetaInfo

func (s *GossipStoreImpl) MetaInfo() types.NodeMetaInfo

func (*GossipStoreImpl) NodeId

func (s *GossipStoreImpl) NodeId() types.NodeId

func (*GossipStoreImpl) RemoveNode

func (s *GossipStoreImpl) RemoveNode(id types.NodeId) error

func (*GossipStoreImpl) Update

func (s *GossipStoreImpl) Update(diff types.NodeInfoMap)

func (*GossipStoreImpl) UpdateLostQuorumTs

func (s *GossipStoreImpl) UpdateLostQuorumTs()

func (*GossipStoreImpl) UpdateNodeStatus

func (s *GossipStoreImpl) UpdateNodeStatus(nodeId types.NodeId, status types.NodeStatus) error

func (*GossipStoreImpl) UpdateSelf

func (s *GossipStoreImpl) UpdateSelf(key types.StoreKey, val interface{})

func (*GossipStoreImpl) UpdateSelfStatus

func (s *GossipStoreImpl) UpdateSelfStatus(status types.NodeStatus)

type GossiperImpl

type GossiperImpl struct {
	// GossipDelegate implements the GossipStoreInterface
	// as well as the memberlist Delegates
	GossipDelegate
	// contains filtered or unexported fields
}

Implements the UnreliableBroadcast interface

func (*GossiperImpl) ExternalNodeLeave

func (g *GossiperImpl) ExternalNodeLeave(nodeId types.NodeId) types.NodeId

func (*GossiperImpl) GetNodes

func (g *GossiperImpl) GetNodes() []string

func (*GossiperImpl) GossipInterval

func (g *GossiperImpl) GossipInterval() time.Duration

func (*GossiperImpl) Init

func (g *GossiperImpl) Init(
	ipPort string,
	selfNodeId types.NodeId,
	genNumber uint64,
	gossipIntervals types.GossipIntervals,
	gossipVersion string,
	clusterId string,
	selfClusterDomain string,
)

func (*GossiperImpl) Ping

func (g *GossiperImpl) Ping(peerNode types.NodeId, addr string) (time.Duration, error)

func (*GossiperImpl) Start

func (*GossiperImpl) Stop

func (g *GossiperImpl) Stop(leaveTimeout time.Duration) error

func (*GossiperImpl) UpdateCluster

func (g *GossiperImpl) UpdateCluster(peers map[types.NodeId]types.NodeUpdate)

func (*GossiperImpl) UpdateClusterDomainsActiveMap

func (g *GossiperImpl) UpdateClusterDomainsActiveMap(activeMap types.ClusterDomainsActiveMap) error

func (*GossiperImpl) UpdateSelfClusterDomain

func (g *GossiperImpl) UpdateSelfClusterDomain(selfClusterDomain string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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