server

package
v0.0.1-beta.30 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Overview

package server exports the Wetware worker node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	Bootstrap(context.Context) error
	View() cluster.View
	String() string
	Close() error
}

Cluster is a local model of the global Wetware cluster. It models the cluster as a PA/EL system and makes no consistency guarantees.

https://en.wikipedia.org/wiki/PACELC_theorem

type ClusterConfig

type ClusterConfig struct {
	fx.In

	TTL          time.Duration        `optional:"true"`
	Meta         pulse.Preparer       `optional:"true"`
	RoutingTable cluster.RoutingTable `optional:"true"`
}

func (ClusterConfig) New

func (rc ClusterConfig) New(vat casm.Vat, r Router) (Cluster, error)

type DebugConfig

type DebugConfig struct {
	fx.In

	System   debug.SystemContext        `optional:"true" name:"debug-info"`
	Environ  func() []string            `optional:"true" name:"debug-environ"`
	Profiles map[debug.Profile]struct{} `optional:"true" name:"debug-profiles"`
}

func (DebugConfig) New

func (dc DebugConfig) New() *debug.Server

type Joiner

type Joiner struct {
	fx.In

	Cluster  ClusterConfig `optional:"true"`
	Debugger DebugConfig   `optional:"true"`
}

Joiner is a factory type that builds a Node from configuration, and joins the cluster. Joiners SHOULD NOT be reused, and should be promptly discarded after a call to Join.

func (Joiner) Join

func (j Joiner) Join(vat casm.Vat, r Router) (*Node, error)

Join the cluster. Note that callers MUST call Bootstrap() on the returned *Node to complete the bootstrap process.

type Node

type Node struct {
	Vat casm.Vat
	Cluster
}

Node is a peer in the Wetware cluster. Manually populating Node's fields is NOT RECOMMENDED. Use Joiner instead.

func (Node) Loggable

func (n Node) Loggable() map[string]any

type Router

type Router interface {
	Join(string, ...ps.TopicOpt) (*ps.Topic, error)
	RegisterTopicValidator(topic string, val interface{}, opts ...ps.ValidatorOpt) error
	UnregisterTopicValidator(topic string) error
}

Router provides an interface for routing messages by topic, and supports per-message validation. It is used by the Joiner to create the cluster topic through which heartbeat messages are routed.

Jump to

Keyboard shortcuts

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