bak

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

历史数据更新

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoadPastData

type LoadPastData struct {
	sync.Mutex
	Title string

	Close       chan bool
	MsgChan     chan *master.Msg // WS发送的消息管道
	Conn        *websocket.Conn  // WS客户端
	DataIndex   public.DataIndex
	DataStorage *public.DataStorage
	StartTime   int64     // 历史数据开始时间
	EndTime     int64     // 历史数据结束时间
	LoadState   chan bool // 历史数据是否全部加载完毕,从开始时间到结束时间的数据全都加载到了内存(DataStorage)中就算完毕
	// contains filtered or unexported fields
}

连续更新数据类型

func NewLoadPastData

func NewLoadPastData(di public.DataIndex, ds *public.DataStorage, sTime, eTime int64) (lpd *LoadPastData, err error)

创建一个连续更新的实例

func (*LoadPastData) CloseWs

func (this *LoadPastData) CloseWs()

CloseWs 主动关闭连接

func (*LoadPastData) LoadFileCache

func (this *LoadPastData) LoadFileCache(di public.DataIndex) (lastTime int64, err error)

通过DataIndex加载本地文件到内存,返回最后时间戳

func (*LoadPastData) ReConnect

func (this *LoadPastData) ReConnect()

Reconnect 断开重连

func (*LoadPastData) SendMsg

func (this *LoadPastData) SendMsg(msg *master.Msg)

给Master发送数据,队列的形式,防止WS并发写

Jump to

Keyboard shortcuts

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