Documentation
¶
Index ¶
- Constants
- func EncodeCommonDistTask(req *dcSDK.BKDistCommand) ([]protocol.Message, error)
- func EncodeSendFileReq(req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]protocol.Message, error)
- func EncodeSlotRspAck(consumeslotnum int32) ([]protocol.Message, error)
- func NewCommonRemoteWorker() dcSDK.RemoteWorker
- func NewCommonRemoteWorkerWithSlot(ctx context.Context, size int64, sendwithcache bool) dcSDK.RemoteWorker
- func SendMessages(client *TCPClient, messages []protocol.Message) error
- type CommonRemoteHandler
- func (r *CommonRemoteHandler) ExecuteCheckCache(server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]bool, error)
- func (r *CommonRemoteHandler) ExecuteCheckCacheLongTCP(server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]bool, error)
- func (r *CommonRemoteHandler) ExecuteQuerySlot(server *dcProtocol.Host, req *dcSDK.BKQuerySlot, ...) (*net.TCPConn, error)
- func (r *CommonRemoteHandler) ExecuteSendFile(server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox, ...) (*dcSDK.BKSendFileResult, error)
- func (r *CommonRemoteHandler) ExecuteSendFileLongTCP(server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox, ...) (*dcSDK.BKSendFileResult, error)
- func (r *CommonRemoteHandler) ExecuteSyncTime(server string) (int64, error)
- func (r *CommonRemoteHandler) ExecuteSyncTimeLongTCP(server string) (int64, error)
- func (r *CommonRemoteHandler) ExecuteTask(server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
- func (r *CommonRemoteHandler) ExecuteTaskLongTCP(server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
- func (r *CommonRemoteHandler) ExecuteTaskWithoutSaveFile(server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
- func (r *CommonRemoteHandler) ExecuteTaskWithoutSaveFileLongTCP(server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
- type RemoteWorker
- type TCPClient
- func (c *TCPClient) Close() error
- func (c *TCPClient) ConnDesc() string
- func (c *TCPClient) Connect(server string) error
- func (c *TCPClient) ReadData(expectlen int) ([]byte, int, error)
- func (c *TCPClient) ReadUntilEOF() ([]byte, int, error)
- func (c *TCPClient) RemoteAddr() string
- func (c *TCPClient) RemoteIP() string
- func (c *TCPClient) SendFile(infile string, compress protocol.CompressType) error
- func (c *TCPClient) TryReadData(expectlen int) ([]byte, int, error)
- func (c *TCPClient) WriteData(data []byte) error
Constants ¶
const ( DEFAULTTIMEOUTSECS = 300 DEFAULTREADALLTIMEOUTSECS = 600 )
define const vars for http client
Variables ¶
This section is empty.
Functions ¶
func EncodeCommonDistTask ¶
func EncodeCommonDistTask(req *dcSDK.BKDistCommand) ([]protocol.Message, error)
EncodeCommonDistTask encode request command info into protocol.Message
func EncodeSendFileReq ¶
func EncodeSendFileReq(req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]protocol.Message, error)
EncodeSendFileReq encode request files into protocol.Message
func NewCommonRemoteWorker ¶
func NewCommonRemoteWorker() dcSDK.RemoteWorker
NewCommonRemoteWorker get a new remote worker SDK
func NewCommonRemoteWorkerWithSlot ¶
func NewCommonRemoteWorkerWithSlot( ctx context.Context, size int64, sendwithcache bool) dcSDK.RemoteWorker
NewCommonRemoteWorkerWithSlot get a new remote worker SDK with specifiled size of slot
Types ¶
type CommonRemoteHandler ¶
type CommonRemoteHandler struct {
// contains filtered or unexported fields
}
CommonRemoteHandler remote executor for bk-common
func (*CommonRemoteHandler) ExecuteCheckCache ¶
func (r *CommonRemoteHandler) ExecuteCheckCache( server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]bool, error)
ExecuteCheckCache check file cache in remote worker
func (*CommonRemoteHandler) ExecuteCheckCacheLongTCP ¶
func (r *CommonRemoteHandler) ExecuteCheckCacheLongTCP( server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox) ([]bool, error)
func (*CommonRemoteHandler) ExecuteQuerySlot ¶
func (r *CommonRemoteHandler) ExecuteQuerySlot( server *dcProtocol.Host, req *dcSDK.BKQuerySlot, c chan *dcSDK.BKQuerySlotResult, timeout int) (*net.TCPConn, error)
ExecuteQuerySlot obtain available slot from remote worker timeout参数单独设置,这个地方比较特殊 TODO : 返回 tcp connection,方便业务在需要时关闭该连接
func (*CommonRemoteHandler) ExecuteSendFile ¶
func (r *CommonRemoteHandler) ExecuteSendFile( server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox, mgr dcSDK.LockMgr) (*dcSDK.BKSendFileResult, error)
ExecuteSendFile send files to remote server
func (*CommonRemoteHandler) ExecuteSendFileLongTCP ¶
func (r *CommonRemoteHandler) ExecuteSendFileLongTCP( server *dcProtocol.Host, req *dcSDK.BKDistFileSender, sandbox *syscall.Sandbox, mgr sdk.LockMgr) (*dcSDK.BKSendFileResult, error)
func (*CommonRemoteHandler) ExecuteSyncTime ¶
func (r *CommonRemoteHandler) ExecuteSyncTime(server string) (int64, error)
ExecuteSyncTime get the target server's current timestamp
func (*CommonRemoteHandler) ExecuteSyncTimeLongTCP ¶
func (r *CommonRemoteHandler) ExecuteSyncTimeLongTCP(server string) (int64, error)
func (*CommonRemoteHandler) ExecuteTask ¶
func (r *CommonRemoteHandler) ExecuteTask( server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
ExecuteTask do execution in remote and get back the result(and files)
func (*CommonRemoteHandler) ExecuteTaskLongTCP ¶
func (r *CommonRemoteHandler) ExecuteTaskLongTCP( server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
ExecuteTaskLongTCP same as ExecuteTask but with long tcp connection
func (*CommonRemoteHandler) ExecuteTaskWithoutSaveFile ¶
func (r *CommonRemoteHandler) ExecuteTaskWithoutSaveFile( server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
ExecuteTaskWithoutSaveFile same as ExecuteTask but do not write file to disk directly, the result file will be kept in memory and wait for custom process
func (*CommonRemoteHandler) ExecuteTaskWithoutSaveFileLongTCP ¶
func (r *CommonRemoteHandler) ExecuteTaskWithoutSaveFileLongTCP( server *dcProtocol.Host, req *dcSDK.BKDistCommand) (*dcSDK.BKDistResult, error)
ExecuteTaskWithoutSaveFileLongTCP same as ExecuteTaskWithoutSaveFile but with long tcp connection
type RemoteWorker ¶
type RemoteWorker struct {
// contains filtered or unexported fields
}
RemoteWorker 作为链接管理单元, 通过实例化不同的handler来提供参数隔离的服务, 但最终的连接池都是用的同一个 TODO: 统一管理连接池
func (*RemoteWorker) Handler ¶
func (rw *RemoteWorker) Handler( ioTimeout int, stats *dcSDK.ControllerJobStats, updateJobStatsFunc func(), sandbox *syscall.Sandbox) dcSDK.RemoteWorkerHandler
Handler get a remote handler
type TCPClient ¶
type TCPClient struct {
// contains filtered or unexported fields
}
TCPClient wrapper net.TCPConn
func NewTCPClientWithConn ¶
NewTCPClientWithConn return new TCPClient with specified conn
func (*TCPClient) ReadUntilEOF ¶
ReadUntilEOF read data until EOF
func (*TCPClient) SendFile ¶
func (c *TCPClient) SendFile(infile string, compress protocol.CompressType) error
SendFile send file
func (*TCPClient) TryReadData ¶
TryReadData try read data, return immediately after received any data