structs

package
v0.0.0-...-9613083 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RegisterNodeRequestType        MessageType = 0
	DeregisterNodeRequestType                  = 1
	RegisterTopicRequestType                   = 2
	DeregisterTopicRequestType                 = 3
	RegisterPartitionRequestType               = 4
	DeregisterPartitionRequestType             = 5
	RegisterGroupRequestType                   = 6
)
View Source
const (
	SerfCheckID           CheckID = "serf health"
	SerfCheckName                 = "Serf health status"
	SerfCheckAliveOutput          = "Node alive and reachable"
	SerfCheckFailedOutput         = "Node not live or unreachable"
)
View Source
const (
	// HealthAny is special, and is used as a wild card,
	// not as a specific state.
	HealthAny      = "any"
	HealthPassing  = "passing"
	HealthWarning  = "warning"
	HealthCritical = "critical"
	HealthMaint    = "maintenance"
)

Variables

This section is empty.

Functions

func Decode

func Decode(buf []byte, out interface{}) error

Decode is used to encode a MsgPack object with type prefix.

func Encode

func Encode(t MessageType, msg interface{}) ([]byte, error)

Encode is used to encode a MsgPack object with type prefix

Types

type CheckID

type CheckID string

type ConfigEntry

type ConfigEntry struct {
	Default     interface{}
	Name        string
	ValidValues []interface{}
	Value       interface{}
}

type DeregisterNodeRequest

type DeregisterNodeRequest struct {
	Node Node
}

type DeregisterPartitionRequest

type DeregisterPartitionRequest struct {
	Partition Partition
}

type DeregisterTopicRequest

type DeregisterTopicRequest struct {
	Topic Topic
}

type Group

type Group struct {
	ID           string
	Group        string
	Coordinator  int32
	LeaderID     string
	Members      map[string]Member
	State        GroupState
	GenerationID int32

	RaftIndex
}

Group

type GroupState

type GroupState int32
const (
	GroupStatePreparingRebalance  GroupState = 0
	GroupStateCompletingRebalance GroupState = 1
	GroupStateStable              GroupState = 2
	GroupStateDead                GroupState = 3
	GroupStateEmpty               GroupState = 4
)

type HealthCheck

type HealthCheck struct {
	Node    string
	CheckID CheckID // unique check id
	Name    string  // check name
	Status  string  // current check stauts
	Output  string  // output of script runs
	RaftIndex
}

HealthCheck represents a single check on a given node

type Member

type Member struct {
	ID         string
	Metadata   []byte
	Assignment []byte
}

Member

type MessageType

type MessageType uint8

type Node

type Node struct {
	ID      int32
	Node    int32
	Address string
	Check   *HealthCheck
	Meta    map[string]string
	RaftIndex
}

Node is used to return info about a node

type NodeService

type NodeService struct {
	ID      string
	Service string
	Tags    []string
	Address string
	Port    int
	RaftIndex
}

NodeService is a service provided by a node

type Partition

type Partition struct {
	// ID identifies the partition. Is here cause memdb wants the indexed field separate.
	ID        int32
	Partition int32
	// Topic is the topic this partition belongs to.
	Topic string
	// ISR is a slice of replica IDs in ISR
	ISR []int32
	// All assigned replicas
	AR []int32
	// Leader is the ID of the leader replica
	Leader int32
	// ControllerEpoch is the epoch of the controller that last updated
	// the leader and ISR info. TODO: this will probably have to change to fit better.
	ControllerEpoch int32
	LeaderEpoch     int32

	RaftIndex
}

Partition

type RaftIndex

type RaftIndex struct {
	CreateIndex uint64
	ModifyIndex uint64
}

type RegisterGroupRequest

type RegisterGroupRequest struct {
	Group Group
}

type RegisterNodeRequest

type RegisterNodeRequest struct {
	Node Node
}

type RegisterPartitionRequest

type RegisterPartitionRequest struct {
	Partition Partition
}

type RegisterTopicRequest

type RegisterTopicRequest struct {
	Topic Topic
}

type Topic

type Topic struct {
	// ID is ID or name of the topic
	ID string
	// Topic is the name of the topic
	Topic string
	// Partitions is a map of partition IDs to slice of replicas IDs.
	Partitions map[int32][]int32
	// Config
	Config TopicConfig
	// Internal, e.g. group metadata topic
	Internal bool

	RaftIndex
}

Topic

type TopicConfig

type TopicConfig map[string]TopicConfigEntry

func NewTopicConfig

func NewTopicConfig() TopicConfig

func (TopicConfig) Get

func (c TopicConfig) Get(name string) TopicConfigEntry

func (TopicConfig) GetValue

func (c TopicConfig) GetValue(name string) interface{}

func (TopicConfig) Set

func (c TopicConfig) Set(e TopicConfigEntry)

func (TopicConfig) SetValue

func (c TopicConfig) SetValue(name string, value interface{}) TopicConfig

type TopicConfigEntry

type TopicConfigEntry struct {
	ConfigEntry
	ServerDefault string
}

Jump to

Keyboard shortcuts

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