server

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 31 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PolarisPingTTL = common.PolarisConnectionTTL >> 1

	// polaris will return peers list at most this number
	ResponseMaxPeerLimit = 500
	// libp2p internal library is not always send message instantly, so closing socket soon after sent a message will cause packet loss and read error, us walkaround here till finding the real reason and fix it.
	MsgSendDelay = time.Second * 1

	PeerHealthcheckInterval = time.Minute
	//PeerHealthcheckInterval = time.Minute * 5
	ConcurrentHealthCheckCount = 20
)

internal

Variables

View Source
var (
	EmptyMsgID = p2pcommon.MsgID(uuid.Nil)
)
View Source
var NotSupportError = fmt.Errorf("not supported cmd")

Functions

func NewHCM

func NewHCM(mapService *PeerMapService, nt p2pcommon.NetworkTransport) *healthCheckManager

Types

type HealthCheckManager

type HealthCheckManager interface {
	Start()
	Stop()
}

type LiteContainerService

type LiteContainerService struct {
	*component.BaseComponent
	// contains filtered or unexported fields
}

P2P is actor component for p2p

func NewNTContainer

func NewNTContainer(cfg *config.Config) *LiteContainerService

NewP2P create a new ActorService for p2p

func (*LiteContainerService) AfterStart

func (lntc *LiteContainerService) AfterStart()

func (*LiteContainerService) BeforeStart

func (lntc *LiteContainerService) BeforeStart()

BeforeStart starts p2p service.

func (*LiteContainerService) BeforeStop

func (lntc *LiteContainerService) BeforeStop()

BeforeStop is called before actor hub stops. it finishes underlying peer manager

func (*LiteContainerService) CallRequest

func (lntc *LiteContainerService) CallRequest(actor string, msg interface{}, timeout time.Duration) (interface{}, error)

CallRequest implement interface method of ActorService

func (*LiteContainerService) CallRequestDefaultTimeout

func (lntc *LiteContainerService) CallRequestDefaultTimeout(actor string, msg interface{}) (interface{}, error)

CallRequest implement interface method of ActorService

func (*LiteContainerService) ChainID

func (lntc *LiteContainerService) ChainID() *types.ChainID

func (*LiteContainerService) FutureRequest

func (lntc *LiteContainerService) FutureRequest(actor string, msg interface{}, timeout time.Duration) *actor.Future

FutureRequest implement interface method of ActorService

func (*LiteContainerService) FutureRequestDefaultTimeout

func (lntc *LiteContainerService) FutureRequestDefaultTimeout(actor string, msg interface{}) *actor.Future

FutureRequestDefaultTimeout implement interface method of ActorService

func (*LiteContainerService) GetNetworkTransport

func (lntc *LiteContainerService) GetNetworkTransport() p2pcommon.NetworkTransport

func (*LiteContainerService) Receive

func (lntc *LiteContainerService) Receive(context actor.Context)

Receive got actor message and then handle it.

func (*LiteContainerService) SendRequest

func (lntc *LiteContainerService) SendRequest(actor string, msg interface{})

SendRequest implement interface method of ActorService

func (*LiteContainerService) SetHub

func (lntc *LiteContainerService) SetHub(hub *component.ComponentHub)

func (*LiteContainerService) Statistics

func (lntc *LiteContainerService) Statistics() *map[string]interface{}

Statistics show statistic information of p2p module. NOTE: It it not implemented yet

func (*LiteContainerService) TellRequest

func (lntc *LiteContainerService) TellRequest(actor string, msg interface{})

TellRequest implement interface method of ActorService

type PRPCServer

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

func (*PRPCServer) BlackList

func (rs *PRPCServer) BlackList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)

func (*PRPCServer) CurrentList

func (rs *PRPCServer) CurrentList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)

func (*PRPCServer) Metric

func (rs *PRPCServer) Metric(ctx context.Context, in *types.MetricsRequest) (*types.Metrics, error)

func (*PRPCServer) NodeState

func (rs *PRPCServer) NodeState(ctx context.Context, in *types.NodeReq) (*types.SingleBytes, error)

func (*PRPCServer) WhiteList

func (rs *PRPCServer) WhiteList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)

type PeerHealth

type PeerHealth int
const (
	PeerHealth_GOOD PeerHealth = 0
	PeerHealth_MID  PeerHealth = 1
	PeerHealth_BAD  PeerHealth = 2
)

PeersState

type PeerMapService

type PeerMapService struct {
	*component.BaseComponent

	PrivateNet bool
	// contains filtered or unexported fields
}

PeerMapService is

func NewPolarisService

func NewPolarisService(cfg *config.Config, ntc p2pcommon.NTContainer) *PeerMapService

func (*PeerMapService) AfterStart

func (pms *PeerMapService) AfterStart()

func (*PeerMapService) BeforeStart

func (pms *PeerMapService) BeforeStart()

func (*PeerMapService) BeforeStop

func (pms *PeerMapService) BeforeStop()

func (*PeerMapService) Receive

func (pms *PeerMapService) Receive(context actor.Context)

func (*PeerMapService) SendGoAwayMsg

func (pms *PeerMapService) SendGoAwayMsg(message string, wt p2pcommon.MsgWriter) error

send notice message and then disconnect. this routine should only run in RunPeer go routine

func (*PeerMapService) SetHub

func (pms *PeerMapService) SetHub(hub *component.ComponentHub)

func (*PeerMapService) Statistics

func (pms *PeerMapService) Statistics() *map[string]interface{}

type PolarisRPC

type PolarisRPC struct {
	*component.BaseComponent
	// contains filtered or unexported fields
}

func NewPolarisRPC

func NewPolarisRPC(cfg *config.Config) *PolarisRPC

func (*PolarisRPC) AfterStart

func (rpc *PolarisRPC) AfterStart()

func (*PolarisRPC) BeforeStart

func (rpc *PolarisRPC) BeforeStart()

Start start rpc service.

func (*PolarisRPC) BeforeStop

func (rpc *PolarisRPC) BeforeStop()

Stop stops rpc service.

func (*PolarisRPC) CallRequest

func (rpc *PolarisRPC) CallRequest(actor string, msg interface{}, timeout time.Duration) (interface{}, error)

CallRequest implement interface method of ActorService

func (*PolarisRPC) CallRequestDefaultTimeout

func (rpc *PolarisRPC) CallRequestDefaultTimeout(actor string, msg interface{}) (interface{}, error)

CallRequest implement interface method of ActorService

func (*PolarisRPC) FutureRequest

func (rpc *PolarisRPC) FutureRequest(actor string, msg interface{}, timeout time.Duration) *actor.Future

FutureRequest implement interface method of ActorService

func (*PolarisRPC) FutureRequestDefaultTimeout

func (rpc *PolarisRPC) FutureRequestDefaultTimeout(actor string, msg interface{}) *actor.Future

FutureRequestDefaultTimeout implement interface method of ActorService

func (*PolarisRPC) GetChainAccessor

func (rpc *PolarisRPC) GetChainAccessor() types.ChainAccessor

func (*PolarisRPC) Receive

func (rpc *PolarisRPC) Receive(context actor.Context)

func (*PolarisRPC) SendRequest

func (rpc *PolarisRPC) SendRequest(actor string, msg interface{})

SendRequest implement interface method of ActorService

func (*PolarisRPC) SetHub

func (rpc *PolarisRPC) SetHub(hub *component.ComponentHub)

func (*PolarisRPC) Statistics

func (rpc *PolarisRPC) Statistics() *map[string]interface{}

Statistics show statistic information of p2p module. NOTE: It it not implemented yet

func (*PolarisRPC) TellRequest

func (rpc *PolarisRPC) TellRequest(actor string, msg interface{})

TellRequest implement interface method of ActorService

Jump to

Keyboard shortcuts

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