You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/09 15:42:02 UTC

[GitHub] [pulsar-client-go] ZiyaoWei commented on pull request #743: Add TableView support

ZiyaoWei commented on pull request #743:
URL: https://github.com/apache/pulsar-client-go/pull/743#issuecomment-1063055258


   A few things worth noting:
   
   - This is stacked on top of https://github.com/apache/pulsar-client-go/pull/743/;
   - The Java implementation actually return views of the underlying map in, e.g., `Keys()`, which I think might be problematic since then the users could inadvertently change the entries in the `TableView`. Maybe we should change it to returning a copy of the underlying values (or maybe I am missing something)?
   - The internal table is a `map` which aren't thread safe - I'll try changing it to `sync.Map` which should make the code less verbose, although since Golang doesn't have generics internally we have to do some type assertions. Alternatively, if we are okay with changing the accessors to return copies we can do the same and stick with a `map`.
   - Since (again) Golang doesn't support generics yet there's no good way of knowing what the types of the values would be, so I am making the API similar to `GetSchemaValue(v interface{})` by letting the users pass the `reflect.Type` of the values. This feels a bit ugly but I can't think of a better alternative, suggestions are most welcome!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org