Skip to content

About

Public protobuf schemas, generated Go types and shared validation for Weir servers and clients.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

80 Commits

Folders and files

Repository files navigation

Weir public protocol

CI Go Reference License: MIT

The public gRPC schema, generated Go types and validation shared by Weir servers and clients.

Overview

Applications do not need this module directly. Use the Go SDK. Use this module to write another client or to change the protocol.

Contents

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

Terms

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.

Dependency direction

The server and the SDK depend on this module. This module depends on neither.

Requirements

Item Requirement
Go 1.27.4

Quick start

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.1

Step 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]

Documentation

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

Development

go test -race ./...
go vet ./...

Default tests use in-memory data. To change the schema, edit api/weir/v1/store.proto and follow Generate.

Related repositories

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

License

MIT. See LICENSE.

About

Public protobuf schemas, generated Go types and shared validation for Weir servers and clients.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages