SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
refactoring
Chris Luae5eb85a0692
diff --git a/weed/pb/filer_pb/filer_pb_helper.go b/weed/pb/filer_pb/filer_pb_helper.goindex b46385c8fa..76a8c973e0 100644--- a/weed/pb/filer_pb/filer_pb_helper.go+++ b/weed/pb/filer_pb/filer_pb_helper.go@@ -1,9 +1,13 @@package filer_pbimport (+ "bytes""context""errors""fmt"+ "github.com/chrislusf/seaweedfs/weed/filer"+ "github.com/chrislusf/seaweedfs/weed/wdclient"+ "math""strings""github.com/chrislusf/seaweedfs/weed/glog"@@ -122,6 +126,25 @@ func LookupEntry(client SeaweedFilerClient, request *LookupDirectoryEntryRequestreturn resp, nil}+func ReadEntry(masterClient *wdclient.MasterClient, filerClient SeaweedFilerClient, dir, name string, byteBuffer *bytes.Buffer) error {++ request := &LookupDirectoryEntryRequest{+ Directory: filer.DirectoryEtc,+ Name: filer.FilerConfName,+ }+ respLookupEntry, err := LookupEntry(filerClient, request)+ if err != nil {+ return err+ }+ if len(respLookupEntry.Entry.Content) > 0 {+ _, err = byteBuffer.Write(respLookupEntry.Entry.Content)+ return err+ }++ return filer.StreamContent(masterClient, byteBuffer, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)++}+var ErrNotFound = errors.New("filer: no entry is found in filer store")func IsCreate(event *SubscribeMetadataResponse) bool {diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.goindex 1600fddec9..f388c96030 100644--- a/weed/shell/command_fs_configure.go+++ b/weed/shell/command_fs_configure.go@@ -5,7 +5,6 @@ import ("flag""fmt""io"- "math""net/http""strings"@@ -65,18 +64,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer iovar buf bytes.Bufferif err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {-- request := &filer_pb.LookupDirectoryEntryRequest{- Directory: filer.DirectoryEtc,- Name: filer.FilerConfName,- }- respLookupEntry, err := filer_pb.LookupEntry(client, request)- if err != nil {- return err- }-- return filer.StreamContent(commandEnv.MasterClient, &buf, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)-+ return filer_pb.ReadEntry(commandEnv.MasterClient, client, filer.DirectoryEtc, filer.FilerConfName, &buf)}); err != nil && err != filer_pb.ErrNotFound {return err}