From 3d3e983ae0eb651cc4ee969c62e4abba052f2c67 Mon Sep 17 00:00:00 2001 From: Kyle Banker Date: Wed, 7 Apr 2010 15:58:02 -0400 Subject: [PATCH] minor: docs --- lib/mongo/gridfs/grid.rb | 4 ++++ lib/mongo/gridfs/grid_file_system.rb | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/mongo/gridfs/grid.rb b/lib/mongo/gridfs/grid.rb index 7db8e16..8833abf 100644 --- a/lib/mongo/gridfs/grid.rb +++ b/lib/mongo/gridfs/grid.rb @@ -80,6 +80,10 @@ module Mongo # Delete a file from the store. # + # Note that deleting a GridFS file can result in read errors if another process + # is attempting to read a file while it's being deleted. While the odds for this + # kind of race condition are small, it's important to be aware of. + # # @param [] id # # @return [Boolean] diff --git a/lib/mongo/gridfs/grid_file_system.rb b/lib/mongo/gridfs/grid_file_system.rb index bdf358c..241291c 100644 --- a/lib/mongo/gridfs/grid_file_system.rb +++ b/lib/mongo/gridfs/grid_file_system.rb @@ -56,7 +56,8 @@ module Mongo # loaded. Otherwise, the content type 'binary/octet-stream' will be used. # @options opts [Integer] (262144) :chunk_size size of file chunks in bytes. # @options opts [Boolean] :delete_old (false) ensure that old versions of the file are deleted. This option - # only work in 'w' mode. + # only work in 'w' mode. Certain precautions must be taken when deleting GridFS files. See the notes under + # GridFileSystem#delete. # @options opts [Boolean] :safe (false) When safe mode is enabled, the chunks sent to the server # will be validated using an md5 hash. If validation fails, an exception will be raised. # @@ -104,6 +105,10 @@ module Mongo # Delete the file with the given filename. Note that this will delete # all versions of the file. # + # Note that deleting a GridFS file can result in read errors if another process + # is attempting to read a file while it's being deleted. While the odds for this + # kind of race condition are small, it's important to be aware of. + # # @param [String] filename # # @yield [] pass a block that returns an array of documents to be deleted.