Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnknownChecksumAlgo = errors.New("unknown checksum algorithm")
)
Functions ¶
func FormatChunkFilename ¶
func FormatSplitfileFilename ¶
Types ¶
type Checksum ¶
type Checksum []byte
Checksum represents a hash checksum.
Implmentens TextMarshaler and TextUnmarshaler.
func (Checksum) MarshalText ¶
func (*Checksum) UnmarshalText ¶
type ChecksumAlgo ¶
type ChecksumAlgo string
ChecksumAlgo represents a checksum algorithm.
const ( ChecksumAlgoNone ChecksumAlgo = "None" ChecksumAlgoCRC32 ChecksumAlgo = "CRC32" )
type File ¶
type File struct {
// Original filename at time of chunk creation.
Filename string `json:"filename"`
// Checksum of the file.
Checksum Checksum `json:"checksum"`
// Size of the file.
Size int64 `json:"size"`
}
File represents a file, either a main file or an specific chunk.
type HasherFunc ¶
HasherFunc is a function that returns a new implementation of hash.Hash.
There is one implementation for every supported checksum algorithm. ChecksumAlgoNone returns a nil HasherFunc and no error.
func GetHasher ¶
func GetHasher(checksumAlgo ChecksumAlgo) (hasherFunc HasherFunc, err error)
type Splitfile ¶
type Splitfile struct {
// Algorithm used for all checksums in the file.
ChecksumAlgo ChecksumAlgo `json:"checksum_algo"`
// The whole main file the chunks were derived from. The checksum is of the
// whole file.
MainFile *File `json:"main_file"`
// The chunks that were derived from the main file. Number of chunks can be
// derived from the number of elements, and their order represents their
// actual order of concatenation to recreate the main file.
Chunks []*File `json:"chunks"`
}
Splitfile is the structure of a of a .split file.
Click to show internal directories.
Click to hide internal directories.