forked from linxGnu/grocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_blob_test.go
38 lines (28 loc) · 1.02 KB
/
options_blob_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
package grocksdb
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestOptionBlobFile(t *testing.T) {
opt := NewDefaultOptions()
defer opt.Destroy()
opt.EnableBlobFiles(true)
require.True(t, opt.IsBlobFilesEnabled())
opt.SetMinBlobSize(1024)
require.EqualValues(t, 1024, opt.GetMinBlobSize())
require.EqualValues(t, 256<<20, opt.GetBlobFileSize())
opt.SetBlobFileSize(128 << 20)
require.EqualValues(t, 128<<20, opt.GetBlobFileSize())
require.Equal(t, NoCompression, opt.GetBlobCompressionType())
opt.SetBlobCompressionType(SnappyCompression)
require.Equal(t, SnappyCompression, opt.GetBlobCompressionType())
require.False(t, opt.IsBlobGCEnabled())
opt.EnableBlobGC(true)
require.True(t, opt.IsBlobGCEnabled())
require.EqualValues(t, 0.25, opt.GetBlobGCAgeCutoff())
opt.SetBlobGCAgeCutoff(0.3)
require.EqualValues(t, 0.3, opt.GetBlobGCAgeCutoff())
require.EqualValues(t, 1.0, opt.GetBlobGCForceThreshold())
opt.SetBlobGCForceThreshold(1.3)
require.EqualValues(t, 1.3, opt.GetBlobGCForceThreshold())
}