-
Notifications
You must be signed in to change notification settings - Fork 33
Enable one-directional sync #36
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,9 @@ public static class MirrorClientCommand extends BaseCommand { | |
| @Option(name = { "-li", "--use-internal-patterns" }, description = "use hardcoded include/excludes that generally work well for internal repos") | ||
| public boolean useInternalPatterns; | ||
|
|
||
| @Option(name = { "-sd", "--sync-direction"}, description = "direction to sync files, defaults to \"BOTH\", allowed values: \"INBOUND\", \"OUTBOUND\", \"BOTH\"") | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, so
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess once we get into the MirrorSession side of things, we do need something that is flippable/complement-able, as you're doing. |
||
| public SyncDirection syncDirection = SyncDirection.BOTH; | ||
|
|
||
| @Override | ||
| protected void runIfChecksOkay() { | ||
| try { | ||
|
|
@@ -193,7 +196,8 @@ protected void runIfChecksOkay() { | |
| new ConnectionDetector.Impl(channelFactory), | ||
| watcherFactory, | ||
| new NativeFileAccess(Paths.get(localRoot).toAbsolutePath()), | ||
| channelFactory); | ||
| channelFactory, | ||
| syncDirection); | ||
| client.startSession(); | ||
| // dumb way of waiting until they hit control-c | ||
| CountDownLatch cl = new CountDownLatch(1); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package mirror; | ||
|
|
||
| public enum SyncDirection { | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Protobuf supports enums: https://developers.google.com/protocol-buffers/docs/proto#enum If we put this enum in there, then you could just send the sync direction as-is over the wire, and not have to encode it/decode it as the separate allow inbound / allow outbound properties. |
||
| INBOUND { | ||
| @Override | ||
| public boolean getAllowInbound() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getAllowOutbound() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public SyncDirection getComplement() { | ||
| return OUTBOUND; | ||
| } | ||
| }, | ||
| OUTBOUND { | ||
| @Override | ||
| public boolean getAllowInbound() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getAllowOutbound() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public SyncDirection getComplement() { | ||
| return INBOUND; | ||
| } | ||
| }, | ||
| BOTH { | ||
| @Override | ||
| public boolean getAllowInbound() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean getAllowOutbound() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public SyncDirection getComplement() { | ||
| return BOTH; | ||
| } | ||
| }; | ||
|
|
||
|
|
||
| public abstract boolean getAllowInbound(); | ||
|
|
||
| public abstract boolean getAllowOutbound(); | ||
|
|
||
| public abstract SyncDirection getComplement(); | ||
| } | ||
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.
I'm pretty sure these references are fixed in master; can you change back to the
mirror-all?