network

package
v0.0.0-...-c84c9ce Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPC

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

GRPC represents a struct for GRPC server

func NewGRPC

func NewGRPC(ctx context.Context, config *config.GrpcConfig) *GRPC

NewGRPC creates a new grpc server struct

func (*GRPC) Start

func (g *GRPC) Start()

Start starts a GRPC server

type Network

type Network interface {
	Start()
}

type NetworkMediator

type NetworkMediator interface {
	MessageHandler(message string, source Source)
}

type NetworkModule

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

func NewNetwork

func NewNetwork(ctx context.Context, execution execution.Execution, storage storage.Storage, config *config.NetworkConfig, grpcCfg *config.GrpcConfig) *NetworkModule

func (*NetworkModule) MessageHandler

func (network *NetworkModule) MessageHandler(message string, source Source)

func (*NetworkModule) Start

func (network *NetworkModule) Start()

type P2P

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

func NewP2P

func NewP2P(ctx context.Context, mediator NetworkMediator, namespace string, maxPeers int, port int) *P2P

func (*P2P) JoinNetwork

func (p2p *P2P) JoinNetwork()

func (*P2P) Publish

func (p2p *P2P) Publish(message string)

func (*P2P) SubscribeTopics

func (p2p *P2P) SubscribeTopics(topics []string)

type RPC

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

func NewRPC

func NewRPC(ctx context.Context, mediator NetworkMediator) *RPC

func (*RPC) Start

func (rpc *RPC) Start()

type Source

type Source int
const (
	SourceP2P Source = iota
	SourceRPC
)

Jump to

Keyboard shortcuts

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