Documentation
¶
Index ¶
- Constants
- Variables
- func AssertStringContainsOneOf(t *testing.T, str string, ss ...string)
- func DeterministicRandomReader(sizeStr string, seed string) (io.Reader, error)
- func DeterministicRandomReaderBytes(size int64, seed string) (io.Reader, error)
- func EstimateFilesForBlockThreshold(threshold, nameLen, cidLen int, tsize uint64) int
- func FindUp(name, dir string) string
- func FloatTruncate(value float64, decimalPlaces int) float64
- func ForEachPar[T any](s []T, f func(T))
- func LinkSerializedSize(nameLen, cidLen int, tsize uint64) int
- func MustOpen(name string) *os.File
- func PreviewStr(s string) string
- func RequiresDocker(t *testing.T)
- func RequiresExpensive(t *testing.T)
- func RequiresFUSE(t *testing.T)
- func RequiresLinux(t *testing.T)
- func RequiresPlugins(t *testing.T)
- func SplitLines(s string) []string
- func StrCat(args ...any) []string
- func ToJSONStr(m JSONObj) string
- func URLStrToMultiaddr(u string) multiaddr.Multiaddr
- func VarintLen(v uint64) int
- type JSONObj
Constants ¶
const ( CIDWelcomeDocs = "QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc" CIDEmptyDir = "QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn" )
Variables ¶
var ( AlphabetEasy = []rune("abcdefghijklmnopqrstuvwxyz01234567890-_") AlphabetHard = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890!@#$%^&*()-_+= ;.,<>'\"[]{}() ") )
Functions ¶
func AssertStringContainsOneOf ¶ added in v0.19.0
func DeterministicRandomReader ¶ added in v0.35.0
DeterministicRandomReader produces specified number of pseudo-random bytes from a seed. Size can be specified as a humanize string (e.g., "256KiB", "1MiB").
func DeterministicRandomReaderBytes ¶
DeterministicRandomReaderBytes produces exactly `size` pseudo-random bytes from a seed. Use this when exact byte precision is needed.
func EstimateFilesForBlockThreshold ¶
EstimateFilesForBlockThreshold estimates how many files with given name/cid lengths will fit under the block size threshold. Returns the number of files that keeps the block size just under the threshold.
func FindUp ¶
Searches for a file in a dir, then the parent dir, etc. If the file is not found, an empty string is returned.
func FloatTruncate ¶ added in v0.21.0
func ForEachPar ¶ added in v0.19.0
func ForEachPar[T any](s []T, f func(T))
ForEachPar invokes f in a new goroutine for each element of s and waits for all to complete.
func LinkSerializedSize ¶
LinkSerializedSize calculates the serialized size of a single PBLink in a dag-pb block. This matches the calculation in boxo/ipld/unixfs/io/directory.go estimatedBlockSize().
The protobuf wire format for a PBLink is:
PBNode.Links wrapper tag (1 byte) + varint length of inner message + Hash field: tag (1) + varint(cidLen) + cidLen + Name field: tag (1) + varint(nameLen) + nameLen + Tsize field: tag (1) + varint(tsize)
func PreviewStr ¶
PreviewStr returns a preview of s, which is a prefix for logging that avoids dumping a huge string to logs.
func RequiresDocker ¶
func RequiresExpensive ¶
func RequiresFUSE ¶
func RequiresLinux ¶
func RequiresPlugins ¶
func SplitLines ¶
func StrCat ¶
StrCat takes a bunch of strings or string slices and concats them all together into one string slice. If an arg is not one of those types, this panics. If an arg is an empty string, it is dropped.
func URLStrToMultiaddr ¶
URLStrToMultiaddr converts a URL string like http://localhost:80 to a multiaddr.