func NewKvStatCache(gen string) *KvStatCache { fullPath := filepath.Join(osutil.CacheDir(), "camput.statcache."+escapeGen(gen)+".kv") db, err := kvutil.Open(fullPath, nil) if err != nil { log.Fatalf("Could not create/open new stat cache at %v, %v", fullPath, err) } return &KvStatCache{ filename: fullPath, db: db, } }
// newKeyValueFromJSONConfig returns a KeyValue implementation on top of a // github.com/cznic/kv file. func newKeyValueFromJSONConfig(cfg jsonconfig.Obj) (sorted.KeyValue, error) { file := cfg.RequiredString("file") if err := cfg.Validate(); err != nil { return nil, err } opts := &kv.Options{} db, err := kvutil.Open(file, opts) if err != nil { return nil, err } is := &kvis{ db: db, opts: opts, path: file, } return is, nil }