pmap

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PolarisConnectionTTL = time.Second * 30
	PolarisPingTTL       = 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

View Source
const (
	// port for RPC
	DefaultRPCPort = 8915
	// port for query and register aergosvr
	DefaultSrvPort = 8916
)
View Source
const (
	PolarisMapSub  protocol.ID = "/polaris/0.1"
	PolarisPingSub protocol.ID = "/ping/0.1"
)

subprotocol for polaris

View Source
const (
	MapQuery p2pcommon.SubProtocol = 0x0100 + iota
	MapResponse
)

Variables

View Source
var (
	// 89.16 is ceiling of declination of Polaris
	MainnetMapServer = []string{
		"/dns/mainnet-polaris.aergo.io/tcp/8916/p2p/16Uiu2HAkuxyDkMTQTGFpmnex2SdfTVzYfPztTyK339rqUdsv3ZUa",
	}

	// 89.16 is ceiling of declination of Polaris
	TestnetMapServer = []string{
		"/dns/polaris.aergo.io/tcp/8916/p2p/16Uiu2HAkvJTHFuJXxr15rFEHsJWnyn1QvGatW2E9ED9Mvy4HWjVF",
	}

	// Hardcoded chainID of ONE MAINNET and ONE TESTNET
	ONEMainNet types.ChainID
	ONETestNet types.ChainID
)
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 added in v0.10.0

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 added in v0.10.0

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

func (*PRPCServer) BlackList added in v0.10.0

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

func (*PRPCServer) CurrentList added in v0.10.0

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

func (*PRPCServer) Metric added in v0.10.0

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

func (*PRPCServer) NodeState added in v0.10.0

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

func (*PRPCServer) WhiteList added in v0.10.0

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 added in v0.10.0

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

func (*PeerMapService) Statistics

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

type PolarisConnectSvc

type PolarisConnectSvc struct {
	*component.BaseComponent

	PrivateChain bool
	// contains filtered or unexported fields
}

PeerMapService is

func NewPolarisConnectSvc

func NewPolarisConnectSvc(cfg *config.P2PConfig, ntc p2pcommon.NTContainer) *PolarisConnectSvc

func (*PolarisConnectSvc) AfterStart

func (pcs *PolarisConnectSvc) AfterStart()

func (*PolarisConnectSvc) BeforeStart

func (pcs *PolarisConnectSvc) BeforeStart()

func (*PolarisConnectSvc) BeforeStop

func (pcs *PolarisConnectSvc) BeforeStop()

func (*PolarisConnectSvc) Receive

func (pcs *PolarisConnectSvc) Receive(context actor.Context)

func (*PolarisConnectSvc) Statistics

func (pcs *PolarisConnectSvc) Statistics() *map[string]interface{}

type PolarisRPC added in v0.10.0

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

func NewPolarisRPC added in v0.10.0

func NewPolarisRPC(cfg *config.Config) *PolarisRPC

func (*PolarisRPC) AfterStart added in v0.10.0

func (rpc *PolarisRPC) AfterStart()

func (*PolarisRPC) BeforeStart added in v0.10.0

func (rpc *PolarisRPC) BeforeStart()

Start start rpc service.

func (*PolarisRPC) BeforeStop added in v0.10.0

func (rpc *PolarisRPC) BeforeStop()

Stop stops rpc service.

func (*PolarisRPC) CallRequest added in v0.10.0

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

CallRequest implement interface method of ActorService

func (*PolarisRPC) CallRequestDefaultTimeout added in v0.10.0

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

CallRequest implement interface method of ActorService

func (*PolarisRPC) FutureRequest added in v0.10.0

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

FutureRequest implement interface method of ActorService

func (*PolarisRPC) FutureRequestDefaultTimeout added in v0.10.0

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

FutureRequestDefaultTimeout implement interface method of ActorService

func (*PolarisRPC) GetChainAccessor added in v0.10.0

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

func (*PolarisRPC) Receive added in v0.10.0

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

func (*PolarisRPC) SendRequest added in v0.10.0

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

SendRequest implement interface method of ActorService

func (*PolarisRPC) SetHub added in v0.10.0

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

func (*PolarisRPC) Statistics added in v0.10.0

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

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

func (*PolarisRPC) TellRequest added in v0.10.0

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