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

Alpha SDK and example for Node.js (Player tracking) #1658

Merged
merged 19 commits into from
Aug 4, 2020

Conversation

steven-supersolid
Copy link
Collaborator

@steven-supersolid steven-supersolid commented Jun 28, 2020

What type of PR is this?
/kind feature

What this PR does / Why we need it:
Adds a Node.js alpha SDK that extends the base SDK with the alpha features of Player Tracking. Also adds an example server to showcase the SDK.
Once the features change stage then they can be moved to the main SDK with the tests and leave the framework for future alpha features.

Special notes for your reviewer:
Relates to #1033
Branched from #1657

@steven-supersolid
Copy link
Collaborator Author

/assign @markmandel

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 81ebcefa-a4e7-4bf3-8f00-610f7f4261bd

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 8840c494-0742-4c9f-9daf-ab5c127648f5

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

examples/nodejs-alpha/Dockerfile Outdated Show resolved Hide resolved
examples/nodejs-simple/Makefile Show resolved Hide resolved
sdks/nodejs/src/index.js Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 61d95d49-1ec7-405e-9692-122f84525004

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: defb51e1-5003-4f33-9123-2db8d328b619

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3f59cdfa-a12f-4d54-9ca5-6bbc6fc67b15

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1658/head:pr_1658 && git checkout pr_1658
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.7.0-c2acc0d

@markmandel
Copy link
Member

Just touching base, to see if this work is still ongoing?

@steven-supersolid
Copy link
Collaborator Author

I can take another look this weekend and still mulling over what the canonical approach would be.
I think correctly we would distribute a separate npm module, e.g. 1.7.0-alpha and the new methods would be built in, however I also think that would be overkill here. The Go SDK approach is not so difficult to parse as to be avoided for JavaScript.

Why I chose this implementation is that there is an SDK class which has an interface of all available operations and once imported/required it is either a regular SDK or an alpha SDK. The alternative is that it is an SDK which has alpha property/method behind which the alpha features are located. I hadn't considered this and it is more of a composition pattern vs. my initial inheritance approach.

Random thoughts:

  • If we were to introduce beta features then with this approach alpha would have to extend beta which doesn't seem quite right
  • What if there is a change of interface in an alpha feature - should developers be able to call the original and the new method?
  • Should it be clear with each method call that this is an alpha method?
  • What if the alpha SDK requires some additional initialisation?

Perhaps overthinking but it would be useful to have a pattern to follow if we continue to roll out alpha and beta features.

@markmandel
Copy link
Member

. The alternative is that it is an SDK which has alpha property/method behind which the alpha features are located. I hadn't considered this and it is more of a composition pattern vs. my initial inheritance approach.

This is how the Go SDK is working.

If we were to introduce beta features then with this approach alpha would have to extend beta which doesn't seem quite right

Beta would be it's own implementation. So no inheritance required.

What if there is a change of interface in an alpha feature - should developers be able to call the original and the new method?

Only the new. We can break Alpha (and beta) commands -- there is no guarantee of stability.

Should it be clear with each method call that this is an alpha method?

That was the idea behind SDK.Alpha().Command() to make that clear.

What if the alpha SDK requires some additional initialisation?

I can't this being a required at this stage, if so, we can handle that at that time.

Does that help?

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 77e939d3-0f11-4441-ba3a-77cbee27c9d2

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 2a24a2c2-1803-4ac6-8428-9f9af640a423

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 34c97545-b001-4fe4-a586-cfaefed5a801

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1658/head:pr_1658 && git checkout pr_1658
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-512b997

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great - just have a minor question and a couple of small nits (2019->2020), but otherwise, i think this is good to go 👍

sdks/nodejs/src/alpha.js Outdated Show resolved Hide resolved
sdks/nodejs/src/agonesSDK.js Show resolved Hide resolved
Co-authored-by: Mark Mandel <markmandel@google.com>
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 0abc2e92-79b2-408e-ad30-f0dbd29f8f88

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1658/head:pr_1658 && git checkout pr_1658
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-fbde7b1

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 4d04f0e4-a159-448e-a811-85769d764420

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1658/head:pr_1658 && git checkout pr_1658
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-55a3d23

@markmandel
Copy link
Member

Just a reminder:
https://github.com/googleforgames/agones/pull/1658/files#diff-278846dade2570eb0da62e878bab72dfR1

This is the only change that is left - this needs to be moved to Copyright 2020 not 2019.

Co-authored-by: Mark Mandel <markmandel@google.com>
@steven-supersolid
Copy link
Collaborator Author

Sorry I missed that one when I clicked the handy 'apply suggestion' button before!

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: f01274fb-9e47-4aee-9c8f-012940a3b311

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/googleforgames/agones.git pull/1658/head:pr_1658 && git checkout pr_1658
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.8.0-8f0396e

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVED 🔥

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markmandel, steven-supersolid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markmandel markmandel merged commit 4225416 into googleforgames:master Aug 4, 2020
@markmandel markmandel added this to the 1.8.0 milestone Aug 4, 2020
@markmandel markmandel added area/examples Examples. Usually found in the `examples` directory kind/feature New features for Agones labels Aug 11, 2020
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
)

* update dependencies in sdk and example
* update build and generate pb
* add alpha sdk
* export sdk and alpha sdk
* cleanup nodejs-simple
* add nodejs-alpha example

Co-authored-by: Mark Mandel <markmandel@google.com>
@steven-supersolid steven-supersolid deleted the player-tracking branch October 25, 2020 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/examples Examples. Usually found in the `examples` directory cla: yes kind/feature New features for Agones lgtm size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants