You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
433 B
23 lines
433 B
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
|
|
}
|