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

Function prepareBuckets

movebucket_test.go:344–355  ·  view source on GitHub ↗

prepareBuckets opens the bucket chain. For each bucket in the chain, open it if existed, otherwise create it and populate sample data.

(t testing.TB, tx *bbolt.Tx, buckets ...string)

Source from the content-addressed store, hash-verified

342// prepareBuckets opens the bucket chain. For each bucket in the chain,
343// open it if existed, otherwise create it and populate sample data.
344func prepareBuckets(t testing.TB, tx *bbolt.Tx, buckets ...string) *bbolt.Bucket {
345 var bk *bbolt.Bucket
346
347 for _, key := range buckets {
348 if childBucket := openBucket(tx, bk, key); childBucket == nil {
349 bk = createBucketAndPopulateData(t, tx, bk, key)
350 } else {
351 bk = childBucket
352 }
353 }
354 return bk
355}
356
357func openBucket(tx *bbolt.Tx, bk *bbolt.Bucket, bucketToOpen string) *bbolt.Bucket {
358 if bk == nil {

Callers 3

TestTx_MoveBucketFunction · 0.85

Calls 2

openBucketFunction · 0.85

Tested by

no test coverage detected