Skip to content

Commit f973f98

Browse files
committed
fix linter
1 parent fda58ee commit f973f98

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

executor/localdb.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
//数据的get set 主要经过 cache
1313
//如果需要进行list, 那么把get set 的内容加入到 后端数据库
1414
type LocalDB struct {
15-
cache *CacheDB
16-
txcache *CacheDB
15+
cache *cacheDB
16+
txcache *cacheDB
1717
keys []string
1818
intx bool
1919
hasbegin bool
@@ -36,8 +36,8 @@ func NewLocalDB(cli queue.Client, readOnly bool) db.KVDB {
3636
panic(err)
3737
}
3838
return &LocalDB{
39-
cache: NewCacheDB(),
40-
txcache: NewCacheDB(),
39+
cache: newcacheDB(),
40+
txcache: newcacheDB(),
4141
txid: txid,
4242
client: cli,
4343
api: api,
@@ -219,18 +219,18 @@ func (l *LocalDB) PrefixCount(prefix []byte) (count int64) {
219219
panic("localdb not support PrefixCount")
220220
}
221221

222-
type CacheDB struct {
222+
type cacheDB struct {
223223
data map[string][]byte
224224
}
225225

226-
func NewCacheDB() *CacheDB {
227-
return &CacheDB{
226+
func newcacheDB() *cacheDB {
227+
return &cacheDB{
228228
data: make(map[string][]byte, 1024),
229229
}
230230
}
231231

232232
//return a flag: is key is in cache
233-
func (db *CacheDB) Get(key []byte) (value []byte, incache bool, err error) {
233+
func (db *cacheDB) Get(key []byte) (value []byte, incache bool, err error) {
234234
if db.data == nil {
235235
return nil, false, types.ErrNotFound
236236
}
@@ -241,18 +241,18 @@ func (db *CacheDB) Get(key []byte) (value []byte, incache bool, err error) {
241241
return nil, ok, types.ErrNotFound
242242
}
243243

244-
func (db *CacheDB) Set(key []byte, value []byte) {
244+
func (db *cacheDB) Set(key []byte, value []byte) {
245245
if db.data == nil {
246246
db.data = make(map[string][]byte, 1024)
247247
}
248248
db.data[string(key)] = value
249249
}
250250

251-
func (db *CacheDB) Reset() {
251+
func (db *cacheDB) Reset() {
252252
db.data = nil
253253
}
254254

255-
func (db *CacheDB) Merge(db2 *CacheDB) {
255+
func (db *cacheDB) Merge(db2 *cacheDB) {
256256
for k, v := range db2.data {
257257
db.data[k] = v
258258
}

0 commit comments

Comments
 (0)