-
Notifications
You must be signed in to change notification settings - Fork 3
/
groupstore_GEN_test.go
63 lines (58 loc) · 1.53 KB
/
groupstore_GEN_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
package store
import (
"io"
"os"
"github.com/gholt/locmap"
)
func newTestGroupStore(c *GroupStoreConfig) (*defaultGroupStore, chan error) {
if c == nil {
c = newTestGroupStoreConfig()
}
s, err := NewGroupStore(c)
ds := s.(*defaultGroupStore)
return ds, err
}
func newTestGroupStoreConfig() *GroupStoreConfig {
locmap := locmap.NewGroupLocMap(&locmap.GroupLocMapConfig{
Roots: 1,
PageSize: 1,
})
return &GroupStoreConfig{
ValueCap: 1024,
Workers: 2,
ChecksumInterval: 1024,
PageSize: 1,
WritePagesPerWorker: 1,
GroupLocMap: locmap,
MsgCap: 1,
FileCap: 1024 * 1024,
FileReaders: 2,
RecoveryBatchSize: 1024,
TombstoneDiscardBatchSize: 1024,
OutPullReplicationBloomN: 1000,
openReadSeeker: func(fullPath string) (io.ReadSeeker, error) {
return &memFile{buf: &memBuf{}}, nil
},
openWriteSeeker: func(fullPath string) (io.WriteSeeker, error) {
return &memFile{buf: &memBuf{}}, nil
},
readdirnames: func(fullPath string) ([]string, error) {
return nil, nil
},
createWriteCloser: func(fullPath string) (io.WriteCloser, error) {
return &memFile{buf: &memBuf{}}, nil
},
stat: func(fullPath string) (os.FileInfo, error) {
return &memFileInfo{}, nil
},
remove: func(fullPath string) error {
return nil
},
rename: func(oldFullPath string, newFullPath string) error {
return nil
},
isNotExist: func(err error) bool {
return false
},
}
}