コード例 #1
0
ファイル: dbm.go プロジェクト: pmezard/exp
// CreateMem creates an in-memory DB not backed by a disk file.  Memory DBs are
// resource limited as they are completely held in memory and are not
// automatically persisted.
//
// For the meaning of opts please see documentation of Options.
func CreateMem(opts *Options) (db *DB, err error) {
	f := lldb.NewMemFiler()
	if opts.ACID == ACIDFull {
		opts.ACID = ACIDTransactions
	}
	return create(nil, f, opts, true)
}
コード例 #2
0
ファイル: file.go プロジェクト: yifan-gu/ql
func (s *file) Verify() (allocs int64, err error) {
	defer s.lock()()
	var stat lldb.AllocStats
	if err = s.a.Verify(lldb.NewMemFiler(), nil, &stat); err != nil {
		return
	}

	allocs = stat.AllocAtoms
	return
}
コード例 #3
0
ファイル: kv.go プロジェクト: mervin0502/kv
// CreateMem creates a new instance of an in-memory DB not backed by a disk
// file. Memory DBs are resource limited as they are completely held in memory
// and are not automatically persisted.
//
// For the meaning of opts please see documentation of Options.
func CreateMem(opts *Options) (db *DB, err error) {
	opts = opts.clone()
	opts._ACID = _ACIDTransactions
	f := lldb.NewMemFiler()
	return create(nil, f, opts, true)
}