rcs icon indicating copy to clipboard operation
rcs copied to clipboard

Add Examples

Open nmezhenskyi opened this issue 2 years ago • 2 comments

Need to add examples of interfacing with HTTP, gRPC, and Native APIs. Ideally in several languages.

nmezhenskyi avatar Nov 15 '22 02:11 nmezhenskyi

@nmezhenskyi I think your Golang RCS has some good promises and I'd love to help contribute. I have some enterprise experience building distributed buffers/caches in Java and have been learning Go for a recent new role.

I took a look through the codebase and have a few questions, specifically around usage (which is also why I'm asking this in the "Add Examples" issue).

  • How is the cache meant to be used? ie how does one know which server to hit to get the data we need? Is it meant to be like Redis where the data is generally available "everywhere" and the Redis server knows which replica has the data?
  • I love how you're focusing on availability in various protocols. More on that, it'd be super important to not only have easy integration but super simple and easy APIs.

I'm down to take a jab at an example. Maybe you can nitpick it and help guide me in the right direction of how you expect it to be used also?

pierater avatar Dec 10 '22 04:12 pierater

Hey @pierater! I'm glad you've found the project interesting and your contributions are welcome!

To answer your questions:

  • The cache supports neither replication nor sharding yet. That's something that needs to be decided on and implemented in the near future. But yeah, I'm leaning toward the Redis' way of doing it. The data would be available "everywhere". Currently though, the client is responsible for keeping track of the server where the data is stored.
  • Native support of various protocols is basically the main idea of this project. I also agree that APIs should be simple and straightforward to use.

Regarding the examples, I wanted to show how one can interact with RCS using its various APIs. So basically examples would be the client-side code.

The easiest example would be to communicate using HTTP API. The gRPC one would be a little trickier, the client would first need to compile the protobuf definitions to its language. And the Native API would be the hardest one since it'd require writing the whole client library to serialize & parse messages.

Examples are welcome in any language really. Go examples could probably reuse a lot of the existing server code.

Here's the directory structure I had in mind:

  • /examples
    • /go
      • /http
      • /grpc
      • /native
    • /java
      • /http
      • /grpc
      • /native

In the future, it'd probably make sense to move the examples into a separate repository. But right now the project is quite small and it just needs something to prove that it actually works haha :)

So if you're interested in adding some examples, feel free to do so! Also, if you have any other questions, suggestions, or advice regarding RCS in general, I'd be happy to discuss!

nmezhenskyi avatar Dec 10 '22 23:12 nmezhenskyi