// Copyright Fuzamei Corp. 2018 All Rights Reserved. // Use of this source code is governed by a BSD-style // license that can be found In the LICENSE file. package timeline import ( "github.com/33cn/chain33/queue" drivers "github.com/33cn/chain33/system/mempool" "github.com/33cn/chain33/types" ) func init() { drivers.Reg("timeline", New) } type subConfig struct { PoolCacheSize int64 `json:"poolCacheSize"` } //New 创建timeline cache 结构的 mempool func New(cfg *types.Mempool, sub []byte) queue.Module { c := drivers.NewMempool(cfg) var subcfg subConfig types.MustDecode(sub, &subcfg) if subcfg.PoolCacheSize == 0 { subcfg.PoolCacheSize = cfg.PoolCacheSize } c.SetQueueCache(drivers.NewSimpleQueue(int(subcfg.PoolCacheSize))) return c }