You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
540 B
31 lines
540 B
1 month ago
|
package dataSource
|
||
|
|
||
|
import (
|
||
|
"gitea.anxinyun.cn/container/common_models"
|
||
|
"sync"
|
||
|
)
|
||
|
|
||
|
type DataChannels struct {
|
||
|
RawDataChan chan common_models.IotaData
|
||
|
AggDataChan chan common_models.AggData
|
||
|
}
|
||
|
|
||
|
var (
|
||
|
once sync.Once
|
||
|
dataChannels *DataChannels
|
||
|
)
|
||
|
|
||
|
func InitChannels() *DataChannels {
|
||
|
once.Do(func() {
|
||
|
dataChannels = &DataChannels{
|
||
|
RawDataChan: make(chan common_models.IotaData, 1),
|
||
|
AggDataChan: make(chan common_models.AggData, 1),
|
||
|
}
|
||
|
})
|
||
|
return dataChannels
|
||
|
}
|
||
|
|
||
|
func GetChannels() *DataChannels {
|
||
|
return dataChannels
|
||
|
}
|