Documentation ¶
Index ¶
- Constants
- Variables
- func AbsInt64(num int64) int64
- func AppendString(strs ...string) string
- func BuildClearLogs(jarvisnode JarvisNode, srcAddr string, destAddr string) (*pb.JarvisMsg, error)
- func BuildConnNode(jarvisnode JarvisNode, srcAddr string, destAddr string, servaddr string, ...) (*pb.JarvisMsg, error)
- func BuildCtrlInfoForScriptFile(filename string, filedata []byte, destpath string, scriptName string) (*pb.CtrlInfo, error)
- func BuildCtrlInfoForScriptFile2(scriptfile *pb.FileData, files []*pb.FileData, scriptName string) (*pb.CtrlInfo, error)
- func BuildCtrlInfoForScriptFile3(scriptfile *pb.FileData, endFiles []string, scriptName string) (*pb.CtrlInfo, error)
- func BuildCtrlResult(jarvisnode JarvisNode, srcAddr string, destAddr string, replyMsgID int64, ...) (*pb.JarvisMsg, error)
- func BuildCtrlResultForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, str string, errInfo string, ...) []*pb.JarvisMsg
- func BuildMultiMsgData(jarvisnode JarvisNode, destAddr string, replyMsgID int64, ...) (*pb.JarvisMsg, error)
- func BuildNodeInfo(jarvisnode JarvisNode, srcAddr string, destAddr string, ni *pb.NodeBaseInfo) (*pb.JarvisMsg, error)
- func BuildOutputMsg(src *pb.JarvisMsg) (*pb.JarvisMsg, error)
- func BuildReply2(jarvisnode JarvisNode, srcAddr string, destAddr string, rt pb.REPLYTYPE, ...) (*pb.JarvisMsg, error)
- func BuildReply2ForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, replytype pb.REPLYTYPE, ...) []*pb.JarvisMsg
- func BuildReplyConn(jarvisnode JarvisNode, srcAddr string, destAddr string, ni *pb.NodeBaseInfo) (*pb.JarvisMsg, error)
- func BuildReplyMsgState(jarvisnode JarvisNode, destAddr string, replyMsgID int64, msgid int64, ...) (*pb.JarvisMsg, error)
- func BuildReplyMyNodesVersion(jarvisnode JarvisNode, srcAddr string, destAddr string, myNodesVersion string) (*pb.JarvisMsg, error)
- func BuildReplyRequestFile(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData, ...) (*pb.JarvisMsg, error)
- func BuildReplyRequestFileForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, fd *pb.FileData, ...) []*pb.JarvisMsg
- func BuildReplyTransferFile(jarvisnode JarvisNode, srcAddr string, destAddr string, md5str string, ...) (*pb.JarvisMsg, error)
- func BuildRequestCtrl(jarvisnode JarvisNode, srcAddr string, destAddr string, ci *pb.CtrlInfo) (*pb.JarvisMsg, error)
- func BuildRequestFile(jarvisnode JarvisNode, srcAddr string, destAddr string, rf *pb.RequestFile) (*pb.JarvisMsg, error)
- func BuildRequestMsgState(jarvisnode JarvisNode, destAddr string, msgid int64) (*pb.JarvisMsg, error)
- func BuildRequestNodes(jarvisnode JarvisNode, srcAddr string, destAddr string) (*pb.JarvisMsg, error)
- func BuildRequestNodes2(jarvisnode JarvisNode, srcAddr string, destAddr string, isNeedLocalHost bool, ...) (*pb.JarvisMsg, error)
- func BuildTransferFile(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData) (*pb.JarvisMsg, error)
- func BuildTransferFile2(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData) (*pb.JarvisMsg, error)
- func BuildUpdateNode(jarvisnode JarvisNode, srcAddr string, destAddr string, nodetype string, ...) (*pb.JarvisMsg, error)
- func CountClientGroupProcMsgResultsEnd(lstResult []*ClientGroupProcMsgResults) int
- func CountMD5String(lst []*pb.FileData) (int64, string, error)
- func DeepCopy(src proto.Message, dest proto.Message) error
- func GetAbsPath(p string) string
- func GetCurPath() string
- func GetFileLength(fn string) (int64, error)
- func GetMD5String(buf []byte) string
- func GetNodeBaseInfo(node *coredbpb.NodeInfo) *pb.NodeBaseInfo
- func GetRealFilename(fn string) string
- func InitJarvisCore(cfg *Config, nodeType string, version string)
- func InitPprof(cfg *Config) error
- func IsClientProcMsgResultEnd(lstResult []*JarvisMsgInfo) bool
- func IsLocalHostAddr(servaddr string) bool
- func IsMyServAddr(destaddr string, myaddr string) bool
- func IsSyncMsg(msg *pb.JarvisMsg) bool
- func IsTimeOut(msg *pb.JarvisMsg) bool
- func IsValidNodeAddr(addr string) bool
- func IsValidNodeName(nodename string) bool
- func IsValidServAddr(servaddr string) bool
- func JSONMsg2Zap(key string, src *pb.JarvisMsg) zap.Field
- func MD5File(fn string) (string, error)
- func NewCtrlResult(jarvisnode JarvisNode, nodeAddr string, msgid int64, dat proto.Message) (*pb.JarvisMsg, error)
- func NewErrorMsg(jarvisnode JarvisNode, nodeAddr string, strErr string, replyMsgID int64) *pb.JarvisMsg
- func ProcFileData(fn string, onfunc FuncOnFileData) error
- func ProcFileDataWithBuff(buf []byte, onfunc FuncOnFileData) error
- func PushReply22Msgs(msgs []*pb.JarvisMsg, jarvisnode JarvisNode, srcAddr string, msgid int64, ...) []*pb.JarvisMsg
- func ReleaseJarvisCore() error
- func RunCommand(ctx context.Context, jnode JarvisNode, cmdname string, cmd string) (string, string, error)
- func SignJarvisMsg(privkey *jarviscrypto.PrivateKey, msg *pb.JarvisMsg) error
- func StoreLocalFile(file *pb.FileData) error
- func StoreLocalFileEx(files []*pb.FileData) error
- func VerifyJarvisMsg(msg *pb.JarvisMsg) error
- type BaseInfo
- type CMDStdOutErr
- type ClientGroupProcMsgResults
- type Config
- type Ctrl
- type CtrlScriptFile
- type CtrlScriptFile2
- type CtrlScriptFile3
- type FuncGetMsgState
- type FuncMsgEvent
- type FuncNodeEvent
- type FuncOnFileData
- type FuncOnGroupSendMsgResult
- type FuncOnProcMsgResult
- type FuncOnRangeProcMsgResult
- type FuncOnTimer
- type FuncStateEvent
- type HTTPServer
- type JarvisMsgInfo
- type JarvisMsgReplyStream
- type JarvisMsgTask
- type JarvisNode
- type NormalMsgTaskInfo
- type ProcMsgResultData
- type RestartNodeParam
- type StreamMsgTaskInfo
- type Timer
- type UpdateNodeParam
Constants ¶
const ( // JarvisResultTypeSend - send JarvisResultTypeSend = 1 // JarvisResultTypeReply - reply JarvisResultTypeReply = 2 // JarvisResultTypeLocalError - error JarvisResultTypeLocalError = 3 // JarvisResultTypeRemoved - removed JarvisResultTypeRemoved = 5 // JarvisResultTypeLocalErrorEnd - error & end JarvisResultTypeLocalErrorEnd = 6 )
const (
// CtrlTypeScriptFile - scriptfile ctrltype
CtrlTypeScriptFile = "scriptfile"
)
const (
// CtrlTypeScriptFile2 - scriptfile2 ctrltype
CtrlTypeScriptFile2 = "scriptfile2"
)
const (
// CtrlTypeScriptFile3 - scriptfile3 ctrltype
CtrlTypeScriptFile3 = "scriptfile3"
)
Variables ¶
var ( // ErrLoadFileReadSize - loadfile invalid file read size ErrLoadFileReadSize = errors.New("loadfile invalid file read size") // ErrNotConnectNode - not connect node ErrNotConnectNode = errors.New("not connect node") // ErrNoCtrlCmd - no ctrl cmd ErrNoCtrlCmd = errors.New("no ctrl cmd") // ErrCoreDBNoAddr - coredb no addr ErrCoreDBNoAddr = errors.New("coredb no addr") // ErrSign - sign err ErrSign = errors.New("sign err") // ErrInvalidAddr - invalid addr ErrInvalidAddr = errors.New("invalid addr") // ErrInvalidPublishKey - invalid publish key ErrInvalidPublishKey = errors.New("invalid publish key") // ErrExistCtrlID - exist ctrlid ErrExistCtrlID = errors.New("exist ctrlid") // ErrAlreadyJoin - already join ErrAlreadyJoin = errors.New("already join") // ErrNotConnectMe - not connect me ErrNotConnectMe = errors.New("not connect me") // ErrGRPCPeerFromContext - grpc.peer.FromContext err ErrGRPCPeerFromContext = errors.New("grpc.peer.FromContext err") // ErrGRPCPeerAddr - grpc.peer.Addr err ErrGRPCPeerAddr = errors.New("grpc.peer.Addr err") // ErrPublicKeyAddr - public key and address do not match ErrPublicKeyAddr = errors.New("public key and address do not match") // ErrPublicKeyVerify - public key verify err ErrPublicKeyVerify = errors.New("public key verify err") // ErrJarvisMsgTimeOut - JarvisMsg timeout ErrJarvisMsgTimeOut = errors.New("JarvisMsg timeout") // ErrStreamNil - stream nil ErrStreamNil = errors.New("stream nil") // ErrInvalidMsgType - invalid msgtype ErrInvalidMsgType = errors.New("invalid msgtype") // ErrServAddrIsMe - servaddr is me ErrServAddrIsMe = errors.New("servaddr is me") // ErrInvalidEvent - invalid event ErrInvalidEvent = errors.New("invalid event") // ErrInvalidServAddr - invalid servaddr ErrInvalidServAddr = errors.New("invalid servaddr") // ErrInvalidNodeName - invalid nodename ErrInvalidNodeName = errors.New("invalid nodename") // ErrUnknowNode - unknow node ErrUnknowNode = errors.New("unknow node") // ErrInvalidMsgID - invalid msgid ErrInvalidMsgID = errors.New("invalid msgid") // ErrDuplicateMsgID - duplicate msgid ErrDuplicateMsgID = errors.New("duplicate msgid") // ErrInvalidRequestData4Node - invalid requestData4Node ErrInvalidRequestData4Node = errors.New("invalid requestData4Node") // ErrInvalidRequestNodeData - invalid requestNodeData ErrInvalidRequestNodeData = errors.New("invalid requestNodeData") // ErrFuncOnSendMsgResultLength - FuncOnSendMsgResult length err ErrFuncOnSendMsgResultLength = errors.New("FuncOnSendMsgResult length err") // ErrAutoUpdateClosed - auto update closed ErrAutoUpdateClosed = errors.New("auto update closed") // ErrServAddrConnFail - the servaddr connect fail ErrServAddrConnFail = errors.New("the servaddr connect fail") // ErrAssertGetNode - assert(GetNode() is not nil) ErrAssertGetNode = errors.New("assert(GetNode() is not nil)") // ErrDeprecatedNode - deprecated node ErrDeprecatedNode = errors.New("deprecated node") // ErrNoFileData - no filedata ErrNoFileData = errors.New("no filedata") // ErrFileDataNoMD5String - filedata no md5tring ErrFileDataNoMD5String = errors.New("filedata no md5tring") // ErrInvalidFileDataMD5String - invalid filedata md5tring ErrInvalidFileDataMD5String = errors.New("invalid filedata md5tring") // ErrNotConnectedNode - not connected node ErrNotConnectedNode = errors.New("not connected node") // ErrInvalidReadFileLength - invalid readfile length ErrInvalidReadFileLength = errors.New("invalid readfile length") // ErrInvalidSeekFileOffset - invalid seekfile offset ErrInvalidSeekFileOffset = errors.New("invalid seekfile offset") // ErrNoConnOrInvalidConn - no connection or invalid connection ErrNoConnOrInvalidConn = errors.New("no connection or invalid connection") // ErrNoCtrlInfo - no ctrlinfo ErrNoCtrlInfo = errors.New("no ctrlinfo") // ErrCannotFindNodeWithAddr - can not find node with addr ErrCannotFindNodeWithAddr = errors.New("can not find node with addr") // ErrNoFuncOnFileData - no FuncOnFileData ErrNoFuncOnFileData = errors.New("no FuncOnFileData") // ErrNoProcMsgResultData - no ProcMsgResultData ErrNoProcMsgResultData = errors.New("no ProcMsgResultData") // ErrInvalidProcMsgResultData - invalid ProcMsgResultData ErrInvalidProcMsgResultData = errors.New("invalid ProcMsgResultData") // ErrDuplicateProcMsgResultData - duplicate ProcMsgResultData ErrDuplicateProcMsgResultData = errors.New("duplicate ProcMsgResultData") // ErrNoCtrl - no ctrl ErrNoCtrl = errors.New("no ctrl") // ErrUnknownCtrlError - unknown ctrl error ErrUnknownCtrlError = errors.New("unknown ctrl error") // ErrProcMsgStreamNil - ProcMsgStream return nil ErrProcMsgStreamNil = errors.New("ProcMsgStream return nil") // ErrIDontTrustYou - I don't trust you ErrIDontTrustYou = errors.New("I don't trust you") // ErrInvalidTimer - Invalid timer ErrInvalidTimer = errors.New("Invalid timer") // ErrInvalidTimerFunc - Invalid timer func ErrInvalidTimerFunc = errors.New("Invalid timer func") // ErrInvalidWait4MyReplyMsgID - Invalid wait for my reply msgid ErrInvalidWait4MyReplyMsgID = errors.New("Invalid wait for my reply msgid") // ErrInvalidWait4MyReplyAddr - Invalid wait for my reply addr ErrInvalidWait4MyReplyAddr = errors.New("Invalid wait for my reply addr") // ErrInvalidJarvisMsgReplyStreamDestAddr - Invalid JarvisMsgReplyStream dest addr ErrInvalidJarvisMsgReplyStreamDestAddr = errors.New("Invalid JarvisMsgReplyStream dest addr") // ErrInvalidJarvisMsgReplyStreamSendMsg - Invalid JarvisMsgReplyStream sendmsg ErrInvalidJarvisMsgReplyStreamSendMsg = errors.New("Invalid JarvisMsgReplyStream sendmsg") // ErrJarvisMsgReplyStreamSent - JarvisMsgReplyStream has been sent ErrJarvisMsgReplyStreamSent = errors.New("JarvisMsgReplyStream has been sent") // ErrInvalidJarvisMsgReplyStreamReplyMsgID - Invalid JarvisMsgReplyStream ReplyMsgID ErrInvalidJarvisMsgReplyStreamReplyMsgID = errors.New("Invalid JarvisMsgReplyStream ReplyMsgID") // ErrInvalidStreamMsgTransferFile2 - Invalid StreamMsg TRANSFER_FILE2 ErrInvalidStreamMsgTransferFile2 = errors.New("Invalid StreamMsg TRANSFER_FILE2") // ErrInvalidCMDStdOutErrErrFile - Invalid CMDStdOutErr errfile ErrInvalidCMDStdOutErrErrFile = errors.New("Invalid CMDStdOutErr errfile") // ErrCfgInvalidUpdateScript - Invalid UpdateScript ErrCfgInvalidUpdateScript = errors.New("Invalid UpdateScript") )
var ( // EventOnNodeConnected - onNodeConnected EventOnNodeConnected = "nodeconnected" // EventOnIConnectNode - onIConnectNode EventOnIConnectNode = "connectnode" // EventOnIConnectNodeFail - onIConnectNodeFail EventOnIConnectNodeFail = "connectnodefail" // EventOnDeprecateNode - onDeprecateNode EventOnDeprecateNode = "deprecatenode" // EventOnCtrl - OnCtrl EventOnCtrl = "onctrl" // EventOnCtrlResult - OnCtrlResult EventOnCtrlResult = "ctrlresult" // EventOnReplyRequestFile - OnReplyRequestFile EventOnReplyRequestFile = "replyrequestfile" // EventOnRequestFile - OnRequestFile EventOnRequestFile = "onrequestfile" // EventOnReplyTransferFile - OnReplyTransferFile EventOnReplyTransferFile = "replytransferfile" // EventOnTransferFile - OnTransferFile EventOnTransferFile = "ontransferfile" // EventOnUpdateNode - OnUpdateNode EventOnUpdateNode = "onupdatenode" // EventOnPrivateKey - OnPrivateKey EventOnPrivateKey = "privatekey" )
Functions ¶
func AppendString ¶ added in v0.7.130
AppendString - append string
func BuildClearLogs ¶ added in v0.7.161
BuildClearLogs - build jarvismsg with CLEAR_LOGS
func BuildConnNode ¶
func BuildConnNode(jarvisnode JarvisNode, srcAddr string, destAddr string, servaddr string, ni *pb.NodeBaseInfo) (*pb.JarvisMsg, error)
BuildConnNode - build jarvismsg with CONNECT_NODE
func BuildCtrlInfoForScriptFile ¶
func BuildCtrlInfoForScriptFile(filename string, filedata []byte, destpath string, scriptName string) (*pb.CtrlInfo, error)
BuildCtrlInfoForScriptFile - build ctrlinfo for scriptfile Deprecated: you can use BuildCtrlInfoForScriptFile3
func BuildCtrlInfoForScriptFile2 ¶ added in v0.6.21
func BuildCtrlInfoForScriptFile2(scriptfile *pb.FileData, files []*pb.FileData, scriptName string) (*pb.CtrlInfo, error)
BuildCtrlInfoForScriptFile2 - build ctrlinfo for scriptfile Deprecated: you can use BuildCtrlInfoForScriptFile3
func BuildCtrlInfoForScriptFile3 ¶ added in v0.7.130
func BuildCtrlInfoForScriptFile3(scriptfile *pb.FileData, endFiles []string, scriptName string) (*pb.CtrlInfo, error)
BuildCtrlInfoForScriptFile3 - build ctrlinfo for scriptfile
func BuildCtrlResult ¶
func BuildCtrlResult(jarvisnode JarvisNode, srcAddr string, destAddr string, replyMsgID int64, result string, errInfo string) (*pb.JarvisMsg, error)
BuildCtrlResult - build jarvismsg with REPLY_CTRL_RESULT
func BuildCtrlResultForCtrl ¶ added in v0.7.130
func BuildCtrlResultForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, str string, errInfo string, msgs []*pb.JarvisMsg) []*pb.JarvisMsg
BuildCtrlResultForCtrl - build CtrlResult for Ctrl
func BuildMultiMsgData ¶ added in v0.7.157
func BuildMultiMsgData(jarvisnode JarvisNode, destAddr string, replyMsgID int64, multimsg *pb.MultiMsgData) (*pb.JarvisMsg, error)
BuildMultiMsgData - build jarvismsg with MULTI_MSG
func BuildNodeInfo ¶ added in v0.6.2
func BuildNodeInfo(jarvisnode JarvisNode, srcAddr string, destAddr string, ni *pb.NodeBaseInfo) (*pb.JarvisMsg, error)
BuildNodeInfo - build jarvismsg with NODE_INFO
func BuildOutputMsg ¶ added in v0.7.130
BuildOutputMsg - build a output jarvismsg
func BuildReply2 ¶ added in v0.7.130
func BuildReply2(jarvisnode JarvisNode, srcAddr string, destAddr string, rt pb.REPLYTYPE, strErr string, replyMsgID int64) (*pb.JarvisMsg, error)
BuildReply2 - build jarvismsg with REPLY2
func BuildReply2ForCtrl ¶ added in v0.7.130
func BuildReply2ForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, replytype pb.REPLYTYPE, info string, msgs []*pb.JarvisMsg) []*pb.JarvisMsg
BuildReply2ForCtrl - build Reply2 for Ctrl
func BuildReplyConn ¶
func BuildReplyConn(jarvisnode JarvisNode, srcAddr string, destAddr string, ni *pb.NodeBaseInfo) (*pb.JarvisMsg, error)
BuildReplyConn - build jarvismsg with REPLY_CONNECT
func BuildReplyMsgState ¶ added in v0.7.157
func BuildReplyMsgState(jarvisnode JarvisNode, destAddr string, replyMsgID int64, msgid int64, state int) (*pb.JarvisMsg, error)
BuildReplyMsgState - build jarvismsg with REPLY_MSG_STATE
func BuildReplyMyNodesVersion ¶ added in v0.7.208
func BuildReplyMyNodesVersion(jarvisnode JarvisNode, srcAddr string, destAddr string, myNodesVersion string) (*pb.JarvisMsg, error)
BuildReplyMyNodesVersion - build jarvismsg with REPLY_MYNODESVERSION
func BuildReplyRequestFile ¶ added in v0.6.12
func BuildReplyRequestFile(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData, replyMsgID int64) (*pb.JarvisMsg, error)
BuildReplyRequestFile - build jarvismsg with REPLY_REQUEST_FILE
func BuildReplyRequestFileForCtrl ¶ added in v0.7.130
func BuildReplyRequestFileForCtrl(jarvisnode JarvisNode, srcAddr string, msgid int64, fd *pb.FileData, msgs []*pb.JarvisMsg) []*pb.JarvisMsg
BuildReplyRequestFileForCtrl - build ReplyRequestFile for Ctrl
func BuildReplyTransferFile ¶ added in v0.7.130
func BuildReplyTransferFile(jarvisnode JarvisNode, srcAddr string, destAddr string, md5str string, replyMsgID int64) (*pb.JarvisMsg, error)
BuildReplyTransferFile - build jarvismsg with REPLY_TRANSFER_FILE
func BuildRequestCtrl ¶
func BuildRequestCtrl(jarvisnode JarvisNode, srcAddr string, destAddr string, ci *pb.CtrlInfo) (*pb.JarvisMsg, error)
BuildRequestCtrl - build jarvismsg with REQUEST_CTRL
func BuildRequestFile ¶ added in v0.6.12
func BuildRequestFile(jarvisnode JarvisNode, srcAddr string, destAddr string, rf *pb.RequestFile) (*pb.JarvisMsg, error)
BuildRequestFile - build jarvismsg with REQUEST_FILE
func BuildRequestMsgState ¶ added in v0.7.157
func BuildRequestMsgState(jarvisnode JarvisNode, destAddr string, msgid int64) (*pb.JarvisMsg, error)
BuildRequestMsgState - build jarvismsg with REQUEST_MSG_STATE
func BuildRequestNodes ¶ added in v0.6.2
func BuildRequestNodes(jarvisnode JarvisNode, srcAddr string, destAddr string) (*pb.JarvisMsg, error)
BuildRequestNodes - build jarvismsg with REQUEST_NODES
func BuildRequestNodes2 ¶ added in v0.7.201
func BuildRequestNodes2(jarvisnode JarvisNode, srcAddr string, destAddr string, isNeedLocalHost bool, myNodesVersion string, nodesVersion string) (*pb.JarvisMsg, error)
BuildRequestNodes2 - build jarvismsg with REQUEST_NODES2
func BuildTransferFile ¶ added in v0.7.130
func BuildTransferFile(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData) (*pb.JarvisMsg, error)
BuildTransferFile - build jarvismsg with TRANSFER_FILE
func BuildTransferFile2 ¶ added in v0.7.130
func BuildTransferFile2(jarvisnode JarvisNode, srcAddr string, destAddr string, fd *pb.FileData) (*pb.JarvisMsg, error)
BuildTransferFile2 - build jarvismsg with TRANSFER_FILE2
func BuildUpdateNode ¶ added in v0.7.130
func BuildUpdateNode(jarvisnode JarvisNode, srcAddr string, destAddr string, nodetype string, nodetypever string, isOnlyRestart bool) (*pb.JarvisMsg, error)
BuildUpdateNode - build jarvismsg with UPDATENODE
func CountClientGroupProcMsgResultsEnd ¶ added in v0.7.130
func CountClientGroupProcMsgResultsEnd(lstResult []*ClientGroupProcMsgResults) int
CountClientGroupProcMsgResultsEnd - count number for end
func CountMD5String ¶ added in v0.7.130
CountMD5String - count MD5 string
func GetAbsPath ¶ added in v0.7.178
GetAbsPath - get absolutely patg
func GetFileLength ¶ added in v0.7.130
GetFileLength - get file length
func GetMD5String ¶ added in v0.7.130
GetMD5String - md5 buf and return string
func GetNodeBaseInfo ¶ added in v0.7.130
func GetNodeBaseInfo(node *coredbpb.NodeInfo) *pb.NodeBaseInfo
GetNodeBaseInfo - get nodebaseinfo from nodeinfo
func GetRealFilename ¶ added in v0.7.130
GetRealFilename - get filename
func InitJarvisCore ¶
InitJarvisCore -
func IsClientProcMsgResultEnd ¶ added in v0.7.130
func IsClientProcMsgResultEnd(lstResult []*JarvisMsgInfo) bool
IsClientProcMsgResultEnd - is end
func IsLocalHostAddr ¶ added in v0.7.130
IsLocalHostAddr - is localhost
func IsMyServAddr ¶ added in v0.6.7
IsMyServAddr - check destaddr is same addr for me
func IsValidNodeAddr ¶ added in v0.7.130
IsValidNodeAddr - is valid nodeaddr
func IsValidNodeName ¶ added in v0.6.12
IsValidNodeName - check node name
func IsValidServAddr ¶ added in v0.7.130
IsValidServAddr - is the server address is valid?
func JSONMsg2Zap ¶ added in v0.7.130
JSONMsg2Zap - I use this interface to output jarvismsg to the zap log.
This interface will hide the long data in jarvismsg.
func NewCtrlResult ¶ added in v0.7.136
func NewCtrlResult(jarvisnode JarvisNode, nodeAddr string, msgid int64, dat proto.Message) (*pb.JarvisMsg, error)
NewCtrlResult - new jarvismsg with REPLY_CTRL_RESULT
func NewErrorMsg ¶ added in v0.7.132
func NewErrorMsg(jarvisnode JarvisNode, nodeAddr string, strErr string, replyMsgID int64) *pb.JarvisMsg
NewErrorMsg - new a error JarvisMsg
func ProcFileData ¶ added in v0.7.130
func ProcFileData(fn string, onfunc FuncOnFileData) error
ProcFileData - proc filedata
func ProcFileDataWithBuff ¶ added in v0.7.130
func ProcFileDataWithBuff(buf []byte, onfunc FuncOnFileData) error
ProcFileDataWithBuff - proc filedata
func PushReply22Msgs ¶ added in v0.7.130
func PushReply22Msgs(msgs []*pb.JarvisMsg, jarvisnode JarvisNode, srcAddr string, msgid int64, replytype pb.REPLYTYPE, info string) []*pb.JarvisMsg
PushReply22Msgs - push Reply2 to msgs
func RunCommand ¶ added in v0.7.169
func RunCommand(ctx context.Context, jnode JarvisNode, cmdname string, cmd string) (string, string, error)
RunCommand - run command
func SignJarvisMsg ¶
func SignJarvisMsg(privkey *jarviscrypto.PrivateKey, msg *pb.JarvisMsg) error
SignJarvisMsg - sign JarvisMsg
func StoreLocalFile ¶ added in v0.6.21
StoreLocalFile - store filedata to local file systems
func StoreLocalFileEx ¶ added in v0.7.130
StoreLocalFileEx - store filedata array to local file systems
func VerifyJarvisMsg ¶
VerifyJarvisMsg - Verify JarvisMsg
Types ¶
type BaseInfo ¶
type BaseInfo struct { Name string BindAddr string ServAddr string Addr string NodeTypeVersion string CoreVersion string NodeType string }
BaseInfo -
type CMDStdOutErr ¶ added in v0.7.169
type CMDStdOutErr struct { LenStdOut int64 OutFileName string ErrFileName string // contains filtered or unexported fields }
CMDStdOutErr - command stdout & stderr
func NewCMDStdOutErr ¶ added in v0.7.169
func NewCMDStdOutErr(fnout string, fnerr string) (*CMDStdOutErr, error)
NewCMDStdOutErr - new CMDStdOutErr
func (*CMDStdOutErr) GetStdErr ¶ added in v0.7.169
func (out *CMDStdOutErr) GetStdErr() ([]byte, error)
GetStdErr - get stderr
func (*CMDStdOutErr) GetStdOut ¶ added in v0.7.169
func (out *CMDStdOutErr) GetStdOut() ([]byte, error)
GetStdOut - get stdout
type ClientGroupProcMsgResults ¶ added in v0.7.130
type ClientGroupProcMsgResults struct {
Results []*JarvisMsgInfo `json:"results"`
}
ClientGroupProcMsgResults - result for FuncOnSendMsgResult
type Config ¶
type Config struct { RootServAddr string LstTrustNode []string // TimeRequestChild - RequestChild time // - default 30s TimeRequestChild int64 // MaxMsgLength - default 4mb MaxMsgLength int32 Pprof struct { BaseURL string } TaskServ struct { BindAddr string ServAddr string } HTTPServ struct { BindAddr string ServAddr string } AnkaDB struct { DBPath string HTTPServ string Engine string } Log struct { LogPath string LogLevel string LogConsole bool LogSubFileName string } BaseNodeInfo struct { NodeName string BindAddr string ServAddr string } AutoUpdate bool UpdateScript string RestartScript string }
Config - config
type Ctrl ¶
type Ctrl interface {
Run(ctx context.Context, jarvisnode JarvisNode, srcAddr string, msgid int64, ci *pb.CtrlInfo) []*pb.JarvisMsg
}
Ctrl -
type FuncGetMsgState ¶ added in v0.7.157
FuncGetMsgState - getMsgState
type FuncMsgEvent ¶ added in v0.6.1
FuncMsgEvent - func event
type FuncNodeEvent ¶
type FuncNodeEvent func(ctx context.Context, jarvisnode JarvisNode, node *coredbpb.NodeInfo) error
FuncNodeEvent - func event
type FuncOnFileData ¶ added in v0.7.130
FuncOnFileData - on proc filedata
type FuncOnGroupSendMsgResult ¶ added in v0.7.130
type FuncOnGroupSendMsgResult func(ctx context.Context, jarvisnode JarvisNode, numsNode int, lstResult []*ClientGroupProcMsgResults) error
FuncOnGroupSendMsgResult - on group sendmsg recv the messages
type FuncOnProcMsgResult ¶ added in v0.7.130
type FuncOnProcMsgResult func(ctx context.Context, jarvisnode JarvisNode, lstResult []*JarvisMsgInfo) error
FuncOnProcMsgResult - on procmsg recv the message
type FuncOnRangeProcMsgResult ¶ added in v0.7.157
type FuncOnRangeProcMsgResult func(prmd *ProcMsgResultData)
FuncOnRangeProcMsgResult - onRangeProcMsgResult
type FuncStateEvent ¶ added in v0.7.130
type FuncStateEvent func(ctx context.Context, jarvisnode JarvisNode) error
FuncStateEvent - func event
type HTTPServer ¶ added in v0.7.178
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer -
type JarvisMsgInfo ¶ added in v0.7.130
type JarvisMsgInfo struct { JarvisResultType int `json:"jarvisresulttype"` Msg *pb.JarvisMsg `json:"msg"` Err error `json:"err"` }
JarvisMsgInfo - JarvisMsg information
func (*JarvisMsgInfo) IsEnd ¶ added in v0.7.157
func (jmi *JarvisMsgInfo) IsEnd() bool
IsEnd - is end msg
func (*JarvisMsgInfo) IsEndOrIGI ¶ added in v0.7.157
func (jmi *JarvisMsgInfo) IsEndOrIGI() bool
IsEndOrIGI - is end msg or IGOTIT
func (*JarvisMsgInfo) IsErrorEnd ¶ added in v0.7.187
func (jmi *JarvisMsgInfo) IsErrorEnd() bool
IsErrorEnd - is error end msg
type JarvisMsgReplyStream ¶ added in v0.7.130
type JarvisMsgReplyStream struct {
// contains filtered or unexported fields
}
JarvisMsgReplyStream - reply JarvisMsg stream
func NewJarvisMsgReplyStream ¶ added in v0.7.130
func NewJarvisMsgReplyStream(procMsg pb.JarvisCoreServ_ProcMsgServer) *JarvisMsgReplyStream
NewJarvisMsgReplyStream - new JarvisMsgReplyStream
func (*JarvisMsgReplyStream) ReplyMsg ¶ added in v0.7.130
func (stream *JarvisMsgReplyStream) ReplyMsg(jn JarvisNode, sendmsg *pb.JarvisMsg) error
ReplyMsg - reply JarvisMsg
type JarvisMsgTask ¶ added in v0.7.166
type JarvisMsgTask struct { Normal *NormalMsgTaskInfo Stream *StreamMsgTaskInfo }
JarvisMsgTask - jarvis message task
type JarvisNode ¶
type JarvisNode interface { // Start - start jarvis node Start(ctx context.Context) (err error) // Stop - stop jarvis node Stop() (err error) // GetCoreDB - get jarvis node coredb GetCoreDB() *coredb.CoreDB // GetConfig - get config GetConfig() *Config // BuildStatus - build jarviscorepb.JarvisNodeStatus BuildStatus() *pb.JarvisNodeStatus // RequestCtrl - send ctrl to jarvisnode with addr RequestCtrl(ctx context.Context, addr string, ci *pb.CtrlInfo, funcOnResult FuncOnProcMsgResult) error // SendFile - send filedata to jarvisnode with addr SendFile(ctx context.Context, addr string, fd *pb.FileData, funcOnResult FuncOnProcMsgResult) error // SendFile2 - send filedata to jarvisnode with addr SendFile2(ctx context.Context, addr string, fd *pb.FileData, funcOnResult FuncOnProcMsgResult) error // RequestFile - request node send filedata to me RequestFile(ctx context.Context, addr string, rf *pb.RequestFile, funcOnResult FuncOnProcMsgResult) error // RequestNodes - request nodes RequestNodes(ctx context.Context, isNeedLocalHost bool, funcOnResult FuncOnGroupSendMsgResult) error // UpdateNode - update node UpdateNode(ctx context.Context, addr string, nodetype string, nodetypever string, isOnlyRestart bool, funcOnResult FuncOnProcMsgResult) error // UpdateAllNodes - update all nodes UpdateAllNodes(ctx context.Context, nodetype string, nodetypever string, isOnlyRestart bool, funcOnResult FuncOnGroupSendMsgResult) error // ClearLogs - clear logs ClearLogs(ctx context.Context, addr string, funcOnResult FuncOnProcMsgResult) error // ClearAllLogs - clear logs ClearAllLogs(ctx context.Context, funcOnResult FuncOnGroupSendMsgResult) error // AddNodeBaseInfo - add nodeinfo AddNodeBaseInfo(nbi *pb.NodeBaseInfo) error // OnMsg - proc JarvisMsg OnMsg(ctx context.Context, task *JarvisMsgTask) error // GetMyInfo - get my nodeinfo GetMyInfo() *BaseInfo // RegNodeEventFunc - reg event handle RegNodeEventFunc(event string, eventfunc FuncNodeEvent) error // RegMsgEventFunc - reg event handle RegMsgEventFunc(event string, eventfunc FuncMsgEvent) error // IsConnected - is connected this node IsConnected(addr string) bool // FindNodeWithName - find node with name FindNodeWithName(name string) *coredbpb.NodeInfo // FindNode - find node FindNode(addr string) *coredbpb.NodeInfo // SetNodeTypeInfo - set node type and version SetNodeTypeInfo(nodetype string, nodetypeversion string) // RegCtrl - register a ctrl RegCtrl(ctrltype string, ctrl Ctrl) error // PostMsg - like windows postMessage PostMsg(normal *NormalMsgTaskInfo, chanEnd chan int) // PostStreamMsg - like windows postMessage PostStreamMsg(stream *StreamMsgTaskInfo, chanEnd chan int) // SendStreamMsg - send stream message to other node SendStreamMsg(addr string, msgs []*pb.JarvisMsg, funcOnResult FuncOnProcMsgResult) // SendMsg - send a message to other node SendMsg(addr string, msg *pb.JarvisMsg, funcOnResult FuncOnProcMsgResult) // ConnectNode - connect node ConnectNode(node *coredbpb.NodeInfo, funcOnResult FuncOnProcMsgResult) error // ConnectNodeWithServAddr - connect node ConnectNodeWithServAddr(servaddr string, funcOnResult FuncOnProcMsgResult) error // OnClientProcMsg - on Client.ProcMsg OnClientProcMsg(addr string, msgid int64, onProcMsgResult FuncOnProcMsgResult) error // OnReplyProcMsg - on reply OnReplyProcMsg(ctx context.Context, addr string, replymsgid int64, jrt int, msg *pb.JarvisMsg, err error) error }
JarvisNode -
type NormalMsgTaskInfo ¶ added in v0.7.166
type NormalMsgTaskInfo struct { Msg *pb.JarvisMsg ReplyStream *JarvisMsgReplyStream OnResult FuncOnProcMsgResult }
NormalMsgTaskInfo - normal message task info
type ProcMsgResultData ¶ added in v0.7.130
type ProcMsgResultData struct {
// contains filtered or unexported fields
}
ProcMsgResultData -
func NewProcMsgResultData ¶ added in v0.7.130
func NewProcMsgResultData(addr string, msgid int64, onProcMsgResult FuncOnProcMsgResult) *ProcMsgResultData
NewProcMsgResultData - new ProcMsgResultData
func (*ProcMsgResultData) OnMsgEnd ¶ added in v0.7.130
func (pmrd *ProcMsgResultData) OnMsgEnd() bool
OnMsgEnd - on MsgEnd
func (*ProcMsgResultData) OnPorcMsgResult ¶ added in v0.7.130
func (pmrd *ProcMsgResultData) OnPorcMsgResult(ctx context.Context, jarvisnode JarvisNode, result *JarvisMsgInfo) error
OnPorcMsgResult - on PorcMsgResult
func (*ProcMsgResultData) OnRecvEnd ¶ added in v0.7.130
func (pmrd *ProcMsgResultData) OnRecvEnd() bool
OnRecvEnd - on RecvEnd
type RestartNodeParam ¶ added in v0.7.185
type RestartNodeParam struct { }
RestartNodeParam - the parameter for restart node
type StreamMsgTaskInfo ¶ added in v0.7.166
type StreamMsgTaskInfo struct { Msgs []JarvisMsgInfo ReplyStream *JarvisMsgReplyStream OnResult FuncOnProcMsgResult }
StreamMsgTaskInfo - stream message task info
type Timer ¶ added in v0.7.157
type Timer struct {
// contains filtered or unexported fields
}
Timer - timer
func NewTimer ¶ added in v0.7.157
func NewTimer(timer int, ontimer FuncOnTimer) *Timer
NewTimer - new timer
func StartTimer ¶ added in v0.7.157
StartTimer - start timer
type UpdateNodeParam ¶ added in v0.7.130
type UpdateNodeParam struct {
NewVersion string
}
UpdateNodeParam - the parameter for update node
Source Files ¶
- autoupdate.go
- baseinfo.go
- client2.go
- clientprocmsgresult.go
- cmdstdouterr.go
- config.go
- connmgr.go
- ctrl.go
- ctrlmgr.go
- ctrlmsgmgr.go
- ctrlscriptfile.go
- ctrlscriptfile2.go
- ctrlscriptfile3.go
- err.go
- event.go
- failservaddr.go
- httpserv.go
- jarvismsgmgr.go
- jarvismsgtask.go
- jarvisnode.go
- jarvistaskserv.go
- msgutils.go
- multimsg.go
- node.go
- pkginit.go
- pprof.go
- procmsgresult.go
- serv2.go
- timer.go
- utils.go
- waitformyreply.go