gitio

package
v14.10.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashfileReader

type HashfileReader struct {
	// contains filtered or unexported fields
}

HashfileReader reads and verifies Git "hashfiles" as defined in https://github.com/git/git/blob/v2.21.0/csum-file.h.

func NewHashfileReader

func NewHashfileReader(r io.Reader) *HashfileReader

NewHashfileReader wraps r to return a reader that will omit the trailing checksum. When the HashfileReader reaches EOF it will transparently compare the actual checksum, as calculated while reading, to the expected checksum provided by the trailer of r.

func (*HashfileReader) Read

func (hr *HashfileReader) Read(p []byte) (int, error)

type TrailerReader

type TrailerReader struct {
	// contains filtered or unexported fields
}

TrailerReader models the behavior of Git hashfiles where the last N bytes of the underlying reader are not part of the content. TrailerReader acts like an io.Reader but will always hold back the last N bytes. Once the underlying reader has reached EOF, the trailer (the last N bytes) can be retrieved with the Trailer() method.

func NewTrailerReader

func NewTrailerReader(r io.Reader, trailerSize int) *TrailerReader

NewTrailerReader returns a new TrailerReader. The returned TrailerReader will never return the last trailerSize bytes of r; to get to those bytes, first read the TrailerReader to EOF and then call Trailer().

func (*TrailerReader) Read

func (tr *TrailerReader) Read(p []byte) (int, error)

func (*TrailerReader) Trailer

func (tr *TrailerReader) Trailer() ([]byte, error)

Trailer yields the last trailerSize bytes of the underlying reader of tr. If the underlying reader has not reached EOF yet Trailer will return an error.

Jump to

Keyboard shortcuts

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