MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestWriteBatch_Data

Function TestWriteBatch_Data

driver/hybriddb/write_batch_test.go:237–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

235}
236
237func TestWriteBatch_Data(t *testing.T) {
238 tempDir := t.TempDir()
239 cfg := &config.Config{
240 LevelDB: config.LevelDBConfig{
241 CacheSize: 64 * 1024 * 1024,
242 BlockSize: 4 * 1024,
243 WriteBufferSize: 4 * 1024 * 1024,
244 MaxOpenFiles: 1000,
245 Compression: true,
246 },
247 }
248
249 db, err := Store{}.Open(tempDir, cfg)
250 require.NoError(t, err)
251 defer db.Close()
252
253 wb := db.NewWriteBatch()
254 defer wb.Close()
255
256 // Add operations
257 wb.Put([]byte("key1"), []byte("value1"))
258 wb.Delete([]byte("key2"))
259 wb.Put([]byte("key3"), []byte("value3"))
260
261 // Get batch data
262 data := wb.Data()
263 assert.NotNil(t, data)
264 assert.Greater(t, len(data), 0)
265
266 // Commit should still work
267 err = wb.Commit()
268 require.NoError(t, err)
269}
270
271func TestWriteBatch_Concurrent(t *testing.T) {
272 tempDir := t.TempDir()

Callers

nothing calls this directly

Calls 8

CloseMethod · 0.95
PutMethod · 0.95
DeleteMethod · 0.95
DataMethod · 0.95
CommitMethod · 0.95
CloseMethod · 0.65
OpenMethod · 0.45
NewWriteBatchMethod · 0.45

Tested by

no test coverage detected