Documentation ¶
Index ¶
- Constants
- Variables
- func EntriesSort(o objects)
- func IsNotFound(err error) bool
- func NewPacks(db string) (Set, Packs, error)
- type Encoder
- type Entry
- type Index
- type IndexEntry
- type IndexVersion
- type IndexZ
- type Packfile
- type Packs
- type RecvFunc
- type Scanner
- func (s *Scanner) Close() error
- func (s *Scanner) Exists(name plumbing.Hash) error
- func (s *Scanner) Names() []string
- func (s *Scanner) Open(oid plumbing.Hash) (r io.ReadCloser, err error)
- func (s *Scanner) PackedObjects(recv RecvFunc) error
- func (s *Scanner) Search(prefix plumbing.Hash) (plumbing.Hash, error)
- type Set
- type SizeReader
- type Storage
- type UnsupportedVersionErr
- type Writer
Constants ¶
const ( PackVersion uint32 = 'Z' NoEntries uint32 = 0 )
const (
HashDigestSize = plumbing.HASH_DIGEST_SIZE
)
const (
IndexVersionCurrent = 'Z'
)
Variables ¶
var ( // ErrShortFanout is an error representing situations where the entire // fanout table could not be read, and is thus too short. ErrShortFanout = fmt.Errorf("zeta: too short fanout table") )
Functions ¶
func EntriesSort ¶
func EntriesSort(o objects)
EntriesSort sorts a slice of write index in increasing order.
func IsNotFound ¶
IsNotFound returns whether a given error represents a missing object in the index.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func (*Encoder) WriteTrailer ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index stores information about the location of objects in a corresponding packfile.
func DecodeIndex ¶
DecodeIndex decodes an index whose underlying data is supplied by "r".
DecodeIndex reads only the header and fanout table, and does not eagerly parse index entries.
If there was an error parsing, it will be returned immediately.
func (*Index) Close ¶
Close closes the packfile index if the underlying data stream is closeable. If so, it returns any error involved in closing.
func (*Index) Entry ¶
func (i *Index) Entry(name plumbing.Hash) (*IndexEntry, error)
Entry returns an entry containing the offset of a given BLAKE3 "name".
Entry operates in O(log(n))-time in the worst case, where "n" is the number of objects that begin with the first byte of "name".
If the entry cannot be found, (nil, ErrNotFound) will be returned. If there was an error searching for or parsing an entry, it will be returned as (nil, err).
Otherwise, (entry, nil) will be returned.
func (*Index) PackedObjects ¶
type IndexEntry ¶
type IndexEntry struct { Pos int64 // PackOffset is the number of bytes before the associated object in a // packfile. PackOffset uint64 }
IndexEntry specifies data encoded into an entry in the pack index.
type IndexVersion ¶
type IndexVersion interface { // Name returns the name of the object located at the given offset "at", // in the Index file "idx". // // It returns an error if the object at that location could not be // parsed. Name(idx *Index, at int64) (plumbing.Hash, error) // Entry parses and returns the full *IndexEntry located at the offset // "at" in the Index file "idx". // // If there was an error parsing the IndexEntry at that location, it // will be returned. Entry(idx *Index, at int64) (*IndexEntry, error) // PackedObjects PackedObjects(idx *Index, recv RecvFunc) error // Width returns the number of bytes occupied by the header of a // particular index version. Width() int64 }
type IndexZ ¶
type IndexZ struct { }
IndexZ implements IndexVersion for packfiles.
func (*IndexZ) Entry ¶
func (v *IndexZ) Entry(idx *Index, at int64) (*IndexEntry, error)
Entry implements IndexVersion.Entry for v2 packfiles by parsing and returning the IndexEntry specified at the offset "at" in the given index file.
type Packfile ¶
type Packfile struct { // Version is the version of the packfile. Version uint32 // Objects is the total number of objects in the packfile. Objects uint32 // contains filtered or unexported fields }
Packfile encapsulates the behavior of accessing an unpacked representation of all of the objects encoded in a single packfile.
func DecodePackfile ¶
DecodePackfile opens the packfile given by the io.ReaderAt "r" for reading. It does not apply any delta-base chains, nor does it do reading otherwise beyond the header.
If the header is malformed, or otherwise cannot be read, an error will be returned without a corresponding packfile.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func NewScanner ¶
func (*Scanner) PackedObjects ¶
type Set ¶
type SizeReader ¶
type SizeReader struct {
// contains filtered or unexported fields
}
SizeReader transforms an io.ReaderAt into an io.Reader by beginning and advancing all reads at the given offset.
func NewSizeReader ¶
func NewSizeReader(r io.ReaderAt, offset int64, size int64) *SizeReader
func (*SizeReader) Read ¶
func (r *SizeReader) Read(p []byte) (n int, err error)
Read implements io.Reader.Read by reading into the given []byte, "p" from the last known offset provided to the OffsetReaderAt.
It returns any error encountered from the underlying data stream, and advances the reader forward by "n", the number of bytes read from the underlying data stream.
func (*SizeReader) Size ¶
func (r *SizeReader) Size() int64
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage implements the storage.Storage interface.
func NewStorage ¶
NewStorage returns a new storage object based on a pack set.
type UnsupportedVersionErr ¶
type UnsupportedVersionErr struct { // Got is the unsupported version that was detected. Got uint32 }
UnsupportedVersionErr is a type implementing 'error' which indicates a the presence of an unsupported packfile version.
func (*UnsupportedVersionErr) Error ¶
func (u *UnsupportedVersionErr) Error() string
Error implements 'error.Error()'.