remote

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(host p2p.Node) *actor.PID

NewRouter instantiates a new router given a certain host node.

func Start

func Start()

Start starts the remote management.

func Stop

func Stop()

Stop stops the remote management.

Types

type NetworkPubSub

type NetworkPubSub struct {
	// contains filtered or unexported fields
}

NetworkPubSub implements the broadcast interface necessary for the client

func NewNetworkPubSub

func NewNetworkPubSub(pubsub *pubsub.PubSub) *NetworkPubSub

NewNetworkPubSub returns a NetworkBroadcaster that can be used to send messages.WireMessage across the p2p network using pubsub.

func NewWrappedPubsub

func NewWrappedPubsub(pubsub UnderlyingPubSub) *NetworkPubSub

NewWrappedPubsub takes any pubsub that conforms to the `underlyingPubSub` interface and returns a wrapped NetworkPubSub

func (*NetworkPubSub) Broadcast

func (nps *NetworkPubSub) Broadcast(topic string, message proto.Message) error

Broadcast sends the message over the wire to any receivers

func (*NetworkPubSub) NewSubscriberProps

func (nps *NetworkPubSub) NewSubscriberProps(topic string) *actor.Props

func (*NetworkPubSub) RegisterTopicValidator

func (nps *NetworkPubSub) RegisterTopicValidator(topic string, validatorFunc PubSubValidator, opts ...pubsub.ValidatorOpt) error

func (*NetworkPubSub) Subscribe

func (nps *NetworkPubSub) Subscribe(ctx spawner, topic string, subscribers ...*actor.PID) *actor.PID

func (*NetworkPubSub) UnregisterTopicValidator

func (nps *NetworkPubSub) UnregisterTopicValidator(topic string)

type PubSub

type PubSub interface {
	Broadcast(topic string, msg proto.Message) error
	NewSubscriberProps(topic string) *actor.Props
	RegisterTopicValidator(topic string, validatorFunc PubSubValidator, opts ...pubsub.ValidatorOpt) error
	UnregisterTopicValidator(topic string)
	Subscribe(ctx spawner, topic string, subscribers ...*actor.PID) *actor.PID
}

type PubSubValidator

type PubSubValidator func(context.Context, peer.ID, proto.Message) bool

type SimulatedPubSub

type SimulatedPubSub struct {
	// contains filtered or unexported fields
}

SimulatedBroadcaster is a simulated in-memory pubsub that doesn't need a network connection

func NewSimulatedPubSub

func NewSimulatedPubSub() *SimulatedPubSub

func (*SimulatedPubSub) Broadcast

func (sb *SimulatedPubSub) Broadcast(topic string, message proto.Message) error

Implements the broadcast necessary for the client side to send to the network

func (*SimulatedPubSub) NewSubscriberProps

func (sb *SimulatedPubSub) NewSubscriberProps(topic string) *actor.Props

returns subscriber props that can be used to listent to broadcast events

func (*SimulatedPubSub) RegisterTopicValidator

func (sb *SimulatedPubSub) RegisterTopicValidator(topic string, validatorFunc PubSubValidator, opts ...pubsub.ValidatorOpt) error

func (*SimulatedPubSub) Subscribe

func (sb *SimulatedPubSub) Subscribe(ctx spawner, topic string, subscribers ...*actor.PID) *actor.PID

func (*SimulatedPubSub) UnregisterTopicValidator

func (sb *SimulatedPubSub) UnregisterTopicValidator(topic string)

type UnderlyingPubSub

type UnderlyingPubSub interface {
	Publish(topic string, data []byte) error
	RegisterTopicValidator(topic string, fn pubsub.Validator, opts ...pubsub.ValidatorOpt) error
	UnregisterTopicValidator(topic string) error
	Subscribe(topic string, opts ...pubsub.SubOpt) (UnderlyingSubscription, error)
}

type UnderlyingSubscription

type UnderlyingSubscription interface {
	Next(context.Context) (*pubsub.Message, error)
	Cancel()
}

Jump to

Keyboard shortcuts

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