shell

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2pIndCb = peer.P2pIndCb // callback type for indication
	P2pPkgCb = peer.P2pPkgCb // callback type for incoming packages
)

Register user callback function to p2p

View Source
const (
	P2pIndPeerActivated = peer.P2pIndPeerActivated // indication for a peer activated to work
	P2pIndPeerClosed    = peer.P2pIndPeerClosed    // indication for peer connection closed
)
View Source
const (
	PisActive  = pisActive
	PisClosing = pisClosing
)
View Source
const (
	MID_CHKK = peer.MID_CHKK
	MID_RPTK = peer.MID_RPTK
	MID_GCD  = peer.MID_GCD
	MID_PCD  = peer.MID_PCD
)
View Source
const (
	SKM_OK = iota
	SKM_DUPLICATED
	SKM_FAILED
)
View Source
const (
	ShMgrMailboxSize = 1024 * 8 // mailbox size

)

debug

View Source
const (
	ShMgrName = sch.ShMgrName // name registered in scheduler

)

chain shell

Variables

View Source
var P2pErrnoDescription = []string{
	"none of errors",
	"invalid parameters",
	"shceduler",
	"not implemented",
	"internal",
	"unknown",
	"max value can errno be",
}

Description about user interface errno

Functions

func DhtCommand

func DhtCommand(dhtMgr *dht.DhtMgr, cmd int, msg interface{}) sch.SchErrno

execute dht command

func DhtGetManager

func DhtGetManager(sdl *sch.Scheduler) *dht.DhtMgr

get dht manager hosted in a scheduler

func DhtInstallCallback

func DhtInstallCallback(dhtMgr *dht.DhtMgr, cbf dht.DhtCallback) dht.DhtErrno

install callback for dht manager

func DhtRemoveCallback

func DhtRemoveCallback(dhtMgr *dht.DhtMgr) dht.DhtErrno

uninstall callback for dht manager

func P2pCreateInstance

func P2pCreateInstance(cfg *config.Config) (*sch.Scheduler, sch.SchErrno)

Create p2p instance

func P2pCreateStaticTaskTab

func P2pCreateStaticTaskTab(what P2pType) []sch.TaskStaticDescription

func P2pStart

func P2pStart(sdl *sch.Scheduler) sch.SchErrno

Start p2p instance

func P2pStop

func P2pStop(sdl *sch.Scheduler, ch chan bool) sch.SchErrno

Stop p2p instance

func ShellDefaultBootstrapConfig

func ShellDefaultBootstrapConfig(bsUrls []string) *config.Config

get default bootstrap node configuration

func ShellDefaultConfig

func ShellDefaultConfig(bsUrls []string) *config.Config

Get default configuration

func ShellGetConfig

func ShellGetConfig(name string) *config.Config

Get configuration

func ShellSetConfig

func ShellSetConfig(name string, cfg *config.Config) (string, config.P2pCfgErrno)

Set configuration

Types

type DhtShellManager

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

func NewDhtShellMgr

func NewDhtShellMgr() *DhtShellManager

Create dht shell manager

func (*DhtShellManager) GetConnStatusChan

func (shMgr *DhtShellManager) GetConnStatusChan() chan *sch.MsgDhtConInstStatusInd

func (*DhtShellManager) GetEventChan

func (shMgr *DhtShellManager) GetEventChan() chan *sch.MsgDhtShEventInd

func (*DhtShellManager) TaskProc4Scheduler

func (shMgr *DhtShellManager) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to scheduler

type P2pErrno

type P2pErrno int

errno about this interface

const (
	P2pEnoNone      P2pErrno = 0 // none of errors
	P2pEnoParameter P2pErrno = 1 // invalid parameters
	P2pEnoScheduler P2pErrno = 2 // shceduler
	P2pEnoNotImpl   P2pErrno = 3 // not implemented
	P2pEnoInternal  P2pErrno = 4 // internal
	P2pEnoUnknown   P2pErrno = 5 // unknown
	P2pEnoMax       P2pErrno = 6 // max, for bound checking
)

func P2pClosePeer

func P2pClosePeer(sdl *sch.Scheduler, snid *peer.SubNetworkID, id *peer.PeerId) P2pErrno

Close peer

func P2pPoweroff

func P2pPoweroff(p2pInst *sch.Scheduler) P2pErrno

Turn off specific p2p instance

func P2pRegisterCallback

func P2pRegisterCallback(what int, cb interface{}, userData interface{}, target interface{}) P2pErrno

func P2pSendPackage

func P2pSendPackage(pkg *peer.P2pPackage2Peer) P2pErrno

Send package to peer

func (P2pErrno) Error

func (eno P2pErrno) Error() string

Error interface

func (P2pErrno) P2pErrnoString

func (eno P2pErrno) P2pErrnoString() string

Errno string

type P2pType

type P2pType = config.P2pAppType

type ShellHsInfo

type ShellHsInfo = peer.Handshake

type ShellManager

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

func NewShellMgr

func NewShellMgr() *ShellManager

Create shell manager

func (*ShellManager) GetActivePeerSnapshot

func (shMgr *ShellManager) GetActivePeerSnapshot() *map[ShellPeerID]ShellPeerSnapshot

func (*ShellManager) GetRxChan

func (shMgr *ShellManager) GetRxChan() chan *peer.P2pPackageRx

func (*ShellManager) TaskProc4Scheduler

func (shMgr *ShellManager) TaskProc4Scheduler(ptn interface{}, msg *sch.SchMessage) sch.SchErrno

Entry point exported to scheduler

type ShellPeerID

type ShellPeerID = shellPeerID

type ShellPeerSnapshot

type ShellPeerSnapshot struct {
	ShellPeerID                 // shell peer identity
	HsInfo      *peer.Handshake // handshake info about peer
	Status      int             // active peer instance status
}

Jump to

Keyboard shortcuts

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