Make it easier to play: add TempFileStore

Bug #1052698 reported by Jason Gerard DeRose
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
FileStore
Fix Released
High
Jason Gerard DeRose

Bug Description

Long ago, before filestore was split out of Dmedia, a FileStore would automatically create a temporary directory if you didn't provide *parentdir*. In the end this was a bad idea for something like FileStore where we need the API to be very explicit, never to make creative guesses about anything.

But my heart was in the right place: you should be able to play with a FileStore with very low friction, without commitment, without risk of damaging production data. So I'm adding a TempFileStore class, inspired by the TempCouch class that has been so useful in usercouch.

I didn't like this because there are lots of scenarios that could cause *parentdir* to be None without the user meaning "please create me a temporary parentdir":

>>> fs = FileStore(None)

But this I do like, because it's unambiguous:

>>> fs = TempFileStore()

Also, because there isn't ambiguity, it's safe to automatically delete the temporary *parentdir* when the TempFileStore is garbage collected. Which is good for play, I think... by definition it will be throw-away.

Related branches

Changed in filestore:
status: In Progress → Fix Committed
Changed in filestore:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.