The public gRPC schema, generated Go types and validation shared by Weir servers and clients.
Applications do not need this module directly. Use the Go SDK. Use this module to write another client or to change the protocol.
| Path | Contents |
|---|---|
api/weir/v1/store.proto |
The public schema |
api/weir/v1 |
Generated Go types for the weir.v1.StoreService.Execute RPC |
api/protocol |
Validation of requests and responses: envelopes, Store names, resources, records and Native |
| Term | Meaning |
|---|---|
| Store | A named backend connection on a Weir server. Every request names a Store. |
| Resource | The path of one record in a Store, made of percent-encoded segments. s:hello is the string key hello. |
| Execute | The only RPC. It is a bidirectional stream. One stream selects one Store and one operation kind. |
| Record | One Read or Mutate request. The first record index is 1. Each later record adds 1. |
| Result | The response to one record. Results arrive in completion order, so match them by index. |
| Native | One opaque backend command, such as a query or a scan. It does not run record batching. |
The server and the SDK depend on this module. This module depends on neither.
| Item | Requirement |
|---|---|
| Go | 1.27.4 |
This encodes a resource path and validates it.
Step 1. Create a module and add the protocol.
mkdir hello
cd hello
go mod init example.com/hello
go get github.com/batchstream/weir-protocol/api/protocol@v0.17.1Step 2. Save this as main.go.
package main
import (
"fmt"
"log"
"github.com/batchstream/weir-protocol/api/protocol"
)
func main() {
resource := protocol.EncodeSegment("my db") + "/records/s:hello"
fmt.Println(resource)
segments, err := protocol.ParseRelativeResource(resource)
if err != nil {
log.Fatal(err)
}
fmt.Println(segments)
}Step 3. Run it.
go run .Expected output:
my%20db/records/s:hello
[my db records s:hello]
| Guide | Contents |
|---|---|
| Semantics | Streams, deadlines, cancellation, mutations, Lua, Native and validation rules |
| Development | Module boundaries, code generation and releases |
api/protocol reference |
Every validation function |
api/weir/v1 reference |
Every generated type |
go test -race ./...
go vet ./...Default tests use in-memory data. To change the schema, edit
api/weir/v1/store.proto and follow Generate.
- Contributing: CONTRIBUTING.md
- Security reports: SECURITY.md
| Repository | Purpose |
|---|---|
| weir | Server |
| weir-go | Go client SDK |
| weir-protocol | Public gRPC schema and validation (this repository) |
| weir-charts | Helm chart |
| weir-tests | System tests and benchmarks |
MIT. See LICENSE.