MCPcopy
hub / github.com/etcd-io/bbolt / fillDBWithKeys

Function fillDBWithKeys

db_test.go:1520–1525  ·  view source on GitHub ↗

Convenience function for inserting a bunch of keys with values of a specific size (in bytes)

(db *btesting.DB, numKeys, valueSize int)

Source from the content-addressed store, hash-verified

1518
1519// Convenience function for inserting a bunch of keys with values of a specific size (in bytes)
1520func fillDBWithKeys(db *btesting.DB, numKeys, valueSize int) error {
1521 return db.Fill([]byte("data"), 1, numKeys,
1522 func(tx int, k int) []byte { return []byte(fmt.Sprintf("%04d", k)) },
1523 func(tx int, k int) []byte { return make([]byte, valueSize) },
1524 )
1525}
1526
1527// Creates a new database size, forces a specific allocation size jump, and fills it with the number of keys specified
1528func createFilledDB(t testing.TB, o *bolt.Options, allocSize int, numKeys int) *btesting.DB {

Calls 1

FillMethod · 0.80

Tested by

no test coverage detected