Documentation ¶
Overview ¶
Package digest is a generated GoMock package.
Index ¶
- Constants
- func Checksum(buf []byte) uint32
- func NewDigest() stackadler32.Digest
- type Buffer
- type FdWithDigest
- type FdWithDigestContentsReader
- type FdWithDigestContentsWriter
- type FdWithDigestReader
- type FdWithDigestWriter
- type MockReaderWithDigest
- type MockReaderWithDigestMockRecorder
- func (mr *MockReaderWithDigestMockRecorder) Digest() *gomock.Call
- func (mr *MockReaderWithDigestMockRecorder) Read(arg0 interface{}) *gomock.Call
- func (mr *MockReaderWithDigestMockRecorder) Reset(arg0 interface{}) *gomock.Call
- func (mr *MockReaderWithDigestMockRecorder) Validate(arg0 interface{}) *gomock.Call
- type ReaderWithDigest
Constants ¶
const (
// DigestLenBytes is the length of generated digests in bytes.
DigestLenBytes = 4
)
Variables ¶
This section is empty.
Functions ¶
func NewDigest ¶
func NewDigest() stackadler32.Digest
NewDigest creates a new digest. The default 32-bit hashing algorithm is adler32.
Types ¶
type Buffer ¶
type Buffer []byte
Buffer is a byte slice that facilitates digest reading and writing.
func (Buffer) ReadDigest ¶
ReadDigest reads the digest from the buffer.
func (Buffer) ReadDigestFromFile ¶
ReadDigestFromFile reads the digest from the file.
func (Buffer) WriteDigest ¶
WriteDigest writes a digest to the buffer.
type FdWithDigest ¶
type FdWithDigest interface { xclose.Closer // Fd returns the file descriptor. Fd() *os.File // Digest returns the digest. Digest() hash.Hash32 // Reset resets the file descriptor and the digest. Reset(fd *os.File) }
FdWithDigest is a container for a file descriptor and the digest for the file contents.
type FdWithDigestContentsReader ¶
type FdWithDigestContentsReader interface { FdWithDigestReader // ReadDigest reads a digest from the underlying file. ReadDigest() (uint32, error) }
FdWithDigestContentsReader provides additional functionality of reading a digest from the underlying file.
func NewFdWithDigestContentsReader ¶
func NewFdWithDigestContentsReader(bufferSize int) FdWithDigestContentsReader
NewFdWithDigestContentsReader creates a new FdWithDigestContentsReader.
type FdWithDigestContentsWriter ¶
type FdWithDigestContentsWriter interface { FdWithDigestWriter // WriteDigests writes a list of digests to the underlying file. WriteDigests(digests ...uint32) error }
FdWithDigestContentsWriter provides additional functionality of writing a digest to the underlying file.
func NewFdWithDigestContentsWriter ¶
func NewFdWithDigestContentsWriter(bufferSize int) FdWithDigestContentsWriter
NewFdWithDigestContentsWriter creates a new FdWithDigestContentsWriter.
type FdWithDigestReader ¶
type FdWithDigestReader interface { FdWithDigest io.Reader // ReadAllAndValidate reads everything in the underlying file and validates // it against the expected digest, returning an error if they don't match. // Note: the buffer "b" must be an exact match for how long the contents being // read is, the signature is structured this way to allow for buffer reuse. ReadAllAndValidate(b []byte, expectedDigest uint32) (int, error) // Validate compares the current digest against the expected digest and returns // an error if they don't match. Validate(expectedDigest uint32) error }
FdWithDigestReader provides a buffered reader for reading from the underlying file.
func NewFdWithDigestReader ¶
func NewFdWithDigestReader(bufferSize int) FdWithDigestReader
NewFdWithDigestReader creates a new FdWithDigestReader.
type FdWithDigestWriter ¶
type FdWithDigestWriter interface { FdWithDigest io.Writer Flush() error }
FdWithDigestWriter provides a buffered writer for writing to the underlying file.
func NewFdWithDigestWriter ¶
func NewFdWithDigestWriter(bufferSize int) FdWithDigestWriter
NewFdWithDigestWriter creates a new FdWithDigestWriter.
type MockReaderWithDigest ¶
type MockReaderWithDigest struct {
// contains filtered or unexported fields
}
MockReaderWithDigest is a mock of ReaderWithDigest interface
func NewMockReaderWithDigest ¶
func NewMockReaderWithDigest(ctrl *gomock.Controller) *MockReaderWithDigest
NewMockReaderWithDigest creates a new mock instance
func (*MockReaderWithDigest) Digest ¶
func (m *MockReaderWithDigest) Digest() hash.Hash32
Digest mocks base method
func (*MockReaderWithDigest) EXPECT ¶
func (m *MockReaderWithDigest) EXPECT() *MockReaderWithDigestMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReaderWithDigest) Read ¶
func (m *MockReaderWithDigest) Read(arg0 []byte) (int, error)
Read mocks base method
func (*MockReaderWithDigest) Reset ¶
func (m *MockReaderWithDigest) Reset(arg0 io.Reader)
Reset mocks base method
func (*MockReaderWithDigest) Validate ¶
func (m *MockReaderWithDigest) Validate(arg0 uint32) error
Validate mocks base method
type MockReaderWithDigestMockRecorder ¶
type MockReaderWithDigestMockRecorder struct {
// contains filtered or unexported fields
}
MockReaderWithDigestMockRecorder is the mock recorder for MockReaderWithDigest
func (*MockReaderWithDigestMockRecorder) Digest ¶
func (mr *MockReaderWithDigestMockRecorder) Digest() *gomock.Call
Digest indicates an expected call of Digest
func (*MockReaderWithDigestMockRecorder) Read ¶
func (mr *MockReaderWithDigestMockRecorder) Read(arg0 interface{}) *gomock.Call
Read indicates an expected call of Read
func (*MockReaderWithDigestMockRecorder) Reset ¶
func (mr *MockReaderWithDigestMockRecorder) Reset(arg0 interface{}) *gomock.Call
Reset indicates an expected call of Reset
func (*MockReaderWithDigestMockRecorder) Validate ¶
func (mr *MockReaderWithDigestMockRecorder) Validate(arg0 interface{}) *gomock.Call
Validate indicates an expected call of Validate
type ReaderWithDigest ¶
type ReaderWithDigest interface { io.Reader // Reset resets the reader for use with a new reader. Reset(reader io.Reader) // Digest returns the digest. Digest() hash.Hash32 // Validate compares the current digest against the expected digest and returns // an error if they don't match. Validate(expectedDigest uint32) error }
ReaderWithDigest is a reader that that calculates a digest as it is read.
func NewReaderWithDigest ¶
func NewReaderWithDigest(reader io.Reader) ReaderWithDigest
NewReaderWithDigest creates a new reader that calculates a digest as it reads an input.