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

Function TestDB_WriteBatch1

engine/batch_test.go:92–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestDB_WriteBatch1(t *testing.T) {
93 opts := config.DefaultOptions
94 dir := "/tmp/batch-3"
95 opts.DirPath = dir
96 db, err := NewDB(opts)
97 defer db.Clean()
98 assert.Nil(t, err)
99 assert.NotNil(t, db)
100
101 // Manual stop during batch submission
102 wbopt := config.DefaultWriteBatchOptions
103 wbopt.MaxBatchNum = 1000000
104 wb := db.NewWriteBatch(wbopt)
105 for i := 0; i < 500000; i++ {
106 err = wb.Put(randkv.GetTestKey(i), randkv.RandomValue(1024))
107 assert.Nil(t, err)
108 }
109
110 err = wb.Commit()
111 assert.Nil(t, err)
112
113}

Callers

nothing calls this directly

Calls 7

CleanMethod · 0.95
NewWriteBatchMethod · 0.95
PutMethod · 0.95
CommitMethod · 0.95
GetTestKeyFunction · 0.92
RandomValueFunction · 0.92
NewDBFunction · 0.85

Tested by

no test coverage detected