mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-22 11:29:06 -05:00
go/utils/remotesrv: grpc.go: Use TableFileStore.Size() to get size in GetRepoMetadata.
This commit is contained in:
@@ -19,8 +19,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync/atomic"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -342,24 +340,11 @@ func (rs *RemoteChunkStore) GetRepoMetadata(ctx context.Context, req *remotesapi
|
||||
return nil, status.Error(codes.Internal, "Could not get chunkstore")
|
||||
}
|
||||
|
||||
_, tfs, _, err := cs.Sources(ctx)
|
||||
|
||||
size, err := cs.Size(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var size uint64
|
||||
for _, tf := range tfs {
|
||||
path := filepath.Join(req.RepoId.Org, req.RepoId.RepoName, tf.FileID())
|
||||
info, err := os.Stat(path)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
size += uint64(info.Size())
|
||||
}
|
||||
|
||||
return &remotesapi.GetRepoMetadataResponse{
|
||||
NbfVersion: cs.Version(),
|
||||
NbsVersion: req.ClientRepoFormat.NbsVersion,
|
||||
|
||||
Reference in New Issue
Block a user