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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to