MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / getCacheLoc

Method getCacheLoc

cmd/disk-cache.go:540–553  ·  view source on GitHub ↗

choose a cache deterministically based on hash of bucket,object. The hash index is treated as a hint. In the event that the cache drive at hash index is offline, treat the list of cache drives as a circular buffer and walk through them starting at hash index until an online drive is found.

(bucket, object string)

Source from the content-addressed store, hash-verified

538// a hint. In the event that the cache drive at hash index is offline, treat the list of cache drives
539// as a circular buffer and walk through them starting at hash index until an online drive is found.
540func (c *cacheObjects) getCacheLoc(bucket, object string) (*diskCache, error) {
541 index := c.hashIndex(bucket, object)
542 numDisks := len(c.cache)
543 for k := 0; k < numDisks; k++ {
544 i := (index + k) % numDisks
545 if c.cache[i] == nil {
546 continue
547 }
548 if c.cache[i].IsOnline() {
549 return c.cache[i], nil
550 }
551 }
552 return nil, errDiskNotFound
553}
554
555// get cache disk where object is currently cached for a GET operation. If object does not exist at that location,
556// treat the list of cache drives as a circular buffer and walk through them starting at hash index

Callers 1

DeleteObjectMethod · 0.95

Calls 2

hashIndexMethod · 0.95
IsOnlineMethod · 0.65

Tested by

no test coverage detected