-
Notifications
You must be signed in to change notification settings - Fork 78
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
find
: design and implement a command for finding files in snapshots
#1055
Comments
Thanks @n8henrie for opening this issue! Can you give some use cases where you are using In fact, implementing it like it's done in restic would be very straightforward. The reason it isn't yet done is because I didn't simply want to reproduce what restic is doing, but wanted to have a much more featureful command which
But there is also nothing wrong with starting with a simple re-implementation! If you give more input, I can work on it or mentor anyone who is willing to start a PR! |
That's awesome! I'm AFK on mobile but will get back with an example soon, and I'd love to work on a PR with some mentorship! I've been keeping an eye on Rustic specifically because I enjoy writing rust much more than go, but I'm definitely still a novice. |
find
: design and implement a command for finding files in snapshots
@n8henrie Are you still interested? |
Yes I am! But I'm very busy with a few projects right now, will likely have some time in about a week. If you'd like to close to keep the issue tracker groomed, I can bookmark this and prompt to reopen once I have time. Otherwise, if it's okay to leave open that's also fine of course. Thanks for the nudge! |
Sorry this is taking so long, I am excited about the opportunity to contribute and especially the mentorship!
I've used it multiple times to find snapshot IDs that contain a specific file of interest. For example, if I discover that I have inadvertently deleted or corrupted a file locally, but I'm not sure when that modification occurred, I may first For example, I have a wrapper script called
Searching my shell history, I've also used it in the past to:
For my future reference, it looks like this is the implementation in restic: https://github.com/restic/restic/blob/d1d773cfcd3115aecbbd6ad6be2bc5e11f395b29/cmd/restic/cmd_find.go#L77 |
@n8henrie Great that you are about to start - and no worry, we all work in our free time so delays from time to time are pretty common... Do you have a Discord account? If we want to chat something more detailed, it might be a possibility to open a channel there. Now, about your use-case: I think we actually have two use-cases:
I would suggest to you to start implementing the second one using just a simple traversal over snapshots and (nested) trees within the snapshots. If you look at https://github.com/rustic-rs/rustic/blob/main/src/commands/snapshots.rs you see can how you can get the (already grouped) snapshots list and how to iterate over it (using a simple "for" loop is sufficient actually). Now, if you already have a snapshot, take a look at https://github.com/rustic-rs/rustic/blob/main/src/commands/ls.rs which uses Hope this helps for a start, but please don't hesitate to ask if you need any more details about one point! |
Just some comments why I think the first one is a different use case: When we are searching for a given full path, we know that this can only be zero or exactly one match per repository. This allows things like showing not only all "matching" snapshots, but also a more detailed history of this full path (like when did metadata change or when did the content change). Also we can heavily optimize here: if there is no |
Interesting thoughts, thanks for your prompt response! Yes, I have discord but don't use it terribly often -- I'll join. Thanks for the pointers, I've been perusing the codebase for the last hour or two to try to get my bearings. Lots of existing examples of searching the repo a file by id (I assume this is a You're right to direct me to Yes, I agree that the
I think you mean per snapshot -- in which case I agree, there seems to be much greater room for optimization (depending on how things are organized in the backend -- it sounds like they are indeed organized into a tree) which should allow for quite a bit of optimization. |
closing this as it has been implemented in #1136 |
Thank you! As mentioned I'll look for other opportunities to contribute. |
@n8henrie Thanks a lot for your offer! An easy way to start with small contributions (besides opening issues which is also warmly welcome!) is to improve the docu: https://github.com/rustic-rs/docs |
According to https://rustic.cli.rs/docs/comparison-restic.html I see the
find
andmount
commands are missing.I see an existing issue for
mount
.Is there any ongoing work or major blockers for the
find
command? I haven't usedmount
, but I've used restic'sfind
command frequently.The text was updated successfully, but these errors were encountered: