mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
update filer
parent
9327502047
commit
b1f4144771
|
@ -3,10 +3,10 @@ It is fairly easy if you need to store filer metadata with other data store.
|
|||
Let's use "yourstore" as the chosen name.
|
||||
|
||||
Here are the steps:
|
||||
1. Add a package under github.com/chrislusf/seaweedfs/weed/filer2/yourstore
|
||||
2. Implement the filer2.FilerStore interface
|
||||
1. Add a package under github.com/chrislusf/seaweedfs/weed/filer/yourstore
|
||||
2. Implement the filer.FilerStore interface
|
||||
```
|
||||
package filer2
|
||||
package filer
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
@ -16,12 +16,25 @@ type FilerStore interface {
|
|||
// GetName gets the name to locate the configuration in filer.toml file
|
||||
GetName() string
|
||||
// Initialize initializes the file store
|
||||
Initialize(configuration Configuration) error
|
||||
InsertEntry(*Entry) error
|
||||
UpdateEntry(*Entry) (err error)
|
||||
FindEntry(FullPath) (entry *Entry, err error)
|
||||
DeleteEntry(FullPath) (err error)
|
||||
ListDirectoryEntries(dirPath FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
|
||||
Initialize(configuration util.Configuration, prefix string) error
|
||||
InsertEntry(context.Context, *Entry) error
|
||||
UpdateEntry(context.Context, *Entry) (err error)
|
||||
// err == filer2.ErrNotFound if not found
|
||||
FindEntry(context.Context, util.FullPath) (entry *Entry, err error)
|
||||
DeleteEntry(context.Context, util.FullPath) (err error)
|
||||
DeleteFolderChildren(context.Context, util.FullPath) (err error)
|
||||
ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
|
||||
ListDirectoryPrefixedEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int, prefix string) ([]*Entry, error)
|
||||
|
||||
BeginTransaction(ctx context.Context) (context.Context, error)
|
||||
CommitTransaction(ctx context.Context) error
|
||||
RollbackTransaction(ctx context.Context) error
|
||||
|
||||
KvPut(ctx context.Context, key []byte, value []byte) (err error)
|
||||
KvGet(ctx context.Context, key []byte) (value []byte, err error)
|
||||
KvDelete(ctx context.Context, key []byte) (err error)
|
||||
|
||||
Shutdown()
|
||||
}
|
||||
|
||||
```
|
||||
|
@ -37,13 +50,13 @@ func init() {
|
|||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/cassandra"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/mysql"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/postgres"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/redis"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/yourstore"
|
||||
"github.com/chrislusf/seaweedfs/weed/filer"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/cassandra"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/leveldb"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/mysql"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/postgres"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/redis"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer/yourstore"
|
||||
// ^^ add here
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
|
|
Loading…
Reference in a new issue