sha

package
v0.0.0-...-791c77c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ByteSize      = 32
	ShaNullString = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
	Null          = ShaNullString
)

Variables

View Source
var Equaler equaler
View Source
var ErrIsNull = errors.New("sha is null")
View Source
var Lessor lessor
View Source
var Resetter resetter

Functions

func DebugCompareBlobs

func DebugCompareBlobs(
	ctx errors.Context,
	blobStore interfaces.BlobStore,
	expectedSha interfaces.Sha,
	actual *strings.Builder,
)

func GetPool

func GetPool() interfaces.Pool[Sha, *Sha]

func MakeErrIsNull

func MakeErrIsNull(s *Sha) error

func MakeHashWriter

func MakeHashWriter() (h hash.Hash)

func MakeReadCloser

func MakeReadCloser(r io.Reader) (src readCloser)

func MakeReadCloserTee

func MakeReadCloserTee(r io.Reader, w io.Writer) (src readCloser)

func MakeWriter

func MakeWriter(in io.Writer) (out *writer)

func PageIndexForSha

func PageIndexForSha(width uint8, s interfaces.Sha) (n uint8, err error)

func PageIndexForString

func PageIndexForString(width uint8, s string) (n uint8, err error)

Types

type Bytes

type Bytes [ByteSize]byte

type ErrNotEqual

type ErrNotEqual struct {
	Expected, Actual interfaces.Sha
}

func MakeErrNotEqual

func MakeErrNotEqual(expected, actual interfaces.Sha) *ErrNotEqual

func (*ErrNotEqual) Error

func (e *ErrNotEqual) Error() string

func (*ErrNotEqual) Is

func (e *ErrNotEqual) Is(target error) bool

type PageId

type PageId struct {
	Index  uint8
	Dir    string
	Prefix string
}

func PageIdFromPath

func PageIdFromPath(n uint8, p string) PageId

func (*PageId) Path

func (pid *PageId) Path() string

func (PageId) String

func (pid PageId) String() string

type PathComponents

type PathComponents interface {
	PathComponents() []string
}

type ReadCloser

type ReadCloser = interfaces.ShaReadCloser

TODO-P4 remove

func MakeNopReadCloser

func MakeNopReadCloser(rc io.ReadCloser) ReadCloser

type Sha

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

func FromFormatString

func FromFormatString(f string, vs ...interface{}) *Sha

func FromHash

func FromHash(h hash.Hash) (s *Sha)

func FromStringContent

func FromStringContent(s string) *Sha

func FromStringer

func FromStringer(v interfaces.Stringer) *Sha

func Make

func Make(getter interfaces.ShaGetter) *Sha

func MakeSha

func MakeSha(v string) (s *Sha, err error)

func MakeShaFromPath

func MakeShaFromPath(p string) (s *Sha, err error)

func Must

func Must(v string) (s *Sha)

func (*Sha) AssertEqualsShaLike

func (a *Sha) AssertEqualsShaLike(b interfaces.Sha) error

func (*Sha) Equals

func (a *Sha) Equals(b *Sha) bool

func (*Sha) EqualsAny

func (a *Sha) EqualsAny(b any) bool

func (*Sha) EqualsSha

func (a *Sha) EqualsSha(b interfaces.Sha) bool

func (*Sha) GetBytes

func (s *Sha) GetBytes() Bytes

func (*Sha) GetHead

func (s *Sha) GetHead() string

func (*Sha) GetShaBytes

func (s *Sha) GetShaBytes() []byte

func (*Sha) GetShaLike

func (s *Sha) GetShaLike() interfaces.Sha

func (*Sha) GetShaString

func (s *Sha) GetShaString() string

func (*Sha) GetTail

func (s *Sha) GetTail() string

func (*Sha) IsNull

func (s *Sha) IsNull() bool

func (*Sha) MarshalBinary

func (s *Sha) MarshalBinary() (text []byte, err error)

func (*Sha) MarshalText

func (s *Sha) MarshalText() (text []byte, err error)

func (*Sha) Path

func (s *Sha) Path(pc ...string) string

func (*Sha) ReadAtFrom

func (s *Sha) ReadAtFrom(r io.ReaderAt, start int64) (n int64, err error)

func (*Sha) ReadFrom

func (s *Sha) ReadFrom(r io.Reader) (n int64, err error)

func (*Sha) Reset

func (s *Sha) Reset()

func (*Sha) ResetWith

func (a *Sha) ResetWith(b *Sha)

func (*Sha) ResetWithShaLike

func (a *Sha) ResetWithShaLike(b interfaces.Sha)

func (*Sha) Set

func (s *Sha) Set(v string) (err error)

func (*Sha) SetFromHash

func (dst *Sha) SetFromHash(h hash.Hash) (err error)

func (*Sha) SetFromPath

func (s *Sha) SetFromPath(p string) (err error)

func (*Sha) SetHexBytes

func (s *Sha) SetHexBytes(b []byte) (err error)

func (*Sha) SetParts

func (s *Sha) SetParts(a, b string) (err error)

func (*Sha) SetShaLike

func (dst *Sha) SetShaLike(src ShaLike) (err error)

func (*Sha) Sha

func (s *Sha) Sha() *Sha

func (*Sha) Size

func (s *Sha) Size() int

func (*Sha) String

func (s *Sha) String() string

func (*Sha) UnmarshalBinary

func (s *Sha) UnmarshalBinary(text []byte) (err error)

func (*Sha) UnmarshalText

func (s *Sha) UnmarshalText(text []byte) (err error)

func (*Sha) WriteTo

func (src *Sha) WriteTo(w io.Writer) (n int64, err error)

type ShaLike

type ShaLike = interfaces.ShaGetter

type Slice

type Slice []*Sha

func (*Slice) ReadFrom

func (s *Slice) ReadFrom(r io.Reader) (n int64, err error)

type WriteCloser

type WriteCloser = interfaces.ShaWriteCloser

TODO-P4 remove

Jump to

Keyboard shortcuts

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