Skip to content

Commit

Permalink
Allow multiple watch actions to be specified by ORing them
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Lehmann <[email protected]>
  • Loading branch information
aaronlehmann committed Mar 17, 2017
1 parent 5e5ef6c commit 6d7cd83
Show file tree
Hide file tree
Showing 4 changed files with 333 additions and 198 deletions.
177 changes: 108 additions & 69 deletions api/store.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions api/store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package docker.swarmkit.v1;

import "specs.proto";
import "objects.proto";
import "raft.proto";
import "types.proto";
import "gogoproto/gogo.proto";
import "plugin/plugin.proto";
Expand Down Expand Up @@ -87,7 +86,8 @@ message WatchRequest {
string kind = 1;

// Action (create/update/delete)
StoreActionKind action = 2;
// This is a bitmask, so multiple actions may be OR'd together
WatchActionKind action = 2;

// Filters are combined using AND logic - an event must match
// all of them to pass the filter.
Expand Down Expand Up @@ -121,7 +121,7 @@ message WatchMessage {
// Action (create/update/delete)
// Note that WatchMessage does not expose "commit" events that
// mark transaction boundaries.
StoreActionKind action = 1;
WatchActionKind action = 1;

// Matched object
Object object = 2;
Expand All @@ -138,3 +138,15 @@ message WatchMessage {
// resume the watch from this point.
Version version = 2;
}

// WatchActionKind distinguishes between creations, updates, and removals. It
// is structured as a bitmap so multiple kinds of events can be requested with
// a mask.
enum WatchActionKind {
option (gogoproto.goproto_enum_prefix) = false;
option (gogoproto.enum_customname) = "WatchActionKind";
WATCH_ACTION_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "WatchActionKindUnknown"]; // default value, invalid
WATCH_ACTION_CREATE = 1 [(gogoproto.enumvalue_customname) = "WatchActionKindCreate"];
WATCH_ACTION_UPDATE = 2 [(gogoproto.enumvalue_customname) = "WatchActionKindUpdate"];
WATCH_ACTION_REMOVE = 4 [(gogoproto.enumvalue_customname) = "WatchActionKindRemove"];
}
Loading

0 comments on commit 6d7cd83

Please sign in to comment.