Documentation ¶
Index ¶
- func WithCacheLookupEnabled(ctx context.Context, enabled bool) context.Context
- func WithMemoryPool(ctx context.Context, p pool.Interface, slabSize int) context.Context
- type CachingBucket
- func (cb *CachingBucket) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)
- func (cb *CachingBucket) Delete(ctx context.Context, name string) error
- func (cb *CachingBucket) Exists(ctx context.Context, name string) (bool, error)
- func (cb *CachingBucket) Get(ctx context.Context, name string) (io.ReadCloser, error)
- func (cb *CachingBucket) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
- func (cb *CachingBucket) IsObjNotFoundErr(err error) bool
- func (cb *CachingBucket) Iter(ctx context.Context, dir string, f func(string) error, ...) error
- func (cb *CachingBucket) Name() string
- func (cb *CachingBucket) ReaderWithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) objstore.BucketReader
- func (cb *CachingBucket) Upload(ctx context.Context, name string, r io.Reader) error
- func (cb *CachingBucket) WithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) objstore.Bucket
- type CachingBucketConfig
- func (cfg *CachingBucketConfig) CacheAttributes(configName string, cache cache.Cache, matcher func(name string) bool, ...)
- func (cfg *CachingBucketConfig) CacheExists(configName string, cache cache.Cache, matcher func(string) bool, ...)
- func (cfg *CachingBucketConfig) CacheGet(configName string, cache cache.Cache, matcher func(string) bool, ...)
- func (cfg *CachingBucketConfig) CacheGetRange(configName string, cache cache.Cache, matcher func(string) bool, ...)
- func (cfg *CachingBucketConfig) CacheIter(configName string, cache cache.Cache, matcher func(string) bool, ...)
- type IterCodec
- type JSONIterCodec
- type SnappyIterCodec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCacheLookupEnabled ¶
WithCacheLookupEnabled returns a new context which will explicitly enable/disable the cache lookup but keep storing the result to the cache. The cache lookup is enabled by default.
func WithMemoryPool ¶
WithMemoryPool returns a new context with a slab pool to be used as a cache.Allocator implementation by the underlying cache client. Slabs are released back to p when the io.ReadCloser associated with the Get or GetRange call is closed.
Types ¶
type CachingBucket ¶
CachingBucket implementation that provides some caching features, based on passed configuration.
func NewCachingBucket ¶
func NewCachingBucket(bucketID string, bucketClient objstore.Bucket, cfg *CachingBucketConfig, logger log.Logger, reg prometheus.Registerer) (*CachingBucket, error)
NewCachingBucket creates new caching bucket with provided configuration. Configuration should not be changed after creating caching bucket.
func (*CachingBucket) Attributes ¶
func (cb *CachingBucket) Attributes(ctx context.Context, name string) (objstore.ObjectAttributes, error)
func (*CachingBucket) Delete ¶
func (cb *CachingBucket) Delete(ctx context.Context, name string) error
func (*CachingBucket) Get ¶
func (cb *CachingBucket) Get(ctx context.Context, name string) (io.ReadCloser, error)
func (*CachingBucket) GetRange ¶
func (cb *CachingBucket) GetRange(ctx context.Context, name string, off, length int64) (io.ReadCloser, error)
func (*CachingBucket) IsObjNotFoundErr ¶
func (cb *CachingBucket) IsObjNotFoundErr(err error) bool
func (*CachingBucket) Iter ¶
func (cb *CachingBucket) Iter(ctx context.Context, dir string, f func(string) error, options ...objstore.IterOption) error
func (*CachingBucket) Name ¶
func (cb *CachingBucket) Name() string
func (*CachingBucket) ReaderWithExpectedErrs ¶
func (cb *CachingBucket) ReaderWithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) objstore.BucketReader
func (*CachingBucket) WithExpectedErrs ¶
func (cb *CachingBucket) WithExpectedErrs(expectedFunc objstore.IsOpFailureExpectedFunc) objstore.Bucket
type CachingBucketConfig ¶
type CachingBucketConfig struct {
// contains filtered or unexported fields
}
CachingBucketConfig contains low-level configuration for individual bucket operations. This is not exposed to the user, but it is expected that code sets up individual operations based on user-provided configuration.
func NewCachingBucketConfig ¶
func NewCachingBucketConfig() *CachingBucketConfig
func (*CachingBucketConfig) CacheAttributes ¶
func (cfg *CachingBucketConfig) CacheAttributes(configName string, cache cache.Cache, matcher func(name string) bool, ttl time.Duration)
CacheAttributes configures caching of "Attributes" operation for matching files.
func (*CachingBucketConfig) CacheExists ¶
func (cfg *CachingBucketConfig) CacheExists(configName string, cache cache.Cache, matcher func(string) bool, existsTTL, doesntExistTTL time.Duration)
CacheExists configures caching of "Exists" operation for matching files. Negative values are cached as well.
func (*CachingBucketConfig) CacheGet ¶
func (cfg *CachingBucketConfig) CacheGet(configName string, cache cache.Cache, matcher func(string) bool, maxCacheableSize int, contentTTL, existsTTL, doesntExistTTL time.Duration)
CacheGet configures caching of "Get" operation for matching files. Content of the object is cached, as well as whether object exists or not.
func (*CachingBucketConfig) CacheGetRange ¶
func (cfg *CachingBucketConfig) CacheGetRange(configName string, cache cache.Cache, matcher func(string) bool, subrangeSize int64, attributesCache cache.Cache, attributesTTL, subrangeTTL time.Duration, maxSubRequests int)
CacheGetRange configures caching of "GetRange" operation. Subranges (aligned on subrange size) are cached individually. Since caching operation needs to know the object size to compute correct subranges, object size is cached as well. Single "GetRange" requests can result in multiple smaller GetRange sub-requests issued on the underlying bucket. MaxSubRequests specifies how many such subrequests may be issued. Values <= 0 mean there is no limit (requests for adjacent missing subranges are still merged).
type IterCodec ¶
type IterCodec interface { Encode(files []string) ([]byte, error) Decode(cachedData []byte) ([]string, error) }
IterCodec is a codec for encoding and decoding results of Iter call.
type JSONIterCodec ¶
type JSONIterCodec struct{}
JSONIterCodec encodes iter results into JSON. Suitable for root dir.
type SnappyIterCodec ¶
type SnappyIterCodec struct {
IterCodec
}