@@ -137,13 +137,19 @@ func (b *Bucket) OpenUploadStreamWithID(fileID interface{}, filename string, opt
137
137
}
138
138
139
139
// UploadFromStream creates a fileID and uploads a file given a source stream.
140
+ //
141
+ // If this upload requires a custom write deadline to be set on the bucket, it cannot be done concurrently with other
142
+ // write operations operations on this bucket that also require a custom deadline.
140
143
func (b * Bucket ) UploadFromStream (filename string , source io.Reader , opts ... * options.UploadOptions ) (primitive.ObjectID , error ) {
141
144
fileID := primitive .NewObjectID ()
142
145
err := b .UploadFromStreamWithID (fileID , filename , source , opts ... )
143
146
return fileID , err
144
147
}
145
148
146
149
// UploadFromStreamWithID uploads a file given a source stream.
150
+ //
151
+ // If this upload requires a custom write deadline to be set on the bucket, it cannot be done concurrently with other
152
+ // write operations operations on this bucket that also require a custom deadline.
147
153
func (b * Bucket ) UploadFromStreamWithID (fileID interface {}, filename string , source io.Reader , opts ... * options.UploadOptions ) error {
148
154
us , err := b .OpenUploadStreamWithID (fileID , filename , opts ... )
149
155
if err != nil {
@@ -191,6 +197,9 @@ func (b *Bucket) OpenDownloadStream(fileID interface{}) (*DownloadStream, error)
191
197
192
198
// DownloadToStream downloads the file with the specified fileID and writes it to the provided io.Writer.
193
199
// Returns the number of bytes written to the steam and an error, or nil if there was no error.
200
+ //
201
+ // If this download requires a custom read deadline to be set on the bucket, it cannot be done concurrently with other
202
+ // read operations operations on this bucket that also require a custom deadline.
194
203
func (b * Bucket ) DownloadToStream (fileID interface {}, stream io.Writer ) (int64 , error ) {
195
204
ds , err := b .OpenDownloadStream (fileID )
196
205
if err != nil {
@@ -221,6 +230,9 @@ func (b *Bucket) OpenDownloadStreamByName(filename string, opts ...*options.Name
221
230
}
222
231
223
232
// DownloadToStreamByName downloads the file with the given name to the given io.Writer.
233
+ //
234
+ // If this download requires a custom read deadline to be set on the bucket, it cannot be done concurrently with other
235
+ // read operations operations on this bucket that also require a custom deadline.
224
236
func (b * Bucket ) DownloadToStreamByName (filename string , stream io.Writer , opts ... * options.NameOptions ) (int64 , error ) {
225
237
ds , err := b .OpenDownloadStreamByName (filename , opts ... )
226
238
if err != nil {
@@ -231,6 +243,9 @@ func (b *Bucket) DownloadToStreamByName(filename string, stream io.Writer, opts
231
243
}
232
244
233
245
// Delete deletes all chunks and metadata associated with the file with the given file ID.
246
+ //
247
+ // If this operation requires a custom write deadline to be set on the bucket, it cannot be done concurrently with other
248
+ // write operations operations on this bucket that also require a custom deadline.
234
249
func (b * Bucket ) Delete (fileID interface {}) error {
235
250
// delete document in files collection and then chunks to minimize race conditions
236
251
@@ -256,6 +271,9 @@ func (b *Bucket) Delete(fileID interface{}) error {
256
271
}
257
272
258
273
// Find returns the files collection documents that match the given filter.
274
+ //
275
+ // If this download requires a custom read deadline to be set on the bucket, it cannot be done concurrently with other
276
+ // read operations operations on this bucket that also require a custom deadline.
259
277
func (b * Bucket ) Find (filter interface {}, opts ... * options.GridFSFindOptions ) (* mongo.Cursor , error ) {
260
278
ctx , cancel := deadlineContext (b .readDeadline )
261
279
if cancel != nil {
@@ -287,6 +305,9 @@ func (b *Bucket) Find(filter interface{}, opts ...*options.GridFSFindOptions) (*
287
305
}
288
306
289
307
// Rename renames the stored file with the specified file ID.
308
+ //
309
+ // If this operation requires a custom write deadline to be set on the bucket, it cannot be done concurrently with other
310
+ // write operations operations on this bucket that also require a custom deadline
290
311
func (b * Bucket ) Rename (fileID interface {}, newFilename string ) error {
291
312
ctx , cancel := deadlineContext (b .writeDeadline )
292
313
if cancel != nil {
@@ -313,6 +334,9 @@ func (b *Bucket) Rename(fileID interface{}, newFilename string) error {
313
334
}
314
335
315
336
// Drop drops the files and chunks collections associated with this bucket.
337
+ //
338
+ // If this operation requires a custom write deadline to be set on the bucket, it cannot be done concurrently with other
339
+ // write operations operations on this bucket that also require a custom deadline
316
340
func (b * Bucket ) Drop () error {
317
341
ctx , cancel := deadlineContext (b .writeDeadline )
318
342
if cancel != nil {
0 commit comments