Jelajahi Sumber

feat(store): refactor and doc update

1. Refactor pkg/store to pkg/kv and let it only contains interface. pkg must not import any internal packages.
2. Refactor some functions to return error at last to comply to the coding style.
3. Fix redisTs last() problem when the value is empty which will cause panic now when checkpoint cold start.
4. Update doc and CN translate.

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 3 tahun lalu
induk
melakukan
77de2be6bd
44 mengubah file dengan 183 tambahan dan 707 penghapusan
  1. 2 0
      docs/en_US/operation/configuration_file.md
  2. 36 0
      docs/zh_CN/operation/configuration_file.md
  3. 6 6
      internal/pkg/db/database.go
  4. 7 7
      internal/pkg/store/builder.go
  5. 3 3
      internal/pkg/store/redis/redisKv.go
  6. 3 3
      internal/pkg/store/redis/redisStoreBuilder.go
  7. 5 5
      internal/pkg/store/redisKv_test.go
  8. 3 3
      pkg/kv/setup.go
  9. 3 3
      internal/pkg/store/sql/sqlKv.go
  10. 3 3
      internal/pkg/store/sql/sqlStoreBuilder.go
  11. 5 5
      internal/pkg/store/sqlKv_test.go
  12. 15 16
      pkg/kv/stores.go
  13. 6 6
      internal/pkg/store/test/common/test.go
  14. 3 3
      internal/pkg/ts/builder.go
  15. 7 5
      internal/pkg/ts/redis/redisTs.go
  16. 2 2
      internal/pkg/ts/redis/redisTsBuilder.go
  17. 6 7
      internal/pkg/ts/redisTs_test.go
  18. 2 2
      internal/pkg/ts/sql/sqlTsBuilder.go
  19. 6 7
      internal/pkg/ts/sqlTs_test.go
  20. 8 8
      internal/pkg/ts/test/common/test.go
  21. 4 5
      internal/plugin/manager.go
  22. 5 5
      internal/processor/rule.go
  23. 3 3
      internal/processor/stream.go
  24. 2 2
      internal/server/server.go
  25. 5 5
      internal/service/manager.go
  26. 2 2
      internal/testx/testUtil.go
  27. 2 2
      internal/topo/context/default_test.go
  28. 3 3
      internal/topo/node/sink_cache.go
  29. 2 2
      internal/topo/planner/analyzer.go
  30. 3 3
      internal/topo/planner/analyzer_test.go
  31. 3 3
      internal/topo/planner/planner.go
  32. 3 3
      internal/topo/planner/planner_test.go
  33. 8 6
      internal/topo/state/kv_store.go
  34. 2 2
      internal/topo/state/kv_store_test.go
  35. 3 3
      internal/xsql/stmtx.go
  36. 1 1
      pkg/kv/stores/kv.go
  37. 1 1
      pkg/kv/stores/tskv.go
  38. 0 20
      tools/migration/README-CN.md
  39. 0 21
      tools/migration/README.md
  40. 0 10
      tools/migration/go.mod
  41. 0 274
      tools/migration/go.sum
  42. 0 33
      tools/migration/main.go
  43. 0 123
      tools/migration/util/migration.go
  44. 0 81
      tools/migration/util/migration_test.go

+ 2 - 0
docs/en_US/operation/configuration_file.md

@@ -139,8 +139,10 @@ The content of the page should be similar as below.
 ```
 
 ## Store configurations
+
 There is possibility to configure storage of state for application. Default storage layer is sqlite database. There is option to set redis as storage.
 In order to use redis as store type property must be changed into redis value.
+
 ### Sqlite
     
 It has properties

+ 36 - 0
docs/zh_CN/operation/configuration_file.md

@@ -138,3 +138,39 @@ http://host:port/kuiper-plugins/0.9.1/alpine/functions
   disableCache: false
 ```
 
+## 存储配置
+
+可通过配置修改创建的流和规则等状态的存储方式。默认情况下,程序状态存储在 sqlite 数据库中。把存储类型改成 redis,可使用 redis 作为存储方式。
+
+### Sqlite
+
+可配置如下属性:
+* path - 配置 sqlite 存储路径。若为空则存储在默认的 data 目录中。
+* name - 数据库文件名。若为空,则设置为默认名字`sqliteKV.db`。
+
+### Redis
+
+可配置如下属性:
+* host     - redis 服务器地址。
+* port     - redis 服务器端口。
+* password - redis 服务器密码。若 redis 未配置认证系统,则可不设置密码。
+* timeout  - 连接超时时间。
+
+### 配置示例
+
+```yaml
+    store:
+      #Type of store that will be used for keeping state of the application
+      type: sqlite
+      redis:
+        host: localhost
+        port: 6379
+        password: kuiper
+        #Timeout in ms
+        timeout: 1000
+      sqlite:
+        #Sqlite absolute database path, if left empty default directory of the application will be used
+        path:
+        #Sqlite file name, if left empty name of db will be sqliteKV.db
+        name:
+```

+ 6 - 6
internal/pkg/db/database.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ type Database interface {
 	Disconnect() error
 }
 
-func CreateDatabase(conf Config) (error, Database) {
+func CreateDatabase(conf Config) (Database, error) {
 	var db Database
 	var err error
 	databaseType := conf.Type
@@ -36,14 +36,14 @@ func CreateDatabase(conf Config) (error, Database) {
 	case "sqlite":
 		err, db = sqlite.NewSqliteDatabase(conf.Sqlite)
 		if err != nil {
-			return err, nil
+			return nil, err
 		}
 	default:
-		return fmt.Errorf("unrecognized database type - %s", databaseType), nil
+		return nil, fmt.Errorf("unrecognized database type - %s", databaseType)
 	}
 	err = db.Connect()
 	if err != nil {
-		return err, nil
+		return nil, err
 	}
-	return nil, db
+	return db, nil
 }

+ 7 - 7
internal/pkg/store/builder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,22 +21,22 @@ import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql"
 	rb "github.com/lf-edge/ekuiper/internal/pkg/store/redis"
 	sb "github.com/lf-edge/ekuiper/internal/pkg/store/sql"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type Builder interface {
-	CreateStore(table string) (error, st.KeyValue)
+	CreateStore(table string) (kv.KeyValue, error)
 }
 
-func CreateStoreBuilder(database db.Database) (error, Builder) {
+func CreateStoreBuilder(database db.Database) (Builder, error) {
 	switch database.(type) {
 	case *redis.Instance:
 		d := *database.(*redis.Instance)
-		return nil, rb.NewStoreBuilder(d)
+		return rb.NewStoreBuilder(d), nil
 	case sql.Database:
 		d := database.(sql.Database)
-		return nil, sb.NewStoreBuilder(d)
+		return sb.NewStoreBuilder(d), nil
 	default:
-		return fmt.Errorf("unrecognized database type"), nil
+		return nil, fmt.Errorf("unrecognized database type")
 	}
 }

+ 3 - 3
internal/pkg/store/redis/redisKv.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -32,13 +32,13 @@ type redisKvStore struct {
 	keyPrefix string
 }
 
-func CreateRedisKvStore(redis dbRedis.Instance, table string) (error, *redisKvStore) {
+func CreateRedisKvStore(redis dbRedis.Instance, table string) (*redisKvStore, error) {
 	store := &redisKvStore{
 		database:  redis,
 		table:     table,
 		keyPrefix: fmt.Sprintf("%s:%s", KvPrefix, table),
 	}
-	return nil, store
+	return store, nil
 }
 
 func (kv redisKvStore) Setnx(key string, value interface{}) error {

+ 3 - 3
internal/pkg/store/redis/redisStoreBuilder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ package redis
 
 import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/redis"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type StoreBuilder struct {
@@ -29,6 +29,6 @@ func NewStoreBuilder(redis redis.Instance) StoreBuilder {
 	}
 }
 
-func (b StoreBuilder) CreateStore(table string) (error, stores.KeyValue) {
+func (b StoreBuilder) CreateStore(table string) (kv.KeyValue, error) {
 	return CreateRedisKvStore(b.database, table)
 }

+ 5 - 5
internal/pkg/store/redisKv_test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -19,7 +19,7 @@ import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/redis"
 	rb "github.com/lf-edge/ekuiper/internal/pkg/store/redis"
 	"github.com/lf-edge/ekuiper/internal/pkg/store/test/common"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"strconv"
 	"testing"
 )
@@ -50,7 +50,7 @@ func TestRedisKvKeys(t *testing.T) {
 	common.TestKvKeys(length, ks, t)
 }
 
-func setupRedisKv() (st.KeyValue, *redis.Instance, *miniredis.Miniredis) {
+func setupRedisKv() (kv.KeyValue, *redis.Instance, *miniredis.Miniredis) {
 	minRedis, err := miniredis.Run()
 	if err != nil {
 		panic(err)
@@ -61,8 +61,8 @@ func setupRedisKv() (st.KeyValue, *redis.Instance, *miniredis.Miniredis) {
 		panic(err)
 	}
 	builder := rb.NewStoreBuilder(redisDB)
-	var ks st.KeyValue
-	err, ks = builder.CreateStore("test")
+	var ks kv.KeyValue
+	ks, err = builder.CreateStore("test")
 	if err != nil {
 		panic(err)
 	}

+ 3 - 3
pkg/kv/setup.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package kv
+package store
 
 import (
 	"github.com/lf-edge/ekuiper/internal/conf"
@@ -57,7 +57,7 @@ func SetupWithKuiperConfig(conf *conf.KuiperConf) error {
 }
 
 func Setup(config db.Config) error {
-	err, database := db.CreateDatabase(config)
+	database, err := db.CreateDatabase(config)
 	if err != nil {
 		return err
 	}

+ 3 - 3
internal/pkg/store/sql/sqlKv.go

@@ -30,7 +30,7 @@ type sqlKvStore struct {
 	table    string
 }
 
-func createSqlKvStore(database dbSql.Database, table string) (error, *sqlKvStore) {
+func createSqlKvStore(database dbSql.Database, table string) (*sqlKvStore, error) {
 	store := &sqlKvStore{
 		database: database,
 		table:    table,
@@ -41,9 +41,9 @@ func createSqlKvStore(database dbSql.Database, table string) (error, *sqlKvStore
 		return err
 	})
 	if err != nil {
-		return err, nil
+		return nil, err
 	}
-	return nil, store
+	return store, nil
 }
 
 func (kv *sqlKvStore) Setnx(key string, value interface{}) error {

+ 3 - 3
internal/pkg/store/sql/sqlStoreBuilder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ package sql
 
 import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type StoreBuilder struct {
@@ -29,6 +29,6 @@ func NewStoreBuilder(d sql.Database) StoreBuilder {
 	}
 }
 
-func (b StoreBuilder) CreateStore(table string) (error, stores.KeyValue) {
+func (b StoreBuilder) CreateStore(table string) (kv.KeyValue, error) {
 	return createSqlKvStore(b.database, table)
 }

+ 5 - 5
internal/pkg/store/sqlKv_test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql/sqlite"
 	sb "github.com/lf-edge/ekuiper/internal/pkg/store/sql"
 	"github.com/lf-edge/ekuiper/internal/pkg/store/test/common"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"os"
 	"path"
 	"path/filepath"
@@ -62,7 +62,7 @@ func deleteIfExists(abs string) error {
 	return nil
 }
 
-func setupSqlKv() (st.KeyValue, *sqlite.Database, string) {
+func setupSqlKv() (kv.KeyValue, *sqlite.Database, string) {
 	absPath, err := filepath.Abs("test")
 	if err != nil {
 		panic(err)
@@ -82,8 +82,8 @@ func setupSqlKv() (st.KeyValue, *sqlite.Database, string) {
 	}
 
 	builder := sb.NewStoreBuilder(db)
-	var store st.KeyValue
-	err, store = builder.CreateStore(Table)
+	var store kv.KeyValue
+	store, err = builder.CreateStore(Table)
 	if err != nil {
 		panic(err)
 	}

+ 15 - 16
pkg/kv/stores.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,30 +12,29 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package kv
+package store
 
 import (
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/pkg/db"
-	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/pkg/ts"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	kv2 "github.com/lf-edge/ekuiper/pkg/kv"
 	"sync"
 )
 
 type stores struct {
-	kv        map[string]st.KeyValue
-	ts        map[string]st.Tskv
+	kv        map[string]kv2.KeyValue
+	ts        map[string]kv2.Tskv
 	mu        sync.Mutex
-	kvBuilder store.Builder
+	kvBuilder Builder
 	tsBuilder ts.Builder
 }
 
 func newStores(db db.Database) (error, *stores) {
 	var err error
-	var kvBuilder store.Builder
+	var kvBuilder Builder
 	var tsBuilder ts.Builder
-	err, kvBuilder = store.CreateStoreBuilder(db)
+	kvBuilder, err = CreateStoreBuilder(db)
 	if err != nil {
 		return err, nil
 	}
@@ -44,21 +43,21 @@ func newStores(db db.Database) (error, *stores) {
 		return err, nil
 	}
 	return nil, &stores{
-		kv:        make(map[string]st.KeyValue),
-		ts:        make(map[string]st.Tskv),
+		kv:        make(map[string]kv2.KeyValue),
+		ts:        make(map[string]kv2.Tskv),
 		mu:        sync.Mutex{},
 		kvBuilder: kvBuilder,
 		tsBuilder: tsBuilder,
 	}
 }
 
-func (s *stores) GetKV(table string) (error, st.KeyValue) {
+func (s *stores) GetKV(table string) (error, kv2.KeyValue) {
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	if ks, contains := s.kv[table]; contains {
 		return nil, ks
 	}
-	err, ks := s.kvBuilder.CreateStore(table)
+	ks, err := s.kvBuilder.CreateStore(table)
 	if err != nil {
 		return err, nil
 	}
@@ -66,7 +65,7 @@ func (s *stores) GetKV(table string) (error, st.KeyValue) {
 	return nil, ks
 }
 
-func (s *stores) GetTS(table string) (error, st.Tskv) {
+func (s *stores) GetTS(table string) (error, kv2.Tskv) {
 	s.mu.Lock()
 	defer s.mu.Unlock()
 	if tts, contains := s.ts[table]; contains {
@@ -88,14 +87,14 @@ func InitGlobalStores(db db.Database) error {
 	return err
 }
 
-func GetKV(table string) (error, st.KeyValue) {
+func GetKV(table string) (error, kv2.KeyValue) {
 	if globalStores == nil {
 		return fmt.Errorf("global stores are not initialized"), nil
 	}
 	return globalStores.GetKV(table)
 }
 
-func GetTS(table string) (error, st.Tskv) {
+func GetTS(table string) (error, kv2.Tskv) {
 	if globalStores == nil {
 		return fmt.Errorf("global stores are not initialized"), nil
 	}

+ 6 - 6
internal/pkg/store/test/common/test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,12 +16,12 @@ package common
 
 import (
 	"fmt"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"reflect"
 	"testing"
 )
 
-func TestKvSetnx(ks stores.KeyValue, t *testing.T) {
+func TestKvSetnx(ks kv.KeyValue, t *testing.T) {
 
 	if err := ks.Setnx("foo", "bar"); nil != err {
 		t.Error(err)
@@ -32,7 +32,7 @@ func TestKvSetnx(ks stores.KeyValue, t *testing.T) {
 	}
 }
 
-func TestKvSet(ks stores.KeyValue, t *testing.T) {
+func TestKvSet(ks kv.KeyValue, t *testing.T) {
 
 	if err := ks.Set("foo", "bar"); nil != err {
 		t.Error(err)
@@ -43,7 +43,7 @@ func TestKvSet(ks stores.KeyValue, t *testing.T) {
 	}
 }
 
-func TestKvGet(ks stores.KeyValue, t *testing.T) {
+func TestKvGet(ks kv.KeyValue, t *testing.T) {
 
 	if err := ks.Setnx("foo", "bar"); nil != err {
 		t.Error(err)
@@ -59,7 +59,7 @@ func TestKvGet(ks stores.KeyValue, t *testing.T) {
 	}
 }
 
-func TestKvKeys(length int, ks stores.KeyValue, t *testing.T) {
+func TestKvKeys(length int, ks kv.KeyValue, t *testing.T) {
 
 	expected := make([]string, 0)
 	for i := 0; i < length; i++ {

+ 3 - 3
internal/pkg/ts/builder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,11 +21,11 @@ import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql"
 	rb "github.com/lf-edge/ekuiper/internal/pkg/ts/redis"
 	sb "github.com/lf-edge/ekuiper/internal/pkg/ts/sql"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type Builder interface {
-	CreateTs(table string) (error, stores.Tskv)
+	CreateTs(table string) (error, kv.Tskv)
 }
 
 func CreateTsBuilder(database db.Database) (error, Builder) {

+ 7 - 5
internal/pkg/ts/redis/redisTs.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -124,11 +124,13 @@ func (t ts) Last(value interface{}) (int64, error) {
 		if err != nil {
 			return err
 		}
-		dec := gob.NewDecoder(bytes.NewBuffer(tmp[0]))
-		if err = dec.Decode(value); err != nil {
-			return err
+		if len(tmp) > 0 {
+			dec := gob.NewDecoder(bytes.NewBuffer(tmp[0]))
+			if err = dec.Decode(value); err != nil {
+				return err
+			}
+			last, err = strconv.ParseInt(string(tmp[1]), 10, 64)
 		}
-		last, err = strconv.ParseInt(string(tmp[1]), 10, 64)
 		return err
 	})
 	if err != nil {

+ 2 - 2
internal/pkg/ts/redis/redisTsBuilder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ package redis
 
 import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/redis"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	st "github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type TsBuilder struct {

+ 6 - 7
internal/pkg/ts/redisTs_test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,14 +12,13 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package ts
+package redis
 
 import (
 	"github.com/alicebob/miniredis/v2"
 	"github.com/lf-edge/ekuiper/internal/pkg/db/redis"
-	rb "github.com/lf-edge/ekuiper/internal/pkg/ts/redis"
 	"github.com/lf-edge/ekuiper/internal/pkg/ts/test/common"
-	st "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	ts2 "github.com/lf-edge/ekuiper/pkg/kv"
 	"strconv"
 	"testing"
 )
@@ -59,7 +58,7 @@ func TestRedisTsDeleteBefore(t *testing.T) {
 	common.TestTsDeleteBefore(ks, t)
 }
 
-func setupRedisKv() (st.Tskv, *redis.Instance, *miniredis.Miniredis) {
+func setupRedisKv() (ts2.Tskv, *redis.Instance, *miniredis.Miniredis) {
 	minRedis, err := miniredis.Run()
 	if err != nil {
 		panic(err)
@@ -70,8 +69,8 @@ func setupRedisKv() (st.Tskv, *redis.Instance, *miniredis.Miniredis) {
 		panic(err)
 	}
 
-	builder := rb.NewTsBuilder(redisDB)
-	var ks st.Tskv
+	builder := NewTsBuilder(redisDB)
+	var ks ts2.Tskv
 	err, ks = builder.CreateTs("test")
 	if err != nil {
 		panic(err)

+ 2 - 2
internal/pkg/ts/sql/sqlTsBuilder.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@ package sql
 
 import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql"
-	ts2 "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	ts2 "github.com/lf-edge/ekuiper/pkg/kv"
 )
 
 type TsBuilder struct {

+ 6 - 7
internal/pkg/ts/sqlTs_test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -12,13 +12,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package ts
+package sql
 
 import (
 	"github.com/lf-edge/ekuiper/internal/pkg/db/sql/sqlite"
-	sb "github.com/lf-edge/ekuiper/internal/pkg/ts/sql"
 	"github.com/lf-edge/ekuiper/internal/pkg/ts/test/common"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	ts2 "github.com/lf-edge/ekuiper/pkg/kv"
 	"os"
 	"path"
 	"path/filepath"
@@ -73,7 +72,7 @@ func deleteIfExists(abs string) error {
 	return nil
 }
 
-func setupSqlKv() (stores.Tskv, *sqlite.Database, string) {
+func setupSqlKv() (ts2.Tskv, *sqlite.Database, string) {
 	absPath, err := filepath.Abs("test")
 	if err != nil {
 		panic(err)
@@ -92,11 +91,11 @@ func setupSqlKv() (stores.Tskv, *sqlite.Database, string) {
 		panic(err)
 	}
 
-	builder := sb.NewTsBuilder(db)
+	builder := NewTsBuilder(db)
 	if err != nil {
 		panic(err)
 	}
-	var store stores.Tskv
+	var store ts2.Tskv
 	err, store = builder.CreateTs(Table)
 	if err != nil {
 		panic(err)

+ 8 - 8
internal/pkg/ts/test/common/test.go

@@ -1,4 +1,4 @@
-// Copyright 2021 INTECH Process Automation Ltd.
+// Copyright 2021 EMQ Technologies Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
 package common
 
 import (
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"reflect"
 	"testing"
 )
@@ -25,7 +25,7 @@ var (
 	Values = []string{"bar1", "bar15", "bar2", "bar3"}
 )
 
-func TestTsSet(ks stores.Tskv, t *testing.T) {
+func TestTsSet(ks kv.Tskv, t *testing.T) {
 	load(ks, t)
 
 	if ok, err := ks.Set(2500, "bar25"); nil != err {
@@ -35,7 +35,7 @@ func TestTsSet(ks stores.Tskv, t *testing.T) {
 	}
 }
 
-func TestTsLast(ks stores.Tskv, t *testing.T) {
+func TestTsLast(ks kv.Tskv, t *testing.T) {
 	load(ks, t)
 
 	var v string
@@ -46,7 +46,7 @@ func TestTsLast(ks stores.Tskv, t *testing.T) {
 	}
 }
 
-func TestTsGet(ks stores.Tskv, t *testing.T) {
+func TestTsGet(ks kv.Tskv, t *testing.T) {
 	load(ks, t)
 
 	var value string
@@ -59,7 +59,7 @@ func TestTsGet(ks stores.Tskv, t *testing.T) {
 	}
 }
 
-func TestTsDelete(ks stores.Tskv, t *testing.T) {
+func TestTsDelete(ks kv.Tskv, t *testing.T) {
 	load(ks, t)
 
 	if err := ks.Delete(1500); nil != err {
@@ -72,7 +72,7 @@ func TestTsDelete(ks stores.Tskv, t *testing.T) {
 	}
 }
 
-func TestTsDeleteBefore(ks stores.Tskv, t *testing.T) {
+func TestTsDeleteBefore(ks kv.Tskv, t *testing.T) {
 	load(ks, t)
 
 	if ok, err := ks.Set(3500, "bar35"); nil != err {
@@ -110,7 +110,7 @@ func TestTsDeleteBefore(ks stores.Tskv, t *testing.T) {
 	}
 }
 
-func load(ks stores.Tskv, t *testing.T) {
+func load(ks kv.Tskv, t *testing.T) {
 	for i := 0; i < len(Keys); i++ {
 		k := Keys[i]
 		v := Values[i]

+ 4 - 5
internal/plugin/manager.go

@@ -22,11 +22,10 @@ import (
 	"github.com/lf-edge/ekuiper/internal/conf"
 	"github.com/lf-edge/ekuiper/internal/pkg/filex"
 	"github.com/lf-edge/ekuiper/internal/pkg/httpx"
-	"github.com/lf-edge/ekuiper/pkg/kv"
-
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/errorx"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"io/ioutil"
 	"os"
 	"os/exec"
@@ -280,7 +279,7 @@ type Manager struct {
 	pluginDir string
 	etcDir    string
 	registry  *Registry
-	db        stores.KeyValue
+	db        kv.KeyValue
 }
 
 func NewPluginManager() (*Manager, error) {
@@ -296,7 +295,7 @@ func NewPluginManager() (*Manager, error) {
 			outerErr = fmt.Errorf("cannot find etc folder: %s", err)
 			return
 		}
-		err, db := kv.GetKV("pluginFuncs")
+		err, db := store.GetKV("pluginFuncs")
 		if err != nil {
 			outerErr = fmt.Errorf("error when opening db: %v.", err)
 		}

+ 5 - 5
internal/processor/rule.go

@@ -19,6 +19,7 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/topo"
 	"github.com/lf-edge/ekuiper/internal/topo/node"
 	"github.com/lf-edge/ekuiper/internal/topo/planner"
@@ -27,15 +28,14 @@ import (
 	"github.com/lf-edge/ekuiper/pkg/cast"
 	"github.com/lf-edge/ekuiper/pkg/errorx"
 	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
 )
 
 type RuleProcessor struct {
-	db stores.KeyValue
+	db kv.KeyValue
 }
 
 func NewRuleProcessor() *RuleProcessor {
-	err, db := kv.GetKV("rule")
+	err, db := store.GetKV("rule")
 	if err != nil {
 		panic(fmt.Sprintf("Can not initalize store for the rule processor at path 'rule': %v", err))
 	}
@@ -233,7 +233,7 @@ func (p *RuleProcessor) ExecDrop(name string) (string, error) {
 }
 
 func cleanCheckpoint(name string) error {
-	err, db := kv.GetTS(name)
+	err, db := store.GetTS(name)
 	if err != nil {
 		return err
 	}
@@ -241,7 +241,7 @@ func cleanCheckpoint(name string) error {
 }
 
 func cleanSinkCache(rule *api.Rule) error {
-	err, store := kv.GetKV("sink")
+	err, store := store.GetKV("sink")
 	if err != nil {
 		return err
 	}

+ 3 - 3
internal/processor/stream.go

@@ -19,11 +19,11 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/xsql"
 	"github.com/lf-edge/ekuiper/pkg/ast"
 	"github.com/lf-edge/ekuiper/pkg/errorx"
 	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
 	"strings"
 )
 
@@ -32,11 +32,11 @@ var (
 )
 
 type StreamProcessor struct {
-	db stores.KeyValue
+	db kv.KeyValue
 }
 
 func NewStreamProcessor() *StreamProcessor {
-	err, db := kv.GetKV("stream")
+	err, db := store.GetKV("stream")
 	if err != nil {
 		panic(fmt.Sprintf("Can not initalize store for the stream processor at path 'stream': %v", err))
 	}

+ 2 - 2
internal/server/server.go

@@ -16,11 +16,11 @@ package server
 
 import (
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/plugin"
 	"github.com/lf-edge/ekuiper/internal/processor"
 	"github.com/lf-edge/ekuiper/internal/service"
 	"github.com/lf-edge/ekuiper/internal/xsql"
-	"github.com/lf-edge/ekuiper/pkg/kv"
 	"github.com/prometheus/client_golang/prometheus/promhttp"
 
 	"context"
@@ -49,7 +49,7 @@ func StartUp(Version, LoadFileType string) {
 	startTimeStamp = time.Now().Unix()
 	conf.InitConf()
 
-	err := kv.SetupWithKuiperConfig(conf.Config)
+	err := store.SetupWithKuiperConfig(conf.Config)
 	if err != nil {
 		panic(err)
 	}

+ 5 - 5
internal/service/manager.go

@@ -20,9 +20,9 @@ import (
 	kconf "github.com/lf-edge/ekuiper/internal/conf"
 	"github.com/lf-edge/ekuiper/internal/pkg/filex"
 	"github.com/lf-edge/ekuiper/internal/pkg/httpx"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
 	"io/ioutil"
 	"os"
 	"path"
@@ -44,8 +44,8 @@ type Manager struct {
 	functionBuf  *sync.Map
 
 	etcDir     string
-	serviceKV  stores.KeyValue
-	functionKV stores.KeyValue
+	serviceKV  kv.KeyValue
+	functionKV kv.KeyValue
 }
 
 func GetServiceManager() (*Manager, error) {
@@ -60,11 +60,11 @@ func GetServiceManager() (*Manager, error) {
 		if err != nil {
 			return nil, fmt.Errorf("cannot find etc/services folder: %s", err)
 		}
-		err, sdb := kv.GetKV("services")
+		err, sdb := store.GetKV("services")
 		if err != nil {
 			return nil, fmt.Errorf("cannot open service db: %s", err)
 		}
-		err, fdb := kv.GetKV("serviceFuncs")
+		err, fdb := store.GetKV("serviceFuncs")
 		if err != nil {
 			return nil, fmt.Errorf("cannot open function db: %s", err)
 		}

+ 2 - 2
internal/testx/testUtil.go

@@ -16,7 +16,7 @@ package testx
 
 import (
 	"github.com/lf-edge/ekuiper/internal/conf"
-	"github.com/lf-edge/ekuiper/pkg/kv"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 )
 
 // errstring returns the string representation of an error.
@@ -29,7 +29,7 @@ func Errstring(err error) string {
 
 func InitEnv() {
 	conf.InitConf()
-	err := kv.SetupDefault()
+	err := store.SetupDefault()
 	if err != nil {
 		conf.Log.Fatal(err)
 	}

+ 2 - 2
internal/topo/context/default_test.go

@@ -16,9 +16,9 @@ package context
 
 import (
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/topo/state"
 	"github.com/lf-edge/ekuiper/pkg/api"
-	"github.com/lf-edge/ekuiper/pkg/kv"
 	"log"
 	"os"
 	"path"
@@ -27,7 +27,7 @@ import (
 )
 
 func TestState(t *testing.T) {
-	err := kv.SetupDefault()
+	err := store.SetupDefault()
 	if err != nil {
 		t.Error(err)
 	}

+ 3 - 3
internal/topo/node/sink_cache.go

@@ -18,10 +18,10 @@ import (
 	"encoding/gob"
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/topo/checkpoint"
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
 	"path"
 	"sort"
 	"strconv"
@@ -80,7 +80,7 @@ type Cache struct {
 	changed bool
 	//serialize
 	key   string //the key for current cache
-	store stores.KeyValue
+	store kv.KeyValue
 }
 
 func NewTimebasedCache(in <-chan interface{}, limit int, saveInterval int, errCh chan<- error, ctx api.StreamContext) *Cache {
@@ -101,7 +101,7 @@ func (c *Cache) initStore(ctx api.StreamContext) {
 		Tail: 0,
 	}
 	var err error
-	err, c.store = kv.GetKV(path.Join("sink", ctx.GetRuleId()))
+	err, c.store = store.GetKV(path.Join("sink", ctx.GetRuleId()))
 	if err != nil {
 		c.drainError(err)
 	}

+ 2 - 2
internal/topo/planner/analyzer.go

@@ -18,14 +18,14 @@ import (
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/xsql"
 	"github.com/lf-edge/ekuiper/pkg/ast"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"strconv"
 	"strings"
 )
 
 // Analyze the select statement by decorating the info from stream statement.
 // Typically, set the correct stream name for fieldRefs
-func decorateStmt(s *ast.SelectStatement, store stores.KeyValue) ([]*ast.StreamStmt, error) {
+func decorateStmt(s *ast.SelectStatement, store kv.KeyValue) ([]*ast.StreamStmt, error) {
 	streamsFromStmt := xsql.GetStreams(s)
 	streamStmts := make([]*ast.StreamStmt, len(streamsFromStmt))
 	isSchemaless := false

+ 3 - 3
internal/topo/planner/analyzer_test.go

@@ -17,11 +17,11 @@ package planner
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/testx"
 	"github.com/lf-edge/ekuiper/internal/xsql"
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/ast"
-	"github.com/lf-edge/ekuiper/pkg/kv"
 	"reflect"
 	"strings"
 	"testing"
@@ -123,7 +123,7 @@ var tests = []struct {
 }
 
 func Test_validation(t *testing.T) {
-	err, store := kv.GetKV("stream")
+	err, store := store.GetKV("stream")
 	if err != nil {
 		t.Error(err)
 		return
@@ -185,7 +185,7 @@ func Test_validation(t *testing.T) {
 }
 
 func Test_validationSchemaless(t *testing.T) {
-	err, store := kv.GetKV("stream")
+	err, store := store.GetKV("stream")
 	if err != nil {
 		t.Error(err)
 		return

+ 3 - 3
internal/topo/planner/planner.go

@@ -18,6 +18,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	store2 "github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/topo"
 	"github.com/lf-edge/ekuiper/internal/topo/node"
 	"github.com/lf-edge/ekuiper/internal/topo/operator"
@@ -25,7 +26,6 @@ import (
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/ast"
 	"github.com/lf-edge/ekuiper/pkg/kv"
-	store2 "github.com/lf-edge/ekuiper/pkg/kv/stores"
 )
 
 func Plan(rule *api.Rule) (*topo.Topo, error) {
@@ -49,7 +49,7 @@ func PlanWithSourcesAndSinks(rule *api.Rule, sources []*node.SourceNode, sinks [
 	if rule.Options.SendMetaToSink && (len(streamsFromStmt) > 1 || stmt.Dimensions != nil) {
 		return nil, fmt.Errorf("Invalid option sendMetaToSink, it can not be applied to window")
 	}
-	err, store := kv.GetKV("stream")
+	err, store := store2.GetKV("stream")
 	if err != nil {
 		return nil, err
 	}
@@ -199,7 +199,7 @@ func getMockSource(sources []*node.SourceNode, name string) *node.SourceNode {
 	return nil
 }
 
-func createLogicalPlan(stmt *ast.SelectStatement, opt *api.RuleOption, store store2.KeyValue) (LogicalPlan, error) {
+func createLogicalPlan(stmt *ast.SelectStatement, opt *api.RuleOption, store kv.KeyValue) (LogicalPlan, error) {
 
 	dimensions := stmt.Dimensions
 	var (

+ 3 - 3
internal/topo/planner/planner_test.go

@@ -18,11 +18,11 @@ import (
 	"encoding/json"
 	"fmt"
 	"github.com/gdexlab/go-render/render"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/testx"
 	"github.com/lf-edge/ekuiper/internal/xsql"
 	"github.com/lf-edge/ekuiper/pkg/api"
 	"github.com/lf-edge/ekuiper/pkg/ast"
-	"github.com/lf-edge/ekuiper/pkg/kv"
 	"reflect"
 	"strings"
 	"testing"
@@ -33,7 +33,7 @@ func init() {
 }
 
 func Test_createLogicalPlan(t *testing.T) {
-	err, store := kv.GetKV("stream")
+	err, store := store.GetKV("stream")
 	if err != nil {
 		t.Error(err)
 		return
@@ -1136,7 +1136,7 @@ func Test_createLogicalPlan(t *testing.T) {
 }
 
 func Test_createLogicalPlanSchemaless(t *testing.T) {
-	err, store := kv.GetKV("stream")
+	err, store := store.GetKV("stream")
 	if err != nil {
 		t.Error(err)
 		return

+ 8 - 6
internal/topo/state/kv_store.go

@@ -18,10 +18,10 @@ import (
 	"encoding/gob"
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	ts "github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/internal/topo/checkpoint"
 	"github.com/lf-edge/ekuiper/pkg/cast"
-	"github.com/lf-edge/ekuiper/pkg/kv"
-	ts "github.com/lf-edge/ekuiper/pkg/kv/stores"
+	ts2 "github.com/lf-edge/ekuiper/pkg/kv"
 	"sync"
 )
 
@@ -36,7 +36,7 @@ func init() {
 //  { "checkpoint1", "checkpoint2" ... "checkpointn" : The complete or incomplete snapshot
 //
 type KVStore struct {
-	db          ts.Tskv
+	db          ts2.Tskv
 	mapStore    *sync.Map //The current root store of a rule
 	checkpoints []int64
 	max         int
@@ -49,7 +49,7 @@ type KVStore struct {
 //"$checkpointId":A map with key of checkpoint id and value of snapshot(gob serialized)
 //Assume each operator only has one instance
 func getKVStore(ruleId string) (*KVStore, error) {
-	err, db := kv.GetTS(ruleId)
+	err, db := ts.GetTS(ruleId)
 	if err != nil {
 		return nil, err
 	}
@@ -67,8 +67,10 @@ func (s *KVStore) restore() error {
 	if err != nil {
 		return err
 	}
-	s.checkpoints = []int64{k}
-	s.mapStore.Store(k, cast.MapToSyncMap(m))
+	if k > 0 {
+		s.checkpoints = []int64{k}
+		s.mapStore.Store(k, cast.MapToSyncMap(m))
+	}
 	return nil
 }
 

+ 2 - 2
internal/topo/state/kv_store_test.go

@@ -17,8 +17,8 @@ package state
 import (
 	"fmt"
 	"github.com/lf-edge/ekuiper/internal/conf"
+	"github.com/lf-edge/ekuiper/internal/pkg/store"
 	"github.com/lf-edge/ekuiper/pkg/cast"
-	"github.com/lf-edge/ekuiper/pkg/kv"
 	"log"
 	"os"
 	"path"
@@ -154,7 +154,7 @@ func TestLifecycle(t *testing.T) {
 	)
 	func() {
 		cleanStateData()
-		err := kv.SetupDefault()
+		err := store.SetupDefault()
 		if err != nil {
 			t.Error(err)
 		}

+ 3 - 3
internal/xsql/stmtx.go

@@ -19,7 +19,7 @@ import (
 	"fmt"
 	"github.com/lf-edge/ekuiper/pkg/ast"
 	"github.com/lf-edge/ekuiper/pkg/errorx"
-	"github.com/lf-edge/ekuiper/pkg/kv/stores"
+	"github.com/lf-edge/ekuiper/pkg/kv"
 	"strings"
 )
 
@@ -57,7 +57,7 @@ type StreamInfo struct {
 	Statement  string         `json:"statement"`
 }
 
-func GetDataSourceStatement(m stores.KeyValue, name string) (*StreamInfo, error) {
+func GetDataSourceStatement(m kv.KeyValue, name string) (*StreamInfo, error) {
 	var (
 		v  string
 		vs = &StreamInfo{}
@@ -72,7 +72,7 @@ func GetDataSourceStatement(m stores.KeyValue, name string) (*StreamInfo, error)
 	return nil, errorx.NewWithCode(errorx.NOT_FOUND, fmt.Sprintf("%s is not found", name))
 }
 
-func GetDataSource(m stores.KeyValue, name string) (stmt *ast.StreamStmt, err error) {
+func GetDataSource(m kv.KeyValue, name string) (stmt *ast.StreamStmt, err error) {
 	info, err := GetDataSourceStatement(m, name)
 	if err != nil {
 		return nil, err

+ 1 - 1
pkg/kv/stores/kv.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package stores
+package kv
 
 type KeyValue interface {
 	// Set key to hold string value if key does not exist otherwise return an error

+ 1 - 1
pkg/kv/stores/tskv.go

@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package stores
+package kv
 
 type Tskv interface {
 	Set(k int64, v interface{}) (inserted bool, err error)

+ 0 - 20
tools/migration/README-CN.md

@@ -1,20 +0,0 @@
-## 1 程序说明及应用:
-
-### 1.1 程序说明:
-
-​    本程序用于历史数据迁移,将版本号小于1.0.2的 eKuiper 数据迁移到1.0.2版本中。程序运行时将 `dada` 文件夹及其子目录下所有名为 `stores.data` 的文件数据迁移到 data 目录下的 `sqliteKV.db` 数据库中。若原数据存储路径为 `data/rule/store.data`,则迁移后数据位于`data/sqliteKV.db `路径下名为`rule`的表中。
-
-### 1.2 编译程序:
-
-执行 `go build -o tools/migration/migration tools/migration/main.go` 命令即可生成 migration 程序。
-
-### 1.3 操作示例
-
-用户需要提供 eKuiper 的 data 文件夹的路径
-
-```shell
-./migration $(ekuiper/data)
-```
-
-## 
-

+ 0 - 21
tools/migration/README.md

@@ -1,21 +0,0 @@
-## 1 Program description and application:
-
-### 1.1 Program description:
-
-This program is used for historical data migration, which migrates eKuiper data whose version number is less than 1.0.2 to 1.0.2 version. When the program is running, all file data named `stores.data` in the `dada` folder and its subdirectories will be migrated to the `sqliteKV.db` database under the data directory. If the original data storage path is `data/rule/store.data`, the migrated data will be located in the table named `rule` under the path `data/sqliteKV.db`.
-
-### 1.2 Compile the program:
-
-Execute the `go build -o tools/migration/migration tools/migration/main.go` command to generate the migration program.
-
-### 1.3 Operation example
-
-The user needs to provide the path of eKuiper's data folder
-
-```shell
-./migration $(ekuiper/data)
-```
-
-## 
-
-

+ 0 - 10
tools/migration/go.mod

@@ -1,10 +0,0 @@
-module github.com/lf-edge/ekuiper/tools/migration
-
-go 1.16
-
-require (
-	github.com/lf-edge/ekuiper v0.0.0
-	github.com/patrickmn/go-cache v2.1.0+incompatible
-)
-
-replace github.com/lf-edge/ekuiper => ../../

+ 0 - 274
tools/migration/go.sum

@@ -1,274 +0,0 @@
-cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
-github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
-github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
-github.com/PaesslerAG/gval v1.0.0/go.mod h1:y/nm5yEyTeX6av0OfKJNp9rBNj2XrGhAf5+v24IBN1I=
-github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
-github.com/PaesslerAG/jsonpath v0.1.1/go.mod h1:lVboNxFGal/VwW6d9JzIy56bUsYAP6tH/x80vjnCseY=
-github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
-github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
-github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w=
-github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
-github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
-github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
-github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
-github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
-github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM=
-github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
-github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
-github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/eclipse/paho.mqtt.golang v1.3.5/go.mod h1:eTzb4gxwwyWpqBUHGQZ4ABAV7+Jgm1PklsYT/eo8Hcc=
-github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0/go.mod h1:pfXURRetgIto0GR0sCjDrfa71hqJ1wxmQWi/mOzWfWU=
-github.com/edgexfoundry/go-mod-messaging/v2 v2.0.1/go.mod h1:bLKWB9yeOHLZoQtHLZlGwz8MjsMJIvHDFce7CcUb4fE=
-github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
-github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
-github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
-github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
-github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 h1:Ghm4eQYC0nEPnSJdVkTrXpu9KtoVCSo1hg7mtI7G9KU=
-github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo=
-github.com/gdexlab/go-render v1.0.1/go.mod h1:wRi5nW2qfjiGj4mPukH4UV0IknS1cHD4VgFTmJX5JzM=
-github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
-github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
-github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
-github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
-github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
-github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
-github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk=
-github.com/go-redis/redis/v7 v7.3.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
-github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
-github.com/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o=
-github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0=
-github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
-github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3/go.mod h1:nPpo7qLxd6XL3hWJG/O60sR8ZKfMCiIoNap5GvD12KU=
-github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
-github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
-github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
-github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
-github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
-github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
-github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
-github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
-github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
-github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
-github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
-github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
-github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
-github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
-github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
-github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU=
-github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
-github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
-github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
-github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
-github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
-github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
-github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
-github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
-github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 h1:IPJ3dvxmJ4uczJe5YQdrYB16oTJlGSC/OyZDqUk9xX4=
-github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869/go.mod h1:cJ6Cj7dQo+O6GJNiMx+Pa94qKj+TG8ONdKHgMNIyyag=
-github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg=
-github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ=
-github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
-github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
-github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
-github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
-github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
-github.com/keepeye/logrus-filename v0.0.0-20190711075016-ce01a4391dd1 h1:JL2rWnBX8jnbHHlLcLde3BBWs+jzqZvOmF+M3sXoNOE=
-github.com/keepeye/logrus-filename v0.0.0-20190711075016-ce01a4391dd1/go.mod h1:nNLjpEi4xVFB7358xLPpPscdvXP+pbhiHgSmjIur8z0=
-github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
-github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
-github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
-github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
-github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
-github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
-github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
-github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
-github.com/lestrrat-go/strftime v1.0.3 h1:qqOPU7y+TM8Y803I8fG9c/DyKG3xH/xkng6keC1015Q=
-github.com/lestrrat-go/strftime v1.0.3/go.mod h1:E1nN3pCbtMSu1yjSVeyuRFVm/U0xoR76fd03sz+Qz4g=
-github.com/mattn/go-sqlite3 v1.14.5 h1:1IdxlwTNazvbKJQSxoJ5/9ECbEeaTTyeU7sEAZ5KKTQ=
-github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
-github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
-github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
-github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
-github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
-github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
-github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
-github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/msgpack-rpc/msgpack-rpc-go v0.0.0-20131026060856-c76397e1782b/go.mod h1:YUWGR1lA7NRnzRjOmYpSgNVip20OCp6NMBwiVFPPhZ8=
-github.com/msgpack/msgpack-go v0.0.0-20130625150338-8224460e6fa3/go.mod h1:jDCQZQaHCHpBYqM4WoGyujFc55bazGAEwK27iK4PQTI=
-github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso=
-github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
-github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
-github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
-github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
-github.com/pebbe/zmq4 v1.2.7/go.mod h1:nqnPueOapVhE2wItZ0uOErngczsJdLOGkebMxaO8r48=
-github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
-github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
-github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
-github.com/prometheus/client_golang v1.2.1/go.mod h1:XMU6Z2MjaRKVu/dC1qupJI9SiNkDYzz3xecMgSW/F+U=
-github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
-github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
-github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
-github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
-github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
-github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
-github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
-github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
-github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
-github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
-github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
-github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
-github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
-github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
-github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
-github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
-github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
-github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-github.com/tebeka/strftime v0.1.5 h1:1NQKN1NiQgkqd/2moD6ySP/5CoZQsKa1d3ZhJ44Jpmg=
-github.com/tebeka/strftime v0.1.5/go.mod h1:29/OidkoWHdEKZqzyDLUyC+LmgDgdHo4WAFCDT7D/Ig=
-github.com/ugorji/go v1.2.5/go.mod h1:gat2tIT8KJG8TVI8yv77nEO/KYT6dV7JE1gfUa8Xuls=
-github.com/ugorji/go/codec v1.2.5/go.mod h1:QPxoTbPKSEAlAHPYt02++xp/en9B/wUdwFCz+hj5caA=
-github.com/urfave/cli v1.22.0/go.mod h1:b3D7uWrF2GilkNgYpgcg6J+JMUw7ehmNkE8sZdliGLc=
-github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
-github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
-golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
-golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
-golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
-golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
-golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
-golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
-golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
-golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
-golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
-golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
-golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
-golang.org/x/tools v0.0.0-20200717024301-6ddee64345a6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
-google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
-google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
-google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
-google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
-google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
-google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
-google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
-google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
-google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
-google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
-google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
-google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
-google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
-google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
-google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
-google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
-google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
-google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
-google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
-gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
-gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
-gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
-gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
-gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
-gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
-honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
-honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=

+ 0 - 33
tools/migration/main.go

@@ -1,33 +0,0 @@
-// Copyright 2021 EMQ Technologies Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"github.com/lf-edge/ekuiper/tools/migration/util"
-	"log"
-	"os"
-)
-
-func main() {
-	if 2 != len(os.Args) {
-		log.Fatal("Please enter the correct path. For example: ./migration kuiper/bin/data")
-	}
-
-	if err := util.DataMigration(os.Args[1]); nil != err {
-		log.Fatal(err)
-	} else {
-		log.Println("The data migration was successful.")
-	}
-}

+ 0 - 123
tools/migration/util/migration.go

@@ -1,123 +0,0 @@
-// Copyright 2021 EMQ Technologies Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
-	"fmt"
-	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/patrickmn/go-cache"
-	"io/ioutil"
-	"os"
-	"path"
-)
-
-func migration(dir string) error {
-	fpath := path.Join(dir, "stores.data")
-	c := cache.New(cache.NoExpiration, 0)
-	if err := gocacheOpen(c, fpath); nil != err {
-		return err
-	}
-	defer gocacheClose(c, fpath)
-
-	keys, err := gocacheKeys(c)
-	if nil != err {
-		return err
-	}
-
-	err, store := kv.GetKVStore(dir)
-	if err != nil {
-		return err
-	}
-
-	for _, k := range keys {
-		if value, ok := c.Get(k); !ok {
-			return fmt.Errorf("not found %s from %s", k, fpath)
-		} else {
-			if err := store.Setnx(k, value); nil != err {
-				return err
-			}
-			if err := gocacheDel(c, k); nil != err {
-				return err
-			}
-		}
-	}
-	return os.Remove(fpath)
-}
-
-func DataMigration(dir string) error {
-	var dirs []string
-	dirs = append(dirs, dir)
-	for i := 0; i < len(dirs); i++ {
-		files, err := ioutil.ReadDir(dirs[i])
-		if nil != err {
-			return err
-		}
-		for _, file := range files {
-			fname := file.Name()
-			if file.IsDir() {
-				dirs = append(dirs, path.Join(dirs[i], fname))
-			} else if "stores.data" == fname {
-				return migration(dirs[i])
-			}
-		}
-	}
-	kv.CloseAll()
-	return nil
-}
-
-func gocacheClose(c *cache.Cache, path string) error {
-	if e := c.SaveFile(path); e != nil {
-		return e
-	}
-	c.Flush()
-	return nil
-}
-
-func gocacheOpen(c *cache.Cache, path string) error {
-	if _, err := os.Stat(path); os.IsNotExist(err) {
-		return nil
-	}
-	if e := c.LoadFile(path); e != nil {
-		return e
-	}
-	return nil
-}
-
-func gocacheKeys(c *cache.Cache) (keys []string, err error) {
-	if c == nil {
-		return nil, fmt.Errorf("cache has not been initialized yet.")
-	}
-	its := c.Items()
-	keys = make([]string, 0, len(its))
-	for k := range its {
-		keys = append(keys, k)
-	}
-	return keys, nil
-}
-
-func gocacheSet(c *cache.Cache, path, key string, value interface{}) error {
-	if c == nil {
-		return fmt.Errorf("cache has not been initialized yet.")
-	}
-	return c.Add(key, value, cache.NoExpiration)
-}
-
-func gocacheDel(c *cache.Cache, key string) error {
-	if c == nil {
-		return fmt.Errorf("cache has not been initialized yet.")
-	}
-	c.Delete(key)
-	return nil
-}

+ 0 - 81
tools/migration/util/migration_test.go

@@ -1,81 +0,0 @@
-// Copyright 2021 EMQ Technologies Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package util
-
-import (
-	"github.com/lf-edge/ekuiper/pkg/kv"
-	"github.com/patrickmn/go-cache"
-	"os"
-	"path"
-	"path/filepath"
-	"testing"
-)
-
-func TestDataMigration(t *testing.T) {
-	kvs := make(map[string]string)
-	kvs["mqtt"] = `{"sql":"create stream mqtt(age BIGINT) WITH (DATASOURCE = \"dev/+/msg\", FORMAT = \"json\");"}`
-	kvs["log"] = `{"id":"log","sql":"SELECT  * FROM mqtt","actions":[{"log":{}}]}`
-
-	dir, _ := filepath.Abs("testMigration")
-	dirSqlite, _ := filepath.Split(dir)
-	fpath := path.Join(dir, "stores.data")
-	if f, _ := os.Stat(fpath); f != nil {
-		os.Remove(fpath)
-	}
-	if _, err := os.Stat(dir); os.IsNotExist(err) {
-		os.MkdirAll(dir, os.ModePerm)
-	}
-	defer os.RemoveAll(dir)
-	defer os.Remove(path.Join(dirSqlite, "sqliteKV.db"))
-
-	c := cache.New(cache.NoExpiration, 0)
-	if err := gocacheOpen(c, fpath); nil != err {
-		t.Error(err)
-		return
-	}
-
-	for k, v := range kvs {
-		if err := gocacheSet(c, fpath, k, v); nil != err {
-			t.Error(err)
-			return
-		}
-	}
-	if err := gocacheClose(c, fpath); nil != err {
-		t.Error(err)
-	}
-
-	if err := DataMigration(dir); nil != err {
-		t.Error(err)
-		return
-	}
-
-	store := kv.GetDefaultKVStore(dir)
-	if err := store.Open(); nil != err {
-		t.Error(err)
-		return
-	}
-	defer store.Close()
-	for k, v := range kvs {
-		var dbVal string
-		if ok, _ := store.Get(k, &dbVal); !ok {
-			t.Error("not found key ", k)
-			return
-		} else if v != dbVal {
-			t.Error("gocache save:", v, "sqlite save:", dbVal)
-			return
-		}
-	}
-
-}