MCPcopy Create free account
hub / github.com/nutsdb/nutsdb / createTestEntry

Function createTestEntry

merge_v2_test.go:464–485  ·  view source on GitHub ↗
(bucketID core.BucketId, key, value []byte, flag uint16, status uint16, ttl uint32, ts uint64, txID uint64, ds core.DataStructure)

Source from the content-addressed store, hash-verified

462func (r *recordingHintWriter) Close() error { return nil }
463
464func createTestEntry(bucketID core.BucketId, key, value []byte, flag uint16, status uint16, ttl uint32, ts uint64, txID uint64, ds core.DataStructure) *core.Entry {
465 meta := core.NewMetaData().
466 WithBucketId(uint64(bucketID)).
467 WithKeySize(uint32(len(key))).
468 WithValueSize(uint32(len(value))).
469 WithFlag(flag).
470 WithStatus(status).
471 WithTTL(ttl).
472 WithTimeStamp(ts).
473 WithTxID(txID).
474 WithDs(uint16(ds))
475
476 entry := &core.Entry{
477 Key: append([]byte(nil), key...),
478 Value: append([]byte(nil), value...),
479 Meta: meta,
480 }
481
482 // Encode once to populate CRC and ensure the entry is well-formed.
483 entry.Encode()
484 return entry
485}
486
487func TestMergeV2PrepareWhileAlreadyMerging(t *testing.T) {
488 dir := t.TempDir()

Calls 12

EncodeMethod · 0.95
NewMetaDataFunction · 0.92
appendFunction · 0.85
WithDsMethod · 0.80
WithTimeStampMethod · 0.80
WithStatusMethod · 0.80
WithFlagMethod · 0.80
WithKeySizeMethod · 0.80
WithBucketIdMethod · 0.80
WithTxIDMethod · 0.45
WithTTLMethod · 0.45
WithValueSizeMethod · 0.45

Tested by

no test coverage detected