MCPcopy
hub / github.com/minio/minio-go / randString

Function randString

utils.go:634–649  ·  utils.go::randString

randString generates random names and prepends them with a known prefix.

(n int, src rand.Source, prefix string)

Source from the content-addressed store, hash-verified

632
633// randString generates random names and prepends them with a known prefix.
634func randString(n int, src rand.Source, prefix string) string {
635 b := make([]byte, n)
636 // A rand.Int63() generates 63 random bits, enough for letterIdxMax letters!
637 for i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {
638 if remain == 0 {
639 cache, remain = src.Int63(), letterIdxMax
640 }
641 if idx := int(cache & letterIdxMask); idx < len(letterBytes) {
642 b[i] = letterBytes[idx]
643 i--
644 }
645 cache >>= letterIdxBits
646 remain--
647 }
648 return prefix + string(b[0:30-len(prefix)])
649}
650
651// IsNetworkOrHostDown - if there was a network error or if the host is down.
652// expectTimeouts indicates that *context* timeouts are expected and does not

Callers 10

HealthCheckMethod · 0.70
TestHealthCheckFunction · 0.70
TestGetObjectCoreFunction · 0.70
TestGetBucketPolicyFunction · 0.70
TestCoreCopyObjectFunction · 0.70
TestCoreCopyObjectPartFunction · 0.70
TestCorePutObjectFunction · 0.70
TestCoreMultipartUploadFunction · 0.70

Calls 1

Int63Method · 0.80

Tested by 9

TestHealthCheckFunction · 0.56
TestGetObjectCoreFunction · 0.56
TestGetBucketPolicyFunction · 0.56
TestCoreCopyObjectFunction · 0.56
TestCoreCopyObjectPartFunction · 0.56
TestCorePutObjectFunction · 0.56
TestCoreMultipartUploadFunction · 0.56