github.com/zhiqiangxu/util@v0.0.0-20230112053021-0a7aee056cd5/diskqueue/conf.go (about) 1 package diskqueue 2 3 import ( 4 "context" 5 "sync" 6 "time" 7 ) 8 9 // CustomDecoder for customized packets 10 type CustomDecoder func(context.Context, *QfileSizeReader) (bool, []byte, error) 11 12 // Conf for diskqueue 13 type Conf struct { 14 Directory string 15 WriteBatch int 16 WriteMmap bool 17 MaxMsgSize int 18 CustomDecoder CustomDecoder 19 MaxPutting int 20 EnableWriteBuffer bool 21 MaxFileSize int64 22 PersistDuration time.Duration // GC works at qfile granularity 23 // below only valid when EnableWriteBuffer is true 24 // unit: second 25 CommitInterval int 26 WriteBufferPool *sync.Pool 27 // below are modified internally for cache 28 writeBufferPool *sync.Pool 29 customDecoder bool 30 }