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

Function insertChunk

unix_test.go:77–98  ·  view source on GitHub ↗
(t *testing.T, db *btesting.DB, chunkId int)

Source from the content-addressed store, hash-verified

75}
76
77func insertChunk(t *testing.T, db *btesting.DB, chunkId int) {
78 chunkSize := 1024
79
80 if err := db.Update(func(tx *bolt.Tx) error {
81 b, err := tx.CreateBucketIfNotExists([]byte("bucket"))
82 if err != nil {
83 t.Fatal(err)
84 }
85
86 for i := 0; i < chunkSize; i++ {
87 key := []byte(fmt.Sprintf("key-%d-%d", chunkId, i))
88 value := []byte("value")
89 if err := b.Put(key, value); err != nil {
90 t.Fatal(err)
91 }
92 }
93
94 return nil
95 }); err != nil {
96 t.Fatal(err)
97 }
98}
99
100// Main reason for this check is travis limiting mlockable memory to 64KB
101// https://github.com/travis-ci/travis-ci/issues/2462

Callers 1

TestMlock_DbCanGrow_BigFunction · 0.85

Calls 4

UpdateMethod · 0.80
FatalMethod · 0.65
PutMethod · 0.45

Tested by

no test coverage detected