You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
676 B

  1. package meta_cache
  2. import (
  3. "context"
  4. "github.com/chrislusf/seaweedfs/weed/filer2"
  5. "github.com/chrislusf/seaweedfs/weed/glog"
  6. "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
  7. "github.com/chrislusf/seaweedfs/weed/util"
  8. )
  9. func InitMetaCache(mc *MetaCache, client filer_pb.FilerClient, path string) error {
  10. glog.V(0).Infof("synchronizing meta data ...")
  11. filer_pb.TraverseBfs(client, util.FullPath(path), func(parentPath util.FullPath, pbEntry *filer_pb.Entry) {
  12. entry := filer2.FromPbEntry(string(parentPath), pbEntry)
  13. if err := mc.InsertEntry(context.Background(), entry); err != nil {
  14. glog.V(0).Infof("read %s: %v", entry.FullPath, err)
  15. }
  16. })
  17. return nil
  18. }