當前位置: 首頁>>代碼示例>>Golang>>正文


Golang C.leveldb_create_iterator函數代碼示例

本文整理匯總了Golang中C.leveldb_create_iterator函數的典型用法代碼示例。如果您正苦於以下問題:Golang leveldb_create_iterator函數的具體用法?Golang leveldb_create_iterator怎麽用?Golang leveldb_create_iterator使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了leveldb_create_iterator函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewIterator

func (db *DB) NewIterator() driver.IIterator {
	it := new(Iterator)

	it.it = C.leveldb_create_iterator(db.db, db.iteratorOpts.Opt)

	return it
}
開發者ID:huanshi,項目名稱:ledisdb,代碼行數:7,代碼來源:db.go

示例2: NewIterator

func (s *Snapshot) NewIterator() *Iterator {
	it := new(Iterator)

	it.it = C.leveldb_create_iterator(s.db.db, s.iteratorOpts.Opt)

	return it
}
開發者ID:Gohan,項目名稱:ledisdb,代碼行數:7,代碼來源:snapshot.go

示例3: Iter

func (self *Leveldb) Iter(fun func(string, Getter) bool) {
	iterator := C.leveldb_create_iterator(self.cdb, self.read_options)
	defer C.leveldb_iter_destroy(iterator)
	var keyLen C.size_t
	var keyValue *C.char
	var valueLen C.size_t
	var valueValue *C.char
	var ret bool
	for C.leveldb_iter_seek_to_first(iterator); C.leveldb_iter_valid(iterator) != levelFalse; C.leveldb_iter_next(iterator) {
		keyValue = C.leveldb_iter_key(iterator, &keyLen)
		key := string(C.GoBytes(unsafe.Pointer(keyValue), C.int(keyLen)))
		valueValue = C.leveldb_iter_value(iterator, &valueLen)
		value := C.GoBytes(unsafe.Pointer(valueValue), C.int(valueLen))
		r := bytes.NewReader(value)
		ret = fun(key, func(e interface{}) error {
			return decode(r, e)
		})
		if ret == false {
			break
		}
	}
}
開發者ID:reusee,項目名稱:obox,代碼行數:22,代碼來源:leveldb.go

示例4: NewIterator

// NewIterator returns an Iterator over the the database that uses the
// ReadOptions given.
//
// Often, this is used for large, offline bulk reads while serving live
// traffic. In that case, it may be wise to disable caching so that the data
// processed by the returned Iterator does not displace the already cached
// data. This can be done by calling SetFillCache(false) on the ReadOptions
// before passing it here.
//
// Similiarly, ReadOptions.SetSnapshot is also useful.
func (db *DB) NewIterator(ro *ReadOptions) *Iterator {
	it := C.leveldb_create_iterator(db.Ldb, ro.Opt)
	return &Iterator{Iter: it}
}
開發者ID:olehz,項目名稱:hyperleveldb-go,代碼行數:14,代碼來源:db.go


注:本文中的C.leveldb_create_iterator函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。