interqueue

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

README

内部队列

主要用来数据缓冲用,分了两个类型

  • xqueue:用于rulex内部
  • yqueue:用于和外部通信

代码简单就不做赘述,稍微读一下即可看懂。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InQueue

func InQueue() chan InteractQueueData

* * GetQueue *

func OutQueue

func OutQueue() chan InteractQueueData

func ReceiveData

func ReceiveData(data InteractQueueData)

func SendData

func SendData(data InteractQueueData)

* * 给前端推送数据 *

func StartDataCacheQueue

func StartDataCacheQueue()

TODO: 下个版本更换为可扩容的Chan

Types

type DataCacheQueue

type DataCacheQueue struct {
	Queue       chan QueueData
	OutQueue    chan QueueData
	InQueue     chan QueueData
	DeviceQueue chan QueueData
	// contains filtered or unexported fields
}

* * DataCacheQueue *

func (*DataCacheQueue) GetDeviceQueue added in v0.6.5

func (q *DataCacheQueue) GetDeviceQueue() chan QueueData

* *GetDeviceQueue *

func (*DataCacheQueue) GetInQueue added in v0.6.5

func (q *DataCacheQueue) GetInQueue() chan QueueData

* * GetQueue *

func (*DataCacheQueue) GetOutQueue added in v0.6.5

func (q *DataCacheQueue) GetOutQueue() chan QueueData

* * GetQueue *

func (*DataCacheQueue) GetQueue

func (q *DataCacheQueue) GetQueue() chan QueueData

* * GetQueue *

func (*DataCacheQueue) GetSize

func (q *DataCacheQueue) GetSize() int

func (*DataCacheQueue) Push

func (q *DataCacheQueue) Push(d QueueData) error

* * Push *

func (*DataCacheQueue) PushDeviceQueue

func (q *DataCacheQueue) PushDeviceQueue(Device *typex.Device, data string) error

* * PushDeviceQueue *

func (*DataCacheQueue) PushInQueue

func (q *DataCacheQueue) PushInQueue(in *typex.InEnd, data string) error

* *PushInQueue *

func (*DataCacheQueue) PushOutQueue

func (q *DataCacheQueue) PushOutQueue(out *typex.OutEnd, data string) error

* * PushOutQueue *

func (*DataCacheQueue) PushQueue

func (q *DataCacheQueue) PushQueue(qd QueueData) error

* * *

type InteractQueue

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

func InitInteractQueue

func InitInteractQueue(rulex typex.RuleX, maxQueueSize int) *InteractQueue

type InteractQueueData

type InteractQueueData struct {
	Topic       string                 `json:"topic"`
	ComponentId string                 `json:"componentId"`
	Data        map[string]interface{} `json:"data"`
}

* * 前后端交互数据 *

func (InteractQueueData) String

func (v InteractQueueData) String() string

type QueueData

type QueueData struct {
	Debug bool // 是否是Debug消息
	I     *typex.InEnd
	O     *typex.OutEnd
	D     *typex.Device
	E     typex.RuleX
	Data  string
}

func (QueueData) String

func (qd QueueData) String() string

type XQueue

type XQueue interface {
	GetQueue() chan QueueData
	GetInQueue() chan QueueData
	GetOutQueue() chan QueueData
	GetDeviceQueue() chan QueueData
	GetSize() int
	Push(QueueData) error
	PushQueue(QueueData) error
	PushInQueue(in *typex.InEnd, data string) error
	PushOutQueue(in *typex.OutEnd, data string) error
	PushDeviceQueue(in *typex.Device, data string) error
}

* * XQueue *

var DefaultDataCacheQueue XQueue

func InitDataCacheQueue

func InitDataCacheQueue(rulex typex.RuleX, maxQueueSize int) XQueue

Jump to

Keyboard shortcuts

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