orchestrator

package
v0.5.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrIncompleteGraph is returned when a requested graph is incomplete
	ErrIncompleteGraph = errors.Error("incomplete graph")
)

Variables

This section is empty.

Functions

func IsComplete

func IsComplete(cs []object.Object) bool

IsComplete checks if a graph is missing any nodes

Types

type Graph

type Graph struct {
	Objects []object.Object
}

type Orchestrator

type Orchestrator interface {
	Subscriber
	Sync(
		ctx context.Context,
		selector []string,
		addresses []string,
	) (
		*Graph,
		error,
	)
	Put(...object.Object) error
	Get(
		ctx context.Context,
		rootHash string,
	) (
		*Graph,
		error,
	)
}

Orchestrator is responsible of keeping streams and their underlying graphs up to date

func New

func New(
	store graph.Store,
	exchange exchange.Exchange,
	discovery discovery.Discoverer,
	localInfo *peer.LocalPeer,

) (
	Orchestrator,
	error,
)

New constructs a new orchestrator given an object store and exchange

func NewWithContext

func NewWithContext(
	ctx context.Context,
	store graph.Store,
	exchange exchange.Exchange,
	discovery discovery.Discoverer,
	localInfo *peer.LocalPeer,

) (
	Orchestrator,
	error,
)

NewWithContext constructs a new orchestrator given an object store and exchange

type PubSub

type PubSub interface {
	Publisher
	Subscriber
}

PubSub -

func NewPubSub

func NewPubSub() PubSub

NewPubSub constructs and returns a new PubSub

type Publisher

type Publisher interface {
	Publish(string)
}

Publisher deals with the publishing part of our PubSub

type Queue

type Queue interface {
	Enqueue(key string, work WorkFunc) error
}

Queue -

func NewQueue

func NewQueue(ctx context.Context, workers int) Queue

NewQueue constructs a new queue

type Subscriber

type Subscriber interface {
	Subscribe(chan string, ...filter)
	Unsubscribe(chan string)
}

Subscriber deals with the subscribing part of our PubSub

type WorkFunc

type WorkFunc func() error

WorkFunc defines work that must be completed

Jump to

Keyboard shortcuts

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