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
* create stream-related types
Created simpleblob.NewReader and simpleblob.NewWriter functions, along with ReaderStorage and WriterStorage interface types.
Those functions allow to provide an optimized way to write to and read from backend if those interfaces are satsfied.
If an interface is not satisfied by backend, a fallback implementation is used, akin to `fs.GlobFS`.
* implement ReaderStorage and WriterStorage for fs backend
Provide io.ReadCloser and io.WriteCloser to interact with files to way the `os` package does it.
The `os` package has byte-slice based functions that rely on streams under the hood, we're doing the same here.
* implement ReaderStorage for S3 backend
The Object returned by MinIO client satisfies io.ReadCloser, so this implementation is very straightforward.
For writing, the MinIO client takes a reader and needs the full size of the stored object.
Thus, we'd need to exhaust the writer into a buffer, take its size and provide it to the client,
which is basically what the fallback implementation of NewWriter does.
* add tests for ReaderStorage and WriterStorage
Confront the results from simpleblob.NewReader and simpleblob.NewWriter with simpleblob.Interface.
* more robust implementation of general WriterStorage wrapper
* fix WriterStorage doc typo
* fix writer wrapper mutex usage
* show that param is name in ReaderStorage
Co-authored-by: wojas <[email protected]>
* replace reader wrapper struct with io.NopCloser
* fix "mixed name and unnamed parameters" syntax error
* replace errorWClosed with ErrClosed
* express intent to check name validity on stream wrapper struct
* rename default `writer` wrapper struct to `fallbackWriter`
* formatting
* s3: use common method for Load and NewReader
* test presence of key after storing with NewWriter
* remove duplicate error check
* s3 backend: implement StorageWriter
* apply comment improvement suggestions
Co-authored-by: wojas <[email protected]>
* s3: simplify doStoreReader and doLoadReader
* tester: test atomicity of writer, and write/read after close
* s3: close pipe, better context cancellation handling
* fs backend: write file atomically with NewWriter
* s3: move prefix prepending and metrics calls to their correct places
* s3: rename ReaderStorage->StreamReader, WriterStorage->StreamWriter
* s3: revert to default NumThreads in PutObjects
* s3: prepend global prefix where missing
* s3: make a comment about global prefix use with marker clearer
* s3: introduce NumMinioThreads to configure NumThreads in minio client
* s3: move stream logic to separate file, implement ReaderFrom
* fs: move stream logic to separate file
* s3: remove unfitting io.ReaderFrom implementation
* s3: stream: start pipe earlier, do not write marker twice
* stream: catch cancelled ctx early in fs & s3
* stream: remove name validation TODO comment
General name validation was dropped in favour of documenting safe names.
* io stream: update README and make a couple comments clearer
---------
Co-authored-by: wojas <[email protected]>
The returned ReadCloser or WriteCloser is an optimized implementation if the backend being used implements the `StreamReader` or `StreamWriter` interfaces.
54
+
If not, a convenience wrapper for the storage is returned.
55
+
56
+
| Backend | StreamReader | StreamWriter |
57
+
| --- | --- | --- |
58
+
| S3 | ✔ | ✔ |
59
+
| Filesystem | ✔ | ✔ |
60
+
| Memory | ✖ | ✖ |
61
+
62
+
41
63
## Limitations
42
64
43
65
The interface currently does not support streaming of large blobs. In the future we may provide this by implementing `fs.FS` in the backend for reading, and a similar interface for writing new blobs.
44
66
67
+
45
68
## API Stability
46
69
47
70
We support the last two stable Go versions, currently 1.17 and 1.18.
48
71
49
72
From a API consumer point of view, we do not plan any backward incompatible changes before a v1.0.
50
-
51
-
For storage backends, any future extensions most likely be added with optional interface, similar to the `fs.FS` design. Utility functions that return a compatible implementation will be used for backends that do not implement the interface, when possible.
0 commit comments