External File manager prototype #149
pavlis
started this conversation in
Design & Development
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Rather than immediately push this as a new branch for inclusion the master branch I think we might want to discuss if what I've got below is a good idea or something that will just cause us headaches down the road.
This came up in writing the CRUD section when I was thinking about the D operation. Deletes are problematic when the waveform data are stored in files for a whole list of reasons. A much longer discussion of the issues can be found in our google doc on the database api design.
I developed the following prototype for something I called an ExternalFileManager class. Read the docstring comments to hopefully understand the concept and how it works. The first code block contains the class definition for this thing. The second is a very crude test script discussed at the bottom of this discussion page:
and here is the very crude test program to show it works:
This thing is very crude. You have to create the directory "testdir" from the place you copy this code. It runs the code to manage two files "fileA" and "fileB" with 5 documents referencing them. If run in the form above all 5 documents will be deleted and the thing properly removes both fileA and fileB. If you change the llimit(5) to some smaller number like limit(4) only one of the files will be deleted. If you use limit(1) or limit(2) neither file will be deleted but the document count will be nonzero. That is what it was designed to do.
Anyway, I think this could be a really nice feature for managing some kinds of data. I made the default collection the one I used for the usarray data download where this will prove useful for storage management.
Beta Was this translation helpful? Give feedback.
All reactions