InMemBucket implements the objstore.Bucket interfaces against local memory.
Methods from Bucket interface are thread-safe. Objects are assumed to be immutable. Attributes returns information about the specified object.(*InMemBucket) Close() error Delete removes all data prefixed with the dir. Exists checks if the given directory exists in memory. Get returns a reader for the given object name. GetRange returns a new range reader for the given object name and range. IsAccessDeniedErr returns true if access to object is denied. IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations. Iter calls f for each entry in the given directory. The argument to f is the full
object name including the prefix of the inspected directory. Name returns the bucket name. Objects returns a copy of the internally stored objects.
NOTE: For assert purposes. Upload writes the file specified in src to into the memory.
*InMemBucket : Bucket
*InMemBucket : BucketReader
*InMemBucket : github.com/polarsignals/frostdb/query/logicalplan.Named
*InMemBucket : github.com/prometheus/common/expfmt.Closer
*InMemBucket : io.Closer
func NewInMemBucket() *InMemBucket
InstrumentedBucket is a Bucket with optional instrumentation control on reader. Attributes returns information about the specified object.( InstrumentedBucket) Close() error Delete removes the object with the given name.
If object does not exist in the moment of deletion, Delete should throw error. Exists checks if the given object exists in the bucket. Get returns a reader for the given object name. GetRange returns a new range reader for the given object name and range. IsAccessDeniedErr returns true if access to object is denied. IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations. Iter calls f for each entry in the given directory (not recursive.). The argument to f is the full
object name including the prefix of the inspected directory.
Entries are passed to function in sorted order. Name returns the bucket name for the provider. ReaderWithExpectedErrs allows to specify a filter that marks certain errors as expected, so it will not increment
objstore_bucket_operation_failures_total metric.
TODO(bwplotka): Remove this when moved to Go 1.14 and replace with InstrumentedBucketReader. Upload the contents of the reader as an object into the bucket.
Upload should be idempotent. WithExpectedErrs allows to specify a filter that marks certain errors as expected, so it will not increment
objstore_bucket_operation_failures_total metric.
InstrumentedBucket : Bucket
InstrumentedBucket : BucketReader
InstrumentedBucket : InstrumentedBucketReader
InstrumentedBucket : github.com/polarsignals/frostdb/query/logicalplan.Named
InstrumentedBucket : github.com/prometheus/common/expfmt.Closer
InstrumentedBucket : io.Closer
func WithNoopInstr(bkt Bucket) InstrumentedBucket
InstrumentedBucketReader is a BucketReader with optional instrumentation control. Attributes returns information about the specified object. Exists checks if the given object exists in the bucket. Get returns a reader for the given object name. GetRange returns a new range reader for the given object name and range. IsAccessDeniedErr returns true if access to object is denied. IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations. Iter calls f for each entry in the given directory (not recursive.). The argument to f is the full
object name including the prefix of the inspected directory.
Entries are passed to function in sorted order. ReaderWithExpectedErrs allows to specify a filter that marks certain errors as expected, so it will not increment
objstore_bucket_operation_failures_total metric.InstrumentedBucket(interface)
InstrumentedBucketReader : BucketReader
ObjectSizer can return size of object. ObjectSize returns the size of the object in bytes, or error if it is not available.
Attributes returns information about the specified object.(*PrefixedBucket) Close() error Delete removes the object with the given name.
If object does not exists in the moment of deletion, Delete should throw error. Exists checks if the given object exists in the bucket. Get returns a reader for the given object name. GetRange returns a new range reader for the given object name and range. IsAccessDeniedErr returns true if access to object is denied. IsObjNotFoundErr returns true if error means that object is not found. Relevant to Get operations. Iter calls f for each entry in the given directory (not recursive.). The argument to f is the full
object name including the prefix of the inspected directory.
Entries are passed to function in sorted order. Name returns the bucket name for the provider. Upload the contents of the reader as an object into the bucket.
Upload should be idempotent.
*PrefixedBucket : Bucket
*PrefixedBucket : BucketReader
*PrefixedBucket : github.com/polarsignals/frostdb/query/logicalplan.Named
*PrefixedBucket : github.com/prometheus/common/expfmt.Closer
*PrefixedBucket : io.Closer
TLSConfig configures the options for TLS connections. The CA cert to use for the targets. The client cert file for the targets. Disable target certificate validation. The client key file for the targets. Used to verify the hostname for the targets.
func NewTLSConfig(cfg *TLSConfig) (*tls.Config, error)
DownloadDir downloads all object found in the directory into the local directory.
DownloadFile downloads the src file from the bucket to dst. If dst is an existing
directory, a file with the same name as the source is created in dst.
If destination file is already existing, download file will overwrite it.
EmptyBucket deletes all objects from bucket. This operation is required to properly delete bucket as a whole.
It is used for testing only.
TODO(bplotka): Add retries.
NewInMemBucket returns a new in memory Bucket.
NOTE: Returned bucket is just a naive in memory bucket implementation. For test use cases only.
NewTLSConfig creates a new tls.Config from the given TLSConfig.
NopCloserWithSize returns a ReadCloser with a no-op Close method wrapping
the provided Reader r. Returned ReadCloser also implements Size method.
TryToGetSize tries to get upfront size from reader.
Some implementations may return only size of unread data in the reader, so it's best to call this method before
doing any reading.
TODO(https://github.com/thanos-io/thanos/issues/678): Remove guessing length when minio provider will support multipart upload without this.
UploadDir uploads all files in srcdir to the bucket with into a top-level directory
named dstdir. It is a caller responsibility to clean partial upload in case of failure.
UploadFile uploads the file with the given name to the bucket.
It is a caller responsibility to clean partial upload in case of failure.
WithRecursiveIter is an option that can be applied to Iter() to recursively list objects
in the bucket.
WithUploadConcurrency is an option to set the concurrency of the upload operation.
WrapWith takes a `bucket` and `metrics` that returns instrumented bucket.
Similar to WrapWithMetrics, but `metrics` can be passed separately as an argument.
WrapWithMetrics takes a bucket and registers metrics with the given registry for
operations run against the bucket.
Package-Level Constants (total 8)
DirDelim is the delimiter used to model a directory structure in an object store bucket.
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.