Documentation
¶
Index ¶
- Variables
- func FilePathWithSharding(fn string) (string, error)
- func IsValidHash(hash string) bool
- func MustRandString(n int, r io.Reader) string
- func NarFilePath(hash, compression string) (string, error)
- func NarInfoFilePath(hash string) (string, error)
- func NarInfoURLPath(hash string) string
- func ParseSize(str string) (uint64, error)
- func RandString(n int, r io.Reader) (string, error)
- func ValidateHash(hash string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidHash is returned if the hash is invalid. ErrInvalidHash = errors.New("invalid hash") // ErrInputTooShort is returned if the input is too short. ErrInputTooShort = errors.New("input is less than 3 characters long") )
var ErrInvalidSizeSuffix = errors.New("invalid size suffix")
ErrInvalidSizeSuffix is returned if the suffix is not valid.
Functions ¶
func FilePathWithSharding ¶ added in v0.0.12
FilePathWithSharding returns the path to a file with sharding.
func IsValidHash ¶ added in v0.8.2
IsValidHash returns true if the hash is valid (32 or 52 lowercase alphanumeric characters).
func MustRandString ¶ added in v0.0.11
MustRandString returns the string returned by RandString. If RandString returns an error, it will panic.
func NarFilePath ¶ added in v0.0.12
NarFilePath returns the path of the nar file given a hash and an optional compression.
func NarInfoFilePath ¶ added in v0.0.12
NarInfoFilePath returns the path of the narinfo file given a hash.
func NarInfoURLPath ¶ added in v0.0.12
NarInfoURLPath returns the path of the narinfo file given a hash.
func ParseSize ¶ added in v0.0.11
ParseSize parses size with units and returns the same size in bytes.
func RandString ¶ added in v0.0.4
RandString returns a random string of length n using r as the random reader; If r is nil, rand.Reader will be used instead.
func ValidateHash ¶ added in v0.8.2
ValidateHash validates the given hash.
Types ¶
This section is empty.