// NewConfig new a config. func NewConfig(conf string) (c *Config, err error) { var ( file *os.File blob []byte ) c = new(Config) if file, err = os.Open(conf); err != nil { return } if blob, err = ioutil.ReadAll(file); err != nil { return } if err = toml.Unmarshal(blob, c); err == nil { c.BlockMaxSize = needle.Size(c.NeedleMaxSize) c.Block.BufferSize = needle.Size(c.NeedleMaxSize) } return }
package index import ( "bfs/libs/errors" "bfs/store/conf" "bfs/store/needle" "os" "testing" "time" ) var ( testConf = &conf.Config{ NeedleMaxSize: 4 * 1024 * 1024, BlockMaxSize: needle.Size(4 * 1024 * 1024), Index: &conf.Index{ BufferSize: 4 * 1024 * 1024, MergeDelay: conf.Duration{10 * time.Second}, MergeWrite: 5, RingBuffer: 10, SyncWrite: 10, Syncfilerange: true, }, } ) func TestIndex(t *testing.T) { var ( i *Indexer err error noffset uint32