mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove Size from Attr
This commit is contained in:
parent
fc7f81f6e7
commit
75a2b05aa3
23
weed/filer2/filechunks.go
Normal file
23
weed/filer2/filechunks.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package filer2
|
||||
|
||||
type Chunks []FileChunk
|
||||
|
||||
func (chunks Chunks) TotalSize() (size uint64) {
|
||||
for _, c := range chunks {
|
||||
t := uint64(c.Offset + int64(c.Size))
|
||||
if size < t {
|
||||
size = t
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (chunks Chunks) Len() int {
|
||||
return len(chunks)
|
||||
}
|
||||
func (chunks Chunks) Swap(i, j int) {
|
||||
chunks[i], chunks[j] = chunks[j], chunks[i]
|
||||
}
|
||||
func (chunks Chunks) Less(i, j int) bool {
|
||||
return chunks[i].Offset < chunks[j].Offset
|
||||
}
|
|
@ -27,7 +27,6 @@ type Attr struct {
|
|||
Mode os.FileMode // file mode
|
||||
Uid uint32 // owner uid
|
||||
Gid uint32 // group gid
|
||||
Size uint64 // total size in bytes
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/google/btree"
|
||||
"strings"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type MemDbStore struct {
|
||||
|
@ -37,6 +38,7 @@ func (filer *MemDbStore) AppendFileChunk(fullpath filer2.FullPath, fileChunk fil
|
|||
return fmt.Errorf("No such file: %s", fullpath)
|
||||
}
|
||||
entry.Chunks = append(entry.Chunks, fileChunk)
|
||||
entry.Mtime = time.Now()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue