|
@ -3,6 +3,7 @@ package filer |
|
|
import ( |
|
|
import ( |
|
|
"context" |
|
|
"context" |
|
|
"errors" |
|
|
"errors" |
|
|
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
"strings" |
|
|
"strings" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
@ -85,6 +86,7 @@ func (fsw *FilerStoreWrapper) InsertEntry(ctx context.Context, entry *Entry) err |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("InsertEntry %s", entry.FullPath) |
|
|
return fsw.ActualStore.InsertEntry(ctx, entry) |
|
|
return fsw.ActualStore.InsertEntry(ctx, entry) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -104,6 +106,7 @@ func (fsw *FilerStoreWrapper) UpdateEntry(ctx context.Context, entry *Entry) err |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("UpdateEntry %s", entry.FullPath) |
|
|
return fsw.ActualStore.UpdateEntry(ctx, entry) |
|
|
return fsw.ActualStore.UpdateEntry(ctx, entry) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -114,6 +117,7 @@ func (fsw *FilerStoreWrapper) FindEntry(ctx context.Context, fp util.FullPath) ( |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "find").Observe(time.Since(start).Seconds()) |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "find").Observe(time.Since(start).Seconds()) |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("FindEntry %s", fp) |
|
|
entry, err = fsw.ActualStore.FindEntry(ctx, fp) |
|
|
entry, err = fsw.ActualStore.FindEntry(ctx, fp) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
return nil, err |
|
@ -138,11 +142,13 @@ func (fsw *FilerStoreWrapper) DeleteEntry(ctx context.Context, fp util.FullPath) |
|
|
} |
|
|
} |
|
|
if len(existingEntry.HardLinkId) != 0 { |
|
|
if len(existingEntry.HardLinkId) != 0 { |
|
|
// remove hard link
|
|
|
// remove hard link
|
|
|
|
|
|
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath) |
|
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil { |
|
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("DeleteEntry %s", fp) |
|
|
return fsw.ActualStore.DeleteEntry(ctx, fp) |
|
|
return fsw.ActualStore.DeleteEntry(ctx, fp) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -155,11 +161,13 @@ func (fsw *FilerStoreWrapper) DeleteOneEntry(ctx context.Context, existingEntry |
|
|
|
|
|
|
|
|
if len(existingEntry.HardLinkId) != 0 { |
|
|
if len(existingEntry.HardLinkId) != 0 { |
|
|
// remove hard link
|
|
|
// remove hard link
|
|
|
|
|
|
glog.V(4).Infof("DeleteHardLink %s", existingEntry.FullPath) |
|
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil { |
|
|
if err = fsw.DeleteHardLink(ctx, existingEntry.HardLinkId); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("DeleteHaDeleteEntryrdLink %s", existingEntry.FullPath) |
|
|
return fsw.ActualStore.DeleteEntry(ctx, existingEntry.FullPath) |
|
|
return fsw.ActualStore.DeleteEntry(ctx, existingEntry.FullPath) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -170,6 +178,7 @@ func (fsw *FilerStoreWrapper) DeleteFolderChildren(ctx context.Context, fp util. |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "deleteFolderChildren").Observe(time.Since(start).Seconds()) |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "deleteFolderChildren").Observe(time.Since(start).Seconds()) |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("DeleteFolderChildren %s", fp) |
|
|
return fsw.ActualStore.DeleteFolderChildren(ctx, fp) |
|
|
return fsw.ActualStore.DeleteFolderChildren(ctx, fp) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -180,6 +189,7 @@ func (fsw *FilerStoreWrapper) ListDirectoryEntries(ctx context.Context, dirPath |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "list").Observe(time.Since(start).Seconds()) |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "list").Observe(time.Since(start).Seconds()) |
|
|
}() |
|
|
}() |
|
|
|
|
|
|
|
|
|
|
|
glog.V(4).Infof("ListDirectoryEntries %s from %s limit %d", dirPath, startFileName, limit) |
|
|
entries, err := fsw.ActualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
entries, err := fsw.ActualStore.ListDirectoryEntries(ctx, dirPath, startFileName, includeStartFile, limit) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return nil, err |
|
|
return nil, err |
|
@ -197,6 +207,7 @@ func (fsw *FilerStoreWrapper) ListDirectoryPrefixedEntries(ctx context.Context, |
|
|
defer func() { |
|
|
defer func() { |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "prefixList").Observe(time.Since(start).Seconds()) |
|
|
stats.FilerStoreHistogram.WithLabelValues(fsw.ActualStore.GetName(), "prefixList").Observe(time.Since(start).Seconds()) |
|
|
}() |
|
|
}() |
|
|
|
|
|
glog.V(4).Infof("ListDirectoryPrefixedEntries %s from %s prefix %s limit %d", dirPath, startFileName, prefix, limit) |
|
|
entries, err := fsw.ActualStore.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
entries, err := fsw.ActualStore.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
if err == ErrUnsupportedListDirectoryPrefixed { |
|
|
if err == ErrUnsupportedListDirectoryPrefixed { |
|
|
entries, err = fsw.prefixFilterEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|
entries, err = fsw.prefixFilterEntries(ctx, dirPath, startFileName, includeStartFile, limit, prefix) |
|
|