package
1.5.0
Repository: https://github.com/m3db/m3.git
Documentation: pkg.go.dev

# README

digest

This package consolidates all our digest algorithms used for data integrity into a single place. Adler32 is used and dependendent on the use case we rely on the standard library or a modified rolling hash version that can be stack allocated.

For highly concurrent callsites that require digests, they use the stack based adler32 library to avoid having to pool digest structs. The stack based adler32 library is a few percent slower than the standard library adler32 algorithm but heap allocation free.

For less concurrent callsites or callsites already under a mutex a cached digest struct can be kept and reused, these callsites use the standard library methods.

For callsites that do not need to incremental checksumming, meaning they only need to checksum a single byte slice, the static checksum method from the standard library is used.

# Functions

Checksum returns the checksum for a buffer.
NewBuffer creates a new digest buffer.
NewDigest creates a new digest.
NewFdWithDigestContentsReader creates a new FdWithDigestContentsReader.
NewFdWithDigestContentsWriter creates a new FdWithDigestContentsWriter.
NewFdWithDigestReader creates a new FdWithDigestReader.
NewFdWithDigestWriter creates a new FdWithDigestWriter.
NewMockReaderWithDigest creates a new mock instance.
NewReaderWithDigest creates a new reader that calculates a digest as it reads an input.
ToBuffer converts a byte slice to a digest buffer.

# Constants

DigestLenBytes is the length of generated digests in bytes.

# Structs

MockReaderWithDigest is a mock of ReaderWithDigest interface.
MockReaderWithDigestMockRecorder is the mock recorder for MockReaderWithDigest.

# Interfaces

FdWithDigest is a container for a file descriptor and the digest for the file contents.
FdWithDigestContentsReader provides additional functionality of reading a digest from the underlying file.
FdWithDigestContentsWriter provides additional functionality of writing a digest to the underlying file.
FdWithDigestReader provides a buffered reader for reading from the underlying file.
FdWithDigestWriter provides a buffered writer for writing to the underlying file.
ReaderWithDigest is a reader that that calculates a digest as it is read.

# Type aliases

Buffer is a byte slice that facilitates digest reading and writing.