mirror of
https://github.com/restic/restic.git
synced 2026-06-20 07:34:18 +00:00
c062a78dcd
This removes them from the public interface. The latter now only provides the PackBlob interface, without being bound to the type used internally by the pack package.
33 lines
717 B
Go
33 lines
717 B
Go
package pack
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/restic/restic/internal/crypto"
|
|
"github.com/restic/restic/internal/restic"
|
|
)
|
|
|
|
// Blob is one part of a file or a tree with pack layout information.
|
|
type Blob struct {
|
|
restic.BlobHandle
|
|
Length uint
|
|
Offset uint
|
|
UncompressedLength uint
|
|
}
|
|
|
|
func (b Blob) String() string {
|
|
return fmt.Sprintf("<Blob (%v) %v, offset %v, length %v, uncompressed length %v>",
|
|
b.Type, b.ID.Str(), b.Offset, b.Length, b.UncompressedLength)
|
|
}
|
|
|
|
func (b Blob) DataLength() uint {
|
|
if b.UncompressedLength != 0 {
|
|
return b.UncompressedLength
|
|
}
|
|
return uint(crypto.PlaintextLength(int(b.Length)))
|
|
}
|
|
|
|
func (b Blob) IsCompressed() bool {
|
|
return b.UncompressedLength != 0
|
|
}
|