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

Method Fill

internal/btesting/btesting.go:170–188  ·  view source on GitHub ↗

Fill - fills the DB using numTx transactions and numKeysPerTx.

(bucket []byte, numTx int, numKeysPerTx int,
	keyGen func(tx int, key int) []byte,
	valueGen func(tx int, key int) []byte)

Source from the content-addressed store, hash-verified

168
169// Fill - fills the DB using numTx transactions and numKeysPerTx.
170func (db *DB) Fill(bucket []byte, numTx int, numKeysPerTx int,
171 keyGen func(tx int, key int) []byte,
172 valueGen func(tx int, key int) []byte) error {
173 for tr := 0; tr < numTx; tr++ {
174 err := db.Update(func(tx *bolt.Tx) error {
175 b, _ := tx.CreateBucketIfNotExists(bucket)
176 for i := 0; i < numKeysPerTx; i++ {
177 if err := b.Put(keyGen(tr, i), valueGen(tr, i)); err != nil {
178 return err
179 }
180 }
181 return nil
182 })
183 if err != nil {
184 return err
185 }
186 }
187 return nil
188}
189
190func (db *DB) Path() string {
191 return db.f

Callers 15

TestOpen_SizeFunction · 0.80
fillDBWithKeysFunction · 0.80
createFilledDBFunction · 0.80
TestTx_Check_CorruptPageFunction · 0.80
TestTx_Check_PanicFunction · 0.80
TestRevertMetaPageFunction · 0.80
TestFindPathsToKeyFunction · 0.80
TestSurgery_CopyPageFunction · 0.80

Calls 3

UpdateMethod · 0.95
PutMethod · 0.45

Tested by 15

TestOpen_SizeFunction · 0.64
fillDBWithKeysFunction · 0.64
createFilledDBFunction · 0.64
TestTx_Check_CorruptPageFunction · 0.64
TestTx_Check_PanicFunction · 0.64
TestRevertMetaPageFunction · 0.64
TestFindPathsToKeyFunction · 0.64
TestSurgery_CopyPageFunction · 0.64