networkdb

package
v25.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const NodeTable = "NodeTable"

NodeTable represents table event for node join and leave

Variables

View Source
var (
	ErrInvalidLengthNetworkdb        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowNetworkdb          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupNetworkdb = fmt.Errorf("proto: unexpected end of group")
)
View Source
var MessageType_name = map[int32]string{
	0: "INVALID",
	1: "NETWORK_EVENT",
	2: "TABLE_EVENT",
	3: "PUSH_PULL",
	4: "BULK_SYNC",
	5: "COMPOUND",
	6: "NODE_EVENT",
}
View Source
var MessageType_value = map[string]int32{
	"INVALID":       0,
	"NETWORK_EVENT": 1,
	"TABLE_EVENT":   2,
	"PUSH_PULL":     3,
	"BULK_SYNC":     4,
	"COMPOUND":      5,
	"NODE_EVENT":    6,
}
View Source
var NetworkEvent_Type_name = map[int32]string{
	0: "INVALID",
	1: "JOIN",
	2: "LEAVE",
}
View Source
var NetworkEvent_Type_value = map[string]int32{
	"INVALID": 0,
	"JOIN":    1,
	"LEAVE":   2,
}
View Source
var NodeEvent_Type_name = map[int32]string{
	0: "INVALID",
	1: "JOIN",
	2: "LEAVE",
}
View Source
var NodeEvent_Type_value = map[string]int32{
	"INVALID": 0,
	"JOIN":    1,
	"LEAVE":   2,
}
View Source
var TableEvent_Type_name = map[int32]string{
	0: "INVALID",
	1: "CREATE",
	2: "UPDATE",
	3: "DELETE",
}
View Source
var TableEvent_Type_value = map[string]int32{
	"INVALID": 0,
	"CREATE":  1,
	"UPDATE":  2,
	"DELETE":  3,
}

Functions

This section is empty.

Types

type BulkSyncMessage

type BulkSyncMessage struct {
	// Lamport time when this bulk sync was initiated.
	LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,1,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	// Indicates if this bulksync is a response to a bulk sync
	// request from a peer node.
	Unsolicited bool `protobuf:"varint,2,opt,name=unsolicited,proto3" json:"unsolicited,omitempty"`
	// Name of the node which is producing this bulk sync message.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
	// List of network names whose table entries are getting
	// bulksynced as part of the bulksync.
	Networks []string `protobuf:"bytes,4,rep,name=networks,proto3" json:"networks,omitempty"`
	// Bulksync payload
	Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
}

BulkSync message payload definition.

func (*BulkSyncMessage) Descriptor

func (*BulkSyncMessage) Descriptor() ([]byte, []int)

func (*BulkSyncMessage) GetNetworks

func (m *BulkSyncMessage) GetNetworks() []string

func (*BulkSyncMessage) GetNodeName

func (m *BulkSyncMessage) GetNodeName() string

func (*BulkSyncMessage) GetPayload

func (m *BulkSyncMessage) GetPayload() []byte

func (*BulkSyncMessage) GetUnsolicited

func (m *BulkSyncMessage) GetUnsolicited() bool

func (*BulkSyncMessage) GoString

func (this *BulkSyncMessage) GoString() string

func (*BulkSyncMessage) Marshal

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

func (*BulkSyncMessage) MarshalTo

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

func (*BulkSyncMessage) MarshalToSizedBuffer

func (m *BulkSyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BulkSyncMessage) ProtoMessage

func (*BulkSyncMessage) ProtoMessage()

func (*BulkSyncMessage) Reset

func (m *BulkSyncMessage) Reset()

func (*BulkSyncMessage) Size

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

func (*BulkSyncMessage) String

func (this *BulkSyncMessage) String() string

func (*BulkSyncMessage) Unmarshal

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

func (*BulkSyncMessage) XXX_DiscardUnknown

func (m *BulkSyncMessage) XXX_DiscardUnknown()

func (*BulkSyncMessage) XXX_Marshal

func (m *BulkSyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BulkSyncMessage) XXX_Merge

func (m *BulkSyncMessage) XXX_Merge(src proto.Message)

func (*BulkSyncMessage) XXX_Size

func (m *BulkSyncMessage) XXX_Size() int

func (*BulkSyncMessage) XXX_Unmarshal

func (m *BulkSyncMessage) XXX_Unmarshal(b []byte) error

type CompoundMessage

type CompoundMessage struct {
	// A list of simple messages.
	Messages []*CompoundMessage_SimpleMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
}

Compound message payload definition.

func (*CompoundMessage) Descriptor

func (*CompoundMessage) Descriptor() ([]byte, []int)

func (*CompoundMessage) GetMessages

func (m *CompoundMessage) GetMessages() []*CompoundMessage_SimpleMessage

func (*CompoundMessage) GoString

func (this *CompoundMessage) GoString() string

func (*CompoundMessage) Marshal

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

func (*CompoundMessage) MarshalTo

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

func (*CompoundMessage) MarshalToSizedBuffer

func (m *CompoundMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CompoundMessage) ProtoMessage

func (*CompoundMessage) ProtoMessage()

func (*CompoundMessage) Reset

func (m *CompoundMessage) Reset()

func (*CompoundMessage) Size

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

func (*CompoundMessage) String

func (this *CompoundMessage) String() string

func (*CompoundMessage) Unmarshal

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

func (*CompoundMessage) XXX_DiscardUnknown

func (m *CompoundMessage) XXX_DiscardUnknown()

func (*CompoundMessage) XXX_Marshal

func (m *CompoundMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CompoundMessage) XXX_Merge

func (m *CompoundMessage) XXX_Merge(src proto.Message)

func (*CompoundMessage) XXX_Size

func (m *CompoundMessage) XXX_Size() int

func (*CompoundMessage) XXX_Unmarshal

func (m *CompoundMessage) XXX_Unmarshal(b []byte) error

type CompoundMessage_SimpleMessage

type CompoundMessage_SimpleMessage struct {
	// Bytestring payload of a message constructed using
	// other message type definitions.
	Payload []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"`
}

func (*CompoundMessage_SimpleMessage) Descriptor

func (*CompoundMessage_SimpleMessage) Descriptor() ([]byte, []int)

func (*CompoundMessage_SimpleMessage) GetPayload

func (m *CompoundMessage_SimpleMessage) GetPayload() []byte

func (*CompoundMessage_SimpleMessage) GoString

func (this *CompoundMessage_SimpleMessage) GoString() string

func (*CompoundMessage_SimpleMessage) Marshal

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

func (*CompoundMessage_SimpleMessage) MarshalTo

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

func (*CompoundMessage_SimpleMessage) MarshalToSizedBuffer

func (m *CompoundMessage_SimpleMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CompoundMessage_SimpleMessage) ProtoMessage

func (*CompoundMessage_SimpleMessage) ProtoMessage()

func (*CompoundMessage_SimpleMessage) Reset

func (m *CompoundMessage_SimpleMessage) Reset()

func (*CompoundMessage_SimpleMessage) Size

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

func (*CompoundMessage_SimpleMessage) String

func (this *CompoundMessage_SimpleMessage) String() string

func (*CompoundMessage_SimpleMessage) Unmarshal

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

func (*CompoundMessage_SimpleMessage) XXX_DiscardUnknown

func (m *CompoundMessage_SimpleMessage) XXX_DiscardUnknown()

func (*CompoundMessage_SimpleMessage) XXX_Marshal

func (m *CompoundMessage_SimpleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CompoundMessage_SimpleMessage) XXX_Merge

func (m *CompoundMessage_SimpleMessage) XXX_Merge(src proto.Message)

func (*CompoundMessage_SimpleMessage) XXX_Size

func (m *CompoundMessage_SimpleMessage) XXX_Size() int

func (*CompoundMessage_SimpleMessage) XXX_Unmarshal

func (m *CompoundMessage_SimpleMessage) XXX_Unmarshal(b []byte) error

type Config

type Config struct {
	// NodeID is the node unique identifier of the node when is part of the cluster
	NodeID string

	// Hostname is the node hostname.
	Hostname string

	// BindAddr is the IP on which networkdb listens. It can be
	// 0.0.0.0 to listen on all addresses on the host.
	BindAddr string

	// AdvertiseAddr is the node's IP address that we advertise for
	// cluster communication.
	AdvertiseAddr string

	// BindPort is the local node's port to which we bind to for
	// cluster communication.
	BindPort int

	// Keys to be added to the Keyring of the memberlist. Key at index
	// 0 is the primary key
	Keys [][]byte

	// PacketBufferSize is the maximum number of bytes that memberlist will
	// put in a packet (this will be for UDP packets by default with a NetTransport).
	// A safe value for this is typically 1400 bytes (which is the default). However,
	// depending on your network's MTU (Maximum Transmission Unit) you may
	// be able to increase this to get more content into each gossip packet.
	PacketBufferSize int

	// StatsPrintPeriod the period to use to print queue stats
	// Default is 5min
	StatsPrintPeriod time.Duration

	// HealthPrintPeriod the period to use to print the health score
	// Default is 1min
	HealthPrintPeriod time.Duration
	// contains filtered or unexported fields
}

Config represents the configuration of the networkdb instance and can be passed by the caller.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a NetworkDB config with default values

type CreateEvent

type CreateEvent event

CreateEvent generates a table entry create event to the watchers

type DeleteEvent

type DeleteEvent event

DeleteEvent generates a table entry delete event to the watchers

type GossipMessage

type GossipMessage struct {
	Type MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.MessageType" json:"type,omitempty"`
	Data []byte      `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}

GossipMessage is a basic message header used by all messages types.

func (*GossipMessage) Descriptor

func (*GossipMessage) Descriptor() ([]byte, []int)

func (*GossipMessage) GetData

func (m *GossipMessage) GetData() []byte

func (*GossipMessage) GetType

func (m *GossipMessage) GetType() MessageType

func (*GossipMessage) GoString

func (this *GossipMessage) GoString() string

func (*GossipMessage) Marshal

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

func (*GossipMessage) MarshalTo

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

func (*GossipMessage) MarshalToSizedBuffer

func (m *GossipMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GossipMessage) ProtoMessage

func (*GossipMessage) ProtoMessage()

func (*GossipMessage) Reset

func (m *GossipMessage) Reset()

func (*GossipMessage) Size

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

func (*GossipMessage) String

func (this *GossipMessage) String() string

func (*GossipMessage) Unmarshal

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

func (*GossipMessage) XXX_DiscardUnknown

func (m *GossipMessage) XXX_DiscardUnknown()

func (*GossipMessage) XXX_Marshal

func (m *GossipMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GossipMessage) XXX_Merge

func (m *GossipMessage) XXX_Merge(src proto.Message)

func (*GossipMessage) XXX_Size

func (m *GossipMessage) XXX_Size() int

func (*GossipMessage) XXX_Unmarshal

func (m *GossipMessage) XXX_Unmarshal(b []byte) error

type MessageType

type MessageType int32

MessageType enum defines all the core message types that networkdb uses to communicate to peers.

const (
	MessageTypeInvalid MessageType = 0
	// NetworkEvent message type is used to communicate network
	// attachments on the node.
	MessageTypeNetworkEvent MessageType = 1
	// TableEvent message type is used to communicate any table
	// CRUD event that happened on the node.
	MessageTypeTableEvent MessageType = 2
	// PushPull message type is used to syncup all network
	// attachments on a peer node either during startup of this
	// node or with a random peer node periodically thereafter.
	MessageTypePushPull MessageType = 3
	// BulkSync message is used to bulksync the whole networkdb
	// state with a peer node during startup of this node or with
	// a random peer node periodically thereafter.
	MessageTypeBulkSync MessageType = 4
	// Compound message type is used to form a compound message
	// which is a pack of many message of above types, packed into
	// a single compound message.
	MessageTypeCompound MessageType = 5
	// NodeEvent message type is used to communicate node
	// join/leave events in the cluster
	MessageTypeNodeEvent MessageType = 6
)

func (MessageType) EnumDescriptor

func (MessageType) EnumDescriptor() ([]byte, []int)

func (MessageType) String

func (x MessageType) String() string

type Mux

type Mux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

type NetworkDB

type NetworkDB struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NetworkDB instance drives the networkdb cluster and acts the broker for cluster-scoped and network-scoped gossip and watches.

func New

func New(c *Config) (*NetworkDB, error)

New creates a new instance of NetworkDB using the Config passed by the caller.

func (*NetworkDB) Close

func (nDB *NetworkDB) Close()

Close destroys this NetworkDB instance by leave the cluster, stopping timers, canceling goroutines etc.

func (*NetworkDB) ClusterPeers

func (nDB *NetworkDB) ClusterPeers() []PeerInfo

ClusterPeers returns all the gossip cluster peers.

func (*NetworkDB) CreateEntry

func (nDB *NetworkDB) CreateEntry(tname, nid, key string, value []byte) error

CreateEntry creates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster. It is an error to create an entry for the same tuple for which there is already an existing entry unless the current entry is deleting state.

func (*NetworkDB) DeleteEntry

func (nDB *NetworkDB) DeleteEntry(tname, nid, key string) error

DeleteEntry deletes a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster.

func (*NetworkDB) GetEntry

func (nDB *NetworkDB) GetEntry(tname, nid, key string) ([]byte, error)

GetEntry retrieves the value of a table entry in a given (network, table, key) tuple

func (*NetworkDB) GetTableByNetwork

func (nDB *NetworkDB) GetTableByNetwork(tname, nid string) map[string]*TableElem

GetTableByNetwork walks the networkdb by the give table and network id and returns a map of keys and values

func (*NetworkDB) Join

func (nDB *NetworkDB) Join(members []string) error

Join joins this NetworkDB instance with a list of peer NetworkDB instances passed by the caller in the form of addr:port

func (*NetworkDB) JoinNetwork

func (nDB *NetworkDB) JoinNetwork(nid string) error

JoinNetwork joins this node to a given network and propagates this event across the cluster. This triggers this node joining the sub-cluster of this network and participates in the network-scoped gossip and bulk sync for this network.

func (*NetworkDB) LeaveNetwork

func (nDB *NetworkDB) LeaveNetwork(nid string) error

LeaveNetwork leaves this node from a given network and propagates this event across the cluster. This triggers this node leaving the sub-cluster of this network and as a result will no longer participate in the network-scoped gossip and bulk sync for this network. Also remove all the table entries for this network from networkdb

func (*NetworkDB) Peers

func (nDB *NetworkDB) Peers(nid string) []PeerInfo

Peers returns the gossip peers for a given network.

func (*NetworkDB) RegisterDiagnosticHandlers

func (nDB *NetworkDB) RegisterDiagnosticHandlers(m Mux)

func (*NetworkDB) RemoveKey

func (nDB *NetworkDB) RemoveKey(key []byte)

RemoveKey removes a key from the key ring. The key being removed can't be the primary key

func (*NetworkDB) SetKey

func (nDB *NetworkDB) SetKey(key []byte)

SetKey adds a new key to the key ring

func (*NetworkDB) SetPrimaryKey

func (nDB *NetworkDB) SetPrimaryKey(key []byte)

SetPrimaryKey sets the given key as the primary key. This should have been added apriori through SetKey

func (*NetworkDB) UpdateEntry

func (nDB *NetworkDB) UpdateEntry(tname, nid, key string, value []byte) error

UpdateEntry updates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster. It is an error to update a non-existent entry.

func (*NetworkDB) WalkTable

func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error

WalkTable walks a single table in NetworkDB and invokes the passed function for each entry in the table passing the network, key, value. The walk stops if the passed function returns a true.

func (*NetworkDB) Watch

func (nDB *NetworkDB) Watch(tname, nid string) (*events.Channel, func())

Watch creates a watcher with filters for a particular table or network or any combination of the tuple. If any of the filter is an empty string it acts as a wildcard for that field. Watch returns a channel of events, where the events will be sent.

type NetworkEntry

type NetworkEntry struct {
	// ID of the network
	NetworkID string `protobuf:"bytes,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
	// Latest lamport time of the network attachment when this
	// network event was recorded.
	LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	// Source node name where this network attachment happened.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
	// Indicates if a leave from this network is in progress.
	Leaving bool `protobuf:"varint,4,opt,name=leaving,proto3" json:"leaving,omitempty"`
}

NetworkEntry for push pull of networks.

func (*NetworkEntry) Descriptor

func (*NetworkEntry) Descriptor() ([]byte, []int)

func (*NetworkEntry) GetLeaving

func (m *NetworkEntry) GetLeaving() bool

func (*NetworkEntry) GetNetworkID

func (m *NetworkEntry) GetNetworkID() string

func (*NetworkEntry) GetNodeName

func (m *NetworkEntry) GetNodeName() string

func (*NetworkEntry) GoString

func (this *NetworkEntry) GoString() string

func (*NetworkEntry) Marshal

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

func (*NetworkEntry) MarshalTo

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

func (*NetworkEntry) MarshalToSizedBuffer

func (m *NetworkEntry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NetworkEntry) ProtoMessage

func (*NetworkEntry) ProtoMessage()

func (*NetworkEntry) Reset

func (m *NetworkEntry) Reset()

func (*NetworkEntry) Size

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

func (*NetworkEntry) String

func (this *NetworkEntry) String() string

func (*NetworkEntry) Unmarshal

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

func (*NetworkEntry) XXX_DiscardUnknown

func (m *NetworkEntry) XXX_DiscardUnknown()

func (*NetworkEntry) XXX_Marshal

func (m *NetworkEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NetworkEntry) XXX_Merge

func (m *NetworkEntry) XXX_Merge(src proto.Message)

func (*NetworkEntry) XXX_Size

func (m *NetworkEntry) XXX_Size() int

func (*NetworkEntry) XXX_Unmarshal

func (m *NetworkEntry) XXX_Unmarshal(b []byte) error

type NetworkEvent

type NetworkEvent struct {
	Type NetworkEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.NetworkEvent_Type" json:"type,omitempty"`
	// Lamport time using a network lamport clock indicating the
	// time this event was generated on the node where it was
	// generated.
	LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	// Source node name.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
	// ID of the network for which the event is generated.
	NetworkID string `protobuf:"bytes,4,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
}

NetworkEvent message payload definition.

func (*NetworkEvent) Descriptor

func (*NetworkEvent) Descriptor() ([]byte, []int)

func (*NetworkEvent) GetNetworkID

func (m *NetworkEvent) GetNetworkID() string

func (*NetworkEvent) GetNodeName

func (m *NetworkEvent) GetNodeName() string

func (*NetworkEvent) GetType

func (m *NetworkEvent) GetType() NetworkEvent_Type

func (*NetworkEvent) GoString

func (this *NetworkEvent) GoString() string

func (*NetworkEvent) Marshal

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

func (*NetworkEvent) MarshalTo

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

func (*NetworkEvent) MarshalToSizedBuffer

func (m *NetworkEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NetworkEvent) ProtoMessage

func (*NetworkEvent) ProtoMessage()

func (*NetworkEvent) Reset

func (m *NetworkEvent) Reset()

func (*NetworkEvent) Size

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

func (*NetworkEvent) String

func (this *NetworkEvent) String() string

func (*NetworkEvent) Unmarshal

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

func (*NetworkEvent) XXX_DiscardUnknown

func (m *NetworkEvent) XXX_DiscardUnknown()

func (*NetworkEvent) XXX_Marshal

func (m *NetworkEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NetworkEvent) XXX_Merge

func (m *NetworkEvent) XXX_Merge(src proto.Message)

func (*NetworkEvent) XXX_Size

func (m *NetworkEvent) XXX_Size() int

func (*NetworkEvent) XXX_Unmarshal

func (m *NetworkEvent) XXX_Unmarshal(b []byte) error

type NetworkEvent_Type

type NetworkEvent_Type int32
const (
	NetworkEventTypeInvalid NetworkEvent_Type = 0
	// Join event is generated when this node joins a network.
	NetworkEventTypeJoin NetworkEvent_Type = 1
	// Leave event is generated when this node leaves a network.
	NetworkEventTypeLeave NetworkEvent_Type = 2
)

func (NetworkEvent_Type) EnumDescriptor

func (NetworkEvent_Type) EnumDescriptor() ([]byte, []int)

func (NetworkEvent_Type) String

func (x NetworkEvent_Type) String() string

type NetworkPushPull

type NetworkPushPull struct {
	// Lamport time when this push pull was initiated.
	LTime    github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,1,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	Networks []*NetworkEntry                            `protobuf:"bytes,2,rep,name=networks,proto3" json:"networks,omitempty"`
	// Name of the node sending this push pull payload.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
}

NetworkPushpull message payload definition.

func (*NetworkPushPull) Descriptor

func (*NetworkPushPull) Descriptor() ([]byte, []int)

func (*NetworkPushPull) GetNetworks

func (m *NetworkPushPull) GetNetworks() []*NetworkEntry

func (*NetworkPushPull) GetNodeName

func (m *NetworkPushPull) GetNodeName() string

func (*NetworkPushPull) GoString

func (this *NetworkPushPull) GoString() string

func (*NetworkPushPull) Marshal

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

func (*NetworkPushPull) MarshalTo

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

func (*NetworkPushPull) MarshalToSizedBuffer

func (m *NetworkPushPull) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NetworkPushPull) ProtoMessage

func (*NetworkPushPull) ProtoMessage()

func (*NetworkPushPull) Reset

func (m *NetworkPushPull) Reset()

func (*NetworkPushPull) Size

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

func (*NetworkPushPull) String

func (this *NetworkPushPull) String() string

func (*NetworkPushPull) Unmarshal

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

func (*NetworkPushPull) XXX_DiscardUnknown

func (m *NetworkPushPull) XXX_DiscardUnknown()

func (*NetworkPushPull) XXX_Marshal

func (m *NetworkPushPull) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NetworkPushPull) XXX_Merge

func (m *NetworkPushPull) XXX_Merge(src proto.Message)

func (*NetworkPushPull) XXX_Size

func (m *NetworkPushPull) XXX_Size() int

func (*NetworkPushPull) XXX_Unmarshal

func (m *NetworkPushPull) XXX_Unmarshal(b []byte) error

type NodeAddr

type NodeAddr struct {
	Addr net.IP
}

NodeAddr represents the value carried for node event in NodeTable

type NodeEvent

type NodeEvent struct {
	Type NodeEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.NodeEvent_Type" json:"type,omitempty"`
	// Lamport time using a network lamport clock indicating the
	// time this event was generated on the node where it was
	// generated.
	LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	// Source node name.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
}

NodeEvent message payload definition.

func (*NodeEvent) Descriptor

func (*NodeEvent) Descriptor() ([]byte, []int)

func (*NodeEvent) GetNodeName

func (m *NodeEvent) GetNodeName() string

func (*NodeEvent) GetType

func (m *NodeEvent) GetType() NodeEvent_Type

func (*NodeEvent) GoString

func (this *NodeEvent) GoString() string

func (*NodeEvent) Marshal

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

func (*NodeEvent) MarshalTo

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

func (*NodeEvent) MarshalToSizedBuffer

func (m *NodeEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NodeEvent) ProtoMessage

func (*NodeEvent) ProtoMessage()

func (*NodeEvent) Reset

func (m *NodeEvent) Reset()

func (*NodeEvent) Size

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

func (*NodeEvent) String

func (this *NodeEvent) String() string

func (*NodeEvent) Unmarshal

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

func (*NodeEvent) XXX_DiscardUnknown

func (m *NodeEvent) XXX_DiscardUnknown()

func (*NodeEvent) XXX_Marshal

func (m *NodeEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NodeEvent) XXX_Merge

func (m *NodeEvent) XXX_Merge(src proto.Message)

func (*NodeEvent) XXX_Size

func (m *NodeEvent) XXX_Size() int

func (*NodeEvent) XXX_Unmarshal

func (m *NodeEvent) XXX_Unmarshal(b []byte) error

type NodeEvent_Type

type NodeEvent_Type int32
const (
	NodeEventTypeInvalid NodeEvent_Type = 0
	// Join event is generated when this node joins the cluster.
	NodeEventTypeJoin NodeEvent_Type = 1
	// Leave event is generated when this node leaves the cluster.
	NodeEventTypeLeave NodeEvent_Type = 2
)

func (NodeEvent_Type) EnumDescriptor

func (NodeEvent_Type) EnumDescriptor() ([]byte, []int)

func (NodeEvent_Type) String

func (x NodeEvent_Type) String() string

type PeerClusterInfo

type PeerClusterInfo struct {
	PeerInfo
}

PeerClusterInfo represents the peer (gossip cluster) nodes

type PeerInfo

type PeerInfo struct {
	Name string
	IP   string
}

PeerInfo represents the peer (gossip cluster) nodes of a network

type TableElem

type TableElem struct {
	Value []byte
	// contains filtered or unexported fields
}

TableElem elem

type TableEvent

type TableEvent struct {
	Type TableEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.TableEvent_Type" json:"type,omitempty"`
	// Lamport time when this event was generated.
	LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"`
	// Node name where this event originated.
	NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"`
	// ID of the network to which this table entry belongs.
	NetworkID string `protobuf:"bytes,4,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"`
	// Name of the table to which this table entry belongs.
	TableName string `protobuf:"bytes,5,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"`
	// Entry key.
	Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
	// Entry value.
	Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
	// Residual reap time for the entry before getting deleted in seconds
	ResidualReapTime int32 `protobuf:"varint,8,opt,name=residual_reap_time,json=residualReapTime,proto3" json:"residual_reap_time,omitempty"`
}

TableEvent message payload definition.

func (*TableEvent) Descriptor

func (*TableEvent) Descriptor() ([]byte, []int)

func (*TableEvent) GetKey

func (m *TableEvent) GetKey() string

func (*TableEvent) GetNetworkID

func (m *TableEvent) GetNetworkID() string

func (*TableEvent) GetNodeName

func (m *TableEvent) GetNodeName() string

func (*TableEvent) GetResidualReapTime

func (m *TableEvent) GetResidualReapTime() int32

func (*TableEvent) GetTableName

func (m *TableEvent) GetTableName() string

func (*TableEvent) GetType

func (m *TableEvent) GetType() TableEvent_Type

func (*TableEvent) GetValue

func (m *TableEvent) GetValue() []byte

func (*TableEvent) GoString

func (this *TableEvent) GoString() string

func (*TableEvent) Marshal

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

func (*TableEvent) MarshalTo

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

func (*TableEvent) MarshalToSizedBuffer

func (m *TableEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TableEvent) ProtoMessage

func (*TableEvent) ProtoMessage()

func (*TableEvent) Reset

func (m *TableEvent) Reset()

func (*TableEvent) Size

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

func (*TableEvent) String

func (this *TableEvent) String() string

func (*TableEvent) Unmarshal

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

func (*TableEvent) XXX_DiscardUnknown

func (m *TableEvent) XXX_DiscardUnknown()

func (*TableEvent) XXX_Marshal

func (m *TableEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TableEvent) XXX_Merge

func (m *TableEvent) XXX_Merge(src proto.Message)

func (*TableEvent) XXX_Size

func (m *TableEvent) XXX_Size() int

func (*TableEvent) XXX_Unmarshal

func (m *TableEvent) XXX_Unmarshal(b []byte) error

type TableEvent_Type

type TableEvent_Type int32
const (
	TableEventTypeInvalid TableEvent_Type = 0
	// Create signifies that this table entry was just
	// created.
	TableEventTypeCreate TableEvent_Type = 1
	// Update signifies that this table entry was just
	// updated.
	TableEventTypeUpdate TableEvent_Type = 2
	// Delete signifies that this table entry was just
	// updated.
	TableEventTypeDelete TableEvent_Type = 3
)

func (TableEvent_Type) EnumDescriptor

func (TableEvent_Type) EnumDescriptor() ([]byte, []int)

func (TableEvent_Type) String

func (x TableEvent_Type) String() string

type UpdateEvent

type UpdateEvent event

UpdateEvent generates a table entry update event to the watchers

Jump to

Keyboard shortcuts

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