Documentation ¶
Index ¶
- Constants
- type CandidateSp
- type Network
- func (p *Network) ChooseSpToConnectTo(ctx context.Context) func()
- func (p *Network) ClearPingTimeMap(sp bool)
- func (p *Network) ClearSpCandidateList()
- func (p *Network) ConnectToGatewayPP(ctx context.Context, pplist []*types.PeerInfo) bool
- func (p *Network) DeletePingTimeMap(key string, sp bool)
- func (p *Network) GetPPListFromSP(ctx context.Context)
- func (p *Network) GetPPStatusFromSP(ctx context.Context)
- func (p *Network) GetPPStatusInitPPList(ctx context.Context)
- func (p *Network) GetSPList(ctx context.Context) func()
- func (p *Network) GetSpCandidateList() []CandidateSp
- func (n *Network) GetStateFromFsm() utils.State
- func (n *Network) InitFsm()
- func (p *Network) InitPPList(ctx context.Context)
- func (p *Network) InitPeer(ctx context.Context)
- func (p *Network) LatencyOfNextPp(ctx context.Context) func()
- func (p *Network) ListenOffline(ctx context.Context)
- func (p *Network) LoadPingTimeMap(key string, sp bool) (int64, bool)
- func (p *Network) RegisterToSP(ctx context.Context, toSP bool)
- func (p *Network) ReportNodeStatus(ctx context.Context)
- func (n *Network) RunFsm(ctx context.Context, eventId uint64)
- func (p *Network) SchedulePpLatencyCheck(ctx context.Context)
- func (p *Network) ScheduleSpLatencyCheck(ctx context.Context)
- func (p *Network) SpLatencyCheck(ctx context.Context) func()
- func (p *Network) StartGetSPList(ctx context.Context) func()
- func (p *Network) StartLatencyCheckToPp(ctx context.Context, NetworkAddr string) error
- func (p *Network) StartMining(ctx context.Context)
- func (p *Network) StartPP(ctx context.Context)
- func (p *Network) StartRegisterToSp(ctx context.Context)
- func (p *Network) StartStatusReportToSP(ctx context.Context)
- func (p *Network) StorePingTimeMap(server string, start int64, sp bool)
- func (p *Network) UpdateSpCandidateList(c CandidateSp)
Constants ¶
View Source
const ( MIN_RELOAD_REGISTER_INTERVAL = 60 MAX_RELOAD_REGISTER_INTERVAL = 600 )
View Source
const ( MIN_RELOAD_SP_INTERVAL = 3 MAX_RELOAD_SP_INTERVAL = 900 //15 min )
View Source
const ( SPLIST_INTERVAL_BASE = 60 // In second SPLIST_MAX_JITTER = 10 // In second MAX_RETRY_TIMES = 3 ERROR_CODE_NO_SPLIST = -2 )
View Source
const ( EVENT_SP_NO_PP_IN_STORE uint64 = iota EVENT_RCV_RSP_REGISTER_NEW_PP EVENT_RCV_STATUS_INACTIVE EVENT_RCV_STATUS_SUSPEND EVENT_RCV_RSP_ACTIVATED EVENT_RCV_STATE_OFFLINE EVENT_START_MINING EVENT_RCV_MINING_NOT_STARTED EVENT_MAINTANENCE_STOP EVENT_MAINTANENCE_START EVENT_CONN_RECONN EVENT_RCV_RSP_FIRST_NODE_STATUS EVENT_RCV_SUSPENDED_STATE EVENT_GET_SP_LIST NUMBER_EVENTS )
View Source
const ( STATE_INIT uint64 = iota STATE_GOT_SP_LIST STATE_NOT_CREATED STATE_NOT_ACTIVATED STATE_NOT_REGISTERED STATE_REGISTERING STATE_REGISTERED STATE_MAINTANENCE STATE_SUSPENDED NUMBER_STATE )
View Source
const (
MINIMAL_NUMBER_OF_PP_PEERS = 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CandidateSp ¶ added in v0.10.0
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func (*Network) ChooseSpToConnectTo ¶ added in v0.10.0
func (*Network) ClearPingTimeMap ¶ added in v0.10.0
func (*Network) ClearSpCandidateList ¶ added in v0.10.0
func (p *Network) ClearSpCandidateList()
func (*Network) ConnectToGatewayPP ¶
func (*Network) DeletePingTimeMap ¶ added in v0.10.0
func (*Network) GetPPListFromSP ¶
GetPPListFromSP node get ppList from sp
func (*Network) GetPPStatusFromSP ¶
GetPPStatusFromSP send ReqGetPPStatus to SP
func (*Network) GetPPStatusInitPPList ¶
GetPPStatusInitPPList P node get node status
func (*Network) GetSpCandidateList ¶ added in v0.10.0
func (p *Network) GetSpCandidateList() []CandidateSp
func (*Network) GetStateFromFsm ¶ added in v0.10.0
func (*Network) InitPPList ¶
func (*Network) LatencyOfNextPp ¶
LatencyOfNextPp only when the Latency is 0 which means not measured, the measurement is started.
func (*Network) ListenOffline ¶
func (*Network) LoadPingTimeMap ¶ added in v0.10.0
func (*Network) RegisterToSP ¶
RegisterToSP send ReqRegister to SP
func (*Network) ReportNodeStatus ¶
doReportNodeStatus
func (*Network) SchedulePpLatencyCheck ¶ added in v0.10.0
func (*Network) ScheduleSpLatencyCheck ¶ added in v0.10.0
func (*Network) SpLatencyCheck ¶ added in v0.10.0
func (*Network) StartGetSPList ¶ added in v0.10.0
func (*Network) StartLatencyCheckToPp ¶
StartLatencyCheckToPp send pp latency check message to measure the latency
func (*Network) StartMining ¶
StartMining send ReqMining to SP if needed
func (*Network) StartRegisterToSp ¶
StartStatusReportToSP to start a timer scheduling reporting Node Status to SP
func (*Network) StartStatusReportToSP ¶
StartStatusReportToSP to start a timer scheduling reporting Node Status to SP
func (*Network) StorePingTimeMap ¶ added in v0.10.0
func (*Network) UpdateSpCandidateList ¶ added in v0.10.0
func (p *Network) UpdateSpCandidateList(c CandidateSp)
Click to show internal directories.
Click to hide internal directories.