add filer notification
This commit is contained in:
@@ -173,6 +173,10 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
|
||||
|
||||
}
|
||||
|
||||
if filer2.EqualEntry(entry, newEntry) {
|
||||
return &filer_pb.UpdateEntryResponse{}, err
|
||||
}
|
||||
|
||||
if err = fs.filer.UpdateEntry(newEntry); err == nil {
|
||||
for _, garbage := range unusedChunks {
|
||||
glog.V(0).Infof("deleting %s old chunk: %v, [%d, %d)", fullpath, garbage.FileId, garbage.Offset, garbage.Offset+int64(garbage.Size))
|
||||
@@ -184,6 +188,8 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr
|
||||
}
|
||||
}
|
||||
|
||||
fs.filer.NotifyUpdateEvent(entry, newEntry)
|
||||
|
||||
return &filer_pb.UpdateEntryResponse{}, err
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,12 @@ import (
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/mysql"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/postgres"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/filer2/redis"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/msgqueue/kafka"
|
||||
_ "github.com/chrislusf/seaweedfs/weed/msgqueue/log"
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"net/http"
|
||||
"github.com/chrislusf/seaweedfs/weed/msgqueue"
|
||||
)
|
||||
|
||||
type FilerOption struct {
|
||||
@@ -23,6 +26,7 @@ type FilerOption struct {
|
||||
SecretKey string
|
||||
DirListingLimit int
|
||||
DataCenter string
|
||||
EnableNotification bool
|
||||
}
|
||||
|
||||
type FilerServer struct {
|
||||
@@ -46,6 +50,10 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
|
||||
fs.filer.LoadConfiguration()
|
||||
|
||||
if fs.option.EnableNotification {
|
||||
msgqueue.LoadConfiguration()
|
||||
}
|
||||
|
||||
defaultMux.HandleFunc("/favicon.ico", faviconHandler)
|
||||
defaultMux.HandleFunc("/", fs.filerHandler)
|
||||
if defaultMux != readonlyMux {
|
||||
|
||||
Reference in New Issue
Block a user