p2p

package
v0.0.0-...-23a443e Latest Latest
Warning

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

Go to latest
Published: Sep 17, 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.PeerDBClient
	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(execFunc doltswarm.ExecFunc, commitMsg string) (string, error)
	GetLastCommit(branch string) (doltswarm.Commit, error)
	InitFromPeer(peerID string) error
	EnableGRPCServers(server *grpc.Server) error
	Initialized() bool
}

type Machine

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

type P2P

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

func NewManager

func NewManager(key *pcrypto.Key, appManager AppManager, externalDB ExternalDB, p2pPort int) (*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(id string) (*Client, error)

func (*P2P) RemovePeer

func (p2p *P2P) RemovePeer(machine Machine) error

func (*P2P) StartServer

func (p2p *P2P) StartServer() (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