GithubHelp home page GithubHelp logo

Comments (3)

frenchtoasters avatar frenchtoasters commented on June 23, 2024

Hi @antiphp I would like to help out with this issue, I am new to the project and just had a few questions before jumping in.

Reading your solution it sounds like changing the gsAnnotations field to []map[string]string here

gsAnnotations map[string]string
then updating SetAnnotation (singular) to either append or overwrite.

Then adding a SetAnnotations (plural) that looks like func (s *SDKServer) SetAnnotations(_ context.Context, kv []*sdk.KeyValue) (*sdk.Empty, error).

Is that the line of thinking you would like here? Or do you think changing that property of the SDKServer to a slice would break something else?
Aside from adding a test is there anywhere you would like this implemented with this?

from agones.

antiphp avatar antiphp commented on June 23, 2024

Hi,

the function signature for SetAnnotations (p) seems fine. One could think of making kv variadic, but it does not seem to be used that often in this project except for GRPC options.

What's the thinking behind append vs overwrite? In my opinion, the latter key will always overwrite, so
[]*sdk.KeyValue{{"foo":"bar"},{"foo":"baz"}} should always result in foo=baz. We could error but it doesn't feel right to add sophisticated logic to what is just a map and everyone expects it to act like a map. But note that this is only my opinion, I am not related to this project, so in the end someone else will review and decide.

Btw this ticket is related: #3834 - Removal of annotations.

Thanks for taking the initiative!

from agones.

frenchtoasters avatar frenchtoasters commented on June 23, 2024

Hi,

the function signature for SetAnnotations (p) seems fine. One could think of making kv variadic, but it does not seem to be used that often in this project except for GRPC options.

What's the thinking behind append vs overwrite? In my opinion, the latter key will always overwrite, so []*sdk.KeyValue{{"foo":"bar"},{"foo":"baz"}} should always result in foo=baz. We could error but it doesn't feel right to add sophisticated logic to what is just a map and everyone expects it to act like a map. But note that this is only my opinion, I am not related to this project, so in the end someone else will review and decide.

Btw this ticket is related: #3834 - Removal of annotations.

Thanks for taking the initiative!

The idea to use append vs overwrite was so that we could handle updating multiple different annotations in the same function i.e. we would get []*sdk.KeyValue{{"foo":"bar"},{"some":"thing"}} and we needed both those annotations applied to the object. However this might just be a misunderstanding on my part of how the project invokes these under the hood.

I was thinking originally that we just wanted to be able to add multiple annotations that are passed to the function at once to a GameServer object. However it seems like the ask is more of not only add the annotations but to update the values of them as well. Which if that is the case I would agree completely that overwrite is the way to go instead of append.

from agones.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.