예제 #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
}