This repository has been archived by the owner on Jun 20, 2023. It is now read-only.
forked from linxGnu/grocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_read_test.go
75 lines (56 loc) · 2.19 KB
/
options_read_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package grocksdb
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestReadOptions(t *testing.T) {
ro := NewDefaultReadOptions()
defer ro.Destroy()
require.EqualValues(t, true, ro.VerifyChecksums())
ro.SetVerifyChecksums(false)
require.EqualValues(t, false, ro.VerifyChecksums())
require.EqualValues(t, true, ro.FillCache())
ro.SetFillCache(false)
require.EqualValues(t, false, ro.FillCache())
ro.SetSnapshot(newNativeSnapshot(nil))
ro.SetIterateUpperBound([]byte{1, 2, 3})
ro.SetIterateLowerBound([]byte{1, 1, 1})
ro.SetTimestamp([]byte{1, 2, 3})
ro.SetIterStartTimestamp([]byte{1, 2, 3})
require.EqualValues(t, ReadAllTier, ro.GetReadTier())
ro.SetReadTier(BlockCacheTier)
require.EqualValues(t, BlockCacheTier, ro.GetReadTier())
require.EqualValues(t, false, ro.Tailing())
ro.SetTailing(true)
require.EqualValues(t, true, ro.Tailing())
require.EqualValues(t, 0, ro.GetReadaheadSize())
ro.SetReadaheadSize(1 << 20)
require.EqualValues(t, 1<<20, ro.GetReadaheadSize())
require.EqualValues(t, false, ro.PrefixSameAsStart())
ro.SetPrefixSameAsStart(true)
require.EqualValues(t, true, ro.PrefixSameAsStart())
require.EqualValues(t, false, ro.PinData())
ro.SetPinData(true)
require.EqualValues(t, true, ro.PinData())
require.EqualValues(t, false, ro.GetTotalOrderSeek())
ro.SetTotalOrderSeek(true)
require.EqualValues(t, true, ro.GetTotalOrderSeek())
require.EqualValues(t, 0, ro.GetMaxSkippableInternalKeys())
ro.SetMaxSkippableInternalKeys(123)
require.EqualValues(t, 123, ro.GetMaxSkippableInternalKeys())
require.EqualValues(t, false, ro.GetBackgroundPurgeOnIteratorCleanup())
ro.SetBackgroundPurgeOnIteratorCleanup(true)
require.EqualValues(t, true, ro.GetBackgroundPurgeOnIteratorCleanup())
require.EqualValues(t, false, ro.IgnoreRangeDeletions())
ro.SetIgnoreRangeDeletions(true)
require.EqualValues(t, true, ro.IgnoreRangeDeletions())
require.EqualValues(t, 0, ro.GetDeadline())
ro.SetDeadline(1000)
require.EqualValues(t, 1000, ro.GetDeadline())
require.EqualValues(t, 0, ro.GetIOTimeout())
ro.SetIOTimeout(1212)
require.EqualValues(t, 1212, ro.GetIOTimeout())
require.False(t, ro.IsAsyncIO())
ro.SetAsyncIO(true)
require.True(t, ro.IsAsyncIO())
}