-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow clients to specify one-directional sync #29
Comments
Interesting. That doesn't seem particularly hard to implement, as you're right, passing around a flag to the diff code that says "this side always wins" seems easy enough. I don't have time/itch to personally hack on this within the next ~weeks, but might get to it the next time I do a round of work on mirror. Happy to review a PR if you take a crack at it. I can give some off-the-top-of-my-head ideas of what files/etc. to change if you're interested. |
yeah, point me at it and I'll take a look |
Here is where the core "local wins / remote wins" logic is at: https://github.com/stephenh/mirror/blob/master/src/main/java/mirror/UpdateTreeDiff.java#L68 Maybe having some sort of enum like It'd have to be a command line around here: https://github.com/stephenh/mirror/blob/master/src/main/java/mirror/Mirror.java#L144 E.g. call https://github.com/stephenh/mirror/blob/master/src/main/proto/mirror.proto#L28 With an inversion, e.g. if the client is in "LatestOverride" seems like an okay-ish name; could be something like "NewerOverride". Dunno, open to better names. |
okay, looks straightforward enough. I'll try to get around to it this week 🙏 |
see #36 |
I have a slightly unusual usecase where I want to sync from my development box to a cloud-side server, and then from that server to a number of docker containers cloud-side. The hub-and-spoke pattern will work fine for me, but in this particular case, if I've deleted a file on my laptop while I was disconnected, I don't want the server to send it back to me if it (likewise if any of the containers happen to have it).
If I could specify sync directions then I could set
laptop -> server -> other clients
and be sure I never get unexpected files appearing on my box after I've deleted them.I suppose the main sticking point here might be that during the sync, if the laptop doesn't have the file the server should delete it, which is different/more complex logic than the current 'last write wins' strategy.
The text was updated successfully, but these errors were encountered: