Versions in this module Expand all Collapse all v1 v1.3.19 Jun 6, 2023 v1.3.18 Jun 6, 2023 Changes in this version + const AzCksumHeader + const AzVersionHeader + const ChecksumCRC32C + const ChecksumMD5 + const ChecksumNone + const ChecksumSHA256 + const ChecksumSHA512 + const ChecksumXXHash + const ContentBinary + const ContentJSON + const ContentJSONCharsetUTF + const ContentLengthUnknown + const ContentMsgPack + const ContentTar + const ContentXML + const ContentZip + const CtxOriginalURL + const CtxReadWrapper + const CtxSetSize + const GB + const GiB + const GsCksumHeader + const GsVersionHeader + const HdrAccept + const HdrAcceptRanges + const HdrContentLength + const HdrContentRange + const HdrContentRangeValPrefix + const HdrContentType + const HdrContentTypeOptions + const HdrETag + const HdrLocation + const HdrRange + const HdrRangeValPrefix + const HdrServer + const HdrUserAgent + const ISO8601 + const KB + const KiB + const LenRunes + const LetterRunes + const MB + const MLCG32 + const MiB + const MultiSyncMapCount + const OnlyNice + const OnlyPlus + const PermRWR + const PermRWRR + const PermRWXRX + const QuantityBytes + const QuantityPercent + const RFC1123GMT + const S3ChecksumCRC32 + const S3ChecksumCRC32C + const S3ChecksumSHA1 + const S3ChecksumSHA256 + const S3CksumHeader + const S3HdrBckRegion + const S3HdrContentSHA256 + const S3HdrMptCnt + const S3HdrObjSrc + const S3LastModified + const S3MetadataChecksumType + const S3MetadataChecksumVal + const S3VersionHeader + const SizeofI16 + const SizeofI32 + const SizeofI64 + const SizeofLen + const StampMicro + const StampSec + const TB + const TiB + const UnitsIEC + const UnitsRaw + const UnitsSI + var ErrBufferUnderrun = errors.New("buffer underrun") + var ErrEmptyTemplate = errors.New("empty range template") + var ErrInvalidQuantityBytes = errors.New("value (bytes) must be non-negative") + var ErrInvalidQuantityPercent = errors.New("percent must be in the range (0, 100)") + var ErrInvalidQuantityUsage = errors.New("invalid quantity, format should be '81%' or '1GB'") + var JSON jsoniter.API + var NoneCksum = NewCksum(ChecksumNone, "") + func Abs(a int) int + func AbsI64(a int64) int64 + func AnyHasPrefixInSlice(prefix string, arr []string) bool + func Assert(cond bool) + func AssertMsg(cond bool, msg string) + func AssertNoErr(err error) + func Assertf(cond bool, f string, a ...any) + func BHead(b []byte) string + func CapitalizeString(s string) string + func CeilAlign(val, align uint) uint + func CeilAlignInt64(val, align int64) int64 + func ClearfAtomic(f *uint64, flags uint64) (ok bool) + func Close(closer io.Closer) + func ConvertToString(value any) (valstr string, err error) + func CopyStruct(dst, src any) + func CreateDir(dir string) error + func CreateFile(fqn string) (*os.File, error) + func CryptoRandS(n int) string + func DamerauLevenstheinDistance(s, t string) int + func DivCeil(a, b int64) int64 + func DivRound(a, b int64) int64 + func DivRoundU64(a, b uint64) uint64 + func DrainReader(r io.Reader) + func Either(lhs, rhs string) string + func Err2ClientURLErr(err error) (uerr *url.Error) + func Errorf(format string, a ...any) + func ExitLog(a ...any) + func ExitLogf(f string, a ...any) + func Exitf(f string, a ...any) + func ExpandPath(path string) string + func FastLog2(c uint64) uint + func FastLog2Ceil(c uint64) uint + func FloodWriter(w io.Writer, n int64) error + func FlushClose(file *os.File) (err error) + func FormatMilli(tm time.Duration) string + func FormatNanoTime(unixnano int64, format string) string + func FormatNowStamp() string + func FormatTime(t time.Time, format string) string + func FreeMemToOS(d ...time.Duration) + func GenDaemonID() string + func GenTestingDaemonID(suffix string) string + func GenTie() string + func GenUUID() (uuid string) + func HomeConfigDir(subdir string) (configDir string) + func HomeDir() (string, error) + func Infof(format string, a ...any) + func InitShortID(seed uint64) + func IsAlphaNice(s string) bool + func IsAlphaPlus(s string) bool + func IsAnySetfAtomic(f *uint64, flags uint64) (yes bool) + func IsAzureURL(u *url.URL) bool + func IsEOF(err error) bool + func IsErrBadCksum(err error) bool + func IsErrBrokenPipe(err error) (yes bool) + func IsErrClientURLTimeout(err error) bool + func IsErrConnectionNotAvail(err error) (yes bool) + func IsErrConnectionRefused(err error) (yes bool) + func IsErrConnectionReset(err error) (yes bool) + func IsErrNotFound(err error) bool + func IsErrOOS(err error) bool + func IsErrSyscallTimeout(err error) bool + func IsErrXattrNotFound(err error) bool — darwin/amd64, linux/amd64 + func IsGoogleAPIURL(u *url.URL) bool + func IsGoogleStorageURL(u *url.URL) bool + func IsHTTP(url string) bool + func IsHTTPS(url string) bool + func IsIOError(err error) bool — darwin/amd64, linux/amd64 + func IsParseBool(s string) bool + func IsRetriableConnErr(err error) (yes bool) + func IsS3URL(link string) bool + func IsSetfAtomic(f *uint64, flags uint64) (yes bool) + func IsTimeZero(t time.Time) bool + func IsUnreachable(err error, status int) bool + func IsValidAtime(atime int64) bool + func IsValidUUID(uuid string) bool + func JoinPath(url, path string) string + func JoinWords(w string, words ...string) (path string) + func Max(xs ...int) int + func MaxDuration(a, b time.Duration) time.Duration + func MaxI32(a, b int32) int32 + func MaxI64(a, b int64) int64 + func MaxU64(a, b uint64) uint64 + func MaxUint(a, b uint) uint + func Min(xs ...int) int + func MinDuration(a, b time.Duration) time.Duration + func MinF64(a, b float64) float64 + func MinI32(a, b int32) int32 + func MinI64(a, b int64) int64 + func MinTime(a, b time.Time) time.Time + func MinU64(a, b uint64) uint64 + func MinUint(a, b uint) uint + func MorphMarshal(data, v any) error + func MustMarshal(v any) []byte + func MustMarshalToString(v any) string + func MustMorphMarshal(data, v any) + func NewCRC32C() hash.Hash + func NewErrDataCksum(a, b *Cksum, context ...string) error + func NewErrMetaCksum(a, b uint64, context ...string) error + func NopReader(size int64) io.Reader + func NowRand() *rand.Rand + func PackedStrLen(s string) int + func ParseBool(s string) (value bool, err error) + func ParseSize(size, units string) (int64, error) + func ParseURL(s string) (u *url.URL, valid bool) + func Plural(num int) (s string) + func ProbingFrequency(dur time.Duration) time.Duration + func RandStringWithSrc(src rand.Source, n int) string + func Ratio(high, low, curr int64) float32 + func RatioPct(high, low, curr int64) int64 + func ReadLines(filename string, cb func(string) error) error + func ReadOneInt64(filename string) (int64, error) + func ReadOneLine(filename string) (string, error) + func ReadOneUint64(filename string) (uint64, error) + func RemoveFile(path string) (err error) + func Rename(src, dst string) (err error) + func ReparseQuery(r *http.Request) + func S2Duration(s string) (time.Duration, error) + func S2UnixNano(s string) (int64, error) + func SHead(s string) string + func SetfAtomic(f *uint64, flags uint64) (ok bool) + func Stat(path string) error + func StrSlicesEqual(lhs, rhs []string) bool + func StrToSentence(str string) string + func StringInSlice(s string, arr []string) bool + func StringSliceToIntSlice(strs []string) ([]int64, error) + func SupportedChecksums() (types []string) + func ToSizeIEC(b int64, digits int) string + func UnixNano2S(unixnano int64) string + func UnsafeB(s string) []byte + func UnsafeS(b []byte) string + func UnwrapSyscallErr(err error) error + func ValidateCksumType(ty string, emptyOK ...bool) (err error) + func ValidateDaemonID(id string) error + func ValidateNiceID(id string, minlen int, tag string) (err error) + func Warningf(format string, a ...any) + type BitFlags uint64 + func (f BitFlags) Clear(flags BitFlags) BitFlags + func (f BitFlags) IsAnySet(flags BitFlags) bool + func (f BitFlags) IsSet(flags BitFlags) bool + func (f BitFlags) Set(flags BitFlags) BitFlags + type Bits uint8 + func (b *Bits) Clear(flag Bits) + func (b *Bits) Has(flag Bits) bool + func (b *Bits) Set(flag Bits) + func (b *Bits) Toggle(flag Bits) + type ByteHandle struct + func NewByteHandle(bt []byte) *ByteHandle + func (*ByteHandle) Close() error + func (b *ByteHandle) Open() (ReadOpenCloser, error) + type BytePack struct + func NewPacker(buf []byte, bufLen int) *BytePack + func (bw *BytePack) Bytes() []byte + func (bw *BytePack) WriteAny(st Packer) + func (bw *BytePack) WriteBool(b bool) + func (bw *BytePack) WriteByte(b byte) + func (bw *BytePack) WriteBytes(b []byte) + func (bw *BytePack) WriteInt16(i int16) + func (bw *BytePack) WriteInt32(i int32) + func (bw *BytePack) WriteInt64(i int64) + func (bw *BytePack) WriteMapStrUint16(mp MapStrUint16) + func (bw *BytePack) WriteString(s string) + func (bw *BytePack) WriteUint16(i uint16) + func (bw *BytePack) WriteUint32(i uint32) + func (bw *BytePack) WriteUint64(i uint64) + type ByteUnpack struct + func NewUnpacker(buf []byte) *ByteUnpack + func (br *ByteUnpack) Bytes() []byte + func (br *ByteUnpack) Len() int + func (br *ByteUnpack) ReadAny(st Unpacker) error + func (br *ByteUnpack) ReadBool() (bool, error) + func (br *ByteUnpack) ReadByte() (byte, error) + func (br *ByteUnpack) ReadBytes() ([]byte, error) + func (br *ByteUnpack) ReadInt16() (int16, error) + func (br *ByteUnpack) ReadInt32() (int32, error) + func (br *ByteUnpack) ReadInt64() (int64, error) + func (br *ByteUnpack) ReadMapStrUint16() (MapStrUint16, error) + func (br *ByteUnpack) ReadString() (string, error) + func (br *ByteUnpack) ReadUint16() (uint16, error) + func (br *ByteUnpack) ReadUint32() (uint32, error) + func (br *ByteUnpack) ReadUint64() (uint64, error) + type CallbackROC struct + func NewCallbackReadOpenCloser(r ReadOpenCloser, readCb func(int, error), reportedBytes ...int) *CallbackROC + func (r *CallbackROC) Close() error + func (r *CallbackROC) Open() (ReadOpenCloser, error) + func (r *CallbackROC) Read(p []byte) (n int, err error) + type Cksum struct + func ChecksumBytes(b []byte, cksumType string) (cksum *Cksum, err error) + func NewCksum(ty, value string) *Cksum + func (ck *Cksum) Clone() *Cksum + func (ck *Cksum) Equal(to *Cksum) bool + func (ck *Cksum) Get() (string, string) + func (ck *Cksum) IsEmpty() bool + func (ck *Cksum) MarshalJSON() ([]byte, error) + func (ck *Cksum) String() string + func (ck *Cksum) Ty() string + func (ck *Cksum) Type() string + func (ck *Cksum) Val() string + func (ck *Cksum) Value() string + type CksumHash struct + H hash.Hash + func CopyAndChecksum(w io.Writer, r io.Reader, buf []byte, cksumType string) (n int64, cksum *CksumHash, err error) + func CopyFile(src, dst string, buf []byte, cksumType string) (written int64, cksum *CksumHash, err error) + func NewCksumHash(ty string) (ck *CksumHash) + func SaveReader(fqn string, reader io.Reader, buf []byte, cksumType string, size int64) (cksum *CksumHash, err error) + func SaveReaderSafe(tmpfqn, fqn string, reader io.Reader, buf []byte, cksumType string, size int64) (cksum *CksumHash, err error) + func (ck *CksumHash) Equal(to *Cksum) bool + func (ck *CksumHash) Finalize() + func (ck *CksumHash) Init(ty string) + func (ck *CksumHash) Sum() []byte + type CksumHashSize struct + Size int64 + func (ck *CksumHashSize) Write(b []byte) (n int, err error) + type Duration time.Duration + func (d *Duration) UnmarshalJSON(b []byte) (err error) + func (d Duration) D() time.Duration + func (d Duration) MarshalJSON() ([]byte, error) + func (d Duration) String() (s string) + type DynSemaphore struct + func NewDynSemaphore(n int) *DynSemaphore + func (s *DynSemaphore) Acquire(cnts ...int) + func (s *DynSemaphore) Release(cnts ...int) + func (s *DynSemaphore) SetSize(n int) + func (s *DynSemaphore) Size() int + type ErrBadCksum struct + func (e *ErrBadCksum) Error() string + type ErrNotFound struct + func NewErrNotFound(format string, a ...any) *ErrNotFound + func (e *ErrNotFound) Error() string + type ErrSignal struct + func NewSignalError(s syscall.Signal) *ErrSignal + func (e *ErrSignal) Error() string + func (e *ErrSignal) ExitCode() int + type ErrTemplate struct + func (e *ErrTemplate) Error() string + type ErrValue struct + func (*ErrValue) Load() any + func (ea *ErrValue) Cnt() int + func (ea *ErrValue) Err() (err error) + func (ea *ErrValue) Store(err error) + type FS struct + Fs string + FsID FsID + FsType string + func (fs *FS) Equal(otherFs FS) bool + func (fs *FS) String() string + type FileHandle struct + func NewFileHandle(fqn string) (*FileHandle, error) + func (f *FileHandle) Open() (ReadOpenCloser, error) + type FileSectionHandle struct + func NewFileSectionHandle(fqn string, offset, size int64) (*FileSectionHandle, error) + func (f *FileSectionHandle) Close() error + func (f *FileSectionHandle) Open() (ReadOpenCloser, error) + func (f *FileSectionHandle) Read(buf []byte) (int, error) + type FsID [2]int32 + func (d *FsID) UnmarshalJSON(b []byte) error + func (d FsID) MarshalJSON() ([]byte, error) + func (d FsID) String() string + type JSONRawMsgs map[string]jsoniter.RawMessage + type LimitedWaitGroup struct + func (lwg *LimitedWaitGroup) Add(n int) + func (lwg *LimitedWaitGroup) Done() + func (lwg *LimitedWaitGroup) Wait() + type MapStrUint16 map[string]uint16 + type MultiSyncMap struct + M [MultiSyncMapCount]sync.Map + func (msm *MultiSyncMap) Get(idx int) *sync.Map + func (msm *MultiSyncMap) GetByHash(hash uint32) *sync.Map + type NamedVal64 struct + Name string + NameSuffix string + Value int64 + type NopLocker struct + func (NopLocker) Lock() + func (NopLocker) Unlock() + type OAH interface + AtimeUnix func() int64 + Checksum func() *Cksum + GetCustomKey func(key string) (val string, exists bool) + GetCustomMD func() StrKVs + SetCustomKey func(k, v string) + SizeBytes func(special ...bool) int64 + String func() string + Version func(special ...bool) string + type Packer interface + Pack func(packer *BytePack) + PackedSize func() int + type ParsedQuantity struct + Type string + Value uint64 + func ParseQuantity(quantity string) (ParsedQuantity, error) + func (pq ParsedQuantity) String() string + type ParsedTemplate struct + Prefix string + Ranges []TemplateRange + func NewParsedTemplate(template string) (ParsedTemplate, error) + func ParseAtTemplate(template string) (pt ParsedTemplate, err error) + func ParseBashTemplate(template string) (pt ParsedTemplate, err error) + func ParseFmtTemplate(template string) (pt ParsedTemplate, err error) + func (pt *ParsedTemplate) Count() int64 + func (pt *ParsedTemplate) InitIter() + func (pt *ParsedTemplate) Next() (string, bool) + func (pt *ParsedTemplate) ToSlice(maxLen ...int) []string + type ReadCloseSizer interface + Size func() int64 + func NewDeferRCS(r ReadCloseSizer, cb func()) ReadCloseSizer + func NewSizedRC(r io.ReadCloser, size int64) ReadCloseSizer + type ReadOpenCloseSizer interface + Size func() int64 + type ReadOpenCloser interface + Open func() (ReadOpenCloser, error) + func NopOpener(r io.ReadCloser) ReadOpenCloser + type ReadReaderAt interface + type ReadSizer interface + Size func() int64 + func NewSizedReader(r io.Reader, size int64) ReadSizer + type ReadWrapperFunc func(r io.ReadCloser) io.ReadCloser + type ReaderArgs struct + DeferCb func() + R io.Reader + ReadCb func(int, error) + Size int64 + type ReaderWithArgs struct + func NewReaderWithArgs(args ReaderArgs) *ReaderWithArgs + func (*ReaderWithArgs) Open() (ReadOpenCloser, error) + func (r *ReaderWithArgs) Close() (err error) + func (r *ReaderWithArgs) Read(p []byte) (n int, err error) + func (r *ReaderWithArgs) Size() int64 + type Runner interface + Name func() string + Run func() error + Stop func(error) + type SectionHandle struct + func NewSectionHandle(r io.ReaderAt, offset, size, padding int64) *SectionHandle + func (*SectionHandle) Close() error + func (f *SectionHandle) Open() (ReadOpenCloser, error) + func (f *SectionHandle) Read(buf []byte) (n int, err error) + type Semaphore struct + func NewSemaphore(n int) *Semaphore + func (s *Semaphore) Acquire() + func (s *Semaphore) Release() + func (s *Semaphore) TryAcquire() <-chan struct{} + type SetSizeFunc func(size int64) + type SimpleOAH struct + Atime int64 + Size int64 + func (SimpleOAH) Checksum() *Cksum + func (SimpleOAH) GetCustomKey(string) (string, bool) + func (SimpleOAH) GetCustomMD() StrKVs + func (SimpleOAH) SetCustomKey(_, _ string) + func (SimpleOAH) String() string + func (SimpleOAH) Version(...bool) string + func (s SimpleOAH) AtimeUnix() int64 + func (s SimpleOAH) SizeBytes(...bool) int64 + type SizeIEC int64 + func (siz *SizeIEC) UnmarshalJSON(b []byte) (err error) + func (siz SizeIEC) MarshalJSON() ([]byte, error) + func (siz SizeIEC) String() string + type StatsUpdater interface + Add func(name string, val int64) + AddMany func(namedVal64 ...NamedVal64) + Get func(name string) int64 + Inc func(name string) + type StopCh struct + func NewStopCh() *StopCh + func (sch *StopCh) Close() + func (sch *StopCh) Init() + func (sch *StopCh) Listen() <-chan struct{} + type StrKVs map[string]string + func NewStrKVs(pairs ...string) (kvs StrKVs) + func (kvs StrKVs) Compare(other StrKVs) bool + func (kvs StrKVs) Contains(key string) (ok bool) + func (kvs StrKVs) ContainsAnyMatch(in []string) string + func (kvs StrKVs) KeyFor(value string) (key string) + func (kvs StrKVs) Keys() []string + type StrSet map[string]struct + func NewStrSet(keys ...string) (ss StrSet) + func (ss StrSet) Add(keys ...string) + func (ss StrSet) All(xs ...string) bool + func (ss StrSet) Clone() StrSet + func (ss StrSet) Contains(key string) (yes bool) + func (ss StrSet) Delete(key string) + func (ss StrSet) Intersection(other StrSet) StrSet + func (ss StrSet) Set(key string) + func (ss StrSet) String() string + func (ss StrSet) ToSlice() []string + type TemplateRange struct + DigitCount int + End int64 + Gap string + Start int64 + Step int64 + type TimeoutGroup struct + func NewTimeoutGroup() *TimeoutGroup + func (twg *TimeoutGroup) Add(n int) + func (twg *TimeoutGroup) Done() + func (twg *TimeoutGroup) Wait() + func (twg *TimeoutGroup) WaitTimeout(timeout time.Duration) bool + func (twg *TimeoutGroup) WaitTimeoutWithStop(timeout time.Duration, stop <-chan struct{}) (timed, stopped bool) + type Unpacker interface + Unpack func(unpacker *ByteUnpack) error + type WG interface + Add func(int) + Done func() + Wait func() + func NewLimitedWaitGroup(limit, have int) WG + type WriteSizer interface + Size func() int64 + type WriterAt interface + type WriterMulti struct + func NewWriterMulti(w ...io.Writer) *WriterMulti + func (mw *WriterMulti) Write(b []byte) (n int, err error) + type WriterOnly struct