Documentation
¶
Overview ¶
* ===========================================================================
- 行为数据结构
- Behavioral data structure
===========================================================================
* ===========================================================================
- 双向链表队列
- Double linked list queue
===========================================================================
Index ¶
- Constants
- type BehaviorActionS
- type BehaviorForestS
- type BehaviorTaskS
- type BehaviorTreeS
- type CommanderPiece
- type ConnQHub
- type Const
- type ExpressI
- type GMessageS
- type MessageS
- type QueueS
- func (queue *QueueS) Back() *list.Element
- func (queue *QueueS) Contains(element interface{}) *list.Element
- func (queue *QueueS) Delete(e *list.Element) interface{}
- func (queue *QueueS) Front() *list.Element
- func (queue *QueueS) GetMaxLen() int
- func (queue *QueueS) IsEmpty() bool
- func (queue *QueueS) Len() int
- func (queue *QueueS) New(maxLen ...int) *QueueS
- func (queue *QueueS) Pop() interface{}
- func (queue *QueueS) PopPeek() interface{}
- func (queue *QueueS) Push(value interface{})
- func (queue *QueueS) Renew()
- func (queue *QueueS) SetMaxLen(maxLen int)
- func (queue *QueueS) Shift() interface{}
- func (queue *QueueS) ShiftPeek() interface{}
- func (queue *QueueS) ToArray() []*list.Element
- func (queue *QueueS) ToArrayV() []interface{}
- func (queue *QueueS) UnShift(value interface{})
- type RequestParamS
- type ResponseDataS
- type SQLDataS
- type ServerS
- type SocketClient
- type SyncMapHub
- func (hub *SyncMapHub) AtomProcess(k string, cb func())
- func (hub *SyncMapHub) Convert2Map() map[string]interface{}
- func (hub *SyncMapHub) DeepCopyMap() <-chan syncMapTuple
- func (hub *SyncMapHub) Del(k string)
- func (hub *SyncMapHub) Get(k string) interface{}
- func (hub *SyncMapHub) GetShard(key string) *syncMapShard
- func (hub *SyncMapHub) Init(tags ...string)
- func (hub *SyncMapHub) IsEmpty() bool
- func (hub *SyncMapHub) Iterator(cb func(n int, k string, v interface{}) bool)
- func (hub *SyncMapHub) Key2Slice(needSorts ...bool) []string
- func (hub *SyncMapHub) Len() int
- func (hub *SyncMapHub) Pop(k string) interface{}
- func (hub *SyncMapHub) Set(k string, v interface{})
- func (hub *SyncMapHub) SetByMap(data map[string]interface{})
- func (hub *SyncMapHub) Val2Slice() []interface{}
- type TimeS
- type UDPPacket
- type WebsocketI
Constants ¶
const ( LogInfo int = iota LogDebug LogTrace LogWarn LogError LogCritical )
* Log Type */
const ShardSize = 32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BehaviorActionS ¶
type BehaviorActionS struct {
Tag string
// 任务
Command string
// 参数
Params string
// 回调
Callback string
}
* 行为动作 */
type BehaviorForestS ¶
type BehaviorForestS struct {
// 行为树编号
UUIDQ *QueueS /* UUID */
// 行为树容器
Trees SyncMapHub /* map[UUID]*model.BehaviorTreeS */
// 错误容器
ErrorQ *QueueS /* string */
}
type BehaviorTaskS ¶
* 行为任务 */
type CommanderPiece ¶
* CommanderQueue内容数据结构 */
type Const ¶
type Const struct {
/* Application Running Environment
0 -> dev
1 -> test
2 -> produce
*/
RunEnv int
Version string
NeuronId string
SystemSplit string
CommanderHost string
CommanderLog bool
BehaviorTree behaviorTreeS
AutorunConfig autorunS
ErrorCode map[int]string
Database databaseS
Redis redisS
File fileS
Proxy proxyS
HTTPRequest requestS
HTTPServer serverS
HTTPS tlsServerS
WSParam wsParamS
TCPParam tcpParamS
UDPParam udpParamS
UartParam uartParamS
Interval intervalS
}
type ExpressI ¶
type ExpressI interface {
// 获取服务启动状态
IsStarted() bool
// 启动服务
StartService()
// 停止服务
StopService()
}
* Saas服务接口 */
type QueueS ¶
type QueueS struct {
// contains filtered or unexported fields
}
type RequestParamS ¶
type RequestParamS struct {
PostData interface{}
Host string
Path string
Header map[string][]string
}
* Request参数 */
var postData = {
'msg': 'Hello World!'
};
var params = {
postData : postData,
hostname: 'www.google.com',
port: 80,
path: '/upload',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
}
type ResponseDataS ¶
* Response对象 */
type SQLDataS ¶
type SQLDataS struct {
Column []string
// Rows.([]interface)[Column]
Data []interface{}
}
* 数据库数据对象 */
type SocketClient ¶
type SocketClient struct {
//* 此Tag为配置文件中NeuronId */
Tag string
Conn interface{} /* ws -> [*websocket.Conn] | tcp -> [net.Conn] | */
}
* Socket客户端结构 */
type SyncMapHub ¶
type SyncMapHub struct {
Tag string
// contains filtered or unexported fields
}
* 线程安全的map容器 */
func (*SyncMapHub) AtomProcess ¶
func (hub *SyncMapHub) AtomProcess(k string, cb func())
* 原子操作[防止指针引用过程中锁无效] */
func (*SyncMapHub) Convert2Map ¶
func (hub *SyncMapHub) Convert2Map() map[string]interface{}
* 转化成map[string]interface{} */
func (*SyncMapHub) DeepCopyMap ¶
func (hub *SyncMapHub) DeepCopyMap() <-chan syncMapTuple
* 利用Channel化数据深拷贝Map */
func (*SyncMapHub) GetShard ¶
func (hub *SyncMapHub) GetShard(key string) *syncMapShard
* 根据Key获取分区编号 */
func (*SyncMapHub) Iterator ¶
func (hub *SyncMapHub) Iterator(cb func(n int, k string, v interface{}) bool)
* 迭代器 [return true -> 继续运行] [return false -> 停止运行] */
func (*SyncMapHub) Key2Slice ¶
func (hub *SyncMapHub) Key2Slice(needSorts ...bool) []string
* 获取所有Key */
func (*SyncMapHub) SetByMap ¶
func (hub *SyncMapHub) SetByMap(data map[string]interface{})
* 通过map设置元素 */
type TimeS ¶
type TimeS struct {
YMD string
Week time.Weekday
Time string
Timestamp string
TimestampMill string
TimestampNano string
Datetime time.Time
}
* 时间信息 */
type WebsocketI ¶
type WebsocketI interface {
// 服务器容器
WSHub() SyncMapHub
// 消息解析模块
GMessageHandler(interface{}, interface{})
}
* WS通信接口 */