MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / GetListKeys

Method GetListKeys

engine/db.go:272–289  ·  view source on GitHub ↗

GetListKeys Gets all the keys in the database

()

Source from the content-addressed store, hash-verified

270
271// GetListKeys Gets all the keys in the database
272func (db *DB) GetListKeys() [][]byte {
273 // Retrieve an iterator for the index
274 iterator := db.index.Iterator(false)
275
276 // Create a slice to store the keys
277 keys := make([][]byte, db.index.Size())
278
279 var idx int
280 // Iterate over the index
281 for iterator.Rewind(); iterator.Valid(); iterator.Next() {
282 // Retrieve the key from the current iterator position
283 keys[idx] = iterator.Key()
284 idx++
285 }
286
287 // Return the list of keys
288 return keys
289}
290
291// Fold get all the data and perform the operation specified by the user.
292// The function returns false to exit

Callers 14

TestDB_GetListKeysFunction · 0.95
TestDB_Merge2Function · 0.95
TestDB_Merge3Function · 0.95
TestGetListKeysHandlerFunction · 0.80
GetListKeysHandlerMethod · 0.80
minMethod · 0.80
maxMethod · 0.80
KeysMethod · 0.80
KeysMethod · 0.80
KeysMethod · 0.80
GetFieldsMethod · 0.80
KeysMethod · 0.80

Calls 6

IteratorMethod · 0.65
SizeMethod · 0.65
RewindMethod · 0.65
ValidMethod · 0.65
NextMethod · 0.65
KeyMethod · 0.65

Tested by 4

TestDB_GetListKeysFunction · 0.76
TestDB_Merge2Function · 0.76
TestDB_Merge3Function · 0.76
TestGetListKeysHandlerFunction · 0.64