Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type BlockLocator ¶
type BlockLocator struct { Digest blockdigest.BlockDigest Size int Hints []string }
func ParseBlockLocator ¶
func ParseBlockLocator(s string) (b BlockLocator, err error)
type FileSegment ¶
type FileSegment struct { Locator string // Offset (within this block) of this data segment Offset int Len int }
FileSegment is a portion of a file that is contained within a single block.
type FileStreamSegment ¶
FileStreamSegment is a portion of a file described as a segment of a stream.
type Manifest ¶
func (*Manifest) BlockIterWithDuplicates ¶
func (m *Manifest) BlockIterWithDuplicates() <-chan blockdigest.BlockLocator
BlockIterWithDuplicates iterates over the block locators of a manifest.
Blocks may appear multiple times within the same manifest if they are used by multiple files. In that case this Iterator will output the same block multiple times.
In order to detect parse errors, caller must check m.Err after the returned channel closes.
func (Manifest) Extract ¶
Extract extracts some or all of the manifest and returns the extracted portion as a normalized manifest. This is a swiss army knife function that can be several ways:
If 'srcpath' and 'relocate' are '.' it simply returns an equivalent manifest in normalized form.
Extract(".", ".") // return entire normalized manfest text
If 'srcpath' points to a single file, it will return manifest text for just that file. The value of "relocate" is can be used to rename the file or set the file stream.
Extract("./foo", ".") // extract file "foo" and put it in stream "." Extract("./foo", "./bar") // extract file "foo", rename it to "bar" in stream "." Extract("./foo", "./bar/") // extract file "foo", rename it to "./bar/foo" Extract("./foo", "./bar/baz") // extract file "foo", rename it to "./bar/baz")
Otherwise it will return the manifest text for all streams with the prefix in "srcpath" and place them under the path in "relocate".
Extract("./stream", ".") // extract "./stream" to "." and "./stream/subdir" to "./subdir") Extract("./stream", "./bar") // extract "./stream" to "./bar" and "./stream/subdir" to "./bar/subdir")
func (*Manifest) FileSegmentIterByName ¶
func (m *Manifest) FileSegmentIterByName(filepath string) <-chan *FileSegment
func (*Manifest) StreamIter ¶
func (m *Manifest) StreamIter() <-chan ManifestStream
type ManifestStream ¶
type ManifestStream struct { StreamName string Blocks []string FileStreamSegments []FileStreamSegment Err error // contains filtered or unexported fields }
ManifestStream represents a single line from a manifest.
func (*ManifestStream) FileSegmentIterByName ¶
func (s *ManifestStream) FileSegmentIterByName(filepath string) <-chan *FileSegment