Exemplo n.º 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
}
Exemplo n.º 2
0
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
}