示例#1
0
func NewBitcask(dirpath string, depth, pos int, before int64) (b *Bitcask, err error) {
	b = new(Bitcask)
	b.path = dirpath

	cpath := C.CString(dirpath)
	defer C.free(unsafe.Pointer(cpath))
	b.bc = C.bc_open(cpath, C.int(depth), C.int(pos), C.time_t(before))

	if b.bc == nil {
		return nil, errors.New("open bitcask failed" + dirpath)
	}
	return
}
示例#2
0
文件: bitcask.go 项目: haiger/beansdb
func NewBitcask(dirpath string, depth, pos int, before int64) (b *Bitcask, err os.Error) {
	b = new(Bitcask)
	b.path = dirpath

	cpath := C.CString(dirpath)
	defer C.free(unsafe.Pointer(cpath))
	b.bc = C.bc_open(cpath, (_Ctype_int)(depth), (_Ctype_int)(pos), (_Ctypedef_time_t)(before))

	if b.bc == nil {
		return nil, os.NewError("open bitcask failed" + dirpath)
	}
	return
}