passing ctx for metadata logging

This commit is contained in:
Chris Lu 2020-06-28 14:34:51 -07:00
parent 12f6b683fc
commit df75b5c98d
4 changed files with 8 additions and 8 deletions

View file

@ -141,7 +141,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
}
} else {
f.maybeAddBucket(dirEntry)
f.NotifyUpdateEvent(nil, dirEntry, false)
f.NotifyUpdateEvent(ctx, nil, dirEntry, false)
}
} else if !dirEntry.IsDirectory() {
@ -192,7 +192,7 @@ func (f *Filer) CreateEntry(ctx context.Context, entry *Entry, o_excl bool) erro
}
f.maybeAddBucket(entry)
f.NotifyUpdateEvent(oldEntry, entry, true)
f.NotifyUpdateEvent(ctx, oldEntry, entry, true)
f.deleteChunksIfNotNew(oldEntry, entry)

View file

@ -74,7 +74,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
if sub.IsDirectory() {
dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks)
f.cacheDelDirectory(string(sub.FullPath))
f.NotifyUpdateEvent(sub, nil, shouldDeleteChunks)
f.NotifyUpdateEvent(ctx, sub, nil, shouldDeleteChunks)
chunks = append(chunks, dirChunks...)
} else {
chunks = append(chunks, sub.Chunks...)
@ -108,7 +108,7 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shou
if entry.IsDirectory() {
f.cacheDelDirectory(string(entry.FullPath))
}
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
f.NotifyUpdateEvent(ctx, entry, nil, shouldDeleteChunks)
return nil
}

View file

@ -15,7 +15,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util"
)
func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool) {
func (f *Filer) NotifyUpdateEvent(ctx context.Context, oldEntry, newEntry *Entry, deleteChunks bool) {
var fullpath string
if oldEntry != nil {
fullpath = string(oldEntry.FullPath)
@ -47,11 +47,11 @@ func (f *Filer) NotifyUpdateEvent(oldEntry, newEntry *Entry, deleteChunks bool)
notification.Queue.SendMessage(fullpath, eventNotification)
}
f.logMetaEvent(fullpath, eventNotification)
f.logMetaEvent(ctx, fullpath, eventNotification)
}
func (f *Filer) logMetaEvent(fullpath string, eventNotification *filer_pb.EventNotification) {
func (f *Filer) logMetaEvent(ctx context.Context, fullpath string, eventNotification *filer_pb.EventNotification) {
dir, _ := util.FullPath(fullpath).DirAndName()

View file

@ -220,7 +220,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
glog.V(3).Infof("UpdateEntry %s: %v", filepath.Join(req.Directory, req.Entry.Name), err)
}
fs.filer.NotifyUpdateEvent(entry, newEntry, true)
fs.filer.NotifyUpdateEvent(ctx, entry, newEntry, true)
return &filer_pb.UpdateEntryResponse{}, err
}