Documentation ¶
Index ¶
- Constants
- func StartMockAgent()
- type AgentInfo
- type Config
- type GseClient
- type GseCommonMsg
- type GseCommonMsgHead
- type GseConnection
- type GseDynamicMetaInfo
- type GseDynamicMsg
- type GseDynamicMsgHead
- type GseLinuxConnection
- func (c *GseLinuxConnection) Close() error
- func (c *GseLinuxConnection) Dial() error
- func (c *GseLinuxConnection) Read(b []byte) (int, error)
- func (c *GseLinuxConnection) SetHost(host string)
- func (c *GseLinuxConnection) SetWriteTimeout(t time.Duration)
- func (c *GseLinuxConnection) Write(b []byte) (int, error)
- type GseLocalCommandMsg
- type GseMsg
- type GseOpMsg
- type GseRequestConfMsg
- type GseSimpleClient
Constants ¶
const ( EINVAL int = iota ErrNetClosing ErrIOTimeout EPIPE )
const ( GSE_TYPE_COMMON = 3072 + 1 // MSG_DATA_REPORT GSE_TYPE_GET_CONF = 0x0A // REPORT_SYNC_CONFIG GSE_TYPE_DYNAMIC = 0x09 // REPORT_DYNAMICAL_PROTOCOL_TYPE GSE_TYPE_OP = 3072 + 12 // MSG_DATA_REPORT_OPS GSE_TYPE_TLOGC = 0x02 // REPORT_EXT )
gse protocol type
const ( GSE_TYPE_DYNAMIC_DEFAULT_META_MAX_LEN = 408 // keep same with gse (8 + 128) * 3 = 408b GSE_TYPE_DYNAMIC_EXT_HEAD_LEN = 24 // sizeof (index ... metaCount) = 24B GSE_TYPE_DYNAMIC_META_LEN = 8 // len(keyLen) + len(valueLen) = 8B )
const ( BYTE = 1.0 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE )
const (
GSE_FLAG_REDUNDENCY = 0x01 // PLUGIN_REDUNDENCY_FLAG
)
gse protocol flags
const MockAddress = "/tmp/ipc.state.report"
const MockNetwork = "unix"
Variables ¶
This section is empty.
Functions ¶
func StartMockAgent ¶
func StartMockAgent()
Types ¶
type Config ¶
type Config struct { ReconnectTimes uint `config:"reconnecttimes"` RetryTimes uint `config:"retrytimes"` RetryInterval time.Duration `config:"retryinterval"` MsgQueueSize uint `config:"mqsize"` WriteTimeout time.Duration `config:"writetimeout"` Endpoint string `config:"endpoint"` Nonblock bool `config:"nonblock"` // TODO not used now }
Config GseClient config
type GseClient ¶
type GseClient struct {
// contains filtered or unexported fields
}
GseClient : gse client used for send data and get agent info
func NewGseClient ¶
NewGseClient create a gse client host set to default gse ipc path, different from linux and windows
func NewGseClientFromConfig ¶
func (*GseClient) GetAgentInfo ¶
GetAgentInfo : get agent info client will update info from gse agent every 1min request from agent first time when client start
func (*GseClient) SendWithNewConnection ¶
SendWithNewConnection : send msg to client with new connection every time
type GseCommonMsg ¶
type GseCommonMsg struct {
// contains filtered or unexported fields
}
GseCommonMsg : msg for GSE_TYPE_COMMON
func NewGseCommonMsg ¶
func NewGseCommonMsg(data []byte, dataid int32, resv1, resv2, flag uint32) *GseCommonMsg
NewGseCommonMsg
type GseCommonMsgHead ¶
type GseCommonMsgHead struct {
// contains filtered or unexported fields
}
GseCommonMsgHead
type GseConnection ¶
type GseConnection interface { Dial() error Close() error Write(b []byte) (int, error) SetWriteTimeout(t time.Duration) Read(b []byte) (int, error) SetHost(host string) }
GseConnection : gse connection
type GseDynamicMetaInfo ¶
type GseDynamicMetaInfo struct {
// contains filtered or unexported fields
}
GseDynamicMetaInfo
type GseDynamicMsg ¶
type GseDynamicMsg struct {
// contains filtered or unexported fields
}
GseDynamicMsg :
func NewGseDynamicMsg ¶
func NewGseDynamicMsg(data []byte, dataid int32, resv1, resv2 uint32) *GseDynamicMsg
NewGseDynamicMsg : new GseDynamicMsg
func (*GseDynamicMsg) ToBytes ¶
func (msg *GseDynamicMsg) ToBytes() []byte
ToBytes : change msg to bytes
type GseDynamicMsgHead ¶
type GseDynamicMsgHead struct { GseCommonMsgHead // contains filtered or unexported fields }
GseDynamicMsgHead
type GseLinuxConnection ¶
type GseLinuxConnection struct {
// contains filtered or unexported fields
}
GseLinuxConnection : gse socket struct on Linux
func NewGseConnection ¶
func NewGseConnection() *GseLinuxConnection
NewGseConnection : create a gse client host set to default gse ipc path, different from linux and windows
func (*GseLinuxConnection) Close ¶
func (c *GseLinuxConnection) Close() error
Close : release resources
func (*GseLinuxConnection) Dial ¶
func (c *GseLinuxConnection) Dial() error
Dial : connect to gse agent
func (*GseLinuxConnection) SetHost ¶
func (c *GseLinuxConnection) SetHost(host string)
SetHost : set agent host
func (*GseLinuxConnection) SetWriteTimeout ¶
func (c *GseLinuxConnection) SetWriteTimeout(t time.Duration)
type GseLocalCommandMsg ¶
GseLocalCommandMsg
type GseRequestConfMsg ¶
type GseRequestConfMsg struct {
GseCommonMsg
}
GseRequestConfMsg : msg for GSE_TYPE_GET_CONF
type GseSimpleClient ¶
type GseSimpleClient struct {
// contains filtered or unexported fields
}
GseSimpleClient : gse client used for send data and get agent info
func NewGseSimpleClient ¶
func NewGseSimpleClient() *GseSimpleClient
NewGseSimpleClient create a gse client host set to default gse ipc path, different from linux and windows
func (*GseSimpleClient) GetAgentInfo ¶
func (c *GseSimpleClient) GetAgentInfo() (AgentInfo, error)
GetAgentInfo : get agent info client will update info from gse agent every 1min request from agent first time when client start
func (*GseSimpleClient) Send ¶
func (c *GseSimpleClient) Send(msg GseMsg) error
Send : send msg to client will bolck when queue is full
func (*GseSimpleClient) SetAgentHost ¶
func (c *GseSimpleClient) SetAgentHost(host string)
SetAgentHost : set agent host
func (*GseSimpleClient) Start ¶
func (c *GseSimpleClient) Start() error
Start : start client start to recv msg and get agent info run as goroutine
func (*GseSimpleClient) SyncGetAgentInfo ¶
func (c *GseSimpleClient) SyncGetAgentInfo() (AgentInfo, error)
SyncGetAgentInfo : sync request agent info