par2

package
v0.0.0-...-b12f7c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2013 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crc32Combine

func Crc32Combine(crc1 uint32, crc2 uint32, len2 int) uint32

Combine two crc where the second has a known length. Returns a crc equal to what would have been calculated if the original input blocks for each were concatenated.

**I don't understand how this works, ported directly from zlib

func Crc32Drop

func Crc32Drop(crc uint32, nzero int) uint32

Given a crc that was calculated from a block of data with a number of zeros at the end. Recalculate it such that the nzero zeroes were not present.

Types

type Creator

type Creator struct {
	Message string
}

type File

type File struct {
	FileDesc *FileDesc
	Ifsc     *Ifsc
}

type FileDesc

type FileDesc struct {
	Id        string
	Hash      []byte
	StartHash []byte
	Length    uint64
	Name      string
}

type Ifsc

type Ifsc struct {
	Id     string
	Slices []Slice
}

type MD5Error

type MD5Error struct {
	FileSum []byte
	CalcSum []byte
}

func (MD5Error) Error

func (m MD5Error) Error() string

type Main

type Main struct {
	SliceSize      uint64
	FileCount      uint32
	RecoveryIds    []string
	NonRecoveryIds []string
}

type Set

type Set struct {
	Id       string
	Path     string
	Main     *Main
	Creator  *Creator
	FileDesc map[string]*FileDesc
	Ifsc     map[string]*Ifsc
	Recovery []interface{}
}

func OpenSet

func OpenSet(file string) (set []*Set, err error)

func ReadFull

func ReadFull(rawRd io.Reader) (set []*Set, err error)

func (*Set) Verify

func (s *Set) Verify(fileid string) (good int, bad int, err error)

func (*Set) VerifyReader

func (s *Set) VerifyReader(fileid string, in io.Reader) (good int, bad int, err error)

type Slice

type Slice struct {
	Hash []byte
	Crc  uint32
}

type Verifier

type Verifier struct {
	Good   int
	Bad    int
	FileId string
	// contains filtered or unexported fields
}

func (*Verifier) Close

func (v *Verifier) Close() error

func (*Verifier) Write

func (v *Verifier) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL