Skip to content

Commit

Permalink
Reserve proto definition and generated code (#820)
Browse files Browse the repository at this point in the history
The proto file definition for the reserve status in #660,
and the generated clients from there.
  • Loading branch information
markmandel authored Jul 2, 2019
1 parent f85af70 commit c94ff02
Show file tree
Hide file tree
Showing 15 changed files with 1,326 additions and 251 deletions.
204 changes: 141 additions & 63 deletions pkg/sdk/sdk.pb.go

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions pkg/sdk/sdk.pb.gw.go

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

6 changes: 6 additions & 0 deletions pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,12 @@ func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameS
return nil
}

// Reserve moves this GameServer to the Reserved state for the Duration specified
func (l *LocalSDKServer) Reserve(_ context.Context, d *sdk.Duration) (*sdk.Empty, error) {
logrus.WithField("duration", d).Info("Reserve request has been received!")
return &sdk.Empty{}, nil
}

// Close tears down all the things
func (l *LocalSDKServer) Close() {
l.updateObservers.Range(func(observer, _ interface{}) bool {
Expand Down
6 changes: 6 additions & 0 deletions pkg/sdkserver/sdkserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ func (s *SDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameServer
return nil
}

// Reserve moves this GameServer to the Reserved state for the Duration specified
// TODO: implement this functionality
func (s *SDKServer) Reserve(_ context.Context, d *sdk.Duration) (*sdk.Empty, error) {
return &sdk.Empty{}, errors.New("not implemented")
}

// sendGameServerUpdate sends a watch game server event
func (s *SDKServer) sendGameServerUpdate(gs *stablev1alpha1.GameServer) {
s.logger.Info("Sending GameServer Event to connectedStreams")
Expand Down
13 changes: 13 additions & 0 deletions sdk.proto
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ service SDK {
body: "*"
};
}

// Marks the GameServer as the Reserved state for Duration
rpc Reserve(Duration) returns (Empty) {
option (google.api.http) = {
post: "/reserve"
body: "*"
};
}
}

// I am Empty
Expand All @@ -91,6 +99,11 @@ message KeyValue {
string value = 2;
}

// time duration, in seconds
message Duration {
int64 seconds = 1;
}

// A GameServer Custom Resource Definition object
// We will only export those resources that make the most
// sense. Can always expand to more as needed.
Expand Down
37 changes: 37 additions & 0 deletions sdk.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,33 @@
]
}
},
"/reserve": {
"post": {
"summary": "Marks the GameServer as the Reserved state for Duration",
"operationId": "Reserve",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/sdkEmpty"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/sdkDuration"
}
}
],
"tags": [
"SDK"
]
}
},
"/shutdown": {
"post": {
"summary": "Call when the GameServer is shutting down",
Expand Down Expand Up @@ -315,6 +342,16 @@
}
}
},
"sdkDuration": {
"type": "object",
"properties": {
"seconds": {
"type": "string",
"format": "int64"
}
},
"title": "time duration, in seconds"
},
"sdkEmpty": {
"type": "object",
"title": "I am Empty"
Expand Down
Loading

0 comments on commit c94ff02

Please sign in to comment.