[CDRIVER-387] add mongoc_gridfs_file_remove() helper Created: 02/Jul/14 Updated: 03/May/17 Resolved: 07/Jul/14 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | TBD |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Christian Hergert | Assignee: | Christian Hergert |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
It would be nice to have a helper to make it easier to remove a particular gridfs file. This should remove the gridfs file and any chunks associated with it. Something like:
|
| Comments |
| Comment by Christian Hergert [ 07/Jul/14 ] | |
|
https://github.com/mongodb/mongo-c-driver/commit/d2cc0bc7a505cdcb0da79c8962cc50b04e2f771a contains a fix for this. I decided to not have it perform the additional destroy() on the file structure as per previous comment. Feel free to add yourself a macro like such if you want a fire and forget style call.
| |
| Comment by Christian Hergert [ 02/Jul/14 ] | |
|
The problem is that it would be inconsistent with the memory management of all of the other functions that are destructive. Especially since the operation can fail, and therefore retry would be impossible without reacquiring the mongoc_gridfs_file_t. | |
| Comment by Frank J. Lhota [ 02/Jul/14 ] | |
|
IMO the function mongoc_gridfs_file_remove(file) should, as its final operation, destroy the file parameter passed to it. After calling this function, the mongoc_gridfs_file_t object passed to it no longer corresponds to a file and chunks in the GRID file system, so it should not be used for any other GRID operation. |