Documentation ¶
Index ¶
- Constants
- Variables
- func NewHCM(mapService *PeerMapService, nt p2pcommon.NetworkTransport) *healthCheckManager
- func NewPolarisListManager(conf *config.PolarisConfig, authDir string, logger *log.Logger) *polarisListManager
- type BlackListMsg
- type CurrentListMsg
- type HealthCheckManager
- type ListEntriesMarshaller
- type ListEntriesMsg
- type LiteContainerService
- func (lntc *LiteContainerService) AfterStart()
- func (lntc *LiteContainerService) BeforeStart()
- func (lntc *LiteContainerService) BeforeStop()
- func (lntc *LiteContainerService) CallRequest(actor string, msg interface{}, timeout time.Duration) (interface{}, error)
- func (lntc *LiteContainerService) CallRequestDefaultTimeout(actor string, msg interface{}) (interface{}, error)
- func (lntc *LiteContainerService) CertificateManager() p2pcommon.CertificateManager
- func (lntc *LiteContainerService) ConsensusAccessor() consensus.ConsensusAccessor
- func (lntc *LiteContainerService) FutureRequest(actor string, msg interface{}, timeout time.Duration) *actor.Future
- func (lntc *LiteContainerService) FutureRequestDefaultTimeout(actor string, msg interface{}) *actor.Future
- func (lntc *LiteContainerService) GenesisChainID() *types.ChainID
- func (lntc *LiteContainerService) GetChainAccessor() types.ChainAccessor
- func (lntc *LiteContainerService) GetNetworkTransport() p2pcommon.NetworkTransport
- func (lntc *LiteContainerService) LocalSettings() p2pcommon.LocalSettings
- func (lntc *LiteContainerService) PeerManager() p2pcommon.PeerManager
- func (lntc *LiteContainerService) Receive(context actor.Context)
- func (lntc *LiteContainerService) RoleManager() p2pcommon.PeerRoleManager
- func (lntc *LiteContainerService) SelfMeta() p2pcommon.PeerMeta
- func (lntc *LiteContainerService) SelfNodeID() types.PeerID
- func (lntc *LiteContainerService) SelfRole() types.PeerRole
- func (lntc *LiteContainerService) SendRequest(actor string, msg interface{})
- func (lntc *LiteContainerService) SetHub(hub *component.ComponentHub)
- func (lntc *LiteContainerService) Statistics() *map[string]interface{}
- func (lntc *LiteContainerService) TellRequest(actor string, msg interface{})
- type PRPCServer
- func (rs *PRPCServer) AddBLEntry(ctx context.Context, entInfo *types.AddEntryParams) (*types.SingleString, error)
- func (rs *PRPCServer) BlackList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)
- func (rs *PRPCServer) CurrentList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)
- func (rs *PRPCServer) ListBLEntries(ctx context.Context, entInfo *types.Empty) (*types.BLConfEntries, error)
- func (rs *PRPCServer) Metric(ctx context.Context, in *types.MetricsRequest) (*types.Metrics, error)
- func (rs *PRPCServer) NodeState(ctx context.Context, in *types.NodeReq) (*types.SingleBytes, error)
- func (rs *PRPCServer) RemoveBLEntry(ctx context.Context, msg *types.RmEntryParams) (*types.SingleString, error)
- func (rs *PRPCServer) WhiteList(ctx context.Context, p1 *types.Paginations) (*types.PolarisPeerList, error)
- type PaginationMsg
- type PeerHealth
- type PeerMapService
- func (pms *PeerMapService) AfterStart()
- func (pms *PeerMapService) BeforeStart()
- func (pms *PeerMapService) BeforeStop()
- func (pms *PeerMapService) Receive(context actor.Context)
- func (pms *PeerMapService) SendGoAwayMsg(message string, wt p2pcommon.MsgReadWriter) error
- func (pms *PeerMapService) SetHub(hub *component.ComponentHub)
- func (pms *PeerMapService) Statistics() *map[string]interface{}
- type PolarisRPC
- func (rpc *PolarisRPC) AfterStart()
- func (rpc *PolarisRPC) BeforeStart()
- func (rpc *PolarisRPC) BeforeStop()
- func (rpc *PolarisRPC) CallRequest(actor string, msg interface{}, timeout time.Duration) (interface{}, error)
- func (rpc *PolarisRPC) CallRequestDefaultTimeout(actor string, msg interface{}) (interface{}, error)
- func (rpc *PolarisRPC) FutureRequest(actor string, msg interface{}, timeout time.Duration) *actor.Future
- func (rpc *PolarisRPC) FutureRequestDefaultTimeout(actor string, msg interface{}) *actor.Future
- func (rpc *PolarisRPC) GetChainAccessor() types.ChainAccessor
- func (rpc *PolarisRPC) Receive(context actor.Context)
- func (rpc *PolarisRPC) SendRequest(actor string, msg interface{})
- func (rpc *PolarisRPC) SetHub(hub *component.ComponentHub)
- func (rpc *PolarisRPC) Statistics() *map[string]interface{}
- func (rpc *PolarisRPC) TellRequest(actor string, msg interface{})
- type WhiteListMsg
Constants ¶
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
const PolarisSvc = "polarisSvc"
Variables ¶
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
var (
EmptyMsgID = p2pcommon.MsgID(uuid.Nil)
)
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) ConsensusAccessor ¶
func (lntc *LiteContainerService) ConsensusAccessor() consensus.ConsensusAccessor
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) PeerManager ¶
func (lntc *LiteContainerService) PeerManager() p2pcommon.PeerManager
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 { types.UnimplementedPolarisRPCServiceServer // 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 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) 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