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:

    • Add a package under github.com/chrislusf/seaweedfs/weed/filer2/yourstore
    • Implement the filer2.FilerStore interface
    1. package filer2
    2. import (
    3. "errors"
    4. )
    5. type FilerStore interface {
    6. // GetName gets the name to locate the configuration in filer.toml file
    7. GetName() string
    8. // Initialize initializes the file store
    9. Initialize(configuration Configuration) error
    10. InsertEntry(*Entry) error
    11. UpdateEntry(*Entry) (err error)
    12. FindEntry(FullPath) (entry *Entry, err error)
    13. DeleteEntry(FullPath) (err error)
    14. ListDirectoryEntries(dirPath FullPath, startFileName string, includeStartFile bool, limit int) ([]*Entry, error)
    15. }
    • Remember to add yourstore to the list of supported stores
    1. func init() {
    2. filer2.Stores = append(filer2.Stores, &YourStore{})
    3. }
    • Load yourstore. Just import it in github.com/chrislusf/seaweedfs/weed/server/filer_server.go
    1. import (
    2. "net/http"
    3. "strconv"
    4. "github.com/chrislusf/seaweedfs/weed/filer2"
    5. _ "github.com/chrislusf/seaweedfs/weed/filer2/cassandra"
    6. _ "github.com/chrislusf/seaweedfs/weed/filer2/leveldb"
    7. _ "github.com/chrislusf/seaweedfs/weed/filer2/mysql"
    8. _ "github.com/chrislusf/seaweedfs/weed/filer2/postgres"
    9. _ "github.com/chrislusf/seaweedfs/weed/filer2/redis"
    10. _ "github.com/chrislusf/seaweedfs/weed/filer2/yourstore"
    11. // ^^ add here
    12. "github.com/chrislusf/seaweedfs/weed/security"
    13. "github.com/chrislusf/seaweedfs/weed/glog"
    14. )
    • Send a pull request!