Skip to content
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

Reserve proto definition and generated code #820

Merged
merged 2 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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