file size support set file length

use Attr.FileSize and TotalChunkSize to determine file size
This commit is contained in:
Chris Lu
2020-08-15 09:32:47 -07:00
parent c03bb180eb
commit c647deace1
16 changed files with 73 additions and 39 deletions

View File

@@ -70,9 +70,9 @@ func duTraverseDirectory(writer io.Writer, filerClient filer_pb.FilerClient, dir
}
} else {
fileBlockCount = uint64(len(entry.Chunks))
fileByteCount = filer2.TotalSize(entry.Chunks)
blockCount += uint64(len(entry.Chunks))
byteCount += filer2.TotalSize(entry.Chunks)
fileByteCount = filer2.FileSize(entry)
blockCount += fileBlockCount
byteCount += fileByteCount
}
if name != "" && !entry.IsDirectory {

View File

@@ -95,7 +95,7 @@ func (c *commandFsLs) Do(args []string, commandEnv *CommandEnv, writer io.Writer
fmt.Fprintf(writer, "%s %3d %s %s %6d %s/%s\n",
fileMode, len(entry.Chunks),
userName, groupName,
filer2.TotalSize(entry.Chunks), dir, entry.Name)
filer2.FileSize(entry), dir, entry.Name)
} else {
fmt.Fprintf(writer, "%s\n", entry.Name)
}