Documentation
¶
Index ¶
- Constants
- type CandidateSp
- type Network
- func (p *Network) ChangeSp(ctx context.Context)
- func (p *Network) ClearPingTimeMap()
- func (p *Network) ClearSpCandidateList()
- func (p *Network) CloseAlternateSpConns(ctx context.Context) func()
- func (p *Network) DeletePingTimeMap(key string)
- func (p *Network) GetPPStatusFromSP(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) ListenOffline(ctx context.Context)
- func (p *Network) LoadPingTimeMap(key string) (int64, bool)
- func (p *Network) NodeStatusResponded(ctx context.Context)
- func (p *Network) RegisterToSP(ctx context.Context)
- func (p *Network) ReportNodeStatus(ctx context.Context)
- func (n *Network) RunFsm(ctx context.Context, eventId uint64)
- 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) 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)
- func (p *Network) UpdateSpCandidateList(c CandidateSp)
Constants ¶
View Source
const ( MIN_RELOAD_REGISTER_INTERVAL = 30 MAX_RELOAD_REGISTER_INTERVAL = 300 )
View Source
const ( MIN_RELOAD_SP_INTERVAL = 3 MAX_RELOAD_SP_INTERVAL = 300 //5 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 ( LatencyCheckSpListInterval = 24 * 3600 // in seconds LatencyCheckSpListTimeout = 5 // in seconds LatencyCheckTopSpsConsidered = 4 // number of SPs )
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 STATE_OFFLINE NUMBER_STATE )
View Source
const (
MAX_NUMBER_NODE_STATUS_FALIURE = 3
)
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) ChangeSp ¶ added in v0.12.0
ChangeSp sorts the candidate SPs by latency, then selects the optimal SP. Closes the connection to the current SP
func (*Network) ClearPingTimeMap ¶ added in v0.10.0
func (p *Network) ClearPingTimeMap()
func (*Network) ClearSpCandidateList ¶ added in v0.10.0
func (p *Network) ClearSpCandidateList()
func (*Network) CloseAlternateSpConns ¶ added in v0.12.0
func (*Network) DeletePingTimeMap ¶ added in v0.10.0
func (*Network) GetPPStatusFromSP ¶
GetPPStatusFromSP send ReqGetPPStatus to SP
func (*Network) GetSpCandidateList ¶ added in v0.10.0
func (p *Network) GetSpCandidateList() []CandidateSp
func (*Network) GetStateFromFsm ¶ added in v0.10.0
func (*Network) ListenOffline ¶
func (*Network) LoadPingTimeMap ¶ added in v0.10.0
func (*Network) NodeStatusResponded ¶ added in v0.12.3
func (*Network) RegisterToSP ¶
RegisterToSP send ReqRegister to SP
func (*Network) ReportNodeStatus ¶
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) 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.