discovery

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	// ID returns the discovery name
	ID() string
	// Start the discovery engine
	Start(ctx context.Context, meta Meta) error
	// Nodes returns the list of up and running Nodes at a given time
	Nodes(ctx context.Context) ([]*Node, error)
	// Watch returns event based upon node lifecycle
	Watch(ctx context.Context) (<-chan Event, error)
	// EarliestNode returns the earliest node. This is based upon the node timestamp
	EarliestNode(ctx context.Context) (*Node, error)
	// Stop shutdown the discovery provider
	Stop() error
}

Discovery helps discover other running actor system in a cloud environment

type Event

type Event interface {
	IsEvent()
}

Event contract

type Meta

type Meta map[string]any

Meta represents the meta information to pass to the discovery engine

func (Meta) GetBool

func (m Meta) GetBool(key string) (*bool, error)

GetBool returns the int value of a given key which value is a boolean If the key value is not a boolean then an error is return

func (Meta) GetInt

func (m Meta) GetInt(key string) (int, error)

GetInt returns the int value of a given key which value is an integer If the key value is not an integer then an error is return

func (Meta) GetMapString

func (m Meta) GetMapString(key string) (map[string]string, error)

GetMapString returns the map of string value of a given key which value is a map of string Map of string means that the map key value pair are both string

func (Meta) GetString

func (m Meta) GetString(key string) (string, error)

GetString returns the string value of a given key which value is a string If the key value is not a string then an error is return

type Node

type Node struct {
	// Name specifies the discovered node's Name
	Name string
	// Host specifies the discovered node's Host
	Host string
	// Specifies the start time
	StartTime int64
	// Ports specifies the list of Ports
	Ports map[string]int32
	// IsRunning specifies whether the node is up and running
	IsRunning bool
}

Node represents a discovered node

type NodeAdded

type NodeAdded struct {
	// Node specifies the added node
	Node *Node
}

NodeAdded discovery lifecycle event

func (NodeAdded) IsEvent

func (e NodeAdded) IsEvent()

type NodeModified

type NodeModified struct {
	// Node specifies the modified node
	Node *Node
	// Current specifies the existing nde
	Current *Node
}

NodeModified discovery lifecycle event

func (NodeModified) IsEvent

func (e NodeModified) IsEvent()

type NodeRemoved

type NodeRemoved struct {
	// Node specifies the removed node
	Node *Node
}

NodeRemoved discovery lifecycle event

func (NodeRemoved) IsEvent

func (e NodeRemoved) IsEvent()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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