func NewChainSet(flushType int, flushDuration time.Duration) *ChainSet {
	return &ChainSet{
		FlushDuration: flushDuration,
		flushType:     flushType,
		Cmap:          make(map[string]*chain),
		cancel:        make(chan interface{}),
	}
}
NewChainSet returns a new ChainSet for managing chains during runtime.
package file
import (
	"encoding/json"
	"fmt"
	"os"
	"runtime"
	"strings"
	"sync"
	"time"
)
var Chains *ChainSet
func init() {
	Chains = NewChainSet(FlushAsTime, time.Second*10)
	Chains.Run()
}
const (
	BlockDataSeparator = "|"
	FileExtension = ".json"
)
const (
	FlushAsTime = 0
	FlushAsSpace = 1
)
type ChainSet struct {
	FlushDuration time.Duration
	flushType     int
	Cmap          map[string]*chain
	cancel        chan interface{}
	mux           sync.RWMutex
}