autopilotevents

package
v1.14.8 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTopicReadyServers stream.StringTopic = "ready-servers"
)

Variables

This section is empty.

Functions

func IsServerReady added in v1.14.0

func IsServerReady(srv *autopilot.ServerState) bool

IsServerReady determines whether the given server (from the autopilot state) is "ready" - by which we mean that they would be an acceptable target for stale queries.

Types

type Config

type Config struct {
	GetStore  func() StateStore
	Publisher Publisher
	// contains filtered or unexported fields
}

type EventPayloadReadyServers

type EventPayloadReadyServers []ReadyServerInfo

EventPayloadReadyServers

func ExtractEventPayload

func ExtractEventPayload(event stream.Event) (EventPayloadReadyServers, error)

func (EventPayloadReadyServers) HasReadPermission

func (e EventPayloadReadyServers) HasReadPermission(authz acl.Authorizer) bool

func (EventPayloadReadyServers) Subject

func (EventPayloadReadyServers) ToSubscriptionEvent

func (e EventPayloadReadyServers) ToSubscriptionEvent(idx uint64) *pbsubscribe.Event

type Publisher

type Publisher interface {
	Publish([]stream.Event)
}

type ReadyServerInfo

type ReadyServerInfo struct {
	ID              string
	Address         string
	TaggedAddresses map[string]string
	ExtGRPCPort     int
	Version         string
}

ReadyServerInfo includes information about a server that is ready to handle incoming requests.

func (*ReadyServerInfo) Equal

func (info *ReadyServerInfo) Equal(other *ReadyServerInfo) bool

type ReadyServersEventPublisher

type ReadyServersEventPublisher struct {
	Config
	// contains filtered or unexported fields
}

ReadyServersEventPublisher is capable to tracking changes to ready servers between consecutive calls to PublishReadyServersEvents. It will then publish "ready-servers" events as necessary.

func NewReadyServersEventPublisher

func NewReadyServersEventPublisher(config Config) *ReadyServersEventPublisher

func (*ReadyServersEventPublisher) HandleSnapshot

HandleSnapshot is the EventPublisher callback to generate a snapshot for the "ready-servers" event streams.

func (*ReadyServersEventPublisher) PublishReadyServersEvents

func (r *ReadyServersEventPublisher) PublishReadyServersEvents(state *autopilot.State)

PublishReadyServersEvents will publish a "ready-servers" event if the list of ready servers has changed since the last time events were published.

type StateStore

type StateStore interface {
	GetNodeID(types.NodeID, *acl.EnterpriseMeta, string) (uint64, *structs.Node, error)
	NodeService(ws memdb.WatchSet, nodeName string, serviceID string, entMeta *acl.EnterpriseMeta, peerName string) (uint64, *structs.NodeService, error)
}

Jump to

Keyboard shortcuts

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