github.com/weedge/lib@v0.0.0-20230424045628-a36dcc1d90e4/asyncbuffer/define.go (about) 1 package asyncbuffer 2 3 import ( 4 "sync" 5 ) 6 7 const ( 8 DefaultBufferWindowSize int = 1 9 DefaultDelaySendTimeMs int = 10 10 ) 11 12 type IBuffer interface { 13 BatchDo([][]byte) 14 FormatInput() (error, []byte) 15 } 16 17 type DemoBuffer struct { 18 Name string 19 } 20 21 type InputBufferItem struct { 22 ChName string 23 Data IBuffer 24 } 25 26 type SendChannel struct { 27 ChName string 28 ChLen int 29 SubWorkerNum int 30 } 31 32 type Conf struct { 33 BufferName string 34 BufferSendChannel map[string]*SendChannel 35 BufferWindowSize int 36 DelaySendTime int 37 } 38 39 type SendData struct { 40 BufferName string 41 MapDataCh map[string]chan []byte 42 BufferData [][]byte 43 BufferIndex int64 44 BufferWindowSize int 45 ISendObj IBuffer 46 IsFlushCh chan bool 47 DelaySendTime int 48 OpLock sync.Mutex 49 BufferDayCounter uint64 50 }