-
Notifications
You must be signed in to change notification settings - Fork 71
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
Refactor into rustic_core
library, rustic
cli library and rustic
application part
#617
Conversation
@aawsome So this would be a really early stage how my approach would be. It's not in a working state right now, though. |
Hi @simonsan
Some points that may need some thinking:
Thanks again for tackling this issue and don't hesitate to call out for help or directions! |
Because I'm right now working on this one: Any ideas what's better, because I think it's really important to decouple there. Keeping the EDIT: But also in general I wonder how the approach is for (De)-Serialization? Especially the |
@aawsome Are you reachable via a platform that allows faster communication than this one, e.g. Discord, Matrix, IRC, Telegram? |
My suggestion:
I'll look for a way to communicate. However, I may be reachable only at some awkward times as I have some other responsibilities like job and family/children... ;-) |
That's a good idea, thank you for the hint! we could make a
Same here (: Maybe our awkward times match up 😅 |
Ah, just saw one thing: The structs under |
So maybe it doesn't make sense to add the |
Yeah, thought the same after seeing how much it is everywhere. will remove the feature again 👍🏽 |
Status update: Library builds now for the first time (OS: Win11) with 2 warnings for dead code. 🚀 |
@aawsome I added a snapshot of the current public api of the library part (separated by OS) here: https://github.com/simonsan/rustic/tree/refactor/crates/rustic_core/tests/public_api_data This is the full output though, over 5k lines. Used for CI basically. Could you please take a look at it and give an opinion what needs to be changed there? Better for the beginning is probably to run it on your own system with |
Status update: Library builds now on openSuse Tumbleweed. 🚀 |
Wow! Great! About interface tests:
Uhmm - actually didn't read through the 5k lines :-) I also don't know if we should expose really all this as public interface. Most likely not.. Generally about the interface: Also, I'm wondering that now the error types have been overworked if it would make sense to just use this in a first-start PR which we could merge pretty fast. Thinking about getting to the split library/CLI step-by-step... The next days I unfortunately have only few time - weekend is family-time and in Germany the 1st of May is a holiday... |
Exactly, same thought here. Will take a look and trying to expose a minimal interface as an API that we can extend, so we can keep the rest stable. There are some things, that I would need to change. Some things are wrapped in a result that clippy says is not needed. Some other things are passed by value but aren't consumed in the body, so we can change that as well to borrow, etc.
No, come on, let's do it here together. You can also push to this PR, I did that intentionally, so we can work together on it. 👍🏽
Would prefer it like doing it completely. think it's better to have it running directly and adapt everything so it is working like before, but split to cli/library. Maybe development on the main branch can be paused, so it's not many merge conflicts, and we focus on the split. Will make everything going forward much easier - and probably less time consuming.
German here as well, same stuff. I have my daughter though in the "Wechselmodell", so whole next week, with probably less time to work on it. The week after more. |
I think I will take the following approach:
Anything to add/change? Better approach? |
I wonder, does it make sense to have the errors as associated types in the traits? e.g.? pub trait ReadBackend: Clone + Send + Sync + 'static {
type ReadBackendError: Send + Sync + 'static + std::error::Error;
fn location(&self) -> String;
fn set_option(&mut self, option: &str, value: &str) -> Result<(), Self::ReadBackendError>;
...
} or would it be better to go with something like this? type BackendResult<T> = Result<T, BackendErrorKind>
pub trait ReadBackend: Clone + Send + Sync + 'static {
fn set_option(&mut self, option: &str, value: &str) -> BackendResult<()>;
} I'm struggling a bit with the implications here 🤔 not often working with generics, I have to say. I think I need some guidance here, to implement the error handling in the library part the right way. EDIT: Variant 1 is probably the way to go, problem is I think we need to remove |
@aawsome Would it be possible for you to have a 20 minutes Discord call (if you have, or another platform) in our mother tongue German to figure out how to go forward on this, also with regards to the trait impl and error handling. Probably much faster, than writing here. So less time invasive overall, I figure. 🤔 |
I created a Discord channel: https://discord.gg/zGZsfkZue6 I never used Discord before, so hope everything works out ;-) |
7d4be61
to
48a26b6
Compare
0e739a9
to
073e467
Compare
rustic_core
library, rustic
cli library and rustic
application part
Co-authored-by: Alexander Weiss <alex@weissfam.de>
c0c6ad3
to
b698cc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @simonsan for all your work!
I checked the changes today and didn't find problems - however as this is a big redesign, there might be still some bugs lurking around. We'll keep this beta for a while to find those bugs - if anyone finds something suspicious, please don't hesitate to report an issue!
LGTM!
Fixes #461
Todo
Library
anyhow
result with suitedErrorKinds
rustic_core/backend/stdin.rs
is missingErrorKindMember(#[from] AnotherError)
and check if we can handle them within code and use our own Error for itanyhow
bail!
macro at places with returning library errorsbail!
macro)clap
,merge
-> combine them undercli
feature flagPublic API
export UPDATE_EXPECT=1; cargo test public_api -p rustic_core
$env:UPDATE_EXPECT=1; cargo test public_api -p rustic_core
CLI
Runnable
traitsrc/commands/start.rs
for implementation detailshelpers.rs
for issues to be tackledCI
public api
checkpublic_api
integration test for various OSFollow up
ProgressExt
)progress
trait in library, that certain structs can implement, so if something in that regards is needed, each struct can expose their own progress/statusprintln!
andeprintln!
to structslet _
bindings where we throw away the result. we should probably check the results and handle possible errorsPublic API
CI
cargo-smart-release
Research
empty
Notes