server

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 35 Imported by: 0

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

View Source
const PolarisSvc = "polarisSvc"

Variables

View Source
var (
	NotFoundError = errors.New("ban status not found")
	UndefinedTime = time.Unix(0, 0)
	FarawayFuture = time.Date(99999, 1, 1, 0, 0, 0, 0, time.UTC)
)

variables that are used internally

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

func NewPolarisListManager

func NewPolarisListManager(conf *config.PolarisConfig, authDir string, logger *log.Logger) *polarisListManager

Types

type BlackListMsg

type BlackListMsg PaginationMsg

type CurrentListMsg

type CurrentListMsg PaginationMsg

type HealthCheckManager

type HealthCheckManager interface {
	Start()
	Stop()
}

type ListEntriesMarshaller

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

func (ListEntriesMarshaller) MarshalZerologArray

func (m ListEntriesMarshaller) MarshalZerologArray(a *zerolog.Array)

type ListEntriesMsg

type ListEntriesMsg struct {
}

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) CertificateManager

func (lntc *LiteContainerService) CertificateManager() p2pcommon.CertificateManager

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) GenesisChainID

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

func (*LiteContainerService) GetChainAccessor

func (lntc *LiteContainerService) GetChainAccessor() types.ChainAccessor

func (*LiteContainerService) GetNetworkTransport

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

func (*LiteContainerService) LocalSettings

func (lntc *LiteContainerService) LocalSettings() p2pcommon.LocalSettings

func (*LiteContainerService) Receive

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

Receive got actor message and then handle it.

func (*LiteContainerService) RoleManager

func (lntc *LiteContainerService) RoleManager() p2pcommon.PeerRoleManager

func (*LiteContainerService) SelfMeta

func (lntc *LiteContainerService) SelfMeta() p2pcommon.PeerMeta

func (*LiteContainerService) SelfNodeID

func (lntc *LiteContainerService) SelfNodeID() types.PeerID

func (*LiteContainerService) SelfRole

func (lntc *LiteContainerService) SelfRole() types.PeerRole

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) AddBLEntry

func (rs *PRPCServer) AddBLEntry(ctx context.Context, entInfo *types.AddEntryParams) (*types.SingleString, error)

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) ListBLEntries

func (rs *PRPCServer) ListBLEntries(ctx context.Context, entInfo *types.Empty) (*types.BLConfEntries, 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) RemoveBLEntry

func (rs *PRPCServer) RemoveBLEntry(ctx context.Context, msg *types.RmEntryParams) (*types.SingleString, error)

func (*PRPCServer) WhiteList

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

type PaginationMsg

type PaginationMsg struct {
	ReferenceHash []byte
	Size          uint32
}

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.MsgReadWriter) 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

type WhiteListMsg

type WhiteListMsg PaginationMsg

Jump to

Keyboard shortcuts

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