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.

20 lines
628 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. filer_pb.TraverseBfs(client, util.FullPath(path), func(parentPath util.FullPath, pbEntry *filer_pb.Entry) {
  11. entry := filer2.FromPbEntry(string(parentPath), pbEntry)
  12. if err := mc.InsertEntry(context.Background(), entry); err != nil {
  13. glog.V(0).Infof("read %s: %v", entry.FullPath, err)
  14. }
  15. })
  16. return nil
  17. }