You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+19-4
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ See [MAINTAINERS.md](https://github.com/thanos-io/thanos/blob/main/MAINTAINERS.m
48
48
49
49
The core this module is the [`Bucket` interface](objstore.go):
50
50
51
-
```go mdox-exec="sed -n '37,50p' objstore.go"
51
+
```go mdox-exec="sed -n '39,55p' objstore.go"
52
52
// Bucket provides read and write access to an object storage bucket.
53
53
// NOTE: We assume strong consistency for write-read flow.
54
54
typeBucketinterface {
@@ -63,18 +63,31 @@ type Bucket interface {
63
63
// If object does not exist in the moment of deletion, Delete should throw error.
64
64
Delete(ctx context.Context, name string) error
65
65
66
+
// Name returns the bucket name for the provider.
67
+
Name() string
68
+
}
66
69
```
67
70
68
71
All [provider implementations](providers) have to implement `Bucket` interface that allows common read and write operations that all supported by all object providers. If you want to limit the code that will do bucket operation to only read access (smart idea, allowing to limit access permissions), you can use the [`BucketReader` interface](objstore.go):
69
72
70
-
```go mdox-exec="sed -n '68,93p' objstore.go"
71
-
73
+
```go mdox-exec="sed -n '71,106p' objstore.go"
72
74
// BucketReader provides read access to an object storage bucket.
73
75
typeBucketReaderinterface {
74
76
// Iter calls f for each entry in the given directory (not recursive.). The argument to f is the full
75
77
// object name including the prefix of the inspected directory.
78
+
76
79
// Entries are passed to function in sorted order.
77
-
Iter(ctx context.Context, dir string, f func(string) error, options ...IterOption) error
80
+
Iter(ctx context.Context, dir string, f func(name string) error, options ...IterOption) error
81
+
82
+
// IterWithAttributes calls f for each entry in the given directory similar to Iter.
83
+
// In addition to Name, it also includes requested object attributes in the argument to f.
84
+
//
85
+
// Attributes can be requested using IterOption.
86
+
// Not all IterOptions are supported by all providers, requesting for an unsupported option will fail with ErrOptionNotSupported.
87
+
IterWithAttributes(ctx context.Context, dir string, f func(attrs IterObjectAttributes) error, options ...IterOption) error
88
+
89
+
// SupportedIterOptions returns a list of supported IterOptions by the underlying provider.
90
+
SupportedIterOptions() []IterOptionType
78
91
79
92
// Get returns a reader for the given object name.
80
93
Get(ctx context.Context, name string) (io.ReadCloser, error)
0 commit comments