-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate dir_archive #56
Comments
@koreiter: can you give some more details of what you are looking for by providing some examples or pseudocode or something like that? What would an "invalid" key-value pair look like? Would it always be that the file is somehow invalid? You'd like to somehow detect the file is in an invalid state (e.g. the file is corrupt or missing) -- maybe by using metadata about the file, or by reading it, or something... and then do what? |
My code can be simplified to:
I stopped executing this after a while (simulating unexpected app crash/stop etc.) Here we can use folder name to spot an invalid object (have to ensure that no one uses "I_*" pattern for his keys). Of course we have to make sure that we don't try to delete currently creating object.
In my situation (as I'm using klepto for caching purpose) removing invalid objects is great solution because I can restore everythink that was deleted. |
So, let me distill this -- and you tell me if I'm correct. The idea is if there's a file that is corrupt in any way... basically... if any of the files result in a KeyError (or other error) when loading, they can be ignored/removed. So, something like a This makes sense, especially if there's some way to do it faster than trying to read all the keys, then failing... seeing which key is bad... removing it, and then repeat this until all keys read. Is that your request, boiled down to the essentials? Any other thoughts? |
That's exactly right. |
Great job and thanks for this lib!
Short description:
I need some tool that will validate dir_archive and remove invalid key-value pairs and make whole archive in valid state (may loose some data).
Long descrption:
I use dir_archive to store my app cache.
This cache is about 4k elements and whole takes around 400MB so dumping takes several minutes.
When something happen with application during dumping (ie. computer shutdown) archive may be left in invalid state.
This may be some additional parameter in constructor that is False by default (like remove_invalid_records_silently=False)
Of course changing lib so that archive is always in valid state would be appreciated but I guess that it is not so easy.
The text was updated successfully, but these errors were encountered: