From 4e7d8eb3f167d2112cdb9c04308e68d6dc639997 Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 11 Jul 2024 14:50:09 -0700 Subject: [PATCH] small refactoring --- weed/filer/filer_delete_entry.go | 4 ++-- weed/server/filer_grpc_server.go | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/weed/filer/filer_delete_entry.go b/weed/filer/filer_delete_entry.go index 64546940e..dae0b28ef 100644 --- a/weed/filer/filer_delete_entry.go +++ b/weed/filer/filer_delete_entry.go @@ -55,7 +55,7 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isR if isDeleteCollection { collectionName := entry.Name() - f.doDeleteCollection(collectionName) + f.DoDeleteCollection(collectionName) } return nil @@ -133,7 +133,7 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shou return nil } -func (f *Filer) doDeleteCollection(collectionName string) (err error) { +func (f *Filer) DoDeleteCollection(collectionName string) (err error) { return f.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error { _, err := client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{ diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index b9571710d..05480d2ad 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -363,12 +363,7 @@ func (fs *FilerServer) DeleteCollection(ctx context.Context, req *filer_pb.Delet glog.V(4).Infof("DeleteCollection %v", req) - err = fs.filer.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error { - _, err := client.CollectionDelete(context.Background(), &master_pb.CollectionDeleteRequest{ - Name: req.GetCollection(), - }) - return err - }) + err = fs.filer.DoDeleteCollection(req.GetCollection()) return &filer_pb.DeleteCollectionResponse{}, err }