Skip to content

Add --repair option for command that work with cache#200

Merged
folbricht merged 1 commit intofolbricht:masterfrom
tanshihaj:master
Dec 3, 2021
Merged

Add --repair option for command that work with cache#200
folbricht merged 1 commit intofolbricht:masterfrom
tanshihaj:master

Conversation

@tanshihaj
Copy link
Copy Markdown
Contributor

Chunks in local cache can corrupt for many reasons and by default desync fails when met them. They can be removed by running desync verify --repair --store /path/to/cache and runnnig desync untar ... again, however it is quite a long operation.
It could be convenient to repair them by redownloading invalid chunks from store when we met them during desync untar and other command which work with cache.

@folbricht
Copy link
Copy Markdown
Owner

Thanks for the PR. I do like the feature, though not a fan of passing the repair flag into so many places. You should be able to simplify that quite a bit.

If you look at https://github.com/folbricht/desync/blob/master/cmd/desync/store.go#L22, it gets cmdStoreOptions passed in. So if you added your flag here, perhaps calling it --cache-repair or similar to be more specific, then you could either pass the boolean to NewCache() here.

To avoid passing a flag to NewCache(), one could create a new object that implements the WriteStore interface and layer that on top of the store in https://github.com/folbricht/desync/blob/master/cmd/desync/store.go#L40. That way there wouldn't need to be any boolean parameter at all, though it would require implementing a store layer whose only job it is to turn InvalidChunk into ChunkNotFound basically.

@tanshihaj tanshihaj force-pushed the master branch 2 times, most recently from bc3de0b to 07a2080 Compare November 30, 2021 10:24
Copy link
Copy Markdown
Owner

@folbricht folbricht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.

@folbricht folbricht merged commit 22df7e6 into folbricht:master Dec 3, 2021
JeremieA pushed a commit to InSimo/desync that referenced this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants