gRPC examples
Get a feel for how to use S2 with grpcurl
Prerequisite
- Download and install grpcurl.
- Your S2 authentication token. Checkout the quickstart for instructions.
Basins
Basins serve as globally-unique namespaces for streams.
Create a basin
Create an initial basin to work with. This is where your streams will live.
List basins
You might end up using many basins. List all of the basins owned by your account with:
Streams
Streams are the fundamental building block of S2. Create an unlimited amount.
Create a stream
Create a new stream, optionally specifying a StreamConfig.
In this case, we’ll use the Standard
storage class, and configure the stream to auto-trim data after 24 hours.
Append records
Next, we can try appending a batch of records. S2 provides both streaming and unary RPCs for appending. Here, we’ll just make a unary request.
Each record batch is formulated as an AppendInput. For now, we’ll just stick with a simple batch containing of a single record. The record body
will be base64-encoded binary data.
Read records
Let’s read it back! Again, we can open a streaming session, using ReadSessionRequest, or make a single unary read. We’ll do the latter below.