hub

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PullChildren

func PullChildren(ctx context.Context, conn *grpc.ClientConn, dialOpts ...grpc.DialOption) <-chan Change[Child]

PullChildren returns a channel of changes to the children of all nodes enrolled in the hub conn. The conn argument should be a connection to the hub. For each node a new connection (via grpc.Dial) will be made using the nodes address and the given dialOpts. Children sent via the returned channel will have their Conn field set to the new connection which can be used so long as that child is still a member of the hub cohort.

func PullNodes

func PullNodes(ctx context.Context, conn *grpc.ClientConn) <-chan Change[Node]

PullNodes returns a channel of changes to the nodes in the hub. Node.Conn is nil, you should connect using information in Node.HubNode if desired.

Types

type Change

type Change[T any] struct {
	Old *T
	New *T
	Err error
}

type Child

type Child struct {
	*Node
	*traits.Child
}

type Node

type Node struct {
	Conn *grpc.ClientConn
	*gen.HubNode
}

type NodeFetcher

type NodeFetcher struct {
	gen.HubApiClient
	// contains filtered or unexported fields
}

func (*NodeFetcher) Poll

func (c *NodeFetcher) Poll(ctx context.Context, changes chan<- *gen.PullHubNodesResponse_Change) error

func (*NodeFetcher) Pull

func (c *NodeFetcher) Pull(ctx context.Context, changes chan<- *gen.PullHubNodesResponse_Change) error

Jump to

Keyboard shortcuts

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