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

Function TestTx_PutWithTimestamp

tx_test.go:157–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestTx_PutWithTimestamp(t *testing.T) {
158 withDefaultDB(t, func(t *testing.T, db *DB) {
159 bucket := "bucket_put_with_timestamp"
160
161 timestamps := []uint64{1547707905, 1547707910, uint64(time.Now().Unix())}
162
163 { // put with timestamp
164 txCreateBucket(t, db, DataStructureBTree, bucket, nil)
165
166 tx, err := db.Begin(true)
167 assert.NoError(t, err)
168 for i, timestamp := range timestamps {
169 key := []byte("key_" + fmt.Sprintf("%03d", i))
170 val := []byte("val_" + fmt.Sprintf("%03d", i))
171
172 err = tx.PutWithTimestamp(bucket, key, val, 0, timestamp)
173 assert.NoError(t, err)
174
175 }
176 err = tx.Commit()
177 assert.NoError(t, err)
178 }
179 })
180}
181
182func TestTx_Commit(t *testing.T) {
183 t.Run("build_bucket_indexes_after_commit", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

withDefaultDBFunction · 0.85
txCreateBucketFunction · 0.85
BeginMethod · 0.80
PutWithTimestampMethod · 0.80
CommitMethod · 0.80

Tested by

no test coverage detected