|
|
@ -184,13 +184,13 @@ func (c cacheObjects) getMetadata(objInfo ObjectInfo) map[string]string { |
|
|
|
|
|
|
|
|
|
|
|
func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, lockType LockType, opts ObjectOptions) (gr *GetObjectReader, err error) { |
|
|
|
func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string, rs *HTTPRangeSpec, h http.Header, lockType LockType, opts ObjectOptions) (gr *GetObjectReader, err error) { |
|
|
|
if c.isCacheExclude(bucket, object) { |
|
|
|
if c.isCacheExclude(bucket, object) { |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// fetch cacheFSObjects if object is currently cached or nearest available cache drive
|
|
|
|
// fetch cacheFSObjects if object is currently cached or nearest available cache drive
|
|
|
|
dcache, err := c.cache.getCachedFSLoc(ctx, bucket, object) |
|
|
|
dcache, err := c.cache.getCachedFSLoc(ctx, bucket, object) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cacheReader, cacheErr := dcache.GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
cacheReader, cacheErr := dcache.GetObjectNInfo(ctx, bucket, object, rs, h, lockType, opts) |
|
|
@ -207,7 +207,7 @@ func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if !objInfo.IsCacheable() || filterFromCache(objInfo.UserDefined) { |
|
|
|
if !objInfo.IsCacheable() || filterFromCache(objInfo.UserDefined) { |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if cacheErr == nil { |
|
|
|
if cacheErr == nil { |
|
|
@ -225,13 +225,13 @@ func (c cacheObjects) GetObjectNInfo(ctx context.Context, bucket, object string, |
|
|
|
|
|
|
|
|
|
|
|
if rs != nil { |
|
|
|
if rs != nil { |
|
|
|
// We don't cache partial objects.
|
|
|
|
// We don't cache partial objects.
|
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
if !dcache.diskAvailable(objInfo.Size) { |
|
|
|
if !dcache.diskAvailable(objInfo.Size) { |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
return c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bkReader, bkErr := c.GetObjectNInfoFn(ctx, bucket, object, rs, h, writeLock, opts) |
|
|
|
bkReader, bkErr := c.GetObjectNInfoFn(ctx, bucket, object, rs, h, lockType, opts) |
|
|
|
if bkErr != nil { |
|
|
|
if bkErr != nil { |
|
|
|
return nil, bkErr |
|
|
|
return nil, bkErr |
|
|
|
} |
|
|
|
} |
|
|
|