engine

package
v0.22.9-patch-1-epoch-... Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenAddr string
	MaxMsgSize int // In bytes
}

Config defines the configurable options for the gRPC server.

type Handler

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

Handler handles the GRPC calls from a client

func NewHandler

func NewHandler(log zerolog.Logger, conduitMap map[network.Channel]network.Conduit, msgChan chan ghost.FlowMessage, codec network.Codec) *Handler

func (Handler) SendEvent

func (h Handler) SendEvent(_ context.Context, req *ghost.SendEventRequest) (*empty.Empty, error)

func (Handler) Subscribe

Subscribe streams ALL the libp2p network messages over GRPC

type RPC

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

RPC implements a gRPC server for the Ghost node

func New

func New(net module.Network, log zerolog.Logger, me module.Local, state protocol.State, config Config) (*RPC, error)

New returns a new RPC engine.

func (*RPC) Done

func (e *RPC) Done() <-chan struct{}

Done returns a done channel that is closed once the engine has fully stopped. It sends a signal to stop the gRPC server, then closes the channel.

func (*RPC) Process

func (e *RPC) Process(channel network.Channel, originID flow.Identifier, event interface{}) error

Process processes the given event from the node with the given origin ID in a blocking manner. It returns the potential processing error when done.

func (*RPC) ProcessLocal

func (e *RPC) ProcessLocal(event interface{}) error

ProcessLocal processes an event originating on the local node.

func (*RPC) Ready

func (e *RPC) Ready() <-chan struct{}

Ready returns a ready channel that is closed once the engine has fully started. The RPC engine is ready when the gRPC server has successfully started.

func (*RPC) Submit

func (e *RPC) Submit(channel network.Channel, originID flow.Identifier, event interface{})

Submit submits the given event from the node with the given origin ID for processing in a non-blocking manner. It returns instantly and logs a potential processing error internally when done.

func (*RPC) SubmitLocal

func (e *RPC) SubmitLocal(event interface{})

SubmitLocal submits an event originating on the local node.

Jump to

Keyboard shortcuts

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