p2p

package
v0.0.0-...-fb108f3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppManager

type AppManager interface {
	GetLogs(name string) ([]byte, error)
	GetStatus(name string) (string, error)
}

type Client

type Client struct {
	p2pproto.PingerClient
	p2pproto.TesterClient
	p2pproto.AppsClient
	p2pproto.InstanceClient
	// contains filtered or unexported fields
}

Client is a remote p2p client

type ExternalDB

type ExternalDB interface {
	AddPeer(peerID string, conn *grpc.ClientConn) error
	RemovePeer(peerID string) error
	GetAllCommits() ([]doltswarm.Commit, error)
	ExecAndCommit(query string, commitMsg string) (string, error)
	GetLastCommit(branch string) (doltswarm.Commit, error)
}

type Machine

type Machine interface {
	GetPublicKey() string
	GetPublicIP() string
	GetName() string
}

type MetaConfigurator

type MetaConfigurator interface {
	SetNetwork(network net.IPNet) net.IP
	SetInstanceName(name string)
}

MetaConfigurator allows for the configuration of the meta package

type P2P

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

func NewManager

func NewManager(key *pcrypto.Key, appManager AppManager, initMode bool, externalDB ExternalDB) (*P2P, error)

NewManager creates and returns a new p2p manager

func (*P2P) AddPeer

func (p2p *P2P) AddPeer(machine Machine) (*Client, error)

AddPeer adds a peer to the p2p manager

func (*P2P) ConfigurePeers

func (p2p *P2P) ConfigurePeers(machines []Machine) error

ConfigurePeers configures all the peers passed as arguemnt

func (*P2P) GetClient

func (p2p *P2P) GetClient(name string) (*Client, error)

func (*P2P) GetGRPCServer

func (p2p *P2P) GetGRPCServer() *grpc.Server

func (*P2P) PubKeyToPeerID

func (p2p *P2P) PubKeyToPeerID(pubKey []byte) (string, error)

GetPeerID adds a peer to the p2p manager

func (*P2P) StartServer

func (p2p *P2P) StartServer(metaConfigurator MetaConfigurator) (func() error, error)

StartServer starts listening for p2p connections

type Server

type Server struct {
	DB ExternalDB
	// contains filtered or unexported fields
}

func (*Server) ExecSQL

func (*Server) GetAppLogs

func (*Server) GetAppStatus

func (*Server) GetHead

func (*Server) GetLogs

HandlerGetInstanceLogs retrieves logs for the local instance

func (*Server) GetPeers

HandlerGetInstancePeers retrieves the peers for the local instance

func (*Server) Init

func (s *Server) Init(ctx context.Context, req *proto.InitRequest) (*proto.InitResponse, error)

HandlerInit does the initialisation on the server side

func (*Server) Ping

func (s *Server) Ping(ctx context.Context, req *proto.PingRequest) (*proto.PingResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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