aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/redis_lua/redis_store.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-02-15 12:10:34 -0800
committerGitHub <noreply@github.com>2022-02-15 12:10:34 -0800
commitaa7fc299b87a1b3e7e787733f9d46c79f9d69619 (patch)
tree25cd83628cd4d9d171c0083400c966aba6872b8a /weed/filer/redis_lua/redis_store.go
parent5eb3a7e4665f1e99ac040127a51bf1afeab3d837 (diff)
parentb5ec3467003b2becca9a91f9cf56ab6b24ede25e (diff)
downloadseaweedfs-aa7fc299b87a1b3e7e787733f9d46c79f9d69619.tar.xz
seaweedfs-aa7fc299b87a1b3e7e787733f9d46c79f9d69619.zip
Merge pull request #2676 from banjiaojuhao/add_filer_store-redis_lua
FilerStore: add redis_lua
Diffstat (limited to 'weed/filer/redis_lua/redis_store.go')
-rw-r--r--weed/filer/redis_lua/redis_store.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/weed/filer/redis_lua/redis_store.go b/weed/filer/redis_lua/redis_store.go
new file mode 100644
index 000000000..a7d11c73c
--- /dev/null
+++ b/weed/filer/redis_lua/redis_store.go
@@ -0,0 +1,38 @@
+package redis_lua
+
+import (
+ "github.com/chrislusf/seaweedfs/weed/filer"
+ "github.com/chrislusf/seaweedfs/weed/util"
+ "github.com/go-redis/redis/v8"
+)
+
+func init() {
+ filer.Stores = append(filer.Stores, &RedisLuaStore{})
+}
+
+type RedisLuaStore struct {
+ UniversalRedisLuaStore
+}
+
+func (store *RedisLuaStore) GetName() string {
+ return "redis_lua"
+}
+
+func (store *RedisLuaStore) Initialize(configuration util.Configuration, prefix string) (err error) {
+ return store.initialize(
+ configuration.GetString(prefix+"address"),
+ configuration.GetString(prefix+"password"),
+ configuration.GetInt(prefix+"database"),
+ configuration.GetStringSlice(prefix+"superLargeDirectories"),
+ )
+}
+
+func (store *RedisLuaStore) initialize(hostPort string, password string, database int, superLargeDirectories []string) (err error) {
+ store.Client = redis.NewClient(&redis.Options{
+ Addr: hostPort,
+ Password: password,
+ DB: database,
+ })
+ store.loadSuperLargeDirectories(superLargeDirectories)
+ return
+}