peers

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerCreated string = "peer_created"
	PeerUpdated string = "peer_updated"
	PeerDeleted string = "peer_deleted"
)

Variables

View Source
var (
	ErrPeerNotFound = errors.New("peer not found")
)

Functions

func MockedMesh

func MockedMesh() *mockedMesh

func NewPeerStore

func NewPeerStore(mesh types.GossipServiceLayer) (*memDBStore, error)

Types

type Channel

type Channel interface {
	Broadcast(b []byte)
}

type Peer

type Peer struct {
	pb.Metadata
}

type PeerStore

type PeerStore interface {
	ByID(id string) (Peer, error)
	ByService(name string) (SubscriptionSet, error)
	EndpointsByService(name string) ([]*pb.NodeService, error)
	All() (SubscriptionSet, error)
	Exists(id string) bool
	Upsert(p Peer) error
	Update(id string, mutation func(peer Peer) Peer) error
	Delete(id string) error
	On(event string, handler func(Peer)) func()
}

type SubscriptionSet

type SubscriptionSet []Peer

func (SubscriptionSet) Apply

func (set SubscriptionSet) Apply(f func(s Peer))

func (SubscriptionSet) ApplyE

func (set SubscriptionSet) ApplyE(f func(s Peer) error) error

func (SubscriptionSet) ApplyIdx

func (set SubscriptionSet) ApplyIdx(f func(idx int, s Peer))

func (SubscriptionSet) Filter

func (set SubscriptionSet) Filter(filters ...peerFilter) SubscriptionSet

Jump to

Keyboard shortcuts

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