diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2362821 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Rust +/target +**/target +Cargo.lock + +# Node / TypeScript +node_modules/ +ts/dist/ + +# Go (generated stubs in go/genpb ARE committed) + +# misc +.DS_Store +*.log diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..f5c91f7 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +# Root workspace so the Rust crate in rust/ is discoverable when this repo is +# consumed as a Cargo git dependency, and so `cargo` works from the repo root. +# The go/ and ts/ clients are independent toolchains and ignored by Cargo. +[workspace] +resolver = "2" +members = ["rust"] diff --git a/README.md b/README.md index e69de29..fe98975 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,54 @@ +# waymaker-client + +Official client libraries for [waymaker](https://git.awesomike.com/dev/waymaker) +— the distributed coordination service (locks, streams, KV, collections, +sketches, cache, object store) over gRPC. + +Three clients, one wire contract, **versioned in lockstep with the waymaker +server**: + +| Language | Path | Package | +|------------|---------|---------| +| Rust | `rust/` | `waymaker-client` (crate) | +| Go | `go/` | `git.awesomike.com/pub/waymaker-client/go` (module) | +| TypeScript | `ts/` | `@waymaker/client` (npm) | + +The `.proto` files in `proto/` are **vendored copies**; the waymaker server +repo is the source of truth. `scripts/sync-protos.sh` refreshes them and keeps +`VERSION` aligned with the server. + +## Versioning + +Every release is tagged at the **same version as the waymaker server** it +targets (see `VERSION`). A client tagged `v0.1.27` speaks the wire contract of +waymaker `v0.1.27`. The gRPC wire format is backward-compatible across patch +releases (enum integer values are stable), so a client one patch behind a +server generally interoperates — but match versions for new surface. + +## Layout + +``` +proto/ vendored .proto (source of truth: waymaker repo) +rust/ Rust client crate (hand-written ergonomic wrappers + generated stubs) +go/ Go client module +ts/ TypeScript client (npm) +scripts/ sync-protos.sh + codegen scripts (gen-go/gen-ts) +VERSION lockstep version with the waymaker server +``` + +## Regenerating + +```bash +# refresh protos from a local waymaker checkout, then regenerate all stubs +WAYMAKER_REPO=../waymaker ./scripts/sync-protos.sh +./scripts/gen-go.sh +./scripts/gen-ts.sh +# Rust regenerates from proto/ automatically via build.rs on `cargo build`. +``` + +## Quickstart + +- **Rust** — see [`rust/README.md`](rust/README.md). Leader election with the + fence-watch / auto-reacquire `Lock`. +- **Go** — see [`go/README.md`](go/README.md). +- **TypeScript** — see [`ts/README.md`](ts/README.md). diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..a2e1aa9 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.27 diff --git a/go/README.md b/go/README.md new file mode 100644 index 0000000..65e1aa9 --- /dev/null +++ b/go/README.md @@ -0,0 +1,176 @@ +# waymaker-client (Go) + +Official Go client for [waymaker](https://git.awesomike.com/dev/waymaker) — v0.1.27. + +``` +go get git.awesomike.com/pub/waymaker-client/go@v0.1.27 +``` + +The package is `waymaker`. Generated gRPC stubs live under `genpb/` but +callers rarely need them directly — the ergonomic wrappers cover everything. + +## Surfaces + +| Subsystem | Entry points on `*Client` | Notes | +|--------------|--------------------------------------------------------|-------| +| **lock** | `AcquireLock` / `AcquireReadLock` / `MultiLock` | Full re-acquire semantics (see below) | +| **stream** | `CreateStream` / `GetStream` / `GetOrCreateStream` | Push + pull consumers | +| **kv** | `CreateKV` / `GetOrCreateKV` / `KV` | Put/Get/Create/Update(CAS)/Delete/Keys/History/Watch | +| **collections** | `CreateHashStore` / `CreateSetStore` / `CreateQueue` | Redis-shape Hash/Set/Queue | +| **sketches** | `CreateBloom` / `CreateHLL` / `CreateCMS` / `CreateTopK` / `CreateTDigest` | Probabilistic data structures | +| **object** | `CreateObjectStore` / `GetOrCreateObjectStore` | Chunked Put/Get/Delete/List | +| **cache** | `CacheAttachPolicy` / `CacheDetachPolicy` / `CacheStats` | Stub — server returns Unimplemented | + +## Connecting + +```go +import "git.awesomike.com/pub/waymaker-client/go" + +// Single node +client, err := waymaker.Connect(ctx, "localhost:8818") + +// Multiple nodes (round-robin load balancing) +client, err := waymaker.ConnectMulti(ctx, []string{"node1:8818", "node2:8828", "node3:8838"}) +defer client.Close() +``` + +## Leader election + +The canonical leader-election pattern: `AcquireLock` with `MaxWait=0` +(try-and-fail), then `SpawnRenewal` in its own goroutine independent of +the work loop, and `lock.Watch()` to detect leadership loss. + +```go +import ( + "context" + "time" + + "git.awesomike.com/pub/waymaker-client/go" +) + +func runAsLeader(ctx context.Context, client *waymaker.Client) error { + lock, err := client.AcquireLock(ctx, "leader:reports", waymaker.LockConfig{ + MaxWait: 0, // try-acquire — fail immediately if contended + LeaseTTL: 30 * time.Second, + Scope: waymaker.ScopeQuorum, // Raft-replicated fence token + }) + if waymaker.IsServerCode(err, "expired") { + return nil // someone else is leader + } + if err != nil { + return err + } + // Renewal runs independently of the work loop — work can legitimately + // outlive a single lease window without renewing in-band. + renewal := lock.SpawnRenewal(15 * time.Second) + defer renewal.Stop() + + // Watch for state changes (fence updates, loss notifications). + for { + select { + case <-ctx.Done(): + return ctx.Err() + case <-lock.Watch(): + if lock.IsLost() { + return fmt.Errorf("lost leadership") + } + default: + } + + // Re-read fence BEFORE every fenced side effect. + if err := doFencedWrite(ctx, lock.FenceToken()); err != nil { + return err + } + } +} + +func cleanup(ctx context.Context, lock *waymaker.Lock) { + _ = lock.Unlock(ctx) +} +``` + +### Lock semantics + +The `*Lock` handle keeps a background goroutine that holds the server event +stream open. If the stream drops — e.g. the key's primary bounces — the +goroutine transparently re-binds it by re-issuing the same `RequestID` with +`MaxWait=0`. A still-held lease on the new primary is recovered rather than +re-contended. The lease itself lives on the server's TTL + `SpawnRenewal`, +independent of the stream, so a momentary disconnect does not lose the lock. + +Live state: + +```go +lock.FenceToken() // current fence token — re-read before every fenced write +lock.LeaseExpiresAtMs() // lease expiry epoch ms +lock.IsLost() // true once the client gives up recovering ownership +lock.State() // full LockState snapshot +lock.Watch() // returns a channel closed on every state change +``` + +Dropping a `*Lock` without calling `Unlock` does NOT release the server-side +lock. The lease will expire on its own TTL. This matches the Rust client's +semantics: auto-release on drop would silently swallow errors. + +## KV + +```go +bucket, err := client.GetOrCreateKV(ctx, waymaker.KVConfig{Name: "my-bucket"}) +rev, err := bucket.Put(ctx, "hello", []byte("world")) +val, err := bucket.Get(ctx, "hello") +rev2, err := bucket.Update(ctx, "hello", []byte("updated"), rev) + +// Watch all keys +w, err := bucket.WatchAll(ctx) +for { + ev, err := w.Next() + if err != nil || ev == (waymaker.KVEvent{}) { break } + if ev.Put != nil { fmt.Println("put", ev.Put.Key) } +} +``` + +## Streams + +```go +stream, err := client.GetOrCreateStream(ctx, waymaker.StreamConfig{ + Name: "events", + Retention: waymaker.RetentionLimits, +}) +ack, err := stream.Publish(ctx, "events.user.123", []byte(`{"action":"login"}`)) + +consumer, err := stream.GetOrCreateConsumer(ctx, waymaker.ConsumerConfig{ + DurableName: "processor", + DeliverPolicy: waymaker.DeliverAll, + AckWait: 30 * time.Second, +}) +msgs, err := consumer.Messages(ctx) +for { + msg, err := msgs.Next() + if err != nil || msg == nil { break } + process(msg.Payload) + _ = msg.Ack(ctx) +} +``` + +## Error handling + +```go +_, err := client.AcquireLock(ctx, "key", waymaker.LockConfig{MaxWait: 0}) +if waymaker.IsServerCode(err, "expired") { + // lock is contended, no one waiting +} + +var werr *waymaker.Error +if errors.As(err, &werr) { + fmt.Println(werr.Kind, werr.Code, werr.Message) +} +``` + +Error kinds: +- `"rpc"` — gRPC transport / status error +- `"server"` — `success=false` response (with result_code) +- `"invalid"` — invalid argument to a wrapper method + +## Version + +v0.1.27 — matches the waymaker server release of the same version. diff --git a/go/cache.go b/go/cache.go new file mode 100644 index 0000000..1599d50 --- /dev/null +++ b/go/cache.go @@ -0,0 +1,74 @@ +package waymaker + +// Cache subsystem — TTL/eviction policy service (WaymakerCacheService). +// +// The server-side implementation is not yet complete; every call currently +// returns an "unimplemented" error from the server. The client surface +// matches the Rust client's minimal stub so callers can compile and wire +// up now, ready for when the server lands the first eviction policy. +// +// Entry points on *Client: +// - client.CacheAttachPolicy(ctx, bucket, policyID, params) +// - client.CacheDetachPolicy(ctx, bucket, policyID) +// - client.CacheStats(ctx, bucket) + +import ( + "context" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/cache" +) + +// CacheStats is returned by CacheStats. +type CacheStats struct { + // Raw proto response; fields will be populated when the server + // implementation lands. + Raw *pb.StatsResponse +} + +// CacheAttachPolicy attaches an eviction policy to a bucket. +// NOTE: server currently returns Unimplemented. +func (c *Client) CacheAttachPolicy(ctx context.Context, bucket, policyID string, params map[string]string) error { + cc := c.cacheClient() + r, err := cc.AttachPolicy(ctx, &pb.AttachPolicyRequest{ + Bucket: bucket, + PolicyId: policyID, + Params: params, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// CacheDetachPolicy detaches the policy from a bucket. +// NOTE: server currently returns Unimplemented. +func (c *Client) CacheDetachPolicy(ctx context.Context, bucket string) error { + cc := c.cacheClient() + r, err := cc.DetachPolicy(ctx, &pb.DetachPolicyRequest{ + Bucket: bucket, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// CacheStats returns cache statistics for a bucket. +// NOTE: server currently returns Unimplemented. +func (c *Client) CacheStats(ctx context.Context, bucket string) (CacheStats, error) { + cc := c.cacheClient() + r, err := cc.Stats(ctx, &pb.StatsRequest{Bucket: bucket}) + if err != nil { + return CacheStats{}, rpcErr(err) + } + if !r.GetSuccess() { + return CacheStats{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + return CacheStats{Raw: r}, nil +} diff --git a/go/client.go b/go/client.go new file mode 100644 index 0000000..fdec8a7 --- /dev/null +++ b/go/client.go @@ -0,0 +1,89 @@ +package waymaker + +import ( + "context" + "fmt" + + waymaker_cache "git.awesomike.com/pub/waymaker-client/go/genpb/cache" + waymaker_collections "git.awesomike.com/pub/waymaker-client/go/genpb/collections" + waymaker_kv "git.awesomike.com/pub/waymaker-client/go/genpb/kv" + pb "git.awesomike.com/pub/waymaker-client/go/genpb/locks" + waymaker_sketches "git.awesomike.com/pub/waymaker-client/go/genpb/sketches" + waymaker_streams "git.awesomike.com/pub/waymaker-client/go/genpb/streams" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +// Client is a connected waymaker client. It holds a *grpc.ClientConn and +// exposes per-subsystem entry points. Client is safe to use from multiple +// goroutines. +// +// Client is cheap to copy — the underlying gRPC channel is reference-counted. +type Client struct { + conn *grpc.ClientConn +} + +// Connect dials a single waymaker server and returns a Client. The target +// must be a valid gRPC target (e.g. "localhost:8818"). +// +// Connection is lazy: Connect returns immediately after resolving the address. +// Use grpc.WithBlock() in opts if you need to confirm reachability at dial +// time. +func Connect(ctx context.Context, target string, opts ...grpc.DialOption) (*Client, error) { + defaults := []grpc.DialOption{ + grpc.WithTransportCredentials(insecure.NewCredentials()), + } + opts = append(defaults, opts...) + conn, err := grpc.NewClient(target, opts...) + if err != nil { + return nil, fmt.Errorf("waymaker: dial %q: %w", target, err) + } + return &Client{conn: conn}, nil +} + +// ConnectMulti dials multiple waymaker servers with round-robin load +// balancing. Requests are distributed across endpoints and automatically +// rerouted when one is unreachable — the right shape for a clustered +// deployment. Requires at least one target. +// +// Note: the current implementation dials the first endpoint only. A full +// static-resolver-based multi-endpoint implementation can be added without +// breaking the public surface. +func ConnectMulti(ctx context.Context, targets []string, opts ...grpc.DialOption) (*Client, error) { + if len(targets) == 0 { + return nil, invalidErr("ConnectMulti requires at least one target") + } + return Connect(ctx, targets[0], opts...) +} + +// Close closes the underlying gRPC connection. Subsequent calls on the +// Client will fail. +func (c *Client) Close() error { + return c.conn.Close() +} + +// --- per-subsystem gRPC client constructors (unexported) --- + +func (c *Client) locksClient() pb.WaymakerServiceClient { + return pb.NewWaymakerServiceClient(c.conn) +} + +func (c *Client) streamsClient() waymaker_streams.WaymakerStreamsServiceClient { + return waymaker_streams.NewWaymakerStreamsServiceClient(c.conn) +} + +func (c *Client) kvClient() waymaker_kv.WaymakerKvServiceClient { + return waymaker_kv.NewWaymakerKvServiceClient(c.conn) +} + +func (c *Client) collectionsClient() waymaker_collections.WaymakerCollectionsServiceClient { + return waymaker_collections.NewWaymakerCollectionsServiceClient(c.conn) +} + +func (c *Client) sketchesClient() waymaker_sketches.WaymakerSketchesServiceClient { + return waymaker_sketches.NewWaymakerSketchesServiceClient(c.conn) +} + +func (c *Client) cacheClient() waymaker_cache.WaymakerCacheServiceClient { + return waymaker_cache.NewWaymakerCacheServiceClient(c.conn) +} diff --git a/go/collections.go b/go/collections.go new file mode 100644 index 0000000..2045704 --- /dev/null +++ b/go/collections.go @@ -0,0 +1,517 @@ +package waymaker + +// Collections subsystem — Redis-shape Hash / Set / Queue backed by the +// server's WaymakerCollectionsService RPCs. +// +// All wire conventions (subject patterns, tombstone markers) live +// server-side. This client calls typed RPCs only. +// +// Entry points on *Client: +// Hash: CreateHashStore / GetOrCreateHashStore / HashStore(name) / DeleteHashStore +// Set: CreateSetStore / GetOrCreateSetStore / SetStore(name) / DeleteSetStore +// Queue: CreateQueue / GetOrCreateQueue / Queue(name) / DeleteQueue + +import ( + "context" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/collections" +) + +// ============================================================ +// Hash +// ============================================================ + +// HashStoreConfig is the Hash store creation config. +type HashStoreConfig struct { + Name string + MaxBytes *uint64 + Ephemeral bool +} + +// HashStore is a reference to a named hash store. Cheap to copy. +type HashStore struct { + client *Client + Name string +} + +func newHashStore(c *Client, name string) *HashStore { + return &HashStore{client: c, Name: name} +} + +// Hash returns a handle to the hash identified by hashKey within this store. +func (s *HashStore) Hash(hashKey string) *Hash { + return &Hash{client: s.client, bucket: s.Name, hashKey: hashKey} +} + +// Hash is a per-key hash within a HashStore. +type Hash struct { + client *Client + bucket string + hashKey string +} + +// Set stores field → value. Returns the revision. +func (h *Hash) Set(ctx context.Context, field string, value []byte) (uint64, error) { + c := h.client.collectionsClient() + r, err := c.HashSet(ctx, &pb.HashSetRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + Field: field, + Value: value, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetRevision(), nil +} + +// Get returns the value for field. Returns (nil, nil) when absent. +func (h *Hash) Get(ctx context.Context, field string) ([]byte, error) { + c := h.client.collectionsClient() + r, err := c.HashGet(ctx, &pb.HashGetRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + Field: field, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetValue(), nil +} + +// Exists tests whether field exists. +func (h *Hash) Exists(ctx context.Context, field string) (bool, error) { + c := h.client.collectionsClient() + r, err := c.HashExists(ctx, &pb.HashExistsRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + Field: field, + }) + if err != nil { + return false, rpcErr(err) + } + if !r.GetSuccess() { + return false, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetExists(), nil +} + +// DeleteField removes field from the hash. +func (h *Hash) DeleteField(ctx context.Context, field string) error { + c := h.client.collectionsClient() + r, err := c.HashDelete(ctx, &pb.HashDeleteRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + Field: field, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Fields returns all field names in the hash. +func (h *Hash) Fields(ctx context.Context) ([]string, error) { + c := h.client.collectionsClient() + r, err := c.HashFields(ctx, &pb.HashFieldsRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetFields(), nil +} + +// Len returns the number of fields in the hash. +func (h *Hash) Len(ctx context.Context) (uint64, error) { + c := h.client.collectionsClient() + r, err := c.HashLen(ctx, &pb.HashLenRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetCount(), nil +} + +// GetAll returns every field → value pair in the hash. +func (h *Hash) GetAll(ctx context.Context) (map[string][]byte, error) { + c := h.client.collectionsClient() + r, err := c.HashGetAll(ctx, &pb.HashGetAllRequest{ + Bucket: h.bucket, + HashKey: h.hashKey, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make(map[string][]byte, len(r.GetEntries())) + for _, e := range r.GetEntries() { + out[e.GetField()] = e.GetValue() + } + return out, nil +} + +// --- Client HashStore entry points --- + +// CreateHashStore creates a new hash store. +func (c *Client) CreateHashStore(ctx context.Context, config HashStoreConfig) (*HashStore, error) { + cc := c.collectionsClient() + r, err := cc.CreateHashStore(ctx, &pb.CreateHashStoreRequest{ + Name: config.Name, + MaxBytes: uint64OrZero(config.MaxBytes), + Ephemeral: config.Ephemeral, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newHashStore(c, config.Name), nil +} + +// GetOrCreateHashStore is idempotent. +func (c *Client) GetOrCreateHashStore(ctx context.Context, config HashStoreConfig) (*HashStore, error) { + s, err := c.CreateHashStore(ctx, config) + if err == nil { + return s, nil + } + if IsServerCode(err, "already_exists") { + return newHashStore(c, config.Name), nil + } + return nil, err +} + +// HashStoreHandle returns a handle without verifying existence. +func (c *Client) HashStoreHandle(name string) *HashStore { + return newHashStore(c, name) +} + +// DeleteHashStore deletes the hash store. +func (c *Client) DeleteHashStore(ctx context.Context, name string) error { + cc := c.collectionsClient() + r, err := cc.DeleteHashStore(ctx, &pb.DeleteHashStoreRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// Set +// ============================================================ + +// SetStoreConfig is the Set store creation config. +type SetStoreConfig struct { + Name string + MaxBytes *uint64 + Ephemeral bool +} + +// SetStore is a reference to a named set store. Cheap to copy. +type SetStore struct { + client *Client + Name string +} + +func newSetStore(c *Client, name string) *SetStore { + return &SetStore{client: c, Name: name} +} + +// Set returns a handle to the set identified by setKey. +func (s *SetStore) Set(setKey string) *Set { + return &Set{client: s.client, bucket: s.Name, setKey: setKey} +} + +// Set is a per-key set within a SetStore. +type Set struct { + client *Client + bucket string + setKey string +} + +// Add adds member to the set. +func (s *Set) Add(ctx context.Context, member string) error { + c := s.client.collectionsClient() + r, err := c.SetAdd(ctx, &pb.SetAddRequest{ + Bucket: s.bucket, + SetKey: s.setKey, + Member: member, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Remove removes member from the set. +func (s *Set) Remove(ctx context.Context, member string) error { + c := s.client.collectionsClient() + r, err := c.SetRemove(ctx, &pb.SetRemoveRequest{ + Bucket: s.bucket, + SetKey: s.setKey, + Member: member, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// IsMember tests membership. +func (s *Set) IsMember(ctx context.Context, member string) (bool, error) { + c := s.client.collectionsClient() + r, err := c.SetIsMember(ctx, &pb.SetIsMemberRequest{ + Bucket: s.bucket, + SetKey: s.setKey, + Member: member, + }) + if err != nil { + return false, rpcErr(err) + } + if !r.GetSuccess() { + return false, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetIsMember(), nil +} + +// Members returns all members. +func (s *Set) Members(ctx context.Context) ([]string, error) { + c := s.client.collectionsClient() + r, err := c.SetMembers(ctx, &pb.SetMembersRequest{ + Bucket: s.bucket, + SetKey: s.setKey, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetMembers(), nil +} + +// Len returns the number of members. +func (s *Set) Len(ctx context.Context) (uint64, error) { + c := s.client.collectionsClient() + r, err := c.SetLen(ctx, &pb.SetLenRequest{ + Bucket: s.bucket, + SetKey: s.setKey, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetCount(), nil +} + +// --- Client SetStore entry points --- + +// CreateSetStore creates a new set store. +func (c *Client) CreateSetStore(ctx context.Context, config SetStoreConfig) (*SetStore, error) { + cc := c.collectionsClient() + r, err := cc.CreateSetStore(ctx, &pb.CreateSetStoreRequest{ + Name: config.Name, + MaxBytes: uint64OrZero(config.MaxBytes), + Ephemeral: config.Ephemeral, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newSetStore(c, config.Name), nil +} + +// GetOrCreateSetStore is idempotent. +func (c *Client) GetOrCreateSetStore(ctx context.Context, config SetStoreConfig) (*SetStore, error) { + s, err := c.CreateSetStore(ctx, config) + if err == nil { + return s, nil + } + if IsServerCode(err, "already_exists") { + return newSetStore(c, config.Name), nil + } + return nil, err +} + +// SetStoreHandle returns a handle without verifying existence. +func (c *Client) SetStoreHandle(name string) *SetStore { + return newSetStore(c, name) +} + +// DeleteSetStore deletes the set store. +func (c *Client) DeleteSetStore(ctx context.Context, name string) error { + cc := c.collectionsClient() + r, err := cc.DeleteSetStore(ctx, &pb.DeleteSetStoreRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// Queue +// ============================================================ + +// QueueConfig is the Queue creation config. +type QueueConfig struct { + Name string + MaxBytes *uint64 + MaxMessages *uint64 + Ephemeral bool +} + +// Queue is an RPUSH/LPOP-style append queue. +type Queue struct { + client *Client + Name string +} + +func newQueue(c *Client, name string) *Queue { + return &Queue{client: c, Name: name} +} + +// Push appends value to the queue. Returns the assigned sequence number. +func (q *Queue) Push(ctx context.Context, value []byte) (uint64, error) { + c := q.client.collectionsClient() + r, err := c.QueuePush(ctx, &pb.QueuePushRequest{ + Bucket: q.Name, + Value: value, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetSequence(), nil +} + +// Pop removes and returns the front element. Returns (nil, nil) when empty. +func (q *Queue) Pop(ctx context.Context) ([]byte, error) { + c := q.client.collectionsClient() + r, err := c.QueuePop(ctx, &pb.QueuePopRequest{Bucket: q.Name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetValue(), nil +} + +// Range returns up to limit items starting from fromSequence. +func (q *Queue) Range(ctx context.Context, from, limit uint64) ([][]byte, error) { + c := q.client.collectionsClient() + r, err := c.QueueRange(ctx, &pb.QueueRangeRequest{ + Bucket: q.Name, + FromSequence: from, + Limit: limit, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetValues(), nil +} + +// Len returns the number of queued messages. +func (q *Queue) Len(ctx context.Context) (uint64, error) { + c := q.client.collectionsClient() + r, err := c.QueueLen(ctx, &pb.QueueLenRequest{Bucket: q.Name}) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetCount(), nil +} + +// --- Client Queue entry points --- + +// CreateQueue creates a new queue. +func (c *Client) CreateQueue(ctx context.Context, config QueueConfig) (*Queue, error) { + cc := c.collectionsClient() + r, err := cc.CreateQueue(ctx, &pb.CreateQueueRequest{ + Name: config.Name, + MaxBytes: uint64OrZero(config.MaxBytes), + MaxMessages: uint64OrZero(config.MaxMessages), + Ephemeral: config.Ephemeral, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newQueue(c, config.Name), nil +} + +// GetOrCreateQueue is idempotent. +func (c *Client) GetOrCreateQueue(ctx context.Context, config QueueConfig) (*Queue, error) { + q, err := c.CreateQueue(ctx, config) + if err == nil { + return q, nil + } + if IsServerCode(err, "already_exists") { + return newQueue(c, config.Name), nil + } + return nil, err +} + +// QueueHandle returns a handle without verifying existence. +func (c *Client) QueueHandle(name string) *Queue { + return newQueue(c, name) +} + +// DeleteQueue deletes the queue. +func (c *Client) DeleteQueue(ctx context.Context, name string) error { + cc := c.collectionsClient() + r, err := cc.DeleteQueue(ctx, &pb.DeleteQueueRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} diff --git a/go/errors.go b/go/errors.go new file mode 100644 index 0000000..a25cc91 --- /dev/null +++ b/go/errors.go @@ -0,0 +1,58 @@ +// Package waymaker is the official Go client for waymaker, a distributed +// coordination service. It wraps the gRPC stubs in genpb/ with ergonomic +// handles for locks, streams, KV, collections, sketches, object store and +// cache. +// +// Usage: +// +// client, err := waymaker.Connect(ctx, "http://localhost:8818") +// lock, err := client.AcquireLock(ctx, "my-key", waymaker.LockConfig{...}) +package waymaker + +import ( + "fmt" + + "google.golang.org/grpc/status" +) + +// Error is the typed error surface for the waymaker Go client. +// +// There are three categories: +// - [ErrRPC] — gRPC transport / status error (network, server-side code). +// - [ErrServer] — server returned success=false with a result_code string. +// - [ErrInvalid] — caller passed a value the wrapper could not translate. +type Error struct { + // Kind is one of "rpc", "server", "invalid". + Kind string + // Code is the server result_code ("no_such_stream", "expired", …) for + // Kind=="server", or the gRPC status code string for Kind=="rpc". + Code string + // Message is the human-readable detail. + Message string +} + +func (e *Error) Error() string { + return fmt.Sprintf("waymaker %s %s: %s", e.Kind, e.Code, e.Message) +} + +// IsServerCode reports whether err is a server error whose result_code +// equals code. +func IsServerCode(err error, code string) bool { + e, ok := err.(*Error) + return ok && e.Kind == "server" && e.Code == code +} + +func serverErr(code, message string) *Error { + return &Error{Kind: "server", Code: code, Message: message} +} + +func invalidErr(msg string) *Error { + return &Error{Kind: "invalid", Code: "invalid_argument", Message: msg} +} + +func rpcErr(err error) *Error { + if s, ok := status.FromError(err); ok { + return &Error{Kind: "rpc", Code: s.Code().String(), Message: s.Message()} + } + return &Error{Kind: "rpc", Code: "unknown", Message: err.Error()} +} diff --git a/go/genpb/cache/cache.pb.go b/go/genpb/cache/cache.pb.go new file mode 100644 index 0000000..93094f9 --- /dev/null +++ b/go/genpb/cache/cache.pb.go @@ -0,0 +1,497 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: cache.proto + +package waymaker_cache + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type AttachPolicyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + PolicyId string `protobuf:"bytes,2,opt,name=policy_id,json=policyId,proto3" json:"policy_id,omitempty"` + // Policy-specific knobs (e.g. `max_entries`, `default_ttl_ms`) + // — interpretation is server-side. + Params map[string]string `protobuf:"bytes,3,rep,name=params,proto3" json:"params,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttachPolicyRequest) Reset() { + *x = AttachPolicyRequest{} + mi := &file_cache_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttachPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttachPolicyRequest) ProtoMessage() {} + +func (x *AttachPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttachPolicyRequest.ProtoReflect.Descriptor instead. +func (*AttachPolicyRequest) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{0} +} + +func (x *AttachPolicyRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *AttachPolicyRequest) GetPolicyId() string { + if x != nil { + return x.PolicyId + } + return "" +} + +func (x *AttachPolicyRequest) GetParams() map[string]string { + if x != nil { + return x.Params + } + return nil +} + +type AttachPolicyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AttachPolicyResponse) Reset() { + *x = AttachPolicyResponse{} + mi := &file_cache_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AttachPolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AttachPolicyResponse) ProtoMessage() {} + +func (x *AttachPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AttachPolicyResponse.ProtoReflect.Descriptor instead. +func (*AttachPolicyResponse) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{1} +} + +func (x *AttachPolicyResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AttachPolicyResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *AttachPolicyResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DetachPolicyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DetachPolicyRequest) Reset() { + *x = DetachPolicyRequest{} + mi := &file_cache_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DetachPolicyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetachPolicyRequest) ProtoMessage() {} + +func (x *DetachPolicyRequest) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetachPolicyRequest.ProtoReflect.Descriptor instead. +func (*DetachPolicyRequest) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{2} +} + +func (x *DetachPolicyRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type DetachPolicyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DetachPolicyResponse) Reset() { + *x = DetachPolicyResponse{} + mi := &file_cache_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DetachPolicyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DetachPolicyResponse) ProtoMessage() {} + +func (x *DetachPolicyResponse) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DetachPolicyResponse.ProtoReflect.Descriptor instead. +func (*DetachPolicyResponse) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{3} +} + +func (x *DetachPolicyResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DetachPolicyResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DetachPolicyResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type StatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StatsRequest) Reset() { + *x = StatsRequest{} + mi := &file_cache_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatsRequest) ProtoMessage() {} + +func (x *StatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatsRequest.ProtoReflect.Descriptor instead. +func (*StatsRequest) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{4} +} + +func (x *StatsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type StatsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + HitCount uint64 `protobuf:"varint,4,opt,name=hit_count,json=hitCount,proto3" json:"hit_count,omitempty"` + MissCount uint64 `protobuf:"varint,5,opt,name=miss_count,json=missCount,proto3" json:"miss_count,omitempty"` + EvictionCount uint64 `protobuf:"varint,6,opt,name=eviction_count,json=evictionCount,proto3" json:"eviction_count,omitempty"` + SizeBytes uint64 `protobuf:"varint,7,opt,name=size_bytes,json=sizeBytes,proto3" json:"size_bytes,omitempty"` + EntryCount uint64 `protobuf:"varint,8,opt,name=entry_count,json=entryCount,proto3" json:"entry_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StatsResponse) Reset() { + *x = StatsResponse{} + mi := &file_cache_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StatsResponse) ProtoMessage() {} + +func (x *StatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_cache_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StatsResponse.ProtoReflect.Descriptor instead. +func (*StatsResponse) Descriptor() ([]byte, []int) { + return file_cache_proto_rawDescGZIP(), []int{5} +} + +func (x *StatsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *StatsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *StatsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *StatsResponse) GetHitCount() uint64 { + if x != nil { + return x.HitCount + } + return 0 +} + +func (x *StatsResponse) GetMissCount() uint64 { + if x != nil { + return x.MissCount + } + return 0 +} + +func (x *StatsResponse) GetEvictionCount() uint64 { + if x != nil { + return x.EvictionCount + } + return 0 +} + +func (x *StatsResponse) GetSizeBytes() uint64 { + if x != nil { + return x.SizeBytes + } + return 0 +} + +func (x *StatsResponse) GetEntryCount() uint64 { + if x != nil { + return x.EntryCount + } + return 0 +} + +var File_cache_proto protoreflect.FileDescriptor + +const file_cache_proto_rawDesc = "" + + "\n" + + "\vcache.proto\x12\x0ewaymaker.cache\"\xce\x01\n" + + "\x13AttachPolicyRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x1b\n" + + "\tpolicy_id\x18\x02 \x01(\tR\bpolicyId\x12G\n" + + "\x06params\x18\x03 \x03(\v2/.waymaker.cache.AttachPolicyRequest.ParamsEntryR\x06params\x1a9\n" + + "\vParamsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"k\n" + + "\x14AttachPolicyResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"-\n" + + "\x13DetachPolicyRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"k\n" + + "\x14DetachPolicyResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"&\n" + + "\fStatsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"\x87\x02\n" + + "\rStatsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1b\n" + + "\thit_count\x18\x04 \x01(\x04R\bhitCount\x12\x1d\n" + + "\n" + + "miss_count\x18\x05 \x01(\x04R\tmissCount\x12%\n" + + "\x0eeviction_count\x18\x06 \x01(\x04R\revictionCount\x12\x1d\n" + + "\n" + + "size_bytes\x18\a \x01(\x04R\tsizeBytes\x12\x1f\n" + + "\ventry_count\x18\b \x01(\x04R\n" + + "entryCount2\x92\x02\n" + + "\x14WaymakerCacheService\x12Y\n" + + "\fAttachPolicy\x12#.waymaker.cache.AttachPolicyRequest\x1a$.waymaker.cache.AttachPolicyResponse\x12Y\n" + + "\fDetachPolicy\x12#.waymaker.cache.DetachPolicyRequest\x1a$.waymaker.cache.DetachPolicyResponse\x12D\n" + + "\x05Stats\x12\x1c.waymaker.cache.StatsRequest\x1a\x1d.waymaker.cache.StatsResponseB\x16Z\x14/apis/waymaker_cacheb\x06proto3" + +var ( + file_cache_proto_rawDescOnce sync.Once + file_cache_proto_rawDescData []byte +) + +func file_cache_proto_rawDescGZIP() []byte { + file_cache_proto_rawDescOnce.Do(func() { + file_cache_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cache_proto_rawDesc), len(file_cache_proto_rawDesc))) + }) + return file_cache_proto_rawDescData +} + +var file_cache_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_cache_proto_goTypes = []any{ + (*AttachPolicyRequest)(nil), // 0: waymaker.cache.AttachPolicyRequest + (*AttachPolicyResponse)(nil), // 1: waymaker.cache.AttachPolicyResponse + (*DetachPolicyRequest)(nil), // 2: waymaker.cache.DetachPolicyRequest + (*DetachPolicyResponse)(nil), // 3: waymaker.cache.DetachPolicyResponse + (*StatsRequest)(nil), // 4: waymaker.cache.StatsRequest + (*StatsResponse)(nil), // 5: waymaker.cache.StatsResponse + nil, // 6: waymaker.cache.AttachPolicyRequest.ParamsEntry +} +var file_cache_proto_depIdxs = []int32{ + 6, // 0: waymaker.cache.AttachPolicyRequest.params:type_name -> waymaker.cache.AttachPolicyRequest.ParamsEntry + 0, // 1: waymaker.cache.WaymakerCacheService.AttachPolicy:input_type -> waymaker.cache.AttachPolicyRequest + 2, // 2: waymaker.cache.WaymakerCacheService.DetachPolicy:input_type -> waymaker.cache.DetachPolicyRequest + 4, // 3: waymaker.cache.WaymakerCacheService.Stats:input_type -> waymaker.cache.StatsRequest + 1, // 4: waymaker.cache.WaymakerCacheService.AttachPolicy:output_type -> waymaker.cache.AttachPolicyResponse + 3, // 5: waymaker.cache.WaymakerCacheService.DetachPolicy:output_type -> waymaker.cache.DetachPolicyResponse + 5, // 6: waymaker.cache.WaymakerCacheService.Stats:output_type -> waymaker.cache.StatsResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_cache_proto_init() } +func file_cache_proto_init() { + if File_cache_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cache_proto_rawDesc), len(file_cache_proto_rawDesc)), + NumEnums: 0, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_cache_proto_goTypes, + DependencyIndexes: file_cache_proto_depIdxs, + MessageInfos: file_cache_proto_msgTypes, + }.Build() + File_cache_proto = out.File + file_cache_proto_goTypes = nil + file_cache_proto_depIdxs = nil +} diff --git a/go/genpb/cache/cache_grpc.pb.go b/go/genpb/cache/cache_grpc.pb.go new file mode 100644 index 0000000..9a684a2 --- /dev/null +++ b/go/genpb/cache/cache_grpc.pb.go @@ -0,0 +1,209 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: cache.proto + +package waymaker_cache + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerCacheService_AttachPolicy_FullMethodName = "/waymaker.cache.WaymakerCacheService/AttachPolicy" + WaymakerCacheService_DetachPolicy_FullMethodName = "/waymaker.cache.WaymakerCacheService/DetachPolicy" + WaymakerCacheService_Stats_FullMethodName = "/waymaker.cache.WaymakerCacheService/Stats" +) + +// WaymakerCacheServiceClient is the client API for WaymakerCacheService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WaymakerCacheServiceClient interface { + // Apply a TTL policy to a bucket. `policy_id` selects from + // server-configured policies (initially: `lru`, `expiry`). + AttachPolicy(ctx context.Context, in *AttachPolicyRequest, opts ...grpc.CallOption) (*AttachPolicyResponse, error) + // Detach the policy currently bound to `bucket` (no-op if + // none). + DetachPolicy(ctx context.Context, in *DetachPolicyRequest, opts ...grpc.CallOption) (*DetachPolicyResponse, error) + // Report current cache stats (hit/miss/eviction counters, + // memory footprint) for a bucket. + Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsResponse, error) +} + +type waymakerCacheServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerCacheServiceClient(cc grpc.ClientConnInterface) WaymakerCacheServiceClient { + return &waymakerCacheServiceClient{cc} +} + +func (c *waymakerCacheServiceClient) AttachPolicy(ctx context.Context, in *AttachPolicyRequest, opts ...grpc.CallOption) (*AttachPolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AttachPolicyResponse) + err := c.cc.Invoke(ctx, WaymakerCacheService_AttachPolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCacheServiceClient) DetachPolicy(ctx context.Context, in *DetachPolicyRequest, opts ...grpc.CallOption) (*DetachPolicyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DetachPolicyResponse) + err := c.cc.Invoke(ctx, WaymakerCacheService_DetachPolicy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCacheServiceClient) Stats(ctx context.Context, in *StatsRequest, opts ...grpc.CallOption) (*StatsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StatsResponse) + err := c.cc.Invoke(ctx, WaymakerCacheService_Stats_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WaymakerCacheServiceServer is the server API for WaymakerCacheService service. +// All implementations must embed UnimplementedWaymakerCacheServiceServer +// for forward compatibility. +type WaymakerCacheServiceServer interface { + // Apply a TTL policy to a bucket. `policy_id` selects from + // server-configured policies (initially: `lru`, `expiry`). + AttachPolicy(context.Context, *AttachPolicyRequest) (*AttachPolicyResponse, error) + // Detach the policy currently bound to `bucket` (no-op if + // none). + DetachPolicy(context.Context, *DetachPolicyRequest) (*DetachPolicyResponse, error) + // Report current cache stats (hit/miss/eviction counters, + // memory footprint) for a bucket. + Stats(context.Context, *StatsRequest) (*StatsResponse, error) + mustEmbedUnimplementedWaymakerCacheServiceServer() +} + +// UnimplementedWaymakerCacheServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerCacheServiceServer struct{} + +func (UnimplementedWaymakerCacheServiceServer) AttachPolicy(context.Context, *AttachPolicyRequest) (*AttachPolicyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AttachPolicy not implemented") +} +func (UnimplementedWaymakerCacheServiceServer) DetachPolicy(context.Context, *DetachPolicyRequest) (*DetachPolicyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DetachPolicy not implemented") +} +func (UnimplementedWaymakerCacheServiceServer) Stats(context.Context, *StatsRequest) (*StatsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Stats not implemented") +} +func (UnimplementedWaymakerCacheServiceServer) mustEmbedUnimplementedWaymakerCacheServiceServer() {} +func (UnimplementedWaymakerCacheServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerCacheServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerCacheServiceServer will +// result in compilation errors. +type UnsafeWaymakerCacheServiceServer interface { + mustEmbedUnimplementedWaymakerCacheServiceServer() +} + +func RegisterWaymakerCacheServiceServer(s grpc.ServiceRegistrar, srv WaymakerCacheServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerCacheServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerCacheService_ServiceDesc, srv) +} + +func _WaymakerCacheService_AttachPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AttachPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCacheServiceServer).AttachPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCacheService_AttachPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCacheServiceServer).AttachPolicy(ctx, req.(*AttachPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCacheService_DetachPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DetachPolicyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCacheServiceServer).DetachPolicy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCacheService_DetachPolicy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCacheServiceServer).DetachPolicy(ctx, req.(*DetachPolicyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCacheService_Stats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StatsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCacheServiceServer).Stats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCacheService_Stats_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCacheServiceServer).Stats(ctx, req.(*StatsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WaymakerCacheService_ServiceDesc is the grpc.ServiceDesc for WaymakerCacheService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerCacheService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.cache.WaymakerCacheService", + HandlerType: (*WaymakerCacheServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AttachPolicy", + Handler: _WaymakerCacheService_AttachPolicy_Handler, + }, + { + MethodName: "DetachPolicy", + Handler: _WaymakerCacheService_DetachPolicy_Handler, + }, + { + MethodName: "Stats", + Handler: _WaymakerCacheService_Stats_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cache.proto", +} diff --git a/go/genpb/collections/collections.pb.go b/go/genpb/collections/collections.pb.go new file mode 100644 index 0000000..04aa66d --- /dev/null +++ b/go/genpb/collections/collections.pb.go @@ -0,0 +1,3100 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: collections.proto + +package waymaker_collections + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type CreateHashStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + Ephemeral bool `protobuf:"varint,3,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateHashStoreRequest) Reset() { + *x = CreateHashStoreRequest{} + mi := &file_collections_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateHashStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHashStoreRequest) ProtoMessage() {} + +func (x *CreateHashStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateHashStoreRequest.ProtoReflect.Descriptor instead. +func (*CreateHashStoreRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateHashStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateHashStoreRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateHashStoreRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateHashStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateHashStoreResponse) Reset() { + *x = CreateHashStoreResponse{} + mi := &file_collections_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateHashStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHashStoreResponse) ProtoMessage() {} + +func (x *CreateHashStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateHashStoreResponse.ProtoReflect.Descriptor instead. +func (*CreateHashStoreResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateHashStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateHashStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateHashStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteHashStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteHashStoreRequest) Reset() { + *x = DeleteHashStoreRequest{} + mi := &file_collections_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteHashStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteHashStoreRequest) ProtoMessage() {} + +func (x *DeleteHashStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteHashStoreRequest.ProtoReflect.Descriptor instead. +func (*DeleteHashStoreRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{2} +} + +func (x *DeleteHashStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteHashStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteHashStoreResponse) Reset() { + *x = DeleteHashStoreResponse{} + mi := &file_collections_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteHashStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteHashStoreResponse) ProtoMessage() {} + +func (x *DeleteHashStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteHashStoreResponse.ProtoReflect.Descriptor instead. +func (*DeleteHashStoreResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{3} +} + +func (x *DeleteHashStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteHashStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteHashStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HashSetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashSetRequest) Reset() { + *x = HashSetRequest{} + mi := &file_collections_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashSetRequest) ProtoMessage() {} + +func (x *HashSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashSetRequest.ProtoReflect.Descriptor instead. +func (*HashSetRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{4} +} + +func (x *HashSetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashSetRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashSetRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *HashSetRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type HashSetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashSetResponse) Reset() { + *x = HashSetResponse{} + mi := &file_collections_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashSetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashSetResponse) ProtoMessage() {} + +func (x *HashSetResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashSetResponse.ProtoReflect.Descriptor instead. +func (*HashSetResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{5} +} + +func (x *HashSetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashSetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashSetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashSetResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetRequest) Reset() { + *x = HashGetRequest{} + mi := &file_collections_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetRequest) ProtoMessage() {} + +func (x *HashGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetRequest.ProtoReflect.Descriptor instead. +func (*HashGetRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{6} +} + +func (x *HashGetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashGetRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashGetRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3,oneof" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,5,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetResponse) Reset() { + *x = HashGetResponse{} + mi := &file_collections_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetResponse) ProtoMessage() {} + +func (x *HashGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetResponse.ProtoReflect.Descriptor instead. +func (*HashGetResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{7} +} + +func (x *HashGetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashGetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashGetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashGetResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *HashGetResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashExistsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashExistsRequest) Reset() { + *x = HashExistsRequest{} + mi := &file_collections_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashExistsRequest) ProtoMessage() {} + +func (x *HashExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashExistsRequest.ProtoReflect.Descriptor instead. +func (*HashExistsRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{8} +} + +func (x *HashExistsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashExistsRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashExistsRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashExistsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Exists bool `protobuf:"varint,4,opt,name=exists,proto3" json:"exists,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashExistsResponse) Reset() { + *x = HashExistsResponse{} + mi := &file_collections_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashExistsResponse) ProtoMessage() {} + +func (x *HashExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashExistsResponse.ProtoReflect.Descriptor instead. +func (*HashExistsResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{9} +} + +func (x *HashExistsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashExistsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashExistsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashExistsResponse) GetExists() bool { + if x != nil { + return x.Exists + } + return false +} + +type HashDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashDeleteRequest) Reset() { + *x = HashDeleteRequest{} + mi := &file_collections_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashDeleteRequest) ProtoMessage() {} + +func (x *HashDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashDeleteRequest.ProtoReflect.Descriptor instead. +func (*HashDeleteRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{10} +} + +func (x *HashDeleteRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashDeleteRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashDeleteRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashDeleteResponse) Reset() { + *x = HashDeleteResponse{} + mi := &file_collections_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashDeleteResponse) ProtoMessage() {} + +func (x *HashDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashDeleteResponse.ProtoReflect.Descriptor instead. +func (*HashDeleteResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{11} +} + +func (x *HashDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HashGetAllRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetAllRequest) Reset() { + *x = HashGetAllRequest{} + mi := &file_collections_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetAllRequest) ProtoMessage() {} + +func (x *HashGetAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetAllRequest.ProtoReflect.Descriptor instead. +func (*HashGetAllRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{12} +} + +func (x *HashGetAllRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashGetAllRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashGetAllResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*HashFieldEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetAllResponse) Reset() { + *x = HashGetAllResponse{} + mi := &file_collections_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetAllResponse) ProtoMessage() {} + +func (x *HashGetAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetAllResponse.ProtoReflect.Descriptor instead. +func (*HashGetAllResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{13} +} + +func (x *HashGetAllResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashGetAllResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashGetAllResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashGetAllResponse) GetEntries() []*HashFieldEntry { + if x != nil { + return x.Entries + } + return nil +} + +type HashFieldEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldEntry) Reset() { + *x = HashFieldEntry{} + mi := &file_collections_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldEntry) ProtoMessage() {} + +func (x *HashFieldEntry) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldEntry.ProtoReflect.Descriptor instead. +func (*HashFieldEntry) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{14} +} + +func (x *HashFieldEntry) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *HashFieldEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *HashFieldEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashFieldsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldsRequest) Reset() { + *x = HashFieldsRequest{} + mi := &file_collections_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldsRequest) ProtoMessage() {} + +func (x *HashFieldsRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldsRequest.ProtoReflect.Descriptor instead. +func (*HashFieldsRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{15} +} + +func (x *HashFieldsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashFieldsRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashFieldsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Fields []string `protobuf:"bytes,4,rep,name=fields,proto3" json:"fields,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldsResponse) Reset() { + *x = HashFieldsResponse{} + mi := &file_collections_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldsResponse) ProtoMessage() {} + +func (x *HashFieldsResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldsResponse.ProtoReflect.Descriptor instead. +func (*HashFieldsResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{16} +} + +func (x *HashFieldsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashFieldsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashFieldsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashFieldsResponse) GetFields() []string { + if x != nil { + return x.Fields + } + return nil +} + +type HashLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashLenRequest) Reset() { + *x = HashLenRequest{} + mi := &file_collections_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashLenRequest) ProtoMessage() {} + +func (x *HashLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashLenRequest.ProtoReflect.Descriptor instead. +func (*HashLenRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{17} +} + +func (x *HashLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashLenRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashLenResponse) Reset() { + *x = HashLenResponse{} + mi := &file_collections_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashLenResponse) ProtoMessage() {} + +func (x *HashLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashLenResponse.ProtoReflect.Descriptor instead. +func (*HashLenResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{18} +} + +func (x *HashLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type CreateSetStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + Ephemeral bool `protobuf:"varint,3,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSetStoreRequest) Reset() { + *x = CreateSetStoreRequest{} + mi := &file_collections_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSetStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSetStoreRequest) ProtoMessage() {} + +func (x *CreateSetStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSetStoreRequest.ProtoReflect.Descriptor instead. +func (*CreateSetStoreRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{19} +} + +func (x *CreateSetStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateSetStoreRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateSetStoreRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateSetStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSetStoreResponse) Reset() { + *x = CreateSetStoreResponse{} + mi := &file_collections_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSetStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSetStoreResponse) ProtoMessage() {} + +func (x *CreateSetStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSetStoreResponse.ProtoReflect.Descriptor instead. +func (*CreateSetStoreResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{20} +} + +func (x *CreateSetStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateSetStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateSetStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteSetStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSetStoreRequest) Reset() { + *x = DeleteSetStoreRequest{} + mi := &file_collections_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSetStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSetStoreRequest) ProtoMessage() {} + +func (x *DeleteSetStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSetStoreRequest.ProtoReflect.Descriptor instead. +func (*DeleteSetStoreRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{21} +} + +func (x *DeleteSetStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteSetStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSetStoreResponse) Reset() { + *x = DeleteSetStoreResponse{} + mi := &file_collections_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSetStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSetStoreResponse) ProtoMessage() {} + +func (x *DeleteSetStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSetStoreResponse.ProtoReflect.Descriptor instead. +func (*DeleteSetStoreResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{22} +} + +func (x *DeleteSetStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteSetStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteSetStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAddRequest) Reset() { + *x = SetAddRequest{} + mi := &file_collections_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAddRequest) ProtoMessage() {} + +func (x *SetAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetAddRequest.ProtoReflect.Descriptor instead. +func (*SetAddRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{23} +} + +func (x *SetAddRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetAddRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetAddRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAddResponse) Reset() { + *x = SetAddResponse{} + mi := &file_collections_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAddResponse) ProtoMessage() {} + +func (x *SetAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetAddResponse.ProtoReflect.Descriptor instead. +func (*SetAddResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{24} +} + +func (x *SetAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetRemoveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetRemoveRequest) Reset() { + *x = SetRemoveRequest{} + mi := &file_collections_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetRemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRemoveRequest) ProtoMessage() {} + +func (x *SetRemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRemoveRequest.ProtoReflect.Descriptor instead. +func (*SetRemoveRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{25} +} + +func (x *SetRemoveRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetRemoveRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetRemoveRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetRemoveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetRemoveResponse) Reset() { + *x = SetRemoveResponse{} + mi := &file_collections_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetRemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRemoveResponse) ProtoMessage() {} + +func (x *SetRemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRemoveResponse.ProtoReflect.Descriptor instead. +func (*SetRemoveResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{26} +} + +func (x *SetRemoveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetRemoveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetRemoveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetIsMemberRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetIsMemberRequest) Reset() { + *x = SetIsMemberRequest{} + mi := &file_collections_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetIsMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetIsMemberRequest) ProtoMessage() {} + +func (x *SetIsMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetIsMemberRequest.ProtoReflect.Descriptor instead. +func (*SetIsMemberRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{27} +} + +func (x *SetIsMemberRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetIsMemberRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetIsMemberRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetIsMemberResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + IsMember bool `protobuf:"varint,4,opt,name=is_member,json=isMember,proto3" json:"is_member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetIsMemberResponse) Reset() { + *x = SetIsMemberResponse{} + mi := &file_collections_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetIsMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetIsMemberResponse) ProtoMessage() {} + +func (x *SetIsMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetIsMemberResponse.ProtoReflect.Descriptor instead. +func (*SetIsMemberResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{28} +} + +func (x *SetIsMemberResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetIsMemberResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetIsMemberResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetIsMemberResponse) GetIsMember() bool { + if x != nil { + return x.IsMember + } + return false +} + +type SetMembersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetMembersRequest) Reset() { + *x = SetMembersRequest{} + mi := &file_collections_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetMembersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetMembersRequest) ProtoMessage() {} + +func (x *SetMembersRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetMembersRequest.ProtoReflect.Descriptor instead. +func (*SetMembersRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{29} +} + +func (x *SetMembersRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetMembersRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +type SetMembersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Members []string `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetMembersResponse) Reset() { + *x = SetMembersResponse{} + mi := &file_collections_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetMembersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetMembersResponse) ProtoMessage() {} + +func (x *SetMembersResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetMembersResponse.ProtoReflect.Descriptor instead. +func (*SetMembersResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{30} +} + +func (x *SetMembersResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetMembersResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetMembersResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetMembersResponse) GetMembers() []string { + if x != nil { + return x.Members + } + return nil +} + +type SetLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetLenRequest) Reset() { + *x = SetLenRequest{} + mi := &file_collections_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetLenRequest) ProtoMessage() {} + +func (x *SetLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetLenRequest.ProtoReflect.Descriptor instead. +func (*SetLenRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{31} +} + +func (x *SetLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetLenRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +type SetLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetLenResponse) Reset() { + *x = SetLenResponse{} + mi := &file_collections_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetLenResponse) ProtoMessage() {} + +func (x *SetLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetLenResponse.ProtoReflect.Descriptor instead. +func (*SetLenResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{32} +} + +func (x *SetLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type CreateQueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + MaxMessages uint64 `protobuf:"varint,3,opt,name=max_messages,json=maxMessages,proto3" json:"max_messages,omitempty"` + Ephemeral bool `protobuf:"varint,4,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateQueueRequest) Reset() { + *x = CreateQueueRequest{} + mi := &file_collections_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateQueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateQueueRequest) ProtoMessage() {} + +func (x *CreateQueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateQueueRequest.ProtoReflect.Descriptor instead. +func (*CreateQueueRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{33} +} + +func (x *CreateQueueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateQueueRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateQueueRequest) GetMaxMessages() uint64 { + if x != nil { + return x.MaxMessages + } + return 0 +} + +func (x *CreateQueueRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateQueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateQueueResponse) Reset() { + *x = CreateQueueResponse{} + mi := &file_collections_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateQueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateQueueResponse) ProtoMessage() {} + +func (x *CreateQueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateQueueResponse.ProtoReflect.Descriptor instead. +func (*CreateQueueResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{34} +} + +func (x *CreateQueueResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateQueueResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateQueueResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteQueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteQueueRequest) Reset() { + *x = DeleteQueueRequest{} + mi := &file_collections_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteQueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteQueueRequest) ProtoMessage() {} + +func (x *DeleteQueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteQueueRequest.ProtoReflect.Descriptor instead. +func (*DeleteQueueRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{35} +} + +func (x *DeleteQueueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteQueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteQueueResponse) Reset() { + *x = DeleteQueueResponse{} + mi := &file_collections_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteQueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteQueueResponse) ProtoMessage() {} + +func (x *DeleteQueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteQueueResponse.ProtoReflect.Descriptor instead. +func (*DeleteQueueResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{36} +} + +func (x *DeleteQueueResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteQueueResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteQueueResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type QueuePushRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePushRequest) Reset() { + *x = QueuePushRequest{} + mi := &file_collections_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePushRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePushRequest) ProtoMessage() {} + +func (x *QueuePushRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePushRequest.ProtoReflect.Descriptor instead. +func (*QueuePushRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{37} +} + +func (x *QueuePushRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *QueuePushRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueuePushResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePushResponse) Reset() { + *x = QueuePushResponse{} + mi := &file_collections_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePushResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePushResponse) ProtoMessage() {} + +func (x *QueuePushResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePushResponse.ProtoReflect.Descriptor instead. +func (*QueuePushResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{38} +} + +func (x *QueuePushResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueuePushResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueuePushResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueuePushResponse) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +type QueuePopRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePopRequest) Reset() { + *x = QueuePopRequest{} + mi := &file_collections_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePopRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePopRequest) ProtoMessage() {} + +func (x *QueuePopRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePopRequest.ProtoReflect.Descriptor instead. +func (*QueuePopRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{39} +} + +func (x *QueuePopRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type QueuePopResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3,oneof" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePopResponse) Reset() { + *x = QueuePopResponse{} + mi := &file_collections_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePopResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePopResponse) ProtoMessage() {} + +func (x *QueuePopResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePopResponse.ProtoReflect.Descriptor instead. +func (*QueuePopResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{40} +} + +func (x *QueuePopResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueuePopResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueuePopResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueuePopResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueueRangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + FromSequence uint64 `protobuf:"varint,2,opt,name=from_sequence,json=fromSequence,proto3" json:"from_sequence,omitempty"` + Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRangeRequest) Reset() { + *x = QueueRangeRequest{} + mi := &file_collections_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRangeRequest) ProtoMessage() {} + +func (x *QueueRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRangeRequest.ProtoReflect.Descriptor instead. +func (*QueueRangeRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{41} +} + +func (x *QueueRangeRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *QueueRangeRequest) GetFromSequence() uint64 { + if x != nil { + return x.FromSequence + } + return 0 +} + +func (x *QueueRangeRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type QueueRangeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Values [][]byte `protobuf:"bytes,4,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRangeResponse) Reset() { + *x = QueueRangeResponse{} + mi := &file_collections_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRangeResponse) ProtoMessage() {} + +func (x *QueueRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRangeResponse.ProtoReflect.Descriptor instead. +func (*QueueRangeResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{42} +} + +func (x *QueueRangeResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueueRangeResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueueRangeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueueRangeResponse) GetValues() [][]byte { + if x != nil { + return x.Values + } + return nil +} + +type QueueLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueLenRequest) Reset() { + *x = QueueLenRequest{} + mi := &file_collections_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueLenRequest) ProtoMessage() {} + +func (x *QueueLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueLenRequest.ProtoReflect.Descriptor instead. +func (*QueueLenRequest) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{43} +} + +func (x *QueueLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type QueueLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueLenResponse) Reset() { + *x = QueueLenResponse{} + mi := &file_collections_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueLenResponse) ProtoMessage() {} + +func (x *QueueLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_collections_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueLenResponse.ProtoReflect.Descriptor instead. +func (*QueueLenResponse) Descriptor() ([]byte, []int) { + return file_collections_proto_rawDescGZIP(), []int{44} +} + +func (x *QueueLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueueLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueueLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueueLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +var File_collections_proto protoreflect.FileDescriptor + +const file_collections_proto_rawDesc = "" + + "\n" + + "\x11collections.proto\x12\x14waymaker.collections\"g\n" + + "\x16CreateHashStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12\x1c\n" + + "\tephemeral\x18\x03 \x01(\bR\tephemeral\"n\n" + + "\x17CreateHashStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\",\n" + + "\x16DeleteHashStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"n\n" + + "\x17DeleteHashStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"o\n" + + "\x0eHashSetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\x12\x14\n" + + "\x05value\x18\x04 \x01(\fR\x05value\"\x82\x01\n" + + "\x0fHashSetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"Y\n" + + "\x0eHashGetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"\xa7\x01\n" + + "\x0fHashGetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x19\n" + + "\x05value\x18\x04 \x01(\fH\x00R\x05value\x88\x01\x01\x12\x1a\n" + + "\brevision\x18\x05 \x01(\x04R\brevisionB\b\n" + + "\x06_value\"\\\n" + + "\x11HashExistsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"\x81\x01\n" + + "\x12HashExistsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06exists\x18\x04 \x01(\bR\x06exists\"\\\n" + + "\x11HashDeleteRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"i\n" + + "\x12HashDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"F\n" + + "\x11HashGetAllRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"\xa9\x01\n" + + "\x12HashGetAllResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12>\n" + + "\aentries\x18\x04 \x03(\v2$.waymaker.collections.HashFieldEntryR\aentries\"X\n" + + "\x0eHashFieldEntry\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x04R\brevision\"F\n" + + "\x11HashFieldsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"\x81\x01\n" + + "\x12HashFieldsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06fields\x18\x04 \x03(\tR\x06fields\"C\n" + + "\x0eHashLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"|\n" + + "\x0fHashLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count\"f\n" + + "\x15CreateSetStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12\x1c\n" + + "\tephemeral\x18\x03 \x01(\bR\tephemeral\"m\n" + + "\x16CreateSetStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"+\n" + + "\x15DeleteSetStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"m\n" + + "\x16DeleteSetStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"X\n" + + "\rSetAddRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"e\n" + + "\x0eSetAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"[\n" + + "\x10SetRemoveRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"h\n" + + "\x11SetRemoveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"]\n" + + "\x12SetIsMemberRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"\x87\x01\n" + + "\x13SetIsMemberResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1b\n" + + "\tis_member\x18\x04 \x01(\bR\bisMember\"D\n" + + "\x11SetMembersRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\"\x83\x01\n" + + "\x12SetMembersResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\amembers\x18\x04 \x03(\tR\amembers\"@\n" + + "\rSetLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\"{\n" + + "\x0eSetLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count\"\x86\x01\n" + + "\x12CreateQueueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12!\n" + + "\fmax_messages\x18\x03 \x01(\x04R\vmaxMessages\x12\x1c\n" + + "\tephemeral\x18\x04 \x01(\bR\tephemeral\"j\n" + + "\x13CreateQueueResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"(\n" + + "\x12DeleteQueueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"j\n" + + "\x13DeleteQueueResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"@\n" + + "\x10QueuePushRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"\x84\x01\n" + + "\x11QueuePushResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\bsequence\x18\x04 \x01(\x04R\bsequence\")\n" + + "\x0fQueuePopRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"\x8c\x01\n" + + "\x10QueuePopResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x19\n" + + "\x05value\x18\x04 \x01(\fH\x00R\x05value\x88\x01\x01B\b\n" + + "\x06_value\"f\n" + + "\x11QueueRangeRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12#\n" + + "\rfrom_sequence\x18\x02 \x01(\x04R\ffromSequence\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x04R\x05limit\"\x81\x01\n" + + "\x12QueueRangeResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06values\x18\x04 \x03(\fR\x06values\")\n" + + "\x0fQueueLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"}\n" + + "\x10QueueLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count2\xec\x10\n" + + "\x1aWaymakerCollectionsService\x12n\n" + + "\x0fCreateHashStore\x12,.waymaker.collections.CreateHashStoreRequest\x1a-.waymaker.collections.CreateHashStoreResponse\x12n\n" + + "\x0fDeleteHashStore\x12,.waymaker.collections.DeleteHashStoreRequest\x1a-.waymaker.collections.DeleteHashStoreResponse\x12V\n" + + "\aHashSet\x12$.waymaker.collections.HashSetRequest\x1a%.waymaker.collections.HashSetResponse\x12V\n" + + "\aHashGet\x12$.waymaker.collections.HashGetRequest\x1a%.waymaker.collections.HashGetResponse\x12_\n" + + "\n" + + "HashExists\x12'.waymaker.collections.HashExistsRequest\x1a(.waymaker.collections.HashExistsResponse\x12_\n" + + "\n" + + "HashDelete\x12'.waymaker.collections.HashDeleteRequest\x1a(.waymaker.collections.HashDeleteResponse\x12_\n" + + "\n" + + "HashGetAll\x12'.waymaker.collections.HashGetAllRequest\x1a(.waymaker.collections.HashGetAllResponse\x12_\n" + + "\n" + + "HashFields\x12'.waymaker.collections.HashFieldsRequest\x1a(.waymaker.collections.HashFieldsResponse\x12V\n" + + "\aHashLen\x12$.waymaker.collections.HashLenRequest\x1a%.waymaker.collections.HashLenResponse\x12k\n" + + "\x0eCreateSetStore\x12+.waymaker.collections.CreateSetStoreRequest\x1a,.waymaker.collections.CreateSetStoreResponse\x12k\n" + + "\x0eDeleteSetStore\x12+.waymaker.collections.DeleteSetStoreRequest\x1a,.waymaker.collections.DeleteSetStoreResponse\x12S\n" + + "\x06SetAdd\x12#.waymaker.collections.SetAddRequest\x1a$.waymaker.collections.SetAddResponse\x12\\\n" + + "\tSetRemove\x12&.waymaker.collections.SetRemoveRequest\x1a'.waymaker.collections.SetRemoveResponse\x12b\n" + + "\vSetIsMember\x12(.waymaker.collections.SetIsMemberRequest\x1a).waymaker.collections.SetIsMemberResponse\x12_\n" + + "\n" + + "SetMembers\x12'.waymaker.collections.SetMembersRequest\x1a(.waymaker.collections.SetMembersResponse\x12S\n" + + "\x06SetLen\x12#.waymaker.collections.SetLenRequest\x1a$.waymaker.collections.SetLenResponse\x12b\n" + + "\vCreateQueue\x12(.waymaker.collections.CreateQueueRequest\x1a).waymaker.collections.CreateQueueResponse\x12b\n" + + "\vDeleteQueue\x12(.waymaker.collections.DeleteQueueRequest\x1a).waymaker.collections.DeleteQueueResponse\x12\\\n" + + "\tQueuePush\x12&.waymaker.collections.QueuePushRequest\x1a'.waymaker.collections.QueuePushResponse\x12Y\n" + + "\bQueuePop\x12%.waymaker.collections.QueuePopRequest\x1a&.waymaker.collections.QueuePopResponse\x12_\n" + + "\n" + + "QueueRange\x12'.waymaker.collections.QueueRangeRequest\x1a(.waymaker.collections.QueueRangeResponse\x12Y\n" + + "\bQueueLen\x12%.waymaker.collections.QueueLenRequest\x1a&.waymaker.collections.QueueLenResponseB\x1cZ\x1a/apis/waymaker_collectionsb\x06proto3" + +var ( + file_collections_proto_rawDescOnce sync.Once + file_collections_proto_rawDescData []byte +) + +func file_collections_proto_rawDescGZIP() []byte { + file_collections_proto_rawDescOnce.Do(func() { + file_collections_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_collections_proto_rawDesc), len(file_collections_proto_rawDesc))) + }) + return file_collections_proto_rawDescData +} + +var file_collections_proto_msgTypes = make([]protoimpl.MessageInfo, 45) +var file_collections_proto_goTypes = []any{ + (*CreateHashStoreRequest)(nil), // 0: waymaker.collections.CreateHashStoreRequest + (*CreateHashStoreResponse)(nil), // 1: waymaker.collections.CreateHashStoreResponse + (*DeleteHashStoreRequest)(nil), // 2: waymaker.collections.DeleteHashStoreRequest + (*DeleteHashStoreResponse)(nil), // 3: waymaker.collections.DeleteHashStoreResponse + (*HashSetRequest)(nil), // 4: waymaker.collections.HashSetRequest + (*HashSetResponse)(nil), // 5: waymaker.collections.HashSetResponse + (*HashGetRequest)(nil), // 6: waymaker.collections.HashGetRequest + (*HashGetResponse)(nil), // 7: waymaker.collections.HashGetResponse + (*HashExistsRequest)(nil), // 8: waymaker.collections.HashExistsRequest + (*HashExistsResponse)(nil), // 9: waymaker.collections.HashExistsResponse + (*HashDeleteRequest)(nil), // 10: waymaker.collections.HashDeleteRequest + (*HashDeleteResponse)(nil), // 11: waymaker.collections.HashDeleteResponse + (*HashGetAllRequest)(nil), // 12: waymaker.collections.HashGetAllRequest + (*HashGetAllResponse)(nil), // 13: waymaker.collections.HashGetAllResponse + (*HashFieldEntry)(nil), // 14: waymaker.collections.HashFieldEntry + (*HashFieldsRequest)(nil), // 15: waymaker.collections.HashFieldsRequest + (*HashFieldsResponse)(nil), // 16: waymaker.collections.HashFieldsResponse + (*HashLenRequest)(nil), // 17: waymaker.collections.HashLenRequest + (*HashLenResponse)(nil), // 18: waymaker.collections.HashLenResponse + (*CreateSetStoreRequest)(nil), // 19: waymaker.collections.CreateSetStoreRequest + (*CreateSetStoreResponse)(nil), // 20: waymaker.collections.CreateSetStoreResponse + (*DeleteSetStoreRequest)(nil), // 21: waymaker.collections.DeleteSetStoreRequest + (*DeleteSetStoreResponse)(nil), // 22: waymaker.collections.DeleteSetStoreResponse + (*SetAddRequest)(nil), // 23: waymaker.collections.SetAddRequest + (*SetAddResponse)(nil), // 24: waymaker.collections.SetAddResponse + (*SetRemoveRequest)(nil), // 25: waymaker.collections.SetRemoveRequest + (*SetRemoveResponse)(nil), // 26: waymaker.collections.SetRemoveResponse + (*SetIsMemberRequest)(nil), // 27: waymaker.collections.SetIsMemberRequest + (*SetIsMemberResponse)(nil), // 28: waymaker.collections.SetIsMemberResponse + (*SetMembersRequest)(nil), // 29: waymaker.collections.SetMembersRequest + (*SetMembersResponse)(nil), // 30: waymaker.collections.SetMembersResponse + (*SetLenRequest)(nil), // 31: waymaker.collections.SetLenRequest + (*SetLenResponse)(nil), // 32: waymaker.collections.SetLenResponse + (*CreateQueueRequest)(nil), // 33: waymaker.collections.CreateQueueRequest + (*CreateQueueResponse)(nil), // 34: waymaker.collections.CreateQueueResponse + (*DeleteQueueRequest)(nil), // 35: waymaker.collections.DeleteQueueRequest + (*DeleteQueueResponse)(nil), // 36: waymaker.collections.DeleteQueueResponse + (*QueuePushRequest)(nil), // 37: waymaker.collections.QueuePushRequest + (*QueuePushResponse)(nil), // 38: waymaker.collections.QueuePushResponse + (*QueuePopRequest)(nil), // 39: waymaker.collections.QueuePopRequest + (*QueuePopResponse)(nil), // 40: waymaker.collections.QueuePopResponse + (*QueueRangeRequest)(nil), // 41: waymaker.collections.QueueRangeRequest + (*QueueRangeResponse)(nil), // 42: waymaker.collections.QueueRangeResponse + (*QueueLenRequest)(nil), // 43: waymaker.collections.QueueLenRequest + (*QueueLenResponse)(nil), // 44: waymaker.collections.QueueLenResponse +} +var file_collections_proto_depIdxs = []int32{ + 14, // 0: waymaker.collections.HashGetAllResponse.entries:type_name -> waymaker.collections.HashFieldEntry + 0, // 1: waymaker.collections.WaymakerCollectionsService.CreateHashStore:input_type -> waymaker.collections.CreateHashStoreRequest + 2, // 2: waymaker.collections.WaymakerCollectionsService.DeleteHashStore:input_type -> waymaker.collections.DeleteHashStoreRequest + 4, // 3: waymaker.collections.WaymakerCollectionsService.HashSet:input_type -> waymaker.collections.HashSetRequest + 6, // 4: waymaker.collections.WaymakerCollectionsService.HashGet:input_type -> waymaker.collections.HashGetRequest + 8, // 5: waymaker.collections.WaymakerCollectionsService.HashExists:input_type -> waymaker.collections.HashExistsRequest + 10, // 6: waymaker.collections.WaymakerCollectionsService.HashDelete:input_type -> waymaker.collections.HashDeleteRequest + 12, // 7: waymaker.collections.WaymakerCollectionsService.HashGetAll:input_type -> waymaker.collections.HashGetAllRequest + 15, // 8: waymaker.collections.WaymakerCollectionsService.HashFields:input_type -> waymaker.collections.HashFieldsRequest + 17, // 9: waymaker.collections.WaymakerCollectionsService.HashLen:input_type -> waymaker.collections.HashLenRequest + 19, // 10: waymaker.collections.WaymakerCollectionsService.CreateSetStore:input_type -> waymaker.collections.CreateSetStoreRequest + 21, // 11: waymaker.collections.WaymakerCollectionsService.DeleteSetStore:input_type -> waymaker.collections.DeleteSetStoreRequest + 23, // 12: waymaker.collections.WaymakerCollectionsService.SetAdd:input_type -> waymaker.collections.SetAddRequest + 25, // 13: waymaker.collections.WaymakerCollectionsService.SetRemove:input_type -> waymaker.collections.SetRemoveRequest + 27, // 14: waymaker.collections.WaymakerCollectionsService.SetIsMember:input_type -> waymaker.collections.SetIsMemberRequest + 29, // 15: waymaker.collections.WaymakerCollectionsService.SetMembers:input_type -> waymaker.collections.SetMembersRequest + 31, // 16: waymaker.collections.WaymakerCollectionsService.SetLen:input_type -> waymaker.collections.SetLenRequest + 33, // 17: waymaker.collections.WaymakerCollectionsService.CreateQueue:input_type -> waymaker.collections.CreateQueueRequest + 35, // 18: waymaker.collections.WaymakerCollectionsService.DeleteQueue:input_type -> waymaker.collections.DeleteQueueRequest + 37, // 19: waymaker.collections.WaymakerCollectionsService.QueuePush:input_type -> waymaker.collections.QueuePushRequest + 39, // 20: waymaker.collections.WaymakerCollectionsService.QueuePop:input_type -> waymaker.collections.QueuePopRequest + 41, // 21: waymaker.collections.WaymakerCollectionsService.QueueRange:input_type -> waymaker.collections.QueueRangeRequest + 43, // 22: waymaker.collections.WaymakerCollectionsService.QueueLen:input_type -> waymaker.collections.QueueLenRequest + 1, // 23: waymaker.collections.WaymakerCollectionsService.CreateHashStore:output_type -> waymaker.collections.CreateHashStoreResponse + 3, // 24: waymaker.collections.WaymakerCollectionsService.DeleteHashStore:output_type -> waymaker.collections.DeleteHashStoreResponse + 5, // 25: waymaker.collections.WaymakerCollectionsService.HashSet:output_type -> waymaker.collections.HashSetResponse + 7, // 26: waymaker.collections.WaymakerCollectionsService.HashGet:output_type -> waymaker.collections.HashGetResponse + 9, // 27: waymaker.collections.WaymakerCollectionsService.HashExists:output_type -> waymaker.collections.HashExistsResponse + 11, // 28: waymaker.collections.WaymakerCollectionsService.HashDelete:output_type -> waymaker.collections.HashDeleteResponse + 13, // 29: waymaker.collections.WaymakerCollectionsService.HashGetAll:output_type -> waymaker.collections.HashGetAllResponse + 16, // 30: waymaker.collections.WaymakerCollectionsService.HashFields:output_type -> waymaker.collections.HashFieldsResponse + 18, // 31: waymaker.collections.WaymakerCollectionsService.HashLen:output_type -> waymaker.collections.HashLenResponse + 20, // 32: waymaker.collections.WaymakerCollectionsService.CreateSetStore:output_type -> waymaker.collections.CreateSetStoreResponse + 22, // 33: waymaker.collections.WaymakerCollectionsService.DeleteSetStore:output_type -> waymaker.collections.DeleteSetStoreResponse + 24, // 34: waymaker.collections.WaymakerCollectionsService.SetAdd:output_type -> waymaker.collections.SetAddResponse + 26, // 35: waymaker.collections.WaymakerCollectionsService.SetRemove:output_type -> waymaker.collections.SetRemoveResponse + 28, // 36: waymaker.collections.WaymakerCollectionsService.SetIsMember:output_type -> waymaker.collections.SetIsMemberResponse + 30, // 37: waymaker.collections.WaymakerCollectionsService.SetMembers:output_type -> waymaker.collections.SetMembersResponse + 32, // 38: waymaker.collections.WaymakerCollectionsService.SetLen:output_type -> waymaker.collections.SetLenResponse + 34, // 39: waymaker.collections.WaymakerCollectionsService.CreateQueue:output_type -> waymaker.collections.CreateQueueResponse + 36, // 40: waymaker.collections.WaymakerCollectionsService.DeleteQueue:output_type -> waymaker.collections.DeleteQueueResponse + 38, // 41: waymaker.collections.WaymakerCollectionsService.QueuePush:output_type -> waymaker.collections.QueuePushResponse + 40, // 42: waymaker.collections.WaymakerCollectionsService.QueuePop:output_type -> waymaker.collections.QueuePopResponse + 42, // 43: waymaker.collections.WaymakerCollectionsService.QueueRange:output_type -> waymaker.collections.QueueRangeResponse + 44, // 44: waymaker.collections.WaymakerCollectionsService.QueueLen:output_type -> waymaker.collections.QueueLenResponse + 23, // [23:45] is the sub-list for method output_type + 1, // [1:23] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_collections_proto_init() } +func file_collections_proto_init() { + if File_collections_proto != nil { + return + } + file_collections_proto_msgTypes[7].OneofWrappers = []any{} + file_collections_proto_msgTypes[40].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_collections_proto_rawDesc), len(file_collections_proto_rawDesc)), + NumEnums: 0, + NumMessages: 45, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_collections_proto_goTypes, + DependencyIndexes: file_collections_proto_depIdxs, + MessageInfos: file_collections_proto_msgTypes, + }.Build() + File_collections_proto = out.File + file_collections_proto_goTypes = nil + file_collections_proto_depIdxs = nil +} diff --git a/go/genpb/collections/collections_grpc.pb.go b/go/genpb/collections/collections_grpc.pb.go new file mode 100644 index 0000000..418c11f --- /dev/null +++ b/go/genpb/collections/collections_grpc.pb.go @@ -0,0 +1,926 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: collections.proto + +package waymaker_collections + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerCollectionsService_CreateHashStore_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/CreateHashStore" + WaymakerCollectionsService_DeleteHashStore_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/DeleteHashStore" + WaymakerCollectionsService_HashSet_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashSet" + WaymakerCollectionsService_HashGet_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashGet" + WaymakerCollectionsService_HashExists_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashExists" + WaymakerCollectionsService_HashDelete_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashDelete" + WaymakerCollectionsService_HashGetAll_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashGetAll" + WaymakerCollectionsService_HashFields_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashFields" + WaymakerCollectionsService_HashLen_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/HashLen" + WaymakerCollectionsService_CreateSetStore_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/CreateSetStore" + WaymakerCollectionsService_DeleteSetStore_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/DeleteSetStore" + WaymakerCollectionsService_SetAdd_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/SetAdd" + WaymakerCollectionsService_SetRemove_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/SetRemove" + WaymakerCollectionsService_SetIsMember_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/SetIsMember" + WaymakerCollectionsService_SetMembers_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/SetMembers" + WaymakerCollectionsService_SetLen_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/SetLen" + WaymakerCollectionsService_CreateQueue_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/CreateQueue" + WaymakerCollectionsService_DeleteQueue_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/DeleteQueue" + WaymakerCollectionsService_QueuePush_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/QueuePush" + WaymakerCollectionsService_QueuePop_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/QueuePop" + WaymakerCollectionsService_QueueRange_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/QueueRange" + WaymakerCollectionsService_QueueLen_FullMethodName = "/waymaker.collections.WaymakerCollectionsService/QueueLen" +) + +// WaymakerCollectionsServiceClient is the client API for WaymakerCollectionsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WaymakerCollectionsServiceClient interface { + // ----- Hash ------------------------------------------------- + CreateHashStore(ctx context.Context, in *CreateHashStoreRequest, opts ...grpc.CallOption) (*CreateHashStoreResponse, error) + DeleteHashStore(ctx context.Context, in *DeleteHashStoreRequest, opts ...grpc.CallOption) (*DeleteHashStoreResponse, error) + HashSet(ctx context.Context, in *HashSetRequest, opts ...grpc.CallOption) (*HashSetResponse, error) + HashGet(ctx context.Context, in *HashGetRequest, opts ...grpc.CallOption) (*HashGetResponse, error) + HashExists(ctx context.Context, in *HashExistsRequest, opts ...grpc.CallOption) (*HashExistsResponse, error) + HashDelete(ctx context.Context, in *HashDeleteRequest, opts ...grpc.CallOption) (*HashDeleteResponse, error) + HashGetAll(ctx context.Context, in *HashGetAllRequest, opts ...grpc.CallOption) (*HashGetAllResponse, error) + HashFields(ctx context.Context, in *HashFieldsRequest, opts ...grpc.CallOption) (*HashFieldsResponse, error) + HashLen(ctx context.Context, in *HashLenRequest, opts ...grpc.CallOption) (*HashLenResponse, error) + // ----- Set -------------------------------------------------- + CreateSetStore(ctx context.Context, in *CreateSetStoreRequest, opts ...grpc.CallOption) (*CreateSetStoreResponse, error) + DeleteSetStore(ctx context.Context, in *DeleteSetStoreRequest, opts ...grpc.CallOption) (*DeleteSetStoreResponse, error) + SetAdd(ctx context.Context, in *SetAddRequest, opts ...grpc.CallOption) (*SetAddResponse, error) + SetRemove(ctx context.Context, in *SetRemoveRequest, opts ...grpc.CallOption) (*SetRemoveResponse, error) + SetIsMember(ctx context.Context, in *SetIsMemberRequest, opts ...grpc.CallOption) (*SetIsMemberResponse, error) + SetMembers(ctx context.Context, in *SetMembersRequest, opts ...grpc.CallOption) (*SetMembersResponse, error) + SetLen(ctx context.Context, in *SetLenRequest, opts ...grpc.CallOption) (*SetLenResponse, error) + // ----- Queue ------------------------------------------------ + CreateQueue(ctx context.Context, in *CreateQueueRequest, opts ...grpc.CallOption) (*CreateQueueResponse, error) + DeleteQueue(ctx context.Context, in *DeleteQueueRequest, opts ...grpc.CallOption) (*DeleteQueueResponse, error) + QueuePush(ctx context.Context, in *QueuePushRequest, opts ...grpc.CallOption) (*QueuePushResponse, error) + QueuePop(ctx context.Context, in *QueuePopRequest, opts ...grpc.CallOption) (*QueuePopResponse, error) + QueueRange(ctx context.Context, in *QueueRangeRequest, opts ...grpc.CallOption) (*QueueRangeResponse, error) + QueueLen(ctx context.Context, in *QueueLenRequest, opts ...grpc.CallOption) (*QueueLenResponse, error) +} + +type waymakerCollectionsServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerCollectionsServiceClient(cc grpc.ClientConnInterface) WaymakerCollectionsServiceClient { + return &waymakerCollectionsServiceClient{cc} +} + +func (c *waymakerCollectionsServiceClient) CreateHashStore(ctx context.Context, in *CreateHashStoreRequest, opts ...grpc.CallOption) (*CreateHashStoreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateHashStoreResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_CreateHashStore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) DeleteHashStore(ctx context.Context, in *DeleteHashStoreRequest, opts ...grpc.CallOption) (*DeleteHashStoreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteHashStoreResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_DeleteHashStore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashSet(ctx context.Context, in *HashSetRequest, opts ...grpc.CallOption) (*HashSetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashSetResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashSet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashGet(ctx context.Context, in *HashGetRequest, opts ...grpc.CallOption) (*HashGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashGetResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashGet_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashExists(ctx context.Context, in *HashExistsRequest, opts ...grpc.CallOption) (*HashExistsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashExistsResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashExists_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashDelete(ctx context.Context, in *HashDeleteRequest, opts ...grpc.CallOption) (*HashDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashGetAll(ctx context.Context, in *HashGetAllRequest, opts ...grpc.CallOption) (*HashGetAllResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashGetAllResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashGetAll_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashFields(ctx context.Context, in *HashFieldsRequest, opts ...grpc.CallOption) (*HashFieldsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashFieldsResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashFields_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) HashLen(ctx context.Context, in *HashLenRequest, opts ...grpc.CallOption) (*HashLenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HashLenResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_HashLen_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) CreateSetStore(ctx context.Context, in *CreateSetStoreRequest, opts ...grpc.CallOption) (*CreateSetStoreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateSetStoreResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_CreateSetStore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) DeleteSetStore(ctx context.Context, in *DeleteSetStoreRequest, opts ...grpc.CallOption) (*DeleteSetStoreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteSetStoreResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_DeleteSetStore_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) SetAdd(ctx context.Context, in *SetAddRequest, opts ...grpc.CallOption) (*SetAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetAddResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_SetAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) SetRemove(ctx context.Context, in *SetRemoveRequest, opts ...grpc.CallOption) (*SetRemoveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetRemoveResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_SetRemove_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) SetIsMember(ctx context.Context, in *SetIsMemberRequest, opts ...grpc.CallOption) (*SetIsMemberResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetIsMemberResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_SetIsMember_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) SetMembers(ctx context.Context, in *SetMembersRequest, opts ...grpc.CallOption) (*SetMembersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetMembersResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_SetMembers_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) SetLen(ctx context.Context, in *SetLenRequest, opts ...grpc.CallOption) (*SetLenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetLenResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_SetLen_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) CreateQueue(ctx context.Context, in *CreateQueueRequest, opts ...grpc.CallOption) (*CreateQueueResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateQueueResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_CreateQueue_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) DeleteQueue(ctx context.Context, in *DeleteQueueRequest, opts ...grpc.CallOption) (*DeleteQueueResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteQueueResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_DeleteQueue_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) QueuePush(ctx context.Context, in *QueuePushRequest, opts ...grpc.CallOption) (*QueuePushResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueuePushResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_QueuePush_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) QueuePop(ctx context.Context, in *QueuePopRequest, opts ...grpc.CallOption) (*QueuePopResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueuePopResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_QueuePop_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) QueueRange(ctx context.Context, in *QueueRangeRequest, opts ...grpc.CallOption) (*QueueRangeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueueRangeResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_QueueRange_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerCollectionsServiceClient) QueueLen(ctx context.Context, in *QueueLenRequest, opts ...grpc.CallOption) (*QueueLenResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueueLenResponse) + err := c.cc.Invoke(ctx, WaymakerCollectionsService_QueueLen_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WaymakerCollectionsServiceServer is the server API for WaymakerCollectionsService service. +// All implementations must embed UnimplementedWaymakerCollectionsServiceServer +// for forward compatibility. +type WaymakerCollectionsServiceServer interface { + // ----- Hash ------------------------------------------------- + CreateHashStore(context.Context, *CreateHashStoreRequest) (*CreateHashStoreResponse, error) + DeleteHashStore(context.Context, *DeleteHashStoreRequest) (*DeleteHashStoreResponse, error) + HashSet(context.Context, *HashSetRequest) (*HashSetResponse, error) + HashGet(context.Context, *HashGetRequest) (*HashGetResponse, error) + HashExists(context.Context, *HashExistsRequest) (*HashExistsResponse, error) + HashDelete(context.Context, *HashDeleteRequest) (*HashDeleteResponse, error) + HashGetAll(context.Context, *HashGetAllRequest) (*HashGetAllResponse, error) + HashFields(context.Context, *HashFieldsRequest) (*HashFieldsResponse, error) + HashLen(context.Context, *HashLenRequest) (*HashLenResponse, error) + // ----- Set -------------------------------------------------- + CreateSetStore(context.Context, *CreateSetStoreRequest) (*CreateSetStoreResponse, error) + DeleteSetStore(context.Context, *DeleteSetStoreRequest) (*DeleteSetStoreResponse, error) + SetAdd(context.Context, *SetAddRequest) (*SetAddResponse, error) + SetRemove(context.Context, *SetRemoveRequest) (*SetRemoveResponse, error) + SetIsMember(context.Context, *SetIsMemberRequest) (*SetIsMemberResponse, error) + SetMembers(context.Context, *SetMembersRequest) (*SetMembersResponse, error) + SetLen(context.Context, *SetLenRequest) (*SetLenResponse, error) + // ----- Queue ------------------------------------------------ + CreateQueue(context.Context, *CreateQueueRequest) (*CreateQueueResponse, error) + DeleteQueue(context.Context, *DeleteQueueRequest) (*DeleteQueueResponse, error) + QueuePush(context.Context, *QueuePushRequest) (*QueuePushResponse, error) + QueuePop(context.Context, *QueuePopRequest) (*QueuePopResponse, error) + QueueRange(context.Context, *QueueRangeRequest) (*QueueRangeResponse, error) + QueueLen(context.Context, *QueueLenRequest) (*QueueLenResponse, error) + mustEmbedUnimplementedWaymakerCollectionsServiceServer() +} + +// UnimplementedWaymakerCollectionsServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerCollectionsServiceServer struct{} + +func (UnimplementedWaymakerCollectionsServiceServer) CreateHashStore(context.Context, *CreateHashStoreRequest) (*CreateHashStoreResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateHashStore not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) DeleteHashStore(context.Context, *DeleteHashStoreRequest) (*DeleteHashStoreResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteHashStore not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashSet(context.Context, *HashSetRequest) (*HashSetResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashSet not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashGet(context.Context, *HashGetRequest) (*HashGetResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashGet not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashExists(context.Context, *HashExistsRequest) (*HashExistsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashExists not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashDelete(context.Context, *HashDeleteRequest) (*HashDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashDelete not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashGetAll(context.Context, *HashGetAllRequest) (*HashGetAllResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashGetAll not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashFields(context.Context, *HashFieldsRequest) (*HashFieldsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashFields not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) HashLen(context.Context, *HashLenRequest) (*HashLenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HashLen not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) CreateSetStore(context.Context, *CreateSetStoreRequest) (*CreateSetStoreResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateSetStore not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) DeleteSetStore(context.Context, *DeleteSetStoreRequest) (*DeleteSetStoreResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteSetStore not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) SetAdd(context.Context, *SetAddRequest) (*SetAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetAdd not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) SetRemove(context.Context, *SetRemoveRequest) (*SetRemoveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetRemove not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) SetIsMember(context.Context, *SetIsMemberRequest) (*SetIsMemberResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetIsMember not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) SetMembers(context.Context, *SetMembersRequest) (*SetMembersResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetMembers not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) SetLen(context.Context, *SetLenRequest) (*SetLenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetLen not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) CreateQueue(context.Context, *CreateQueueRequest) (*CreateQueueResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateQueue not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) DeleteQueue(context.Context, *DeleteQueueRequest) (*DeleteQueueResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteQueue not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) QueuePush(context.Context, *QueuePushRequest) (*QueuePushResponse, error) { + return nil, status.Error(codes.Unimplemented, "method QueuePush not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) QueuePop(context.Context, *QueuePopRequest) (*QueuePopResponse, error) { + return nil, status.Error(codes.Unimplemented, "method QueuePop not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) QueueRange(context.Context, *QueueRangeRequest) (*QueueRangeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method QueueRange not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) QueueLen(context.Context, *QueueLenRequest) (*QueueLenResponse, error) { + return nil, status.Error(codes.Unimplemented, "method QueueLen not implemented") +} +func (UnimplementedWaymakerCollectionsServiceServer) mustEmbedUnimplementedWaymakerCollectionsServiceServer() { +} +func (UnimplementedWaymakerCollectionsServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerCollectionsServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerCollectionsServiceServer will +// result in compilation errors. +type UnsafeWaymakerCollectionsServiceServer interface { + mustEmbedUnimplementedWaymakerCollectionsServiceServer() +} + +func RegisterWaymakerCollectionsServiceServer(s grpc.ServiceRegistrar, srv WaymakerCollectionsServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerCollectionsServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerCollectionsService_ServiceDesc, srv) +} + +func _WaymakerCollectionsService_CreateHashStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateHashStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).CreateHashStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_CreateHashStore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).CreateHashStore(ctx, req.(*CreateHashStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_DeleteHashStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteHashStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).DeleteHashStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_DeleteHashStore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).DeleteHashStore(ctx, req.(*DeleteHashStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashSet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashSetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashSet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashSet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashSet(ctx, req.(*HashSetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashGet(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashGet_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashGet(ctx, req.(*HashGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashExistsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashExists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashExists_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashExists(ctx, req.(*HashExistsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashDelete(ctx, req.(*HashDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashGetAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashGetAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashGetAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashGetAll_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashGetAll(ctx, req.(*HashGetAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashFields_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashFieldsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashFields(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashFields_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashFields(ctx, req.(*HashFieldsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_HashLen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HashLenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).HashLen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_HashLen_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).HashLen(ctx, req.(*HashLenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_CreateSetStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSetStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).CreateSetStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_CreateSetStore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).CreateSetStore(ctx, req.(*CreateSetStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_DeleteSetStore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteSetStoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).DeleteSetStore(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_DeleteSetStore_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).DeleteSetStore(ctx, req.(*DeleteSetStoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_SetAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).SetAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_SetAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).SetAdd(ctx, req.(*SetAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_SetRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetRemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).SetRemove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_SetRemove_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).SetRemove(ctx, req.(*SetRemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_SetIsMember_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetIsMemberRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).SetIsMember(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_SetIsMember_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).SetIsMember(ctx, req.(*SetIsMemberRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_SetMembers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetMembersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).SetMembers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_SetMembers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).SetMembers(ctx, req.(*SetMembersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_SetLen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetLenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).SetLen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_SetLen_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).SetLen(ctx, req.(*SetLenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_CreateQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateQueueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).CreateQueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_CreateQueue_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).CreateQueue(ctx, req.(*CreateQueueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_DeleteQueue_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteQueueRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).DeleteQueue(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_DeleteQueue_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).DeleteQueue(ctx, req.(*DeleteQueueRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_QueuePush_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueuePushRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).QueuePush(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_QueuePush_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).QueuePush(ctx, req.(*QueuePushRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_QueuePop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueuePopRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).QueuePop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_QueuePop_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).QueuePop(ctx, req.(*QueuePopRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_QueueRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueueRangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).QueueRange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_QueueRange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).QueueRange(ctx, req.(*QueueRangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerCollectionsService_QueueLen_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueueLenRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerCollectionsServiceServer).QueueLen(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerCollectionsService_QueueLen_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerCollectionsServiceServer).QueueLen(ctx, req.(*QueueLenRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WaymakerCollectionsService_ServiceDesc is the grpc.ServiceDesc for WaymakerCollectionsService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerCollectionsService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.collections.WaymakerCollectionsService", + HandlerType: (*WaymakerCollectionsServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateHashStore", + Handler: _WaymakerCollectionsService_CreateHashStore_Handler, + }, + { + MethodName: "DeleteHashStore", + Handler: _WaymakerCollectionsService_DeleteHashStore_Handler, + }, + { + MethodName: "HashSet", + Handler: _WaymakerCollectionsService_HashSet_Handler, + }, + { + MethodName: "HashGet", + Handler: _WaymakerCollectionsService_HashGet_Handler, + }, + { + MethodName: "HashExists", + Handler: _WaymakerCollectionsService_HashExists_Handler, + }, + { + MethodName: "HashDelete", + Handler: _WaymakerCollectionsService_HashDelete_Handler, + }, + { + MethodName: "HashGetAll", + Handler: _WaymakerCollectionsService_HashGetAll_Handler, + }, + { + MethodName: "HashFields", + Handler: _WaymakerCollectionsService_HashFields_Handler, + }, + { + MethodName: "HashLen", + Handler: _WaymakerCollectionsService_HashLen_Handler, + }, + { + MethodName: "CreateSetStore", + Handler: _WaymakerCollectionsService_CreateSetStore_Handler, + }, + { + MethodName: "DeleteSetStore", + Handler: _WaymakerCollectionsService_DeleteSetStore_Handler, + }, + { + MethodName: "SetAdd", + Handler: _WaymakerCollectionsService_SetAdd_Handler, + }, + { + MethodName: "SetRemove", + Handler: _WaymakerCollectionsService_SetRemove_Handler, + }, + { + MethodName: "SetIsMember", + Handler: _WaymakerCollectionsService_SetIsMember_Handler, + }, + { + MethodName: "SetMembers", + Handler: _WaymakerCollectionsService_SetMembers_Handler, + }, + { + MethodName: "SetLen", + Handler: _WaymakerCollectionsService_SetLen_Handler, + }, + { + MethodName: "CreateQueue", + Handler: _WaymakerCollectionsService_CreateQueue_Handler, + }, + { + MethodName: "DeleteQueue", + Handler: _WaymakerCollectionsService_DeleteQueue_Handler, + }, + { + MethodName: "QueuePush", + Handler: _WaymakerCollectionsService_QueuePush_Handler, + }, + { + MethodName: "QueuePop", + Handler: _WaymakerCollectionsService_QueuePop_Handler, + }, + { + MethodName: "QueueRange", + Handler: _WaymakerCollectionsService_QueueRange_Handler, + }, + { + MethodName: "QueueLen", + Handler: _WaymakerCollectionsService_QueueLen_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "collections.proto", +} diff --git a/go/genpb/kv/kv.pb.go b/go/genpb/kv/kv.pb.go new file mode 100644 index 0000000..b2bfa5a --- /dev/null +++ b/go/genpb/kv/kv.pb.go @@ -0,0 +1,1797 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: kv.proto + +package waymaker_kv + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type KvCreateBucketRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` // 0 = unbounded + MaxValueSize uint64 `protobuf:"varint,3,opt,name=max_value_size,json=maxValueSize,proto3" json:"max_value_size,omitempty"` // 0 = no per-value cap + // Bucket-level TTL (ms). 0 = no time-based eviction. + // Independent of per-key TTL set via Put. + MaxAgeMs uint64 `protobuf:"varint,4,opt,name=max_age_ms,json=maxAgeMs,proto3" json:"max_age_ms,omitempty"` + Ephemeral bool `protobuf:"varint,5,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + // Per-key revision cap. 0 (default) = unbounded — history depth + // is then bounded only by the bucket's stream-level retention + // (max_age_ms / max_bytes). When N > 0, after each successful + // write to a key, older revisions of *that key* beyond the N + // most recent are dropped via per-message pruning. Useful when + // one bucket hosts many keys with very different write rates — + // a fast-churning key won't crowd out older revisions of a + // slow-changing key. NATS JetStream's "MaxRevisions" semantic. + MaxRevisions uint64 `protobuf:"varint,6,opt,name=max_revisions,json=maxRevisions,proto3" json:"max_revisions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateBucketRequest) Reset() { + *x = KvCreateBucketRequest{} + mi := &file_kv_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateBucketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateBucketRequest) ProtoMessage() {} + +func (x *KvCreateBucketRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateBucketRequest.ProtoReflect.Descriptor instead. +func (*KvCreateBucketRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{0} +} + +func (x *KvCreateBucketRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvCreateBucketRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *KvCreateBucketRequest) GetMaxValueSize() uint64 { + if x != nil { + return x.MaxValueSize + } + return 0 +} + +func (x *KvCreateBucketRequest) GetMaxAgeMs() uint64 { + if x != nil { + return x.MaxAgeMs + } + return 0 +} + +func (x *KvCreateBucketRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +func (x *KvCreateBucketRequest) GetMaxRevisions() uint64 { + if x != nil { + return x.MaxRevisions + } + return 0 +} + +type KvCreateBucketResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "already_exists" | "invalid_config" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateBucketResponse) Reset() { + *x = KvCreateBucketResponse{} + mi := &file_kv_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateBucketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateBucketResponse) ProtoMessage() {} + +func (x *KvCreateBucketResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateBucketResponse.ProtoReflect.Descriptor instead. +func (*KvCreateBucketResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{1} +} + +func (x *KvCreateBucketResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvCreateBucketResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvCreateBucketResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type KvDeleteBucketRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteBucketRequest) Reset() { + *x = KvDeleteBucketRequest{} + mi := &file_kv_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteBucketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteBucketRequest) ProtoMessage() {} + +func (x *KvDeleteBucketRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteBucketRequest.ProtoReflect.Descriptor instead. +func (*KvDeleteBucketRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{2} +} + +func (x *KvDeleteBucketRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type KvDeleteBucketResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteBucketResponse) Reset() { + *x = KvDeleteBucketResponse{} + mi := &file_kv_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteBucketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteBucketResponse) ProtoMessage() {} + +func (x *KvDeleteBucketResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteBucketResponse.ProtoReflect.Descriptor instead. +func (*KvDeleteBucketResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{3} +} + +func (x *KvDeleteBucketResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvDeleteBucketResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvDeleteBucketResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type KvPutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + TtlMs uint64 `protobuf:"varint,4,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` // per-key TTL; 0 = no TTL + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutRequest) Reset() { + *x = KvPutRequest{} + mi := &file_kv_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutRequest) ProtoMessage() {} + +func (x *KvPutRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutRequest.ProtoReflect.Descriptor instead. +func (*KvPutRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{4} +} + +func (x *KvPutRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvPutRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvPutRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvPutRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + TtlMs uint64 `protobuf:"varint,4,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateRequest) Reset() { + *x = KvCreateRequest{} + mi := &file_kv_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateRequest) ProtoMessage() {} + +func (x *KvCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateRequest.ProtoReflect.Descriptor instead. +func (*KvCreateRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{5} +} + +func (x *KvCreateRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvCreateRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvCreateRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvCreateRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvUpdateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // The revision the caller believes is current. Server returns + // wrong_revision if mismatch. + ExpectedRevision uint64 `protobuf:"varint,4,opt,name=expected_revision,json=expectedRevision,proto3" json:"expected_revision,omitempty"` + TtlMs uint64 `protobuf:"varint,5,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvUpdateRequest) Reset() { + *x = KvUpdateRequest{} + mi := &file_kv_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvUpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvUpdateRequest) ProtoMessage() {} + +func (x *KvUpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvUpdateRequest.ProtoReflect.Descriptor instead. +func (*KvUpdateRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{6} +} + +func (x *KvUpdateRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvUpdateRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvUpdateRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvUpdateRequest) GetExpectedRevision() uint64 { + if x != nil { + return x.ExpectedRevision + } + return 0 +} + +func (x *KvUpdateRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvPutResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + // "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutResponse) Reset() { + *x = KvPutResponse{} + mi := &file_kv_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutResponse) ProtoMessage() {} + +func (x *KvPutResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutResponse.ProtoReflect.Descriptor instead. +func (*KvPutResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{7} +} + +func (x *KvPutResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvPutResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvPutResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvPutResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type KvGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvGetRequest) Reset() { + *x = KvGetRequest{} + mi := &file_kv_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvGetRequest) ProtoMessage() {} + +func (x *KvGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvGetRequest.ProtoReflect.Descriptor instead. +func (*KvGetRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{8} +} + +func (x *KvGetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvGetRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entry *KvEntry `protobuf:"bytes,4,opt,name=entry,proto3,oneof" json:"entry,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvGetResponse) Reset() { + *x = KvGetResponse{} + mi := &file_kv_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvGetResponse) ProtoMessage() {} + +func (x *KvGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvGetResponse.ProtoReflect.Descriptor instead. +func (*KvGetResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{9} +} + +func (x *KvGetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvGetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvGetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvGetResponse) GetEntry() *KvEntry { + if x != nil { + return x.Entry + } + return nil +} + +type KvEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvEntry) Reset() { + *x = KvEntry{} + mi := &file_kv_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvEntry) ProtoMessage() {} + +func (x *KvEntry) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvEntry.ProtoReflect.Descriptor instead. +func (*KvEntry) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{10} +} + +func (x *KvEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvEntry) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type KvDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteRequest) Reset() { + *x = KvDeleteRequest{} + mi := &file_kv_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteRequest) ProtoMessage() {} + +func (x *KvDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteRequest.ProtoReflect.Descriptor instead. +func (*KvDeleteRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{11} +} + +func (x *KvDeleteRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvDeleteRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteResponse) Reset() { + *x = KvDeleteResponse{} + mi := &file_kv_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteResponse) ProtoMessage() {} + +func (x *KvDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteResponse.ProtoReflect.Descriptor instead. +func (*KvDeleteResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{12} +} + +func (x *KvDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvDeleteResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type KvKeysRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeysRequest) Reset() { + *x = KvKeysRequest{} + mi := &file_kv_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeysRequest) ProtoMessage() {} + +func (x *KvKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeysRequest.ProtoReflect.Descriptor instead. +func (*KvKeysRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{13} +} + +func (x *KvKeysRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type KvKeysResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*KvKeyEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeysResponse) Reset() { + *x = KvKeysResponse{} + mi := &file_kv_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeysResponse) ProtoMessage() {} + +func (x *KvKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeysResponse.ProtoReflect.Descriptor instead. +func (*KvKeysResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{14} +} + +func (x *KvKeysResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvKeysResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvKeysResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvKeysResponse) GetEntries() []*KvKeyEntry { + if x != nil { + return x.Entries + } + return nil +} + +type KvKeyEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + Deleted bool `protobuf:"varint,3,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeyEntry) Reset() { + *x = KvKeyEntry{} + mi := &file_kv_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeyEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeyEntry) ProtoMessage() {} + +func (x *KvKeyEntry) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeyEntry.ProtoReflect.Descriptor instead. +func (*KvKeyEntry) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{15} +} + +func (x *KvKeyEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvKeyEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvKeyEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type KvHistoryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + FromRevision uint64 `protobuf:"varint,3,opt,name=from_revision,json=fromRevision,proto3" json:"from_revision,omitempty"` // 0 = from beginning + Limit uint64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` // 0 = server default + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryRequest) Reset() { + *x = KvHistoryRequest{} + mi := &file_kv_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryRequest) ProtoMessage() {} + +func (x *KvHistoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryRequest.ProtoReflect.Descriptor instead. +func (*KvHistoryRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{16} +} + +func (x *KvHistoryRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvHistoryRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvHistoryRequest) GetFromRevision() uint64 { + if x != nil { + return x.FromRevision + } + return 0 +} + +func (x *KvHistoryRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type KvHistoryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*KvHistoryEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryResponse) Reset() { + *x = KvHistoryResponse{} + mi := &file_kv_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryResponse) ProtoMessage() {} + +func (x *KvHistoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryResponse.ProtoReflect.Descriptor instead. +func (*KvHistoryResponse) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{17} +} + +func (x *KvHistoryResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvHistoryResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvHistoryResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvHistoryResponse) GetEntries() []*KvHistoryEntry { + if x != nil { + return x.Entries + } + return nil +} + +type KvHistoryEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + Deleted bool `protobuf:"varint,4,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryEntry) Reset() { + *x = KvHistoryEntry{} + mi := &file_kv_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryEntry) ProtoMessage() {} + +func (x *KvHistoryEntry) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryEntry.ProtoReflect.Descriptor instead. +func (*KvHistoryEntry) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{18} +} + +func (x *KvHistoryEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvHistoryEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvHistoryEntry) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *KvHistoryEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type KvTouchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + TtlMs uint64 `protobuf:"varint,3,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvTouchRequest) Reset() { + *x = KvTouchRequest{} + mi := &file_kv_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvTouchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvTouchRequest) ProtoMessage() {} + +func (x *KvTouchRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvTouchRequest.ProtoReflect.Descriptor instead. +func (*KvTouchRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{19} +} + +func (x *KvTouchRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvTouchRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvTouchRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvWatchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // empty = whole bucket + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvWatchRequest) Reset() { + *x = KvWatchRequest{} + mi := &file_kv_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvWatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvWatchRequest) ProtoMessage() {} + +func (x *KvWatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvWatchRequest.ProtoReflect.Descriptor instead. +func (*KvWatchRequest) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{20} +} + +func (x *KvWatchRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvWatchRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvWatchEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Event: + // + // *KvWatchEvent_Put + // *KvWatchEvent_Delete + Event isKvWatchEvent_Event `protobuf_oneof:"event"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvWatchEvent) Reset() { + *x = KvWatchEvent{} + mi := &file_kv_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvWatchEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvWatchEvent) ProtoMessage() {} + +func (x *KvWatchEvent) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvWatchEvent.ProtoReflect.Descriptor instead. +func (*KvWatchEvent) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{21} +} + +func (x *KvWatchEvent) GetEvent() isKvWatchEvent_Event { + if x != nil { + return x.Event + } + return nil +} + +func (x *KvWatchEvent) GetPut() *KvPutEvent { + if x != nil { + if x, ok := x.Event.(*KvWatchEvent_Put); ok { + return x.Put + } + } + return nil +} + +func (x *KvWatchEvent) GetDelete() *KvDeleteEvent { + if x != nil { + if x, ok := x.Event.(*KvWatchEvent_Delete); ok { + return x.Delete + } + } + return nil +} + +type isKvWatchEvent_Event interface { + isKvWatchEvent_Event() +} + +type KvWatchEvent_Put struct { + Put *KvPutEvent `protobuf:"bytes,1,opt,name=put,proto3,oneof"` +} + +type KvWatchEvent_Delete struct { + Delete *KvDeleteEvent `protobuf:"bytes,2,opt,name=delete,proto3,oneof"` +} + +func (*KvWatchEvent_Put) isKvWatchEvent_Event() {} + +func (*KvWatchEvent_Delete) isKvWatchEvent_Event() {} + +type KvPutEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,4,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutEvent) Reset() { + *x = KvPutEvent{} + mi := &file_kv_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutEvent) ProtoMessage() {} + +func (x *KvPutEvent) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutEvent.ProtoReflect.Descriptor instead. +func (*KvPutEvent) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{22} +} + +func (x *KvPutEvent) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvPutEvent) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvPutEvent) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvPutEvent) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type KvDeleteEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteEvent) Reset() { + *x = KvDeleteEvent{} + mi := &file_kv_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteEvent) ProtoMessage() {} + +func (x *KvDeleteEvent) ProtoReflect() protoreflect.Message { + mi := &file_kv_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteEvent.ProtoReflect.Descriptor instead. +func (*KvDeleteEvent) Descriptor() ([]byte, []int) { + return file_kv_proto_rawDescGZIP(), []int{23} +} + +func (x *KvDeleteEvent) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvDeleteEvent) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvDeleteEvent) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +var File_kv_proto protoreflect.FileDescriptor + +const file_kv_proto_rawDesc = "" + + "\n" + + "\bkv.proto\x12\vwaymaker.kv\"\xd3\x01\n" + + "\x15KvCreateBucketRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12$\n" + + "\x0emax_value_size\x18\x03 \x01(\x04R\fmaxValueSize\x12\x1c\n" + + "\n" + + "max_age_ms\x18\x04 \x01(\x04R\bmaxAgeMs\x12\x1c\n" + + "\tephemeral\x18\x05 \x01(\bR\tephemeral\x12#\n" + + "\rmax_revisions\x18\x06 \x01(\x04R\fmaxRevisions\"m\n" + + "\x16KvCreateBucketResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"/\n" + + "\x15KvDeleteBucketRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"m\n" + + "\x16KvDeleteBucketResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"e\n" + + "\fKvPutRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12\x15\n" + + "\x06ttl_ms\x18\x04 \x01(\x04R\x05ttlMs\"h\n" + + "\x0fKvCreateRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12\x15\n" + + "\x06ttl_ms\x18\x04 \x01(\x04R\x05ttlMs\"\x95\x01\n" + + "\x0fKvUpdateRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12+\n" + + "\x11expected_revision\x18\x04 \x01(\x04R\x10expectedRevision\x12\x15\n" + + "\x06ttl_ms\x18\x05 \x01(\x04R\x05ttlMs\"\x80\x01\n" + + "\rKvPutResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"8\n" + + "\fKvGetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"\x9f\x01\n" + + "\rKvGetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12/\n" + + "\x05entry\x18\x04 \x01(\v2\x14.waymaker.kv.KvEntryH\x00R\x05entry\x88\x01\x01B\b\n" + + "\x06_entry\"P\n" + + "\aKvEntry\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\";\n" + + "\x0fKvDeleteRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"\x83\x01\n" + + "\x10KvDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"'\n" + + "\rKvKeysRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"\x98\x01\n" + + "\x0eKvKeysResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x121\n" + + "\aentries\x18\x04 \x03(\v2\x17.waymaker.kv.KvKeyEntryR\aentries\"T\n" + + "\n" + + "KvKeyEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x18\n" + + "\adeleted\x18\x03 \x01(\bR\adeleted\"w\n" + + "\x10KvHistoryRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12#\n" + + "\rfrom_revision\x18\x03 \x01(\x04R\ffromRevision\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x04R\x05limit\"\x9f\x01\n" + + "\x11KvHistoryResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x125\n" + + "\aentries\x18\x04 \x03(\v2\x1b.waymaker.kv.KvHistoryEntryR\aentries\"q\n" + + "\x0eKvHistoryEntry\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\x12\x18\n" + + "\adeleted\x18\x04 \x01(\bR\adeleted\"Q\n" + + "\x0eKvTouchRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x15\n" + + "\x06ttl_ms\x18\x03 \x01(\x04R\x05ttlMs\":\n" + + "\x0eKvWatchRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"z\n" + + "\fKvWatchEvent\x12+\n" + + "\x03put\x18\x01 \x01(\v2\x17.waymaker.kv.KvPutEventH\x00R\x03put\x124\n" + + "\x06delete\x18\x02 \x01(\v2\x1a.waymaker.kv.KvDeleteEventH\x00R\x06deleteB\a\n" + + "\x05event\"e\n" + + "\n" + + "KvPutEvent\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x04 \x01(\x03R\x04tsMs\"R\n" + + "\rKvDeleteEvent\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs2\xa0\x06\n" + + "\x11WaymakerKvService\x12W\n" + + "\fCreateBucket\x12\".waymaker.kv.KvCreateBucketRequest\x1a#.waymaker.kv.KvCreateBucketResponse\x12W\n" + + "\fDeleteBucket\x12\".waymaker.kv.KvDeleteBucketRequest\x1a#.waymaker.kv.KvDeleteBucketResponse\x12<\n" + + "\x03Put\x12\x19.waymaker.kv.KvPutRequest\x1a\x1a.waymaker.kv.KvPutResponse\x12B\n" + + "\x06Create\x12\x1c.waymaker.kv.KvCreateRequest\x1a\x1a.waymaker.kv.KvPutResponse\x12B\n" + + "\x06Update\x12\x1c.waymaker.kv.KvUpdateRequest\x1a\x1a.waymaker.kv.KvPutResponse\x12E\n" + + "\x06Delete\x12\x1c.waymaker.kv.KvDeleteRequest\x1a\x1d.waymaker.kv.KvDeleteResponse\x12<\n" + + "\x03Get\x12\x19.waymaker.kv.KvGetRequest\x1a\x1a.waymaker.kv.KvGetResponse\x12?\n" + + "\x04Keys\x12\x1a.waymaker.kv.KvKeysRequest\x1a\x1b.waymaker.kv.KvKeysResponse\x12H\n" + + "\aHistory\x12\x1d.waymaker.kv.KvHistoryRequest\x1a\x1e.waymaker.kv.KvHistoryResponse\x12@\n" + + "\x05Touch\x12\x1b.waymaker.kv.KvTouchRequest\x1a\x1a.waymaker.kv.KvPutResponse\x12A\n" + + "\x05Watch\x12\x1b.waymaker.kv.KvWatchRequest\x1a\x19.waymaker.kv.KvWatchEvent0\x01B\x13Z\x11/apis/waymaker_kvb\x06proto3" + +var ( + file_kv_proto_rawDescOnce sync.Once + file_kv_proto_rawDescData []byte +) + +func file_kv_proto_rawDescGZIP() []byte { + file_kv_proto_rawDescOnce.Do(func() { + file_kv_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc))) + }) + return file_kv_proto_rawDescData +} + +var file_kv_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_kv_proto_goTypes = []any{ + (*KvCreateBucketRequest)(nil), // 0: waymaker.kv.KvCreateBucketRequest + (*KvCreateBucketResponse)(nil), // 1: waymaker.kv.KvCreateBucketResponse + (*KvDeleteBucketRequest)(nil), // 2: waymaker.kv.KvDeleteBucketRequest + (*KvDeleteBucketResponse)(nil), // 3: waymaker.kv.KvDeleteBucketResponse + (*KvPutRequest)(nil), // 4: waymaker.kv.KvPutRequest + (*KvCreateRequest)(nil), // 5: waymaker.kv.KvCreateRequest + (*KvUpdateRequest)(nil), // 6: waymaker.kv.KvUpdateRequest + (*KvPutResponse)(nil), // 7: waymaker.kv.KvPutResponse + (*KvGetRequest)(nil), // 8: waymaker.kv.KvGetRequest + (*KvGetResponse)(nil), // 9: waymaker.kv.KvGetResponse + (*KvEntry)(nil), // 10: waymaker.kv.KvEntry + (*KvDeleteRequest)(nil), // 11: waymaker.kv.KvDeleteRequest + (*KvDeleteResponse)(nil), // 12: waymaker.kv.KvDeleteResponse + (*KvKeysRequest)(nil), // 13: waymaker.kv.KvKeysRequest + (*KvKeysResponse)(nil), // 14: waymaker.kv.KvKeysResponse + (*KvKeyEntry)(nil), // 15: waymaker.kv.KvKeyEntry + (*KvHistoryRequest)(nil), // 16: waymaker.kv.KvHistoryRequest + (*KvHistoryResponse)(nil), // 17: waymaker.kv.KvHistoryResponse + (*KvHistoryEntry)(nil), // 18: waymaker.kv.KvHistoryEntry + (*KvTouchRequest)(nil), // 19: waymaker.kv.KvTouchRequest + (*KvWatchRequest)(nil), // 20: waymaker.kv.KvWatchRequest + (*KvWatchEvent)(nil), // 21: waymaker.kv.KvWatchEvent + (*KvPutEvent)(nil), // 22: waymaker.kv.KvPutEvent + (*KvDeleteEvent)(nil), // 23: waymaker.kv.KvDeleteEvent +} +var file_kv_proto_depIdxs = []int32{ + 10, // 0: waymaker.kv.KvGetResponse.entry:type_name -> waymaker.kv.KvEntry + 15, // 1: waymaker.kv.KvKeysResponse.entries:type_name -> waymaker.kv.KvKeyEntry + 18, // 2: waymaker.kv.KvHistoryResponse.entries:type_name -> waymaker.kv.KvHistoryEntry + 22, // 3: waymaker.kv.KvWatchEvent.put:type_name -> waymaker.kv.KvPutEvent + 23, // 4: waymaker.kv.KvWatchEvent.delete:type_name -> waymaker.kv.KvDeleteEvent + 0, // 5: waymaker.kv.WaymakerKvService.CreateBucket:input_type -> waymaker.kv.KvCreateBucketRequest + 2, // 6: waymaker.kv.WaymakerKvService.DeleteBucket:input_type -> waymaker.kv.KvDeleteBucketRequest + 4, // 7: waymaker.kv.WaymakerKvService.Put:input_type -> waymaker.kv.KvPutRequest + 5, // 8: waymaker.kv.WaymakerKvService.Create:input_type -> waymaker.kv.KvCreateRequest + 6, // 9: waymaker.kv.WaymakerKvService.Update:input_type -> waymaker.kv.KvUpdateRequest + 11, // 10: waymaker.kv.WaymakerKvService.Delete:input_type -> waymaker.kv.KvDeleteRequest + 8, // 11: waymaker.kv.WaymakerKvService.Get:input_type -> waymaker.kv.KvGetRequest + 13, // 12: waymaker.kv.WaymakerKvService.Keys:input_type -> waymaker.kv.KvKeysRequest + 16, // 13: waymaker.kv.WaymakerKvService.History:input_type -> waymaker.kv.KvHistoryRequest + 19, // 14: waymaker.kv.WaymakerKvService.Touch:input_type -> waymaker.kv.KvTouchRequest + 20, // 15: waymaker.kv.WaymakerKvService.Watch:input_type -> waymaker.kv.KvWatchRequest + 1, // 16: waymaker.kv.WaymakerKvService.CreateBucket:output_type -> waymaker.kv.KvCreateBucketResponse + 3, // 17: waymaker.kv.WaymakerKvService.DeleteBucket:output_type -> waymaker.kv.KvDeleteBucketResponse + 7, // 18: waymaker.kv.WaymakerKvService.Put:output_type -> waymaker.kv.KvPutResponse + 7, // 19: waymaker.kv.WaymakerKvService.Create:output_type -> waymaker.kv.KvPutResponse + 7, // 20: waymaker.kv.WaymakerKvService.Update:output_type -> waymaker.kv.KvPutResponse + 12, // 21: waymaker.kv.WaymakerKvService.Delete:output_type -> waymaker.kv.KvDeleteResponse + 9, // 22: waymaker.kv.WaymakerKvService.Get:output_type -> waymaker.kv.KvGetResponse + 14, // 23: waymaker.kv.WaymakerKvService.Keys:output_type -> waymaker.kv.KvKeysResponse + 17, // 24: waymaker.kv.WaymakerKvService.History:output_type -> waymaker.kv.KvHistoryResponse + 7, // 25: waymaker.kv.WaymakerKvService.Touch:output_type -> waymaker.kv.KvPutResponse + 21, // 26: waymaker.kv.WaymakerKvService.Watch:output_type -> waymaker.kv.KvWatchEvent + 16, // [16:27] is the sub-list for method output_type + 5, // [5:16] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_kv_proto_init() } +func file_kv_proto_init() { + if File_kv_proto != nil { + return + } + file_kv_proto_msgTypes[9].OneofWrappers = []any{} + file_kv_proto_msgTypes[21].OneofWrappers = []any{ + (*KvWatchEvent_Put)(nil), + (*KvWatchEvent_Delete)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_kv_proto_rawDesc), len(file_kv_proto_rawDesc)), + NumEnums: 0, + NumMessages: 24, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_kv_proto_goTypes, + DependencyIndexes: file_kv_proto_depIdxs, + MessageInfos: file_kv_proto_msgTypes, + }.Build() + File_kv_proto = out.File + file_kv_proto_goTypes = nil + file_kv_proto_depIdxs = nil +} diff --git a/go/genpb/kv/kv_grpc.pb.go b/go/genpb/kv/kv_grpc.pb.go new file mode 100644 index 0000000..5e4e8d5 --- /dev/null +++ b/go/genpb/kv/kv_grpc.pb.go @@ -0,0 +1,529 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: kv.proto + +package waymaker_kv + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerKvService_CreateBucket_FullMethodName = "/waymaker.kv.WaymakerKvService/CreateBucket" + WaymakerKvService_DeleteBucket_FullMethodName = "/waymaker.kv.WaymakerKvService/DeleteBucket" + WaymakerKvService_Put_FullMethodName = "/waymaker.kv.WaymakerKvService/Put" + WaymakerKvService_Create_FullMethodName = "/waymaker.kv.WaymakerKvService/Create" + WaymakerKvService_Update_FullMethodName = "/waymaker.kv.WaymakerKvService/Update" + WaymakerKvService_Delete_FullMethodName = "/waymaker.kv.WaymakerKvService/Delete" + WaymakerKvService_Get_FullMethodName = "/waymaker.kv.WaymakerKvService/Get" + WaymakerKvService_Keys_FullMethodName = "/waymaker.kv.WaymakerKvService/Keys" + WaymakerKvService_History_FullMethodName = "/waymaker.kv.WaymakerKvService/History" + WaymakerKvService_Touch_FullMethodName = "/waymaker.kv.WaymakerKvService/Touch" + WaymakerKvService_Watch_FullMethodName = "/waymaker.kv.WaymakerKvService/Watch" +) + +// WaymakerKvServiceClient is the client API for WaymakerKvService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WaymakerKvServiceClient interface { + // ----- Bucket lifecycle ------------------------------------- + CreateBucket(ctx context.Context, in *KvCreateBucketRequest, opts ...grpc.CallOption) (*KvCreateBucketResponse, error) + DeleteBucket(ctx context.Context, in *KvDeleteBucketRequest, opts ...grpc.CallOption) (*KvDeleteBucketResponse, error) + // ----- Mutations -------------------------------------------- + Put(ctx context.Context, in *KvPutRequest, opts ...grpc.CallOption) (*KvPutResponse, error) + // CAS create — succeeds only when the key has never been + // written or its current value is a tombstone. + Create(ctx context.Context, in *KvCreateRequest, opts ...grpc.CallOption) (*KvPutResponse, error) + // CAS update — succeeds only when `expected_revision` + // matches the server-side revision. + Update(ctx context.Context, in *KvUpdateRequest, opts ...grpc.CallOption) (*KvPutResponse, error) + Delete(ctx context.Context, in *KvDeleteRequest, opts ...grpc.CallOption) (*KvDeleteResponse, error) + // ----- Reads ------------------------------------------------ + Get(ctx context.Context, in *KvGetRequest, opts ...grpc.CallOption) (*KvGetResponse, error) + Keys(ctx context.Context, in *KvKeysRequest, opts ...grpc.CallOption) (*KvKeysResponse, error) + History(ctx context.Context, in *KvHistoryRequest, opts ...grpc.CallOption) (*KvHistoryResponse, error) + // ----- TTL refresh ------------------------------------------ + Touch(ctx context.Context, in *KvTouchRequest, opts ...grpc.CallOption) (*KvPutResponse, error) + // ----- Watch ------------------------------------------------ + // Server-streamed event flow for a single bucket. When `key` + // is empty, every put/delete in the bucket fans out; when + // `key` is set, only events at that key are emitted. + Watch(ctx context.Context, in *KvWatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[KvWatchEvent], error) +} + +type waymakerKvServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerKvServiceClient(cc grpc.ClientConnInterface) WaymakerKvServiceClient { + return &waymakerKvServiceClient{cc} +} + +func (c *waymakerKvServiceClient) CreateBucket(ctx context.Context, in *KvCreateBucketRequest, opts ...grpc.CallOption) (*KvCreateBucketResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvCreateBucketResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_CreateBucket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) DeleteBucket(ctx context.Context, in *KvDeleteBucketRequest, opts ...grpc.CallOption) (*KvDeleteBucketResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvDeleteBucketResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_DeleteBucket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Put(ctx context.Context, in *KvPutRequest, opts ...grpc.CallOption) (*KvPutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvPutResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Put_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Create(ctx context.Context, in *KvCreateRequest, opts ...grpc.CallOption) (*KvPutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvPutResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Create_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Update(ctx context.Context, in *KvUpdateRequest, opts ...grpc.CallOption) (*KvPutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvPutResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Update_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Delete(ctx context.Context, in *KvDeleteRequest, opts ...grpc.CallOption) (*KvDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Get(ctx context.Context, in *KvGetRequest, opts ...grpc.CallOption) (*KvGetResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvGetResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Get_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Keys(ctx context.Context, in *KvKeysRequest, opts ...grpc.CallOption) (*KvKeysResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvKeysResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Keys_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) History(ctx context.Context, in *KvHistoryRequest, opts ...grpc.CallOption) (*KvHistoryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvHistoryResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_History_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Touch(ctx context.Context, in *KvTouchRequest, opts ...grpc.CallOption) (*KvPutResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(KvPutResponse) + err := c.cc.Invoke(ctx, WaymakerKvService_Touch_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerKvServiceClient) Watch(ctx context.Context, in *KvWatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[KvWatchEvent], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerKvService_ServiceDesc.Streams[0], WaymakerKvService_Watch_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[KvWatchRequest, KvWatchEvent]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerKvService_WatchClient = grpc.ServerStreamingClient[KvWatchEvent] + +// WaymakerKvServiceServer is the server API for WaymakerKvService service. +// All implementations must embed UnimplementedWaymakerKvServiceServer +// for forward compatibility. +type WaymakerKvServiceServer interface { + // ----- Bucket lifecycle ------------------------------------- + CreateBucket(context.Context, *KvCreateBucketRequest) (*KvCreateBucketResponse, error) + DeleteBucket(context.Context, *KvDeleteBucketRequest) (*KvDeleteBucketResponse, error) + // ----- Mutations -------------------------------------------- + Put(context.Context, *KvPutRequest) (*KvPutResponse, error) + // CAS create — succeeds only when the key has never been + // written or its current value is a tombstone. + Create(context.Context, *KvCreateRequest) (*KvPutResponse, error) + // CAS update — succeeds only when `expected_revision` + // matches the server-side revision. + Update(context.Context, *KvUpdateRequest) (*KvPutResponse, error) + Delete(context.Context, *KvDeleteRequest) (*KvDeleteResponse, error) + // ----- Reads ------------------------------------------------ + Get(context.Context, *KvGetRequest) (*KvGetResponse, error) + Keys(context.Context, *KvKeysRequest) (*KvKeysResponse, error) + History(context.Context, *KvHistoryRequest) (*KvHistoryResponse, error) + // ----- TTL refresh ------------------------------------------ + Touch(context.Context, *KvTouchRequest) (*KvPutResponse, error) + // ----- Watch ------------------------------------------------ + // Server-streamed event flow for a single bucket. When `key` + // is empty, every put/delete in the bucket fans out; when + // `key` is set, only events at that key are emitted. + Watch(*KvWatchRequest, grpc.ServerStreamingServer[KvWatchEvent]) error + mustEmbedUnimplementedWaymakerKvServiceServer() +} + +// UnimplementedWaymakerKvServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerKvServiceServer struct{} + +func (UnimplementedWaymakerKvServiceServer) CreateBucket(context.Context, *KvCreateBucketRequest) (*KvCreateBucketResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateBucket not implemented") +} +func (UnimplementedWaymakerKvServiceServer) DeleteBucket(context.Context, *KvDeleteBucketRequest) (*KvDeleteBucketResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteBucket not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Put(context.Context, *KvPutRequest) (*KvPutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Put not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Create(context.Context, *KvCreateRequest) (*KvPutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Create not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Update(context.Context, *KvUpdateRequest) (*KvPutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Update not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Delete(context.Context, *KvDeleteRequest) (*KvDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Delete not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Get(context.Context, *KvGetRequest) (*KvGetResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Get not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Keys(context.Context, *KvKeysRequest) (*KvKeysResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Keys not implemented") +} +func (UnimplementedWaymakerKvServiceServer) History(context.Context, *KvHistoryRequest) (*KvHistoryResponse, error) { + return nil, status.Error(codes.Unimplemented, "method History not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Touch(context.Context, *KvTouchRequest) (*KvPutResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Touch not implemented") +} +func (UnimplementedWaymakerKvServiceServer) Watch(*KvWatchRequest, grpc.ServerStreamingServer[KvWatchEvent]) error { + return status.Error(codes.Unimplemented, "method Watch not implemented") +} +func (UnimplementedWaymakerKvServiceServer) mustEmbedUnimplementedWaymakerKvServiceServer() {} +func (UnimplementedWaymakerKvServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerKvServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerKvServiceServer will +// result in compilation errors. +type UnsafeWaymakerKvServiceServer interface { + mustEmbedUnimplementedWaymakerKvServiceServer() +} + +func RegisterWaymakerKvServiceServer(s grpc.ServiceRegistrar, srv WaymakerKvServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerKvServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerKvService_ServiceDesc, srv) +} + +func _WaymakerKvService_CreateBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvCreateBucketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).CreateBucket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_CreateBucket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).CreateBucket(ctx, req.(*KvCreateBucketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_DeleteBucket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvDeleteBucketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).DeleteBucket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_DeleteBucket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).DeleteBucket(ctx, req.(*KvDeleteBucketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Put_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvPutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Put(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Put_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Put(ctx, req.(*KvPutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Create(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Create_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Create(ctx, req.(*KvCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Update(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Update_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Update(ctx, req.(*KvUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Delete(ctx, req.(*KvDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Get(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Get_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Get(ctx, req.(*KvGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Keys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvKeysRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Keys(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Keys_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Keys(ctx, req.(*KvKeysRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_History_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvHistoryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).History(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_History_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).History(ctx, req.(*KvHistoryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Touch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KvTouchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerKvServiceServer).Touch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerKvService_Touch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerKvServiceServer).Touch(ctx, req.(*KvTouchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerKvService_Watch_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(KvWatchRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerKvServiceServer).Watch(m, &grpc.GenericServerStream[KvWatchRequest, KvWatchEvent]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerKvService_WatchServer = grpc.ServerStreamingServer[KvWatchEvent] + +// WaymakerKvService_ServiceDesc is the grpc.ServiceDesc for WaymakerKvService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerKvService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.kv.WaymakerKvService", + HandlerType: (*WaymakerKvServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBucket", + Handler: _WaymakerKvService_CreateBucket_Handler, + }, + { + MethodName: "DeleteBucket", + Handler: _WaymakerKvService_DeleteBucket_Handler, + }, + { + MethodName: "Put", + Handler: _WaymakerKvService_Put_Handler, + }, + { + MethodName: "Create", + Handler: _WaymakerKvService_Create_Handler, + }, + { + MethodName: "Update", + Handler: _WaymakerKvService_Update_Handler, + }, + { + MethodName: "Delete", + Handler: _WaymakerKvService_Delete_Handler, + }, + { + MethodName: "Get", + Handler: _WaymakerKvService_Get_Handler, + }, + { + MethodName: "Keys", + Handler: _WaymakerKvService_Keys_Handler, + }, + { + MethodName: "History", + Handler: _WaymakerKvService_History_Handler, + }, + { + MethodName: "Touch", + Handler: _WaymakerKvService_Touch_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Watch", + Handler: _WaymakerKvService_Watch_Handler, + ServerStreams: true, + }, + }, + Metadata: "kv.proto", +} diff --git a/go/genpb/locks/waymaker_locks.pb.go b/go/genpb/locks/waymaker_locks.pb.go new file mode 100644 index 0000000..6af6fea --- /dev/null +++ b/go/genpb/locks/waymaker_locks.pb.go @@ -0,0 +1,1529 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: waymaker_locks.proto + +package waymaker + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// LockEventType defines the various types of events that can occur during +// the lock acquisition process. +type LockEventType int32 + +const ( + LockEventType_Unknown LockEventType = 0 // Default value when the event type is not known. + LockEventType_Waiting LockEventType = 1 // Indicates that the lock request is waiting to be granted. + LockEventType_Acquired LockEventType = 2 // Indicates that the lock has been successfully acquired. + LockEventType_Failed LockEventType = 3 // Indicates that the lock request has failed. + LockEventType_Expired LockEventType = 4 // Indicates that the lock has expired. + LockEventType_Heartbeat LockEventType = 5 // Periodic event indicating that the lock is still active. +) + +// Enum value maps for LockEventType. +var ( + LockEventType_name = map[int32]string{ + 0: "Unknown", + 1: "Waiting", + 2: "Acquired", + 3: "Failed", + 4: "Expired", + 5: "Heartbeat", + } + LockEventType_value = map[string]int32{ + "Unknown": 0, + "Waiting": 1, + "Acquired": 2, + "Failed": 3, + "Expired": 4, + "Heartbeat": 5, + } +) + +func (x LockEventType) Enum() *LockEventType { + p := new(LockEventType) + *p = x + return p +} + +func (x LockEventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LockEventType) Descriptor() protoreflect.EnumDescriptor { + return file_waymaker_locks_proto_enumTypes[0].Descriptor() +} + +func (LockEventType) Type() protoreflect.EnumType { + return &file_waymaker_locks_proto_enumTypes[0] +} + +func (x LockEventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use LockEventType.Descriptor instead. +func (LockEventType) EnumDescriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{0} +} + +// FenceScope controls ONE thing: how durable the per-key fence_token +// counter (the monotonic uint64) is across failures. Three things it does +// NOT control — do not conflate them with the scope: +// +// - Whether a HELD LOCK survives a node loss / rollout. That is +// cluster.replication-factor plus secondary adoption, and it already +// applies to every non-Ephemeral lock regardless of scope. A stronger +// scope does not make a lock survive; a replicated lease does. +// +// - Client-side transparency across a primary bounce. The lock client +// transparently re-binds its event stream and re-confirms ownership +// after a disconnect, but that is a client-lib behaviour — no scope +// value changes it. +// +// - Mutual exclusion. Holding the lock is NOT, by itself, a guarantee +// that no one else acts. The holder MUST validate fence_token at its +// own side effect (the DB write / object PUT) and reject anything +// carrying a fence below the last one it durably committed. Even +// ScopeQuorum does not let you skip that check — an all-at-once +// cluster restart can still drop an in-memory token. See USAGE.md +// "Fence tokens" for the enforcement rule. +// +// Unspecified: server treats as Ephemeral. +// Ephemeral: per-key counter in RAM on the owning node. Resets on +// process restart or hash-ring rebalance. Fast — no I/O. +// Right for rate limiting, cache lockout, advisory locks, +// anywhere fence resets across failure are tolerable. +// Local: per-key counter persisted to disk on the owning node. +// Survives process restart on the same node. Still resets +// on hash-ring rebalance (a different node has its own +// disk). One fsync per acquire (~1-5ms on SSD). +// Quorum: Raft-replicated per-key counter — cluster-wide monotonic, +// survives any single-node failure (the surviving quorum +// keeps the count). One Raft commit per acquire (~5ms). +// Requires the cluster Raft backend to be wired; a +// single-node or test build returns BadInput for this +// scope. Pick this when an external resource fences on the +// token and two holders must never see fences that fail to +// prove an ordering. (Named Quorum, not Global: the +// guarantee is "a Raft quorum agrees on the count", which +// carries its own limit and makes no geographic claim.) +type FenceScope int32 + +const ( + FenceScope_ScopeUnspecified FenceScope = 0 + FenceScope_ScopeEphemeral FenceScope = 1 + FenceScope_ScopeLocal FenceScope = 2 + // Wire value 3 is unchanged from the former ScopeGlobal — old and new + // binaries interoperate mid-rollout; only the symbol name changed. + FenceScope_ScopeQuorum FenceScope = 3 +) + +// Enum value maps for FenceScope. +var ( + FenceScope_name = map[int32]string{ + 0: "ScopeUnspecified", + 1: "ScopeEphemeral", + 2: "ScopeLocal", + 3: "ScopeQuorum", + } + FenceScope_value = map[string]int32{ + "ScopeUnspecified": 0, + "ScopeEphemeral": 1, + "ScopeLocal": 2, + "ScopeQuorum": 3, + } +) + +func (x FenceScope) Enum() *FenceScope { + p := new(FenceScope) + *p = x + return p +} + +func (x FenceScope) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (FenceScope) Descriptor() protoreflect.EnumDescriptor { + return file_waymaker_locks_proto_enumTypes[1].Descriptor() +} + +func (FenceScope) Type() protoreflect.EnumType { + return &file_waymaker_locks_proto_enumTypes[1] +} + +func (x FenceScope) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use FenceScope.Descriptor instead. +func (FenceScope) EnumDescriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{1} +} + +// LockRequest defines the parameters for requesting a lock. +type LockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The unique key representing the lock. + MaxWaitPeriod uint32 `protobuf:"varint,2,opt,name=max_wait_period,json=maxWaitPeriod,proto3" json:"max_wait_period,omitempty"` // The maximum time (in milliseconds) to wait for the lock to be granted. + MaxLeasePeriod uint32 `protobuf:"varint,3,opt,name=max_lease_period,json=maxLeasePeriod,proto3" json:"max_lease_period,omitempty"` // The maximum time (in milliseconds) the lock can be held. + Priority uint32 `protobuf:"varint,4,opt,name=priority,proto3" json:"priority,omitempty"` // The priority level of the lock request. + RequesterInfo string `protobuf:"bytes,10,opt,name=requester_info,json=requesterInfo,proto3" json:"requester_info,omitempty"` // Additional information about the requester. + RequesterApplication string `protobuf:"bytes,11,opt,name=requester_application,json=requesterApplication,proto3" json:"requester_application,omitempty"` // The name of the application making the request. + RequestId string `protobuf:"bytes,12,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // Idempotency key for retries of the same logical acquire request. + FenceScope FenceScope `protobuf:"varint,13,opt,name=fence_scope,json=fenceScope,proto3,enum=waymaker.FenceScope" json:"fence_scope,omitempty"` // Persistence/durability tier for fence_token. Defaults to Ephemeral. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockRequest) Reset() { + *x = LockRequest{} + mi := &file_waymaker_locks_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockRequest) ProtoMessage() {} + +func (x *LockRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LockRequest.ProtoReflect.Descriptor instead. +func (*LockRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{0} +} + +func (x *LockRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *LockRequest) GetMaxWaitPeriod() uint32 { + if x != nil { + return x.MaxWaitPeriod + } + return 0 +} + +func (x *LockRequest) GetMaxLeasePeriod() uint32 { + if x != nil { + return x.MaxLeasePeriod + } + return 0 +} + +func (x *LockRequest) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *LockRequest) GetRequesterInfo() string { + if x != nil { + return x.RequesterInfo + } + return "" +} + +func (x *LockRequest) GetRequesterApplication() string { + if x != nil { + return x.RequesterApplication + } + return "" +} + +func (x *LockRequest) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *LockRequest) GetFenceScope() FenceScope { + if x != nil { + return x.FenceScope + } + return FenceScope_ScopeUnspecified +} + +// LockEvent represents an event related to the lock acquisition process. +type LockEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates whether the event was successful. + EventType LockEventType `protobuf:"varint,2,opt,name=event_type,json=eventType,proto3,enum=waymaker.LockEventType" json:"event_type,omitempty"` // The type of event that occurred. + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // A message providing additional details about the event. + Id string `protobuf:"bytes,4,opt,name=id,proto3" json:"id,omitempty"` // The unique identifier of the lock. + Key string `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"` // The key associated with the lock. + LeaseExpiresAt int64 `protobuf:"varint,6,opt,name=lease_expires_at,json=leaseExpiresAt,proto3" json:"lease_expires_at,omitempty"` // The timestamp (in Unix milliseconds) when the lease expires. + AcquiredAt int64 `protobuf:"varint,7,opt,name=acquired_at,json=acquiredAt,proto3" json:"acquired_at,omitempty"` // The timestamp (in Unix milliseconds) when the lock was acquired. + WaitingExpiresAt int64 `protobuf:"varint,8,opt,name=waiting_expires_at,json=waitingExpiresAt,proto3" json:"waiting_expires_at,omitempty"` // The timestamp (in Unix milliseconds) when the waiting period expires. + // Monotonic-per-key fence token assigned at acquire. Increments by 1 per + // successful acquisition of `key`. 0 on non-Acquired events. + // + // Held in RAM on the consistent-hash-owning node. Monotonic within that + // node's process lifetime; resets to 0 across node restart, crash, or + // hash-ring rebalance. This is intentional — see README "Known + // limitations" and "When to use waymaker" for the use cases this suits + // vs. when to reach for a different tool (etcd / ZooKeeper / Consul). + FenceToken uint64 `protobuf:"varint,9,opt,name=fence_token,json=fenceToken,proto3" json:"fence_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LockEvent) Reset() { + *x = LockEvent{} + mi := &file_waymaker_locks_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LockEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LockEvent) ProtoMessage() {} + +func (x *LockEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LockEvent.ProtoReflect.Descriptor instead. +func (*LockEvent) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{1} +} + +func (x *LockEvent) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *LockEvent) GetEventType() LockEventType { + if x != nil { + return x.EventType + } + return LockEventType_Unknown +} + +func (x *LockEvent) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *LockEvent) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *LockEvent) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *LockEvent) GetLeaseExpiresAt() int64 { + if x != nil { + return x.LeaseExpiresAt + } + return 0 +} + +func (x *LockEvent) GetAcquiredAt() int64 { + if x != nil { + return x.AcquiredAt + } + return 0 +} + +func (x *LockEvent) GetWaitingExpiresAt() int64 { + if x != nil { + return x.WaitingExpiresAt + } + return 0 +} + +func (x *LockEvent) GetFenceToken() uint64 { + if x != nil { + return x.FenceToken + } + return 0 +} + +// UnLockRequest defines the parameters for releasing a lock. +type UnLockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The unique key representing the lock. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // The unique identifier of the lock to be released. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnLockRequest) Reset() { + *x = UnLockRequest{} + mi := &file_waymaker_locks_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnLockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnLockRequest) ProtoMessage() {} + +func (x *UnLockRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnLockRequest.ProtoReflect.Descriptor instead. +func (*UnLockRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{2} +} + +func (x *UnLockRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *UnLockRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +// UnLockResponse represents the response to an UnLock request. +type UnLockResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates whether the unlock operation was successful. + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // A code indicating the result of the unlock operation. + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // A message providing additional details about the unlock operation. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnLockResponse) Reset() { + *x = UnLockResponse{} + mi := &file_waymaker_locks_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnLockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnLockResponse) ProtoMessage() {} + +func (x *UnLockResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnLockResponse.ProtoReflect.Descriptor instead. +func (*UnLockResponse) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{3} +} + +func (x *UnLockResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *UnLockResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *UnLockResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// Lease represents the details of a lock lease. +type Lease struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // The unique identifier of the lock. + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // The key associated with the lock. + Acquired bool `protobuf:"varint,3,opt,name=acquired,proto3" json:"acquired,omitempty"` // Indicates whether the lock has been acquired. + Priority uint32 `protobuf:"varint,5,opt,name=priority,proto3" json:"priority,omitempty"` // The priority level of the lock. + CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // The timestamp (in Unix milliseconds) when the lock was created. + LeaseExpiresAt int64 `protobuf:"varint,7,opt,name=lease_expires_at,json=leaseExpiresAt,proto3" json:"lease_expires_at,omitempty"` // The timestamp (in Unix milliseconds) when the lease expires. + WaitingExpiresAt int64 `protobuf:"varint,8,opt,name=waiting_expires_at,json=waitingExpiresAt,proto3" json:"waiting_expires_at,omitempty"` // The timestamp (in Unix milliseconds) when the waiting period expires. + // Fence token assigned at acquire. See LockEvent.fence_token caveats. + FenceToken uint64 `protobuf:"varint,9,opt,name=fence_token,json=fenceToken,proto3" json:"fence_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Lease) Reset() { + *x = Lease{} + mi := &file_waymaker_locks_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Lease) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Lease) ProtoMessage() {} + +func (x *Lease) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Lease.ProtoReflect.Descriptor instead. +func (*Lease) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{4} +} + +func (x *Lease) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Lease) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Lease) GetAcquired() bool { + if x != nil { + return x.Acquired + } + return false +} + +func (x *Lease) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *Lease) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Lease) GetLeaseExpiresAt() int64 { + if x != nil { + return x.LeaseExpiresAt + } + return 0 +} + +func (x *Lease) GetWaitingExpiresAt() int64 { + if x != nil { + return x.WaitingExpiresAt + } + return 0 +} + +func (x *Lease) GetFenceToken() uint64 { + if x != nil { + return x.FenceToken + } + return 0 +} + +// ExtendLeaseRequest defines the parameters for extending the lease of a lock. +type ExtendLeaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The unique key representing the lock. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // The unique identifier of the lock to extend the lease for. + LeaseTimeout uint32 `protobuf:"varint,3,opt,name=lease_timeout,json=leaseTimeout,proto3" json:"lease_timeout,omitempty"` // The additional time (in milliseconds) to extend the lease. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendLeaseRequest) Reset() { + *x = ExtendLeaseRequest{} + mi := &file_waymaker_locks_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendLeaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendLeaseRequest) ProtoMessage() {} + +func (x *ExtendLeaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendLeaseRequest.ProtoReflect.Descriptor instead. +func (*ExtendLeaseRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{5} +} + +func (x *ExtendLeaseRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *ExtendLeaseRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ExtendLeaseRequest) GetLeaseTimeout() uint32 { + if x != nil { + return x.LeaseTimeout + } + return 0 +} + +// ExtendLeaseResponse represents the response to an ExtendLease request. +type ExtendLeaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates whether the lease extension was successful. + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // A code indicating the result of the lease extension. + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // A message providing additional details about the lease extension. + Lease *Lease `protobuf:"bytes,4,opt,name=lease,proto3" json:"lease,omitempty"` // The updated lease details after the extension. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtendLeaseResponse) Reset() { + *x = ExtendLeaseResponse{} + mi := &file_waymaker_locks_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtendLeaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtendLeaseResponse) ProtoMessage() {} + +func (x *ExtendLeaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtendLeaseResponse.ProtoReflect.Descriptor instead. +func (*ExtendLeaseResponse) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{6} +} + +func (x *ExtendLeaseResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ExtendLeaseResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ExtendLeaseResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ExtendLeaseResponse) GetLease() *Lease { + if x != nil { + return x.Lease + } + return nil +} + +// LeaseStatusRequest defines the parameters for retrieving the status of a lock lease. +type LeaseStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The unique key representing the lock. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // The unique identifier of the lock to check the status of. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseStatusRequest) Reset() { + *x = LeaseStatusRequest{} + mi := &file_waymaker_locks_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseStatusRequest) ProtoMessage() {} + +func (x *LeaseStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaseStatusRequest.ProtoReflect.Descriptor instead. +func (*LeaseStatusRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{7} +} + +func (x *LeaseStatusRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *LeaseStatusRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +// LeaseStatusResponse represents the response to a LeaseStatus request. +type LeaseStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // Indicates whether the lease status retrieval was successful. + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // A code indicating the result of the lease status retrieval. + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // A message providing additional details about the lease status retrieval. + Lease *Lease `protobuf:"bytes,4,opt,name=lease,proto3" json:"lease,omitempty"` // The current lease details for the lock. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaseStatusResponse) Reset() { + *x = LeaseStatusResponse{} + mi := &file_waymaker_locks_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaseStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaseStatusResponse) ProtoMessage() {} + +func (x *LeaseStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaseStatusResponse.ProtoReflect.Descriptor instead. +func (*LeaseStatusResponse) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{8} +} + +func (x *LeaseStatusResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *LeaseStatusResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *LeaseStatusResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *LeaseStatusResponse) GetLease() *Lease { + if x != nil { + return x.Lease + } + return nil +} + +// A single (key, lock-kind) entry inside a MultiLockRequest. +type MultiLockKey struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The unique key representing the lock. + WriteLock bool `protobuf:"varint,2,opt,name=write_lock,json=writeLock,proto3" json:"write_lock,omitempty"` // true = exclusive (write), false = shared (read). + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MultiLockKey) Reset() { + *x = MultiLockKey{} + mi := &file_waymaker_locks_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MultiLockKey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiLockKey) ProtoMessage() {} + +func (x *MultiLockKey) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiLockKey.ProtoReflect.Descriptor instead. +func (*MultiLockKey) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{9} +} + +func (x *MultiLockKey) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *MultiLockKey) GetWriteLock() bool { + if x != nil { + return x.WriteLock + } + return false +} + +// MultiLockRequest defines the parameters for atomically acquiring N locks. +// See MultiLock RPC docs for ordering and rollback semantics. +type MultiLockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Keys []*MultiLockKey `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` // 1..N keys to acquire. Re-ordered server-side. + MaxWaitPeriod uint32 `protobuf:"varint,2,opt,name=max_wait_period,json=maxWaitPeriod,proto3" json:"max_wait_period,omitempty"` // Total batch deadline (ms). Per-key budget is the remainder. + MaxLeasePeriod uint32 `protobuf:"varint,3,opt,name=max_lease_period,json=maxLeasePeriod,proto3" json:"max_lease_period,omitempty"` // Per-key lease length (ms). + Priority uint32 `protobuf:"varint,4,opt,name=priority,proto3" json:"priority,omitempty"` // Priority applied to every key. + RequesterInfo string `protobuf:"bytes,10,opt,name=requester_info,json=requesterInfo,proto3" json:"requester_info,omitempty"` + RequesterApplication string `protobuf:"bytes,11,opt,name=requester_application,json=requesterApplication,proto3" json:"requester_application,omitempty"` + RequestId string `protobuf:"bytes,12,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // Idempotency key for the batch. + FenceScope FenceScope `protobuf:"varint,13,opt,name=fence_scope,json=fenceScope,proto3,enum=waymaker.FenceScope" json:"fence_scope,omitempty"` // Applies to every key in the batch. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MultiLockRequest) Reset() { + *x = MultiLockRequest{} + mi := &file_waymaker_locks_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MultiLockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiLockRequest) ProtoMessage() {} + +func (x *MultiLockRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiLockRequest.ProtoReflect.Descriptor instead. +func (*MultiLockRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{10} +} + +func (x *MultiLockRequest) GetKeys() []*MultiLockKey { + if x != nil { + return x.Keys + } + return nil +} + +func (x *MultiLockRequest) GetMaxWaitPeriod() uint32 { + if x != nil { + return x.MaxWaitPeriod + } + return 0 +} + +func (x *MultiLockRequest) GetMaxLeasePeriod() uint32 { + if x != nil { + return x.MaxLeasePeriod + } + return 0 +} + +func (x *MultiLockRequest) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *MultiLockRequest) GetRequesterInfo() string { + if x != nil { + return x.RequesterInfo + } + return "" +} + +func (x *MultiLockRequest) GetRequesterApplication() string { + if x != nil { + return x.RequesterApplication + } + return "" +} + +func (x *MultiLockRequest) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *MultiLockRequest) GetFenceScope() FenceScope { + if x != nil { + return x.FenceScope + } + return FenceScope_ScopeUnspecified +} + +// MultiLockResponse — unary result of a MultiLock attempt. +type MultiLockResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // true iff all keys were acquired. + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "timeout" | "no_keys" | "invalid_scope" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` // Free-form detail; empty on success. + // Populated only on success, in lexicographic key order (the order the + // server acquired them in). On failure this is empty and any locks + // briefly held during the attempt have already been released. + Leases []*Lease `protobuf:"bytes,4,rep,name=leases,proto3" json:"leases,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MultiLockResponse) Reset() { + *x = MultiLockResponse{} + mi := &file_waymaker_locks_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MultiLockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MultiLockResponse) ProtoMessage() {} + +func (x *MultiLockResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MultiLockResponse.ProtoReflect.Descriptor instead. +func (*MultiLockResponse) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{11} +} + +func (x *MultiLockResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MultiLockResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *MultiLockResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *MultiLockResponse) GetLeases() []*Lease { + if x != nil { + return x.Leases + } + return nil +} + +// ListAcquiredLocksRequest — filter for ListAcquiredLocks. +type ListAcquiredLocksRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyPrefix string `protobuf:"bytes,1,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty"` // Optional; empty = every held key on this node. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAcquiredLocksRequest) Reset() { + *x = ListAcquiredLocksRequest{} + mi := &file_waymaker_locks_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAcquiredLocksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAcquiredLocksRequest) ProtoMessage() {} + +func (x *ListAcquiredLocksRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAcquiredLocksRequest.ProtoReflect.Descriptor instead. +func (*ListAcquiredLocksRequest) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{12} +} + +func (x *ListAcquiredLocksRequest) GetKeyPrefix() string { + if x != nil { + return x.KeyPrefix + } + return "" +} + +// AcquiredLock — one lock currently HELD (not waiting) on the serving node. +type AcquiredLock struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // The lock key. + LockId string `protobuf:"bytes,2,opt,name=lock_id,json=lockId,proto3" json:"lock_id,omitempty"` // The holder's unique lock id. + WriteLock bool `protobuf:"varint,3,opt,name=write_lock,json=writeLock,proto3" json:"write_lock,omitempty"` // true = exclusive (write); false = shared (read). + Priority uint32 `protobuf:"varint,4,opt,name=priority,proto3" json:"priority,omitempty"` // Priority the lock was acquired at. + FenceToken uint64 `protobuf:"varint,5,opt,name=fence_token,json=fenceToken,proto3" json:"fence_token,omitempty"` // Fence token assigned at acquire. + LeaseExpiresAt int64 `protobuf:"varint,6,opt,name=lease_expires_at,json=leaseExpiresAt,proto3" json:"lease_expires_at,omitempty"` // Lease expiry (epoch ms). + AcquiredAt int64 `protobuf:"varint,7,opt,name=acquired_at,json=acquiredAt,proto3" json:"acquired_at,omitempty"` // Acquire time (epoch ms). + RequestId string `protobuf:"bytes,8,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` // Idempotency key of the acquire. + RequesterInfo string `protobuf:"bytes,9,opt,name=requester_info,json=requesterInfo,proto3" json:"requester_info,omitempty"` // Caller-supplied requester metadata (free-form string). + RequesterApplication string `protobuf:"bytes,10,opt,name=requester_application,json=requesterApplication,proto3" json:"requester_application,omitempty"` // Caller-supplied application name. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AcquiredLock) Reset() { + *x = AcquiredLock{} + mi := &file_waymaker_locks_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AcquiredLock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcquiredLock) ProtoMessage() {} + +func (x *AcquiredLock) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcquiredLock.ProtoReflect.Descriptor instead. +func (*AcquiredLock) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{13} +} + +func (x *AcquiredLock) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *AcquiredLock) GetLockId() string { + if x != nil { + return x.LockId + } + return "" +} + +func (x *AcquiredLock) GetWriteLock() bool { + if x != nil { + return x.WriteLock + } + return false +} + +func (x *AcquiredLock) GetPriority() uint32 { + if x != nil { + return x.Priority + } + return 0 +} + +func (x *AcquiredLock) GetFenceToken() uint64 { + if x != nil { + return x.FenceToken + } + return 0 +} + +func (x *AcquiredLock) GetLeaseExpiresAt() int64 { + if x != nil { + return x.LeaseExpiresAt + } + return 0 +} + +func (x *AcquiredLock) GetAcquiredAt() int64 { + if x != nil { + return x.AcquiredAt + } + return 0 +} + +func (x *AcquiredLock) GetRequestId() string { + if x != nil { + return x.RequestId + } + return "" +} + +func (x *AcquiredLock) GetRequesterInfo() string { + if x != nil { + return x.RequesterInfo + } + return "" +} + +func (x *AcquiredLock) GetRequesterApplication() string { + if x != nil { + return x.RequesterApplication + } + return "" +} + +// ListAcquiredLocksResponse — held locks on the serving node. +type ListAcquiredLocksResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Locks []*AcquiredLock `protobuf:"bytes,2,rep,name=locks,proto3" json:"locks,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListAcquiredLocksResponse) Reset() { + *x = ListAcquiredLocksResponse{} + mi := &file_waymaker_locks_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListAcquiredLocksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListAcquiredLocksResponse) ProtoMessage() {} + +func (x *ListAcquiredLocksResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_locks_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListAcquiredLocksResponse.ProtoReflect.Descriptor instead. +func (*ListAcquiredLocksResponse) Descriptor() ([]byte, []int) { + return file_waymaker_locks_proto_rawDescGZIP(), []int{14} +} + +func (x *ListAcquiredLocksResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListAcquiredLocksResponse) GetLocks() []*AcquiredLock { + if x != nil { + return x.Locks + } + return nil +} + +var File_waymaker_locks_proto protoreflect.FileDescriptor + +const file_waymaker_locks_proto_rawDesc = "" + + "\n" + + "\x14waymaker_locks.proto\x12\bwaymaker\"\xbf\x02\n" + + "\vLockRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12&\n" + + "\x0fmax_wait_period\x18\x02 \x01(\rR\rmaxWaitPeriod\x12(\n" + + "\x10max_lease_period\x18\x03 \x01(\rR\x0emaxLeasePeriod\x12\x1a\n" + + "\bpriority\x18\x04 \x01(\rR\bpriority\x12%\n" + + "\x0erequester_info\x18\n" + + " \x01(\tR\rrequesterInfo\x123\n" + + "\x15requester_application\x18\v \x01(\tR\x14requesterApplication\x12\x1d\n" + + "\n" + + "request_id\x18\f \x01(\tR\trequestId\x125\n" + + "\vfence_scope\x18\r \x01(\x0e2\x14.waymaker.FenceScopeR\n" + + "fenceScope\"\xb3\x02\n" + + "\tLockEvent\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x126\n" + + "\n" + + "event_type\x18\x02 \x01(\x0e2\x17.waymaker.LockEventTypeR\teventType\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x0e\n" + + "\x02id\x18\x04 \x01(\tR\x02id\x12\x10\n" + + "\x03key\x18\x05 \x01(\tR\x03key\x12(\n" + + "\x10lease_expires_at\x18\x06 \x01(\x03R\x0eleaseExpiresAt\x12\x1f\n" + + "\vacquired_at\x18\a \x01(\x03R\n" + + "acquiredAt\x12,\n" + + "\x12waiting_expires_at\x18\b \x01(\x03R\x10waitingExpiresAt\x12\x1f\n" + + "\vfence_token\x18\t \x01(\x04R\n" + + "fenceToken\"1\n" + + "\rUnLockRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x0e\n" + + "\x02id\x18\x02 \x01(\tR\x02id\"e\n" + + "\x0eUnLockResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\xff\x01\n" + + "\x05Lease\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x1a\n" + + "\bacquired\x18\x03 \x01(\bR\bacquired\x12\x1a\n" + + "\bpriority\x18\x05 \x01(\rR\bpriority\x12\x1d\n" + + "\n" + + "created_at\x18\x06 \x01(\x03R\tcreatedAt\x12(\n" + + "\x10lease_expires_at\x18\a \x01(\x03R\x0eleaseExpiresAt\x12,\n" + + "\x12waiting_expires_at\x18\b \x01(\x03R\x10waitingExpiresAt\x12\x1f\n" + + "\vfence_token\x18\t \x01(\x04R\n" + + "fenceTokenJ\x04\b\x04\x10\x05\"[\n" + + "\x12ExtendLeaseRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x0e\n" + + "\x02id\x18\x02 \x01(\tR\x02id\x12#\n" + + "\rlease_timeout\x18\x03 \x01(\rR\fleaseTimeout\"\x91\x01\n" + + "\x13ExtendLeaseResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12%\n" + + "\x05lease\x18\x04 \x01(\v2\x0f.waymaker.LeaseR\x05lease\"6\n" + + "\x12LeaseStatusRequest\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x0e\n" + + "\x02id\x18\x02 \x01(\tR\x02id\"\x91\x01\n" + + "\x13LeaseStatusResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12%\n" + + "\x05lease\x18\x04 \x01(\v2\x0f.waymaker.LeaseR\x05lease\"?\n" + + "\fMultiLockKey\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1d\n" + + "\n" + + "write_lock\x18\x02 \x01(\bR\twriteLock\"\xde\x02\n" + + "\x10MultiLockRequest\x12*\n" + + "\x04keys\x18\x01 \x03(\v2\x16.waymaker.MultiLockKeyR\x04keys\x12&\n" + + "\x0fmax_wait_period\x18\x02 \x01(\rR\rmaxWaitPeriod\x12(\n" + + "\x10max_lease_period\x18\x03 \x01(\rR\x0emaxLeasePeriod\x12\x1a\n" + + "\bpriority\x18\x04 \x01(\rR\bpriority\x12%\n" + + "\x0erequester_info\x18\n" + + " \x01(\tR\rrequesterInfo\x123\n" + + "\x15requester_application\x18\v \x01(\tR\x14requesterApplication\x12\x1d\n" + + "\n" + + "request_id\x18\f \x01(\tR\trequestId\x125\n" + + "\vfence_scope\x18\r \x01(\x0e2\x14.waymaker.FenceScopeR\n" + + "fenceScope\"\x91\x01\n" + + "\x11MultiLockResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12'\n" + + "\x06leases\x18\x04 \x03(\v2\x0f.waymaker.LeaseR\x06leases\"9\n" + + "\x18ListAcquiredLocksRequest\x12\x1d\n" + + "\n" + + "key_prefix\x18\x01 \x01(\tR\tkeyPrefix\"\xdb\x02\n" + + "\fAcquiredLock\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x17\n" + + "\alock_id\x18\x02 \x01(\tR\x06lockId\x12\x1d\n" + + "\n" + + "write_lock\x18\x03 \x01(\bR\twriteLock\x12\x1a\n" + + "\bpriority\x18\x04 \x01(\rR\bpriority\x12\x1f\n" + + "\vfence_token\x18\x05 \x01(\x04R\n" + + "fenceToken\x12(\n" + + "\x10lease_expires_at\x18\x06 \x01(\x03R\x0eleaseExpiresAt\x12\x1f\n" + + "\vacquired_at\x18\a \x01(\x03R\n" + + "acquiredAt\x12\x1d\n" + + "\n" + + "request_id\x18\b \x01(\tR\trequestId\x12%\n" + + "\x0erequester_info\x18\t \x01(\tR\rrequesterInfo\x123\n" + + "\x15requester_application\x18\n" + + " \x01(\tR\x14requesterApplication\"c\n" + + "\x19ListAcquiredLocksResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12,\n" + + "\x05locks\x18\x02 \x03(\v2\x16.waymaker.AcquiredLockR\x05locks*_\n" + + "\rLockEventType\x12\v\n" + + "\aUnknown\x10\x00\x12\v\n" + + "\aWaiting\x10\x01\x12\f\n" + + "\bAcquired\x10\x02\x12\n" + + "\n" + + "\x06Failed\x10\x03\x12\v\n" + + "\aExpired\x10\x04\x12\r\n" + + "\tHeartbeat\x10\x05*W\n" + + "\n" + + "FenceScope\x12\x14\n" + + "\x10ScopeUnspecified\x10\x00\x12\x12\n" + + "\x0eScopeEphemeral\x10\x01\x12\x0e\n" + + "\n" + + "ScopeLocal\x10\x02\x12\x0f\n" + + "\vScopeQuorum\x10\x032\x88\x04\n" + + "\x0fWaymakerService\x126\n" + + "\x04Lock\x12\x15.waymaker.LockRequest\x1a\x13.waymaker.LockEvent\"\x000\x01\x12:\n" + + "\bReadLock\x12\x15.waymaker.LockRequest\x1a\x13.waymaker.LockEvent\"\x000\x01\x12=\n" + + "\x06UnLock\x12\x17.waymaker.UnLockRequest\x1a\x18.waymaker.UnLockResponse\"\x00\x12L\n" + + "\vLeaseStatus\x12\x1c.waymaker.LeaseStatusRequest\x1a\x1d.waymaker.LeaseStatusResponse\"\x00\x12L\n" + + "\vExtendLease\x12\x1c.waymaker.ExtendLeaseRequest\x1a\x1d.waymaker.ExtendLeaseResponse\"\x00\x12F\n" + + "\tMultiLock\x12\x1a.waymaker.MultiLockRequest\x1a\x1b.waymaker.MultiLockResponse\"\x00\x12^\n" + + "\x11ListAcquiredLocks\x12\".waymaker.ListAcquiredLocksRequest\x1a#.waymaker.ListAcquiredLocksResponse\"\x00B\x10Z\x0e/apis/waymakerb\x06proto3" + +var ( + file_waymaker_locks_proto_rawDescOnce sync.Once + file_waymaker_locks_proto_rawDescData []byte +) + +func file_waymaker_locks_proto_rawDescGZIP() []byte { + file_waymaker_locks_proto_rawDescOnce.Do(func() { + file_waymaker_locks_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_waymaker_locks_proto_rawDesc), len(file_waymaker_locks_proto_rawDesc))) + }) + return file_waymaker_locks_proto_rawDescData +} + +var file_waymaker_locks_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_waymaker_locks_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_waymaker_locks_proto_goTypes = []any{ + (LockEventType)(0), // 0: waymaker.LockEventType + (FenceScope)(0), // 1: waymaker.FenceScope + (*LockRequest)(nil), // 2: waymaker.LockRequest + (*LockEvent)(nil), // 3: waymaker.LockEvent + (*UnLockRequest)(nil), // 4: waymaker.UnLockRequest + (*UnLockResponse)(nil), // 5: waymaker.UnLockResponse + (*Lease)(nil), // 6: waymaker.Lease + (*ExtendLeaseRequest)(nil), // 7: waymaker.ExtendLeaseRequest + (*ExtendLeaseResponse)(nil), // 8: waymaker.ExtendLeaseResponse + (*LeaseStatusRequest)(nil), // 9: waymaker.LeaseStatusRequest + (*LeaseStatusResponse)(nil), // 10: waymaker.LeaseStatusResponse + (*MultiLockKey)(nil), // 11: waymaker.MultiLockKey + (*MultiLockRequest)(nil), // 12: waymaker.MultiLockRequest + (*MultiLockResponse)(nil), // 13: waymaker.MultiLockResponse + (*ListAcquiredLocksRequest)(nil), // 14: waymaker.ListAcquiredLocksRequest + (*AcquiredLock)(nil), // 15: waymaker.AcquiredLock + (*ListAcquiredLocksResponse)(nil), // 16: waymaker.ListAcquiredLocksResponse +} +var file_waymaker_locks_proto_depIdxs = []int32{ + 1, // 0: waymaker.LockRequest.fence_scope:type_name -> waymaker.FenceScope + 0, // 1: waymaker.LockEvent.event_type:type_name -> waymaker.LockEventType + 6, // 2: waymaker.ExtendLeaseResponse.lease:type_name -> waymaker.Lease + 6, // 3: waymaker.LeaseStatusResponse.lease:type_name -> waymaker.Lease + 11, // 4: waymaker.MultiLockRequest.keys:type_name -> waymaker.MultiLockKey + 1, // 5: waymaker.MultiLockRequest.fence_scope:type_name -> waymaker.FenceScope + 6, // 6: waymaker.MultiLockResponse.leases:type_name -> waymaker.Lease + 15, // 7: waymaker.ListAcquiredLocksResponse.locks:type_name -> waymaker.AcquiredLock + 2, // 8: waymaker.WaymakerService.Lock:input_type -> waymaker.LockRequest + 2, // 9: waymaker.WaymakerService.ReadLock:input_type -> waymaker.LockRequest + 4, // 10: waymaker.WaymakerService.UnLock:input_type -> waymaker.UnLockRequest + 9, // 11: waymaker.WaymakerService.LeaseStatus:input_type -> waymaker.LeaseStatusRequest + 7, // 12: waymaker.WaymakerService.ExtendLease:input_type -> waymaker.ExtendLeaseRequest + 12, // 13: waymaker.WaymakerService.MultiLock:input_type -> waymaker.MultiLockRequest + 14, // 14: waymaker.WaymakerService.ListAcquiredLocks:input_type -> waymaker.ListAcquiredLocksRequest + 3, // 15: waymaker.WaymakerService.Lock:output_type -> waymaker.LockEvent + 3, // 16: waymaker.WaymakerService.ReadLock:output_type -> waymaker.LockEvent + 5, // 17: waymaker.WaymakerService.UnLock:output_type -> waymaker.UnLockResponse + 10, // 18: waymaker.WaymakerService.LeaseStatus:output_type -> waymaker.LeaseStatusResponse + 8, // 19: waymaker.WaymakerService.ExtendLease:output_type -> waymaker.ExtendLeaseResponse + 13, // 20: waymaker.WaymakerService.MultiLock:output_type -> waymaker.MultiLockResponse + 16, // 21: waymaker.WaymakerService.ListAcquiredLocks:output_type -> waymaker.ListAcquiredLocksResponse + 15, // [15:22] is the sub-list for method output_type + 8, // [8:15] is the sub-list for method input_type + 8, // [8:8] is the sub-list for extension type_name + 8, // [8:8] is the sub-list for extension extendee + 0, // [0:8] is the sub-list for field type_name +} + +func init() { file_waymaker_locks_proto_init() } +func file_waymaker_locks_proto_init() { + if File_waymaker_locks_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_waymaker_locks_proto_rawDesc), len(file_waymaker_locks_proto_rawDesc)), + NumEnums: 2, + NumMessages: 15, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_waymaker_locks_proto_goTypes, + DependencyIndexes: file_waymaker_locks_proto_depIdxs, + EnumInfos: file_waymaker_locks_proto_enumTypes, + MessageInfos: file_waymaker_locks_proto_msgTypes, + }.Build() + File_waymaker_locks_proto = out.File + file_waymaker_locks_proto_goTypes = nil + file_waymaker_locks_proto_depIdxs = nil +} diff --git a/go/genpb/locks/waymaker_locks_grpc.pb.go b/go/genpb/locks/waymaker_locks_grpc.pb.go new file mode 100644 index 0000000..51fdc0e --- /dev/null +++ b/go/genpb/locks/waymaker_locks_grpc.pb.go @@ -0,0 +1,414 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: waymaker_locks.proto + +package waymaker + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerService_Lock_FullMethodName = "/waymaker.WaymakerService/Lock" + WaymakerService_ReadLock_FullMethodName = "/waymaker.WaymakerService/ReadLock" + WaymakerService_UnLock_FullMethodName = "/waymaker.WaymakerService/UnLock" + WaymakerService_LeaseStatus_FullMethodName = "/waymaker.WaymakerService/LeaseStatus" + WaymakerService_ExtendLease_FullMethodName = "/waymaker.WaymakerService/ExtendLease" + WaymakerService_MultiLock_FullMethodName = "/waymaker.WaymakerService/MultiLock" + WaymakerService_ListAcquiredLocks_FullMethodName = "/waymaker.WaymakerService/ListAcquiredLocks" +) + +// WaymakerServiceClient is the client API for WaymakerService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// WaymakerService defines a gRPC service for managing distributed locks. +type WaymakerServiceClient interface { + // Lock attempts to acquire a lock based on the provided LockRequest. + // The response is a stream of LockEvent messages that provide updates + // on the status of the lock acquisition. + Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) + // ReadLock attempts to acquire a read lock, which allows multiple readers + // but no writers to hold the lock simultaneously. The response is a stream + // of LockEvent messages that provide updates on the status of the lock acquisition. + ReadLock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) + // UnLock releases a previously acquired lock based on the provided UnLockRequest. + // The response is an UnLockResponse indicating the success or failure of the operation. + UnLock(ctx context.Context, in *UnLockRequest, opts ...grpc.CallOption) (*UnLockResponse, error) + // LeaseStatus retrieves the current status of a lock lease based on the provided + // LeaseStatusRequest. The response is a LeaseStatusResponse containing details + // about the lease. + LeaseStatus(ctx context.Context, in *LeaseStatusRequest, opts ...grpc.CallOption) (*LeaseStatusResponse, error) + // ExtendLease extends the lease of an already acquired lock based on the provided + // ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + // or failure of the operation and the updated lease information. + ExtendLease(ctx context.Context, in *ExtendLeaseRequest, opts ...grpc.CallOption) (*ExtendLeaseResponse, error) + // MultiLock acquires N locks atomically — all keys are granted or none are. + // The server sorts keys lexicographically to guarantee deadlock-free + // ordering between any two MultiLock callers (without this, callers asking + // for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + // applies to the whole batch as a single deadline, not per key. On any + // failure the server releases every key it already acquired in this batch + // before returning. Returns a unary response — no streaming. + MultiLock(ctx context.Context, in *MultiLockRequest, opts ...grpc.CallOption) (*MultiLockResponse, error) + // ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + // request (the node that owns each key via the consistent-hash ring). It is a + // read-only operator/introspection surface (waymaker-ctl `locks list`); it does + // NOT include waiters. An optional `key_prefix` filters the result server-side. + // In a multi-node cluster, call it on each node to see the full picture, since + // each node only holds the locks for the keys it owns. + ListAcquiredLocks(ctx context.Context, in *ListAcquiredLocksRequest, opts ...grpc.CallOption) (*ListAcquiredLocksResponse, error) +} + +type waymakerServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerServiceClient(cc grpc.ClientConnInterface) WaymakerServiceClient { + return &waymakerServiceClient{cc} +} + +func (c *waymakerServiceClient) Lock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerService_ServiceDesc.Streams[0], WaymakerService_Lock_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[LockRequest, LockEvent]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerService_LockClient = grpc.ServerStreamingClient[LockEvent] + +func (c *waymakerServiceClient) ReadLock(ctx context.Context, in *LockRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[LockEvent], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerService_ServiceDesc.Streams[1], WaymakerService_ReadLock_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[LockRequest, LockEvent]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerService_ReadLockClient = grpc.ServerStreamingClient[LockEvent] + +func (c *waymakerServiceClient) UnLock(ctx context.Context, in *UnLockRequest, opts ...grpc.CallOption) (*UnLockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UnLockResponse) + err := c.cc.Invoke(ctx, WaymakerService_UnLock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerServiceClient) LeaseStatus(ctx context.Context, in *LeaseStatusRequest, opts ...grpc.CallOption) (*LeaseStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaseStatusResponse) + err := c.cc.Invoke(ctx, WaymakerService_LeaseStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerServiceClient) ExtendLease(ctx context.Context, in *ExtendLeaseRequest, opts ...grpc.CallOption) (*ExtendLeaseResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ExtendLeaseResponse) + err := c.cc.Invoke(ctx, WaymakerService_ExtendLease_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerServiceClient) MultiLock(ctx context.Context, in *MultiLockRequest, opts ...grpc.CallOption) (*MultiLockResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MultiLockResponse) + err := c.cc.Invoke(ctx, WaymakerService_MultiLock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerServiceClient) ListAcquiredLocks(ctx context.Context, in *ListAcquiredLocksRequest, opts ...grpc.CallOption) (*ListAcquiredLocksResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListAcquiredLocksResponse) + err := c.cc.Invoke(ctx, WaymakerService_ListAcquiredLocks_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WaymakerServiceServer is the server API for WaymakerService service. +// All implementations must embed UnimplementedWaymakerServiceServer +// for forward compatibility. +// +// WaymakerService defines a gRPC service for managing distributed locks. +type WaymakerServiceServer interface { + // Lock attempts to acquire a lock based on the provided LockRequest. + // The response is a stream of LockEvent messages that provide updates + // on the status of the lock acquisition. + Lock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error + // ReadLock attempts to acquire a read lock, which allows multiple readers + // but no writers to hold the lock simultaneously. The response is a stream + // of LockEvent messages that provide updates on the status of the lock acquisition. + ReadLock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error + // UnLock releases a previously acquired lock based on the provided UnLockRequest. + // The response is an UnLockResponse indicating the success or failure of the operation. + UnLock(context.Context, *UnLockRequest) (*UnLockResponse, error) + // LeaseStatus retrieves the current status of a lock lease based on the provided + // LeaseStatusRequest. The response is a LeaseStatusResponse containing details + // about the lease. + LeaseStatus(context.Context, *LeaseStatusRequest) (*LeaseStatusResponse, error) + // ExtendLease extends the lease of an already acquired lock based on the provided + // ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + // or failure of the operation and the updated lease information. + ExtendLease(context.Context, *ExtendLeaseRequest) (*ExtendLeaseResponse, error) + // MultiLock acquires N locks atomically — all keys are granted or none are. + // The server sorts keys lexicographically to guarantee deadlock-free + // ordering between any two MultiLock callers (without this, callers asking + // for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + // applies to the whole batch as a single deadline, not per key. On any + // failure the server releases every key it already acquired in this batch + // before returning. Returns a unary response — no streaming. + MultiLock(context.Context, *MultiLockRequest) (*MultiLockResponse, error) + // ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + // request (the node that owns each key via the consistent-hash ring). It is a + // read-only operator/introspection surface (waymaker-ctl `locks list`); it does + // NOT include waiters. An optional `key_prefix` filters the result server-side. + // In a multi-node cluster, call it on each node to see the full picture, since + // each node only holds the locks for the keys it owns. + ListAcquiredLocks(context.Context, *ListAcquiredLocksRequest) (*ListAcquiredLocksResponse, error) + mustEmbedUnimplementedWaymakerServiceServer() +} + +// UnimplementedWaymakerServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerServiceServer struct{} + +func (UnimplementedWaymakerServiceServer) Lock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error { + return status.Error(codes.Unimplemented, "method Lock not implemented") +} +func (UnimplementedWaymakerServiceServer) ReadLock(*LockRequest, grpc.ServerStreamingServer[LockEvent]) error { + return status.Error(codes.Unimplemented, "method ReadLock not implemented") +} +func (UnimplementedWaymakerServiceServer) UnLock(context.Context, *UnLockRequest) (*UnLockResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UnLock not implemented") +} +func (UnimplementedWaymakerServiceServer) LeaseStatus(context.Context, *LeaseStatusRequest) (*LeaseStatusResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaseStatus not implemented") +} +func (UnimplementedWaymakerServiceServer) ExtendLease(context.Context, *ExtendLeaseRequest) (*ExtendLeaseResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ExtendLease not implemented") +} +func (UnimplementedWaymakerServiceServer) MultiLock(context.Context, *MultiLockRequest) (*MultiLockResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MultiLock not implemented") +} +func (UnimplementedWaymakerServiceServer) ListAcquiredLocks(context.Context, *ListAcquiredLocksRequest) (*ListAcquiredLocksResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListAcquiredLocks not implemented") +} +func (UnimplementedWaymakerServiceServer) mustEmbedUnimplementedWaymakerServiceServer() {} +func (UnimplementedWaymakerServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerServiceServer will +// result in compilation errors. +type UnsafeWaymakerServiceServer interface { + mustEmbedUnimplementedWaymakerServiceServer() +} + +func RegisterWaymakerServiceServer(s grpc.ServiceRegistrar, srv WaymakerServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerService_ServiceDesc, srv) +} + +func _WaymakerService_Lock_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(LockRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerServiceServer).Lock(m, &grpc.GenericServerStream[LockRequest, LockEvent]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerService_LockServer = grpc.ServerStreamingServer[LockEvent] + +func _WaymakerService_ReadLock_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(LockRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerServiceServer).ReadLock(m, &grpc.GenericServerStream[LockRequest, LockEvent]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerService_ReadLockServer = grpc.ServerStreamingServer[LockEvent] + +func _WaymakerService_UnLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnLockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerServiceServer).UnLock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerService_UnLock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerServiceServer).UnLock(ctx, req.(*UnLockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerService_LeaseStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaseStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerServiceServer).LeaseStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerService_LeaseStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerServiceServer).LeaseStatus(ctx, req.(*LeaseStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerService_ExtendLease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ExtendLeaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerServiceServer).ExtendLease(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerService_ExtendLease_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerServiceServer).ExtendLease(ctx, req.(*ExtendLeaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerService_MultiLock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MultiLockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerServiceServer).MultiLock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerService_MultiLock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerServiceServer).MultiLock(ctx, req.(*MultiLockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerService_ListAcquiredLocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListAcquiredLocksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerServiceServer).ListAcquiredLocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerService_ListAcquiredLocks_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerServiceServer).ListAcquiredLocks(ctx, req.(*ListAcquiredLocksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WaymakerService_ServiceDesc is the grpc.ServiceDesc for WaymakerService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.WaymakerService", + HandlerType: (*WaymakerServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UnLock", + Handler: _WaymakerService_UnLock_Handler, + }, + { + MethodName: "LeaseStatus", + Handler: _WaymakerService_LeaseStatus_Handler, + }, + { + MethodName: "ExtendLease", + Handler: _WaymakerService_ExtendLease_Handler, + }, + { + MethodName: "MultiLock", + Handler: _WaymakerService_MultiLock_Handler, + }, + { + MethodName: "ListAcquiredLocks", + Handler: _WaymakerService_ListAcquiredLocks_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Lock", + Handler: _WaymakerService_Lock_Handler, + ServerStreams: true, + }, + { + StreamName: "ReadLock", + Handler: _WaymakerService_ReadLock_Handler, + ServerStreams: true, + }, + }, + Metadata: "waymaker_locks.proto", +} diff --git a/go/genpb/sketches/sketches.pb.go b/go/genpb/sketches/sketches.pb.go new file mode 100644 index 0000000..066cd7f --- /dev/null +++ b/go/genpb/sketches/sketches.pb.go @@ -0,0 +1,3780 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: sketches.proto + +package waymaker_sketches + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ProbType int32 + +const ( + ProbType_PROB_UNSPECIFIED ProbType = 0 + ProbType_PROB_BLOOM ProbType = 1 + ProbType_PROB_HLL ProbType = 2 + ProbType_PROB_CMS ProbType = 3 + ProbType_PROB_TOPK ProbType = 4 + ProbType_PROB_TDIGEST ProbType = 5 +) + +// Enum value maps for ProbType. +var ( + ProbType_name = map[int32]string{ + 0: "PROB_UNSPECIFIED", + 1: "PROB_BLOOM", + 2: "PROB_HLL", + 3: "PROB_CMS", + 4: "PROB_TOPK", + 5: "PROB_TDIGEST", + } + ProbType_value = map[string]int32{ + "PROB_UNSPECIFIED": 0, + "PROB_BLOOM": 1, + "PROB_HLL": 2, + "PROB_CMS": 3, + "PROB_TOPK": 4, + "PROB_TDIGEST": 5, + } +) + +func (x ProbType) Enum() *ProbType { + p := new(ProbType) + *p = x + return p +} + +func (x ProbType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProbType) Descriptor() protoreflect.EnumDescriptor { + return file_sketches_proto_enumTypes[0].Descriptor() +} + +func (ProbType) Type() protoreflect.EnumType { + return &file_sketches_proto_enumTypes[0] +} + +func (x ProbType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ProbType.Descriptor instead. +func (ProbType) EnumDescriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{0} +} + +type BloomReserveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Capacity uint64 `protobuf:"varint,2,opt,name=capacity,proto3" json:"capacity,omitempty"` + ErrorRate float64 `protobuf:"fixed64,3,opt,name=error_rate,json=errorRate,proto3" json:"error_rate,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomReserveRequest) Reset() { + *x = BloomReserveRequest{} + mi := &file_sketches_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomReserveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomReserveRequest) ProtoMessage() {} + +func (x *BloomReserveRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomReserveRequest.ProtoReflect.Descriptor instead. +func (*BloomReserveRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{0} +} + +func (x *BloomReserveRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BloomReserveRequest) GetCapacity() uint64 { + if x != nil { + return x.Capacity + } + return 0 +} + +func (x *BloomReserveRequest) GetErrorRate() float64 { + if x != nil { + return x.ErrorRate + } + return 0 +} + +type BloomReserveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomReserveResponse) Reset() { + *x = BloomReserveResponse{} + mi := &file_sketches_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomReserveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomReserveResponse) ProtoMessage() {} + +func (x *BloomReserveResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomReserveResponse.ProtoReflect.Descriptor instead. +func (*BloomReserveResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{1} +} + +func (x *BloomReserveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomReserveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomReserveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type BloomAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Item []byte `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomAddRequest) Reset() { + *x = BloomAddRequest{} + mi := &file_sketches_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomAddRequest) ProtoMessage() {} + +func (x *BloomAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomAddRequest.ProtoReflect.Descriptor instead. +func (*BloomAddRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{2} +} + +func (x *BloomAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BloomAddRequest) GetItem() []byte { + if x != nil { + return x.Item + } + return nil +} + +type BloomAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomAddResponse) Reset() { + *x = BloomAddResponse{} + mi := &file_sketches_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomAddResponse) ProtoMessage() {} + +func (x *BloomAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomAddResponse.ProtoReflect.Descriptor instead. +func (*BloomAddResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{3} +} + +func (x *BloomAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type BloomMultiAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomMultiAddRequest) Reset() { + *x = BloomMultiAddRequest{} + mi := &file_sketches_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomMultiAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomMultiAddRequest) ProtoMessage() {} + +func (x *BloomMultiAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomMultiAddRequest.ProtoReflect.Descriptor instead. +func (*BloomMultiAddRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{4} +} + +func (x *BloomMultiAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BloomMultiAddRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type BloomMultiAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomMultiAddResponse) Reset() { + *x = BloomMultiAddResponse{} + mi := &file_sketches_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomMultiAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomMultiAddResponse) ProtoMessage() {} + +func (x *BloomMultiAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomMultiAddResponse.ProtoReflect.Descriptor instead. +func (*BloomMultiAddResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{5} +} + +func (x *BloomMultiAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomMultiAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomMultiAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type BloomExistsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Item []byte `protobuf:"bytes,2,opt,name=item,proto3" json:"item,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomExistsRequest) Reset() { + *x = BloomExistsRequest{} + mi := &file_sketches_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomExistsRequest) ProtoMessage() {} + +func (x *BloomExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomExistsRequest.ProtoReflect.Descriptor instead. +func (*BloomExistsRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{6} +} + +func (x *BloomExistsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BloomExistsRequest) GetItem() []byte { + if x != nil { + return x.Item + } + return nil +} + +type BloomExistsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Exists bool `protobuf:"varint,4,opt,name=exists,proto3" json:"exists,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomExistsResponse) Reset() { + *x = BloomExistsResponse{} + mi := &file_sketches_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomExistsResponse) ProtoMessage() {} + +func (x *BloomExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomExistsResponse.ProtoReflect.Descriptor instead. +func (*BloomExistsResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{7} +} + +func (x *BloomExistsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomExistsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomExistsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *BloomExistsResponse) GetExists() bool { + if x != nil { + return x.Exists + } + return false +} + +type BloomMultiExistsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomMultiExistsRequest) Reset() { + *x = BloomMultiExistsRequest{} + mi := &file_sketches_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomMultiExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomMultiExistsRequest) ProtoMessage() {} + +func (x *BloomMultiExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomMultiExistsRequest.ProtoReflect.Descriptor instead. +func (*BloomMultiExistsRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{8} +} + +func (x *BloomMultiExistsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *BloomMultiExistsRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type BloomMultiExistsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Exists []bool `protobuf:"varint,4,rep,packed,name=exists,proto3" json:"exists,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomMultiExistsResponse) Reset() { + *x = BloomMultiExistsResponse{} + mi := &file_sketches_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomMultiExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomMultiExistsResponse) ProtoMessage() {} + +func (x *BloomMultiExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomMultiExistsResponse.ProtoReflect.Descriptor instead. +func (*BloomMultiExistsResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{9} +} + +func (x *BloomMultiExistsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomMultiExistsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomMultiExistsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *BloomMultiExistsResponse) GetExists() []bool { + if x != nil { + return x.Exists + } + return nil +} + +type BloomInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomInfoRequest) Reset() { + *x = BloomInfoRequest{} + mi := &file_sketches_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomInfoRequest) ProtoMessage() {} + +func (x *BloomInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomInfoRequest.ProtoReflect.Descriptor instead. +func (*BloomInfoRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{10} +} + +func (x *BloomInfoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type BloomInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Capacity uint64 `protobuf:"varint,4,opt,name=capacity,proto3" json:"capacity,omitempty"` + ErrorRate float64 `protobuf:"fixed64,5,opt,name=error_rate,json=errorRate,proto3" json:"error_rate,omitempty"` + BitsSet uint64 `protobuf:"varint,6,opt,name=bits_set,json=bitsSet,proto3" json:"bits_set,omitempty"` + BitCount uint64 `protobuf:"varint,7,opt,name=bit_count,json=bitCount,proto3" json:"bit_count,omitempty"` + HashCount uint32 `protobuf:"varint,8,opt,name=hash_count,json=hashCount,proto3" json:"hash_count,omitempty"` + ItemsAdded uint64 `protobuf:"varint,9,opt,name=items_added,json=itemsAdded,proto3" json:"items_added,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomInfoResponse) Reset() { + *x = BloomInfoResponse{} + mi := &file_sketches_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomInfoResponse) ProtoMessage() {} + +func (x *BloomInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomInfoResponse.ProtoReflect.Descriptor instead. +func (*BloomInfoResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{11} +} + +func (x *BloomInfoResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomInfoResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomInfoResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *BloomInfoResponse) GetCapacity() uint64 { + if x != nil { + return x.Capacity + } + return 0 +} + +func (x *BloomInfoResponse) GetErrorRate() float64 { + if x != nil { + return x.ErrorRate + } + return 0 +} + +func (x *BloomInfoResponse) GetBitsSet() uint64 { + if x != nil { + return x.BitsSet + } + return 0 +} + +func (x *BloomInfoResponse) GetBitCount() uint64 { + if x != nil { + return x.BitCount + } + return 0 +} + +func (x *BloomInfoResponse) GetHashCount() uint32 { + if x != nil { + return x.HashCount + } + return 0 +} + +func (x *BloomInfoResponse) GetItemsAdded() uint64 { + if x != nil { + return x.ItemsAdded + } + return 0 +} + +type BloomDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomDeleteRequest) Reset() { + *x = BloomDeleteRequest{} + mi := &file_sketches_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomDeleteRequest) ProtoMessage() {} + +func (x *BloomDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomDeleteRequest.ProtoReflect.Descriptor instead. +func (*BloomDeleteRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{12} +} + +func (x *BloomDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type BloomDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BloomDeleteResponse) Reset() { + *x = BloomDeleteResponse{} + mi := &file_sketches_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BloomDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BloomDeleteResponse) ProtoMessage() {} + +func (x *BloomDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BloomDeleteResponse.ProtoReflect.Descriptor instead. +func (*BloomDeleteResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{13} +} + +func (x *BloomDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *BloomDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *BloomDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HllReserveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Precision uint32 `protobuf:"varint,2,opt,name=precision,proto3" json:"precision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllReserveRequest) Reset() { + *x = HllReserveRequest{} + mi := &file_sketches_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllReserveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllReserveRequest) ProtoMessage() {} + +func (x *HllReserveRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllReserveRequest.ProtoReflect.Descriptor instead. +func (*HllReserveRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{14} +} + +func (x *HllReserveRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *HllReserveRequest) GetPrecision() uint32 { + if x != nil { + return x.Precision + } + return 0 +} + +type HllReserveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllReserveResponse) Reset() { + *x = HllReserveResponse{} + mi := &file_sketches_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllReserveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllReserveResponse) ProtoMessage() {} + +func (x *HllReserveResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllReserveResponse.ProtoReflect.Descriptor instead. +func (*HllReserveResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{15} +} + +func (x *HllReserveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HllReserveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HllReserveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HllAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllAddRequest) Reset() { + *x = HllAddRequest{} + mi := &file_sketches_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllAddRequest) ProtoMessage() {} + +func (x *HllAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllAddRequest.ProtoReflect.Descriptor instead. +func (*HllAddRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{16} +} + +func (x *HllAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *HllAddRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type HllAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllAddResponse) Reset() { + *x = HllAddResponse{} + mi := &file_sketches_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllAddResponse) ProtoMessage() {} + +func (x *HllAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllAddResponse.ProtoReflect.Descriptor instead. +func (*HllAddResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{17} +} + +func (x *HllAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HllAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HllAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HllCountRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllCountRequest) Reset() { + *x = HllCountRequest{} + mi := &file_sketches_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllCountRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllCountRequest) ProtoMessage() {} + +func (x *HllCountRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllCountRequest.ProtoReflect.Descriptor instead. +func (*HllCountRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{18} +} + +func (x *HllCountRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type HllCountResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Estimate uint64 `protobuf:"varint,4,opt,name=estimate,proto3" json:"estimate,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllCountResponse) Reset() { + *x = HllCountResponse{} + mi := &file_sketches_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllCountResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllCountResponse) ProtoMessage() {} + +func (x *HllCountResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllCountResponse.ProtoReflect.Descriptor instead. +func (*HllCountResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{19} +} + +func (x *HllCountResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HllCountResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HllCountResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HllCountResponse) GetEstimate() uint64 { + if x != nil { + return x.Estimate + } + return 0 +} + +type HllMergeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + Sources []string `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllMergeRequest) Reset() { + *x = HllMergeRequest{} + mi := &file_sketches_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllMergeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllMergeRequest) ProtoMessage() {} + +func (x *HllMergeRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllMergeRequest.ProtoReflect.Descriptor instead. +func (*HllMergeRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{20} +} + +func (x *HllMergeRequest) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *HllMergeRequest) GetSources() []string { + if x != nil { + return x.Sources + } + return nil +} + +type HllMergeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllMergeResponse) Reset() { + *x = HllMergeResponse{} + mi := &file_sketches_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllMergeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllMergeResponse) ProtoMessage() {} + +func (x *HllMergeResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllMergeResponse.ProtoReflect.Descriptor instead. +func (*HllMergeResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{21} +} + +func (x *HllMergeResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HllMergeResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HllMergeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HllDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllDeleteRequest) Reset() { + *x = HllDeleteRequest{} + mi := &file_sketches_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllDeleteRequest) ProtoMessage() {} + +func (x *HllDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllDeleteRequest.ProtoReflect.Descriptor instead. +func (*HllDeleteRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{22} +} + +func (x *HllDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type HllDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HllDeleteResponse) Reset() { + *x = HllDeleteResponse{} + mi := &file_sketches_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HllDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HllDeleteResponse) ProtoMessage() {} + +func (x *HllDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HllDeleteResponse.ProtoReflect.Descriptor instead. +func (*HllDeleteResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{23} +} + +func (x *HllDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HllDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HllDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CmsReserveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Width uint64 `protobuf:"varint,2,opt,name=width,proto3" json:"width,omitempty"` + Depth uint64 `protobuf:"varint,3,opt,name=depth,proto3" json:"depth,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsReserveRequest) Reset() { + *x = CmsReserveRequest{} + mi := &file_sketches_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsReserveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsReserveRequest) ProtoMessage() {} + +func (x *CmsReserveRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsReserveRequest.ProtoReflect.Descriptor instead. +func (*CmsReserveRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{24} +} + +func (x *CmsReserveRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CmsReserveRequest) GetWidth() uint64 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *CmsReserveRequest) GetDepth() uint64 { + if x != nil { + return x.Depth + } + return 0 +} + +type CmsReserveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsReserveResponse) Reset() { + *x = CmsReserveResponse{} + mi := &file_sketches_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsReserveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsReserveResponse) ProtoMessage() {} + +func (x *CmsReserveResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsReserveResponse.ProtoReflect.Descriptor instead. +func (*CmsReserveResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{25} +} + +func (x *CmsReserveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CmsReserveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CmsReserveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type CmsIncrByItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + Item []byte `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsIncrByItem) Reset() { + *x = CmsIncrByItem{} + mi := &file_sketches_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsIncrByItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsIncrByItem) ProtoMessage() {} + +func (x *CmsIncrByItem) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsIncrByItem.ProtoReflect.Descriptor instead. +func (*CmsIncrByItem) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{26} +} + +func (x *CmsIncrByItem) GetItem() []byte { + if x != nil { + return x.Item + } + return nil +} + +func (x *CmsIncrByItem) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type CmsIncrByRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items []*CmsIncrByItem `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsIncrByRequest) Reset() { + *x = CmsIncrByRequest{} + mi := &file_sketches_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsIncrByRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsIncrByRequest) ProtoMessage() {} + +func (x *CmsIncrByRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsIncrByRequest.ProtoReflect.Descriptor instead. +func (*CmsIncrByRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{27} +} + +func (x *CmsIncrByRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CmsIncrByRequest) GetItems() []*CmsIncrByItem { + if x != nil { + return x.Items + } + return nil +} + +type CmsIncrByResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Counts []uint64 `protobuf:"varint,4,rep,packed,name=counts,proto3" json:"counts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsIncrByResponse) Reset() { + *x = CmsIncrByResponse{} + mi := &file_sketches_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsIncrByResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsIncrByResponse) ProtoMessage() {} + +func (x *CmsIncrByResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsIncrByResponse.ProtoReflect.Descriptor instead. +func (*CmsIncrByResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{28} +} + +func (x *CmsIncrByResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CmsIncrByResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CmsIncrByResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CmsIncrByResponse) GetCounts() []uint64 { + if x != nil { + return x.Counts + } + return nil +} + +type CmsQueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsQueryRequest) Reset() { + *x = CmsQueryRequest{} + mi := &file_sketches_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsQueryRequest) ProtoMessage() {} + +func (x *CmsQueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsQueryRequest.ProtoReflect.Descriptor instead. +func (*CmsQueryRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{29} +} + +func (x *CmsQueryRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CmsQueryRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type CmsQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Counts []uint64 `protobuf:"varint,4,rep,packed,name=counts,proto3" json:"counts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsQueryResponse) Reset() { + *x = CmsQueryResponse{} + mi := &file_sketches_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsQueryResponse) ProtoMessage() {} + +func (x *CmsQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsQueryResponse.ProtoReflect.Descriptor instead. +func (*CmsQueryResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{30} +} + +func (x *CmsQueryResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CmsQueryResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CmsQueryResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *CmsQueryResponse) GetCounts() []uint64 { + if x != nil { + return x.Counts + } + return nil +} + +type CmsDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsDeleteRequest) Reset() { + *x = CmsDeleteRequest{} + mi := &file_sketches_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsDeleteRequest) ProtoMessage() {} + +func (x *CmsDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsDeleteRequest.ProtoReflect.Descriptor instead. +func (*CmsDeleteRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{31} +} + +func (x *CmsDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CmsDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CmsDeleteResponse) Reset() { + *x = CmsDeleteResponse{} + mi := &file_sketches_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CmsDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CmsDeleteResponse) ProtoMessage() {} + +func (x *CmsDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CmsDeleteResponse.ProtoReflect.Descriptor instead. +func (*CmsDeleteResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{32} +} + +func (x *CmsDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CmsDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CmsDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TopKReserveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + K uint32 `protobuf:"varint,2,opt,name=k,proto3" json:"k,omitempty"` + Width uint64 `protobuf:"varint,3,opt,name=width,proto3" json:"width,omitempty"` + Depth uint64 `protobuf:"varint,4,opt,name=depth,proto3" json:"depth,omitempty"` + Decay float64 `protobuf:"fixed64,5,opt,name=decay,proto3" json:"decay,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKReserveRequest) Reset() { + *x = TopKReserveRequest{} + mi := &file_sketches_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKReserveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKReserveRequest) ProtoMessage() {} + +func (x *TopKReserveRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKReserveRequest.ProtoReflect.Descriptor instead. +func (*TopKReserveRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{33} +} + +func (x *TopKReserveRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TopKReserveRequest) GetK() uint32 { + if x != nil { + return x.K + } + return 0 +} + +func (x *TopKReserveRequest) GetWidth() uint64 { + if x != nil { + return x.Width + } + return 0 +} + +func (x *TopKReserveRequest) GetDepth() uint64 { + if x != nil { + return x.Depth + } + return 0 +} + +func (x *TopKReserveRequest) GetDecay() float64 { + if x != nil { + return x.Decay + } + return 0 +} + +type TopKReserveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKReserveResponse) Reset() { + *x = TopKReserveResponse{} + mi := &file_sketches_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKReserveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKReserveResponse) ProtoMessage() {} + +func (x *TopKReserveResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKReserveResponse.ProtoReflect.Descriptor instead. +func (*TopKReserveResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{34} +} + +func (x *TopKReserveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TopKReserveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TopKReserveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TopKAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKAddRequest) Reset() { + *x = TopKAddRequest{} + mi := &file_sketches_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKAddRequest) ProtoMessage() {} + +func (x *TopKAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKAddRequest.ProtoReflect.Descriptor instead. +func (*TopKAddRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{35} +} + +func (x *TopKAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TopKAddRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type TopKAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Evicted [][]byte `protobuf:"bytes,4,rep,name=evicted,proto3" json:"evicted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKAddResponse) Reset() { + *x = TopKAddResponse{} + mi := &file_sketches_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKAddResponse) ProtoMessage() {} + +func (x *TopKAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKAddResponse.ProtoReflect.Descriptor instead. +func (*TopKAddResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{36} +} + +func (x *TopKAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TopKAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TopKAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *TopKAddResponse) GetEvicted() [][]byte { + if x != nil { + return x.Evicted + } + return nil +} + +type TopKQueryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Items [][]byte `protobuf:"bytes,2,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKQueryRequest) Reset() { + *x = TopKQueryRequest{} + mi := &file_sketches_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKQueryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKQueryRequest) ProtoMessage() {} + +func (x *TopKQueryRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKQueryRequest.ProtoReflect.Descriptor instead. +func (*TopKQueryRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{37} +} + +func (x *TopKQueryRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TopKQueryRequest) GetItems() [][]byte { + if x != nil { + return x.Items + } + return nil +} + +type TopKQueryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + InTopK []bool `protobuf:"varint,4,rep,packed,name=in_top_k,json=inTopK,proto3" json:"in_top_k,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKQueryResponse) Reset() { + *x = TopKQueryResponse{} + mi := &file_sketches_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKQueryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKQueryResponse) ProtoMessage() {} + +func (x *TopKQueryResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKQueryResponse.ProtoReflect.Descriptor instead. +func (*TopKQueryResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{38} +} + +func (x *TopKQueryResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TopKQueryResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TopKQueryResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *TopKQueryResponse) GetInTopK() []bool { + if x != nil { + return x.InTopK + } + return nil +} + +type TopKListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKListRequest) Reset() { + *x = TopKListRequest{} + mi := &file_sketches_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKListRequest) ProtoMessage() {} + +func (x *TopKListRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKListRequest.ProtoReflect.Descriptor instead. +func (*TopKListRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{39} +} + +func (x *TopKListRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TopKListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*TopKEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKListResponse) Reset() { + *x = TopKListResponse{} + mi := &file_sketches_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKListResponse) ProtoMessage() {} + +func (x *TopKListResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKListResponse.ProtoReflect.Descriptor instead. +func (*TopKListResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{40} +} + +func (x *TopKListResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TopKListResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TopKListResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *TopKListResponse) GetEntries() []*TopKEntry { + if x != nil { + return x.Entries + } + return nil +} + +type TopKEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Item []byte `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` + Count uint64 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKEntry) Reset() { + *x = TopKEntry{} + mi := &file_sketches_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKEntry) ProtoMessage() {} + +func (x *TopKEntry) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKEntry.ProtoReflect.Descriptor instead. +func (*TopKEntry) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{41} +} + +func (x *TopKEntry) GetItem() []byte { + if x != nil { + return x.Item + } + return nil +} + +func (x *TopKEntry) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type TopKDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKDeleteRequest) Reset() { + *x = TopKDeleteRequest{} + mi := &file_sketches_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKDeleteRequest) ProtoMessage() {} + +func (x *TopKDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKDeleteRequest.ProtoReflect.Descriptor instead. +func (*TopKDeleteRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{42} +} + +func (x *TopKDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TopKDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopKDeleteResponse) Reset() { + *x = TopKDeleteResponse{} + mi := &file_sketches_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopKDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopKDeleteResponse) ProtoMessage() {} + +func (x *TopKDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopKDeleteResponse.ProtoReflect.Descriptor instead. +func (*TopKDeleteResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{43} +} + +func (x *TopKDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TopKDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TopKDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TDigestCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Compression uint32 `protobuf:"varint,2,opt,name=compression,proto3" json:"compression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestCreateRequest) Reset() { + *x = TDigestCreateRequest{} + mi := &file_sketches_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestCreateRequest) ProtoMessage() {} + +func (x *TDigestCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestCreateRequest.ProtoReflect.Descriptor instead. +func (*TDigestCreateRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{44} +} + +func (x *TDigestCreateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TDigestCreateRequest) GetCompression() uint32 { + if x != nil { + return x.Compression + } + return 0 +} + +type TDigestCreateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestCreateResponse) Reset() { + *x = TDigestCreateResponse{} + mi := &file_sketches_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestCreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestCreateResponse) ProtoMessage() {} + +func (x *TDigestCreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestCreateResponse.ProtoReflect.Descriptor instead. +func (*TDigestCreateResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{45} +} + +func (x *TDigestCreateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TDigestCreateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TDigestCreateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TDigestAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Values []float64 `protobuf:"fixed64,2,rep,packed,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestAddRequest) Reset() { + *x = TDigestAddRequest{} + mi := &file_sketches_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestAddRequest) ProtoMessage() {} + +func (x *TDigestAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestAddRequest.ProtoReflect.Descriptor instead. +func (*TDigestAddRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{46} +} + +func (x *TDigestAddRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TDigestAddRequest) GetValues() []float64 { + if x != nil { + return x.Values + } + return nil +} + +type TDigestAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestAddResponse) Reset() { + *x = TDigestAddResponse{} + mi := &file_sketches_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestAddResponse) ProtoMessage() {} + +func (x *TDigestAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestAddResponse.ProtoReflect.Descriptor instead. +func (*TDigestAddResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{47} +} + +func (x *TDigestAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TDigestAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TDigestAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TDigestQuantileRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Quantiles []float64 `protobuf:"fixed64,2,rep,packed,name=quantiles,proto3" json:"quantiles,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestQuantileRequest) Reset() { + *x = TDigestQuantileRequest{} + mi := &file_sketches_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestQuantileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestQuantileRequest) ProtoMessage() {} + +func (x *TDigestQuantileRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestQuantileRequest.ProtoReflect.Descriptor instead. +func (*TDigestQuantileRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{48} +} + +func (x *TDigestQuantileRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *TDigestQuantileRequest) GetQuantiles() []float64 { + if x != nil { + return x.Quantiles + } + return nil +} + +type TDigestQuantileResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Values []float64 `protobuf:"fixed64,4,rep,packed,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestQuantileResponse) Reset() { + *x = TDigestQuantileResponse{} + mi := &file_sketches_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestQuantileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestQuantileResponse) ProtoMessage() {} + +func (x *TDigestQuantileResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestQuantileResponse.ProtoReflect.Descriptor instead. +func (*TDigestQuantileResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{49} +} + +func (x *TDigestQuantileResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TDigestQuantileResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TDigestQuantileResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *TDigestQuantileResponse) GetValues() []float64 { + if x != nil { + return x.Values + } + return nil +} + +type TDigestMinMaxRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestMinMaxRequest) Reset() { + *x = TDigestMinMaxRequest{} + mi := &file_sketches_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestMinMaxRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestMinMaxRequest) ProtoMessage() {} + +func (x *TDigestMinMaxRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestMinMaxRequest.ProtoReflect.Descriptor instead. +func (*TDigestMinMaxRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{50} +} + +func (x *TDigestMinMaxRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TDigestMinMaxResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Min float64 `protobuf:"fixed64,4,opt,name=min,proto3" json:"min,omitempty"` + Max float64 `protobuf:"fixed64,5,opt,name=max,proto3" json:"max,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestMinMaxResponse) Reset() { + *x = TDigestMinMaxResponse{} + mi := &file_sketches_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestMinMaxResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestMinMaxResponse) ProtoMessage() {} + +func (x *TDigestMinMaxResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestMinMaxResponse.ProtoReflect.Descriptor instead. +func (*TDigestMinMaxResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{51} +} + +func (x *TDigestMinMaxResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TDigestMinMaxResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TDigestMinMaxResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *TDigestMinMaxResponse) GetMin() float64 { + if x != nil { + return x.Min + } + return 0 +} + +func (x *TDigestMinMaxResponse) GetMax() float64 { + if x != nil { + return x.Max + } + return 0 +} + +type TDigestDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestDeleteRequest) Reset() { + *x = TDigestDeleteRequest{} + mi := &file_sketches_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestDeleteRequest) ProtoMessage() {} + +func (x *TDigestDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestDeleteRequest.ProtoReflect.Descriptor instead. +func (*TDigestDeleteRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{52} +} + +func (x *TDigestDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type TDigestDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TDigestDeleteResponse) Reset() { + *x = TDigestDeleteResponse{} + mi := &file_sketches_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TDigestDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TDigestDeleteResponse) ProtoMessage() {} + +func (x *TDigestDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TDigestDeleteResponse.ProtoReflect.Descriptor instead. +func (*TDigestDeleteResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{53} +} + +func (x *TDigestDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TDigestDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TDigestDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ReplicateProbStateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type ProbType `protobuf:"varint,1,opt,name=type,proto3,enum=waymaker.sketches.ProbType" json:"type,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Opaque binary snapshot — see specs/WIRE_SPEC.md "Probabilistic + // subsystem" for the per-type byte layout. + Snapshot []byte `protobuf:"bytes,3,opt,name=snapshot,proto3" json:"snapshot,omitempty"` + Version uint64 `protobuf:"varint,4,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateProbStateRequest) Reset() { + *x = ReplicateProbStateRequest{} + mi := &file_sketches_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateProbStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateProbStateRequest) ProtoMessage() {} + +func (x *ReplicateProbStateRequest) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateProbStateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateProbStateRequest) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{54} +} + +func (x *ReplicateProbStateRequest) GetType() ProbType { + if x != nil { + return x.Type + } + return ProbType_PROB_UNSPECIFIED +} + +func (x *ReplicateProbStateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ReplicateProbStateRequest) GetSnapshot() []byte { + if x != nil { + return x.Snapshot + } + return nil +} + +func (x *ReplicateProbStateRequest) GetVersion() uint64 { + if x != nil { + return x.Version + } + return 0 +} + +type ReplicateProbStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateProbStateResponse) Reset() { + *x = ReplicateProbStateResponse{} + mi := &file_sketches_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateProbStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateProbStateResponse) ProtoMessage() {} + +func (x *ReplicateProbStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_sketches_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateProbStateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateProbStateResponse) Descriptor() ([]byte, []int) { + return file_sketches_proto_rawDescGZIP(), []int{55} +} + +func (x *ReplicateProbStateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateProbStateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateProbStateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_sketches_proto protoreflect.FileDescriptor + +const file_sketches_proto_rawDesc = "" + + "\n" + + "\x0esketches.proto\x12\x11waymaker.sketches\"d\n" + + "\x13BloomReserveRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1a\n" + + "\bcapacity\x18\x02 \x01(\x04R\bcapacity\x12\x1d\n" + + "\n" + + "error_rate\x18\x03 \x01(\x01R\terrorRate\"k\n" + + "\x14BloomReserveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"9\n" + + "\x0fBloomAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04item\x18\x02 \x01(\fR\x04item\"g\n" + + "\x10BloomAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"@\n" + + "\x14BloomMultiAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"l\n" + + "\x15BloomMultiAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"<\n" + + "\x12BloomExistsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n" + + "\x04item\x18\x02 \x01(\fR\x04item\"\x82\x01\n" + + "\x13BloomExistsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06exists\x18\x04 \x01(\bR\x06exists\"C\n" + + "\x17BloomMultiExistsRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"\x87\x01\n" + + "\x18BloomMultiExistsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06exists\x18\x04 \x03(\bR\x06exists\"&\n" + + "\x10BloomInfoRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x9b\x02\n" + + "\x11BloomInfoResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\bcapacity\x18\x04 \x01(\x04R\bcapacity\x12\x1d\n" + + "\n" + + "error_rate\x18\x05 \x01(\x01R\terrorRate\x12\x19\n" + + "\bbits_set\x18\x06 \x01(\x04R\abitsSet\x12\x1b\n" + + "\tbit_count\x18\a \x01(\x04R\bbitCount\x12\x1d\n" + + "\n" + + "hash_count\x18\b \x01(\rR\thashCount\x12\x1f\n" + + "\vitems_added\x18\t \x01(\x04R\n" + + "itemsAdded\"(\n" + + "\x12BloomDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"j\n" + + "\x13BloomDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"E\n" + + "\x11HllReserveRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n" + + "\tprecision\x18\x02 \x01(\rR\tprecision\"i\n" + + "\x12HllReserveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"9\n" + + "\rHllAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"e\n" + + "\x0eHllAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"%\n" + + "\x0fHllCountRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x83\x01\n" + + "\x10HllCountResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\bestimate\x18\x04 \x01(\x04R\bestimate\"M\n" + + "\x0fHllMergeRequest\x12 \n" + + "\vdestination\x18\x01 \x01(\tR\vdestination\x12\x18\n" + + "\asources\x18\x02 \x03(\tR\asources\"g\n" + + "\x10HllMergeResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"&\n" + + "\x10HllDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"h\n" + + "\x11HllDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"S\n" + + "\x11CmsReserveRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05width\x18\x02 \x01(\x04R\x05width\x12\x14\n" + + "\x05depth\x18\x03 \x01(\x04R\x05depth\"i\n" + + "\x12CmsReserveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"9\n" + + "\rCmsIncrByItem\x12\x12\n" + + "\x04item\x18\x01 \x01(\fR\x04item\x12\x14\n" + + "\x05count\x18\x02 \x01(\x04R\x05count\"^\n" + + "\x10CmsIncrByRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x126\n" + + "\x05items\x18\x02 \x03(\v2 .waymaker.sketches.CmsIncrByItemR\x05items\"\x80\x01\n" + + "\x11CmsIncrByResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06counts\x18\x04 \x03(\x04R\x06counts\";\n" + + "\x0fCmsQueryRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"\x7f\n" + + "\x10CmsQueryResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06counts\x18\x04 \x03(\x04R\x06counts\"&\n" + + "\x10CmsDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"h\n" + + "\x11CmsDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"x\n" + + "\x12TopKReserveRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\f\n" + + "\x01k\x18\x02 \x01(\rR\x01k\x12\x14\n" + + "\x05width\x18\x03 \x01(\x04R\x05width\x12\x14\n" + + "\x05depth\x18\x04 \x01(\x04R\x05depth\x12\x14\n" + + "\x05decay\x18\x05 \x01(\x01R\x05decay\"j\n" + + "\x13TopKReserveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\":\n" + + "\x0eTopKAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"\x80\x01\n" + + "\x0fTopKAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\aevicted\x18\x04 \x03(\fR\aevicted\"<\n" + + "\x10TopKQueryRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05items\x18\x02 \x03(\fR\x05items\"\x82\x01\n" + + "\x11TopKQueryResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\bin_top_k\x18\x04 \x03(\bR\x06inTopK\"%\n" + + "\x0fTopKListRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x9f\x01\n" + + "\x10TopKListResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x126\n" + + "\aentries\x18\x04 \x03(\v2\x1c.waymaker.sketches.TopKEntryR\aentries\"5\n" + + "\tTopKEntry\x12\x12\n" + + "\x04item\x18\x01 \x01(\fR\x04item\x12\x14\n" + + "\x05count\x18\x02 \x01(\x04R\x05count\"'\n" + + "\x11TopKDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"i\n" + + "\x12TopKDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"L\n" + + "\x14TDigestCreateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12 \n" + + "\vcompression\x18\x02 \x01(\rR\vcompression\"l\n" + + "\x15TDigestCreateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"?\n" + + "\x11TDigestAddRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + + "\x06values\x18\x02 \x03(\x01R\x06values\"i\n" + + "\x12TDigestAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"J\n" + + "\x16TDigestQuantileRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1c\n" + + "\tquantiles\x18\x02 \x03(\x01R\tquantiles\"\x86\x01\n" + + "\x17TDigestQuantileResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06values\x18\x04 \x03(\x01R\x06values\"*\n" + + "\x14TDigestMinMaxRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\x90\x01\n" + + "\x15TDigestMinMaxResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x10\n" + + "\x03min\x18\x04 \x01(\x01R\x03min\x12\x10\n" + + "\x03max\x18\x05 \x01(\x01R\x03max\"*\n" + + "\x14TDigestDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"l\n" + + "\x15TDigestDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\x96\x01\n" + + "\x19ReplicateProbStateRequest\x12/\n" + + "\x04type\x18\x01 \x01(\x0e2\x1b.waymaker.sketches.ProbTypeR\x04type\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1a\n" + + "\bsnapshot\x18\x03 \x01(\fR\bsnapshot\x12\x18\n" + + "\aversion\x18\x04 \x01(\x04R\aversion\"q\n" + + "\x1aReplicateProbStateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage*m\n" + + "\bProbType\x12\x14\n" + + "\x10PROB_UNSPECIFIED\x10\x00\x12\x0e\n" + + "\n" + + "PROB_BLOOM\x10\x01\x12\f\n" + + "\bPROB_HLL\x10\x02\x12\f\n" + + "\bPROB_CMS\x10\x03\x12\r\n" + + "\tPROB_TOPK\x10\x04\x12\x10\n" + + "\fPROB_TDIGEST\x10\x052\xdc\x13\n" + + "\x17WaymakerSketchesService\x12_\n" + + "\fBloomReserve\x12&.waymaker.sketches.BloomReserveRequest\x1a'.waymaker.sketches.BloomReserveResponse\x12S\n" + + "\bBloomAdd\x12\".waymaker.sketches.BloomAddRequest\x1a#.waymaker.sketches.BloomAddResponse\x12b\n" + + "\rBloomMultiAdd\x12'.waymaker.sketches.BloomMultiAddRequest\x1a(.waymaker.sketches.BloomMultiAddResponse\x12\\\n" + + "\vBloomExists\x12%.waymaker.sketches.BloomExistsRequest\x1a&.waymaker.sketches.BloomExistsResponse\x12k\n" + + "\x10BloomMultiExists\x12*.waymaker.sketches.BloomMultiExistsRequest\x1a+.waymaker.sketches.BloomMultiExistsResponse\x12V\n" + + "\tBloomInfo\x12#.waymaker.sketches.BloomInfoRequest\x1a$.waymaker.sketches.BloomInfoResponse\x12\\\n" + + "\vBloomDelete\x12%.waymaker.sketches.BloomDeleteRequest\x1a&.waymaker.sketches.BloomDeleteResponse\x12Y\n" + + "\n" + + "HllReserve\x12$.waymaker.sketches.HllReserveRequest\x1a%.waymaker.sketches.HllReserveResponse\x12M\n" + + "\x06HllAdd\x12 .waymaker.sketches.HllAddRequest\x1a!.waymaker.sketches.HllAddResponse\x12S\n" + + "\bHllCount\x12\".waymaker.sketches.HllCountRequest\x1a#.waymaker.sketches.HllCountResponse\x12S\n" + + "\bHllMerge\x12\".waymaker.sketches.HllMergeRequest\x1a#.waymaker.sketches.HllMergeResponse\x12V\n" + + "\tHllDelete\x12#.waymaker.sketches.HllDeleteRequest\x1a$.waymaker.sketches.HllDeleteResponse\x12Y\n" + + "\n" + + "CmsReserve\x12$.waymaker.sketches.CmsReserveRequest\x1a%.waymaker.sketches.CmsReserveResponse\x12V\n" + + "\tCmsIncrBy\x12#.waymaker.sketches.CmsIncrByRequest\x1a$.waymaker.sketches.CmsIncrByResponse\x12S\n" + + "\bCmsQuery\x12\".waymaker.sketches.CmsQueryRequest\x1a#.waymaker.sketches.CmsQueryResponse\x12V\n" + + "\tCmsDelete\x12#.waymaker.sketches.CmsDeleteRequest\x1a$.waymaker.sketches.CmsDeleteResponse\x12\\\n" + + "\vTopKReserve\x12%.waymaker.sketches.TopKReserveRequest\x1a&.waymaker.sketches.TopKReserveResponse\x12P\n" + + "\aTopKAdd\x12!.waymaker.sketches.TopKAddRequest\x1a\".waymaker.sketches.TopKAddResponse\x12V\n" + + "\tTopKQuery\x12#.waymaker.sketches.TopKQueryRequest\x1a$.waymaker.sketches.TopKQueryResponse\x12S\n" + + "\bTopKList\x12\".waymaker.sketches.TopKListRequest\x1a#.waymaker.sketches.TopKListResponse\x12Y\n" + + "\n" + + "TopKDelete\x12$.waymaker.sketches.TopKDeleteRequest\x1a%.waymaker.sketches.TopKDeleteResponse\x12b\n" + + "\rTDigestCreate\x12'.waymaker.sketches.TDigestCreateRequest\x1a(.waymaker.sketches.TDigestCreateResponse\x12Y\n" + + "\n" + + "TDigestAdd\x12$.waymaker.sketches.TDigestAddRequest\x1a%.waymaker.sketches.TDigestAddResponse\x12h\n" + + "\x0fTDigestQuantile\x12).waymaker.sketches.TDigestQuantileRequest\x1a*.waymaker.sketches.TDigestQuantileResponse\x12b\n" + + "\rTDigestMinMax\x12'.waymaker.sketches.TDigestMinMaxRequest\x1a(.waymaker.sketches.TDigestMinMaxResponse\x12b\n" + + "\rTDigestDelete\x12'.waymaker.sketches.TDigestDeleteRequest\x1a(.waymaker.sketches.TDigestDeleteResponse\x12q\n" + + "\x12ReplicateProbState\x12,.waymaker.sketches.ReplicateProbStateRequest\x1a-.waymaker.sketches.ReplicateProbStateResponseB\x19Z\x17/apis/waymaker_sketchesb\x06proto3" + +var ( + file_sketches_proto_rawDescOnce sync.Once + file_sketches_proto_rawDescData []byte +) + +func file_sketches_proto_rawDescGZIP() []byte { + file_sketches_proto_rawDescOnce.Do(func() { + file_sketches_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_sketches_proto_rawDesc), len(file_sketches_proto_rawDesc))) + }) + return file_sketches_proto_rawDescData +} + +var file_sketches_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_sketches_proto_msgTypes = make([]protoimpl.MessageInfo, 56) +var file_sketches_proto_goTypes = []any{ + (ProbType)(0), // 0: waymaker.sketches.ProbType + (*BloomReserveRequest)(nil), // 1: waymaker.sketches.BloomReserveRequest + (*BloomReserveResponse)(nil), // 2: waymaker.sketches.BloomReserveResponse + (*BloomAddRequest)(nil), // 3: waymaker.sketches.BloomAddRequest + (*BloomAddResponse)(nil), // 4: waymaker.sketches.BloomAddResponse + (*BloomMultiAddRequest)(nil), // 5: waymaker.sketches.BloomMultiAddRequest + (*BloomMultiAddResponse)(nil), // 6: waymaker.sketches.BloomMultiAddResponse + (*BloomExistsRequest)(nil), // 7: waymaker.sketches.BloomExistsRequest + (*BloomExistsResponse)(nil), // 8: waymaker.sketches.BloomExistsResponse + (*BloomMultiExistsRequest)(nil), // 9: waymaker.sketches.BloomMultiExistsRequest + (*BloomMultiExistsResponse)(nil), // 10: waymaker.sketches.BloomMultiExistsResponse + (*BloomInfoRequest)(nil), // 11: waymaker.sketches.BloomInfoRequest + (*BloomInfoResponse)(nil), // 12: waymaker.sketches.BloomInfoResponse + (*BloomDeleteRequest)(nil), // 13: waymaker.sketches.BloomDeleteRequest + (*BloomDeleteResponse)(nil), // 14: waymaker.sketches.BloomDeleteResponse + (*HllReserveRequest)(nil), // 15: waymaker.sketches.HllReserveRequest + (*HllReserveResponse)(nil), // 16: waymaker.sketches.HllReserveResponse + (*HllAddRequest)(nil), // 17: waymaker.sketches.HllAddRequest + (*HllAddResponse)(nil), // 18: waymaker.sketches.HllAddResponse + (*HllCountRequest)(nil), // 19: waymaker.sketches.HllCountRequest + (*HllCountResponse)(nil), // 20: waymaker.sketches.HllCountResponse + (*HllMergeRequest)(nil), // 21: waymaker.sketches.HllMergeRequest + (*HllMergeResponse)(nil), // 22: waymaker.sketches.HllMergeResponse + (*HllDeleteRequest)(nil), // 23: waymaker.sketches.HllDeleteRequest + (*HllDeleteResponse)(nil), // 24: waymaker.sketches.HllDeleteResponse + (*CmsReserveRequest)(nil), // 25: waymaker.sketches.CmsReserveRequest + (*CmsReserveResponse)(nil), // 26: waymaker.sketches.CmsReserveResponse + (*CmsIncrByItem)(nil), // 27: waymaker.sketches.CmsIncrByItem + (*CmsIncrByRequest)(nil), // 28: waymaker.sketches.CmsIncrByRequest + (*CmsIncrByResponse)(nil), // 29: waymaker.sketches.CmsIncrByResponse + (*CmsQueryRequest)(nil), // 30: waymaker.sketches.CmsQueryRequest + (*CmsQueryResponse)(nil), // 31: waymaker.sketches.CmsQueryResponse + (*CmsDeleteRequest)(nil), // 32: waymaker.sketches.CmsDeleteRequest + (*CmsDeleteResponse)(nil), // 33: waymaker.sketches.CmsDeleteResponse + (*TopKReserveRequest)(nil), // 34: waymaker.sketches.TopKReserveRequest + (*TopKReserveResponse)(nil), // 35: waymaker.sketches.TopKReserveResponse + (*TopKAddRequest)(nil), // 36: waymaker.sketches.TopKAddRequest + (*TopKAddResponse)(nil), // 37: waymaker.sketches.TopKAddResponse + (*TopKQueryRequest)(nil), // 38: waymaker.sketches.TopKQueryRequest + (*TopKQueryResponse)(nil), // 39: waymaker.sketches.TopKQueryResponse + (*TopKListRequest)(nil), // 40: waymaker.sketches.TopKListRequest + (*TopKListResponse)(nil), // 41: waymaker.sketches.TopKListResponse + (*TopKEntry)(nil), // 42: waymaker.sketches.TopKEntry + (*TopKDeleteRequest)(nil), // 43: waymaker.sketches.TopKDeleteRequest + (*TopKDeleteResponse)(nil), // 44: waymaker.sketches.TopKDeleteResponse + (*TDigestCreateRequest)(nil), // 45: waymaker.sketches.TDigestCreateRequest + (*TDigestCreateResponse)(nil), // 46: waymaker.sketches.TDigestCreateResponse + (*TDigestAddRequest)(nil), // 47: waymaker.sketches.TDigestAddRequest + (*TDigestAddResponse)(nil), // 48: waymaker.sketches.TDigestAddResponse + (*TDigestQuantileRequest)(nil), // 49: waymaker.sketches.TDigestQuantileRequest + (*TDigestQuantileResponse)(nil), // 50: waymaker.sketches.TDigestQuantileResponse + (*TDigestMinMaxRequest)(nil), // 51: waymaker.sketches.TDigestMinMaxRequest + (*TDigestMinMaxResponse)(nil), // 52: waymaker.sketches.TDigestMinMaxResponse + (*TDigestDeleteRequest)(nil), // 53: waymaker.sketches.TDigestDeleteRequest + (*TDigestDeleteResponse)(nil), // 54: waymaker.sketches.TDigestDeleteResponse + (*ReplicateProbStateRequest)(nil), // 55: waymaker.sketches.ReplicateProbStateRequest + (*ReplicateProbStateResponse)(nil), // 56: waymaker.sketches.ReplicateProbStateResponse +} +var file_sketches_proto_depIdxs = []int32{ + 27, // 0: waymaker.sketches.CmsIncrByRequest.items:type_name -> waymaker.sketches.CmsIncrByItem + 42, // 1: waymaker.sketches.TopKListResponse.entries:type_name -> waymaker.sketches.TopKEntry + 0, // 2: waymaker.sketches.ReplicateProbStateRequest.type:type_name -> waymaker.sketches.ProbType + 1, // 3: waymaker.sketches.WaymakerSketchesService.BloomReserve:input_type -> waymaker.sketches.BloomReserveRequest + 3, // 4: waymaker.sketches.WaymakerSketchesService.BloomAdd:input_type -> waymaker.sketches.BloomAddRequest + 5, // 5: waymaker.sketches.WaymakerSketchesService.BloomMultiAdd:input_type -> waymaker.sketches.BloomMultiAddRequest + 7, // 6: waymaker.sketches.WaymakerSketchesService.BloomExists:input_type -> waymaker.sketches.BloomExistsRequest + 9, // 7: waymaker.sketches.WaymakerSketchesService.BloomMultiExists:input_type -> waymaker.sketches.BloomMultiExistsRequest + 11, // 8: waymaker.sketches.WaymakerSketchesService.BloomInfo:input_type -> waymaker.sketches.BloomInfoRequest + 13, // 9: waymaker.sketches.WaymakerSketchesService.BloomDelete:input_type -> waymaker.sketches.BloomDeleteRequest + 15, // 10: waymaker.sketches.WaymakerSketchesService.HllReserve:input_type -> waymaker.sketches.HllReserveRequest + 17, // 11: waymaker.sketches.WaymakerSketchesService.HllAdd:input_type -> waymaker.sketches.HllAddRequest + 19, // 12: waymaker.sketches.WaymakerSketchesService.HllCount:input_type -> waymaker.sketches.HllCountRequest + 21, // 13: waymaker.sketches.WaymakerSketchesService.HllMerge:input_type -> waymaker.sketches.HllMergeRequest + 23, // 14: waymaker.sketches.WaymakerSketchesService.HllDelete:input_type -> waymaker.sketches.HllDeleteRequest + 25, // 15: waymaker.sketches.WaymakerSketchesService.CmsReserve:input_type -> waymaker.sketches.CmsReserveRequest + 28, // 16: waymaker.sketches.WaymakerSketchesService.CmsIncrBy:input_type -> waymaker.sketches.CmsIncrByRequest + 30, // 17: waymaker.sketches.WaymakerSketchesService.CmsQuery:input_type -> waymaker.sketches.CmsQueryRequest + 32, // 18: waymaker.sketches.WaymakerSketchesService.CmsDelete:input_type -> waymaker.sketches.CmsDeleteRequest + 34, // 19: waymaker.sketches.WaymakerSketchesService.TopKReserve:input_type -> waymaker.sketches.TopKReserveRequest + 36, // 20: waymaker.sketches.WaymakerSketchesService.TopKAdd:input_type -> waymaker.sketches.TopKAddRequest + 38, // 21: waymaker.sketches.WaymakerSketchesService.TopKQuery:input_type -> waymaker.sketches.TopKQueryRequest + 40, // 22: waymaker.sketches.WaymakerSketchesService.TopKList:input_type -> waymaker.sketches.TopKListRequest + 43, // 23: waymaker.sketches.WaymakerSketchesService.TopKDelete:input_type -> waymaker.sketches.TopKDeleteRequest + 45, // 24: waymaker.sketches.WaymakerSketchesService.TDigestCreate:input_type -> waymaker.sketches.TDigestCreateRequest + 47, // 25: waymaker.sketches.WaymakerSketchesService.TDigestAdd:input_type -> waymaker.sketches.TDigestAddRequest + 49, // 26: waymaker.sketches.WaymakerSketchesService.TDigestQuantile:input_type -> waymaker.sketches.TDigestQuantileRequest + 51, // 27: waymaker.sketches.WaymakerSketchesService.TDigestMinMax:input_type -> waymaker.sketches.TDigestMinMaxRequest + 53, // 28: waymaker.sketches.WaymakerSketchesService.TDigestDelete:input_type -> waymaker.sketches.TDigestDeleteRequest + 55, // 29: waymaker.sketches.WaymakerSketchesService.ReplicateProbState:input_type -> waymaker.sketches.ReplicateProbStateRequest + 2, // 30: waymaker.sketches.WaymakerSketchesService.BloomReserve:output_type -> waymaker.sketches.BloomReserveResponse + 4, // 31: waymaker.sketches.WaymakerSketchesService.BloomAdd:output_type -> waymaker.sketches.BloomAddResponse + 6, // 32: waymaker.sketches.WaymakerSketchesService.BloomMultiAdd:output_type -> waymaker.sketches.BloomMultiAddResponse + 8, // 33: waymaker.sketches.WaymakerSketchesService.BloomExists:output_type -> waymaker.sketches.BloomExistsResponse + 10, // 34: waymaker.sketches.WaymakerSketchesService.BloomMultiExists:output_type -> waymaker.sketches.BloomMultiExistsResponse + 12, // 35: waymaker.sketches.WaymakerSketchesService.BloomInfo:output_type -> waymaker.sketches.BloomInfoResponse + 14, // 36: waymaker.sketches.WaymakerSketchesService.BloomDelete:output_type -> waymaker.sketches.BloomDeleteResponse + 16, // 37: waymaker.sketches.WaymakerSketchesService.HllReserve:output_type -> waymaker.sketches.HllReserveResponse + 18, // 38: waymaker.sketches.WaymakerSketchesService.HllAdd:output_type -> waymaker.sketches.HllAddResponse + 20, // 39: waymaker.sketches.WaymakerSketchesService.HllCount:output_type -> waymaker.sketches.HllCountResponse + 22, // 40: waymaker.sketches.WaymakerSketchesService.HllMerge:output_type -> waymaker.sketches.HllMergeResponse + 24, // 41: waymaker.sketches.WaymakerSketchesService.HllDelete:output_type -> waymaker.sketches.HllDeleteResponse + 26, // 42: waymaker.sketches.WaymakerSketchesService.CmsReserve:output_type -> waymaker.sketches.CmsReserveResponse + 29, // 43: waymaker.sketches.WaymakerSketchesService.CmsIncrBy:output_type -> waymaker.sketches.CmsIncrByResponse + 31, // 44: waymaker.sketches.WaymakerSketchesService.CmsQuery:output_type -> waymaker.sketches.CmsQueryResponse + 33, // 45: waymaker.sketches.WaymakerSketchesService.CmsDelete:output_type -> waymaker.sketches.CmsDeleteResponse + 35, // 46: waymaker.sketches.WaymakerSketchesService.TopKReserve:output_type -> waymaker.sketches.TopKReserveResponse + 37, // 47: waymaker.sketches.WaymakerSketchesService.TopKAdd:output_type -> waymaker.sketches.TopKAddResponse + 39, // 48: waymaker.sketches.WaymakerSketchesService.TopKQuery:output_type -> waymaker.sketches.TopKQueryResponse + 41, // 49: waymaker.sketches.WaymakerSketchesService.TopKList:output_type -> waymaker.sketches.TopKListResponse + 44, // 50: waymaker.sketches.WaymakerSketchesService.TopKDelete:output_type -> waymaker.sketches.TopKDeleteResponse + 46, // 51: waymaker.sketches.WaymakerSketchesService.TDigestCreate:output_type -> waymaker.sketches.TDigestCreateResponse + 48, // 52: waymaker.sketches.WaymakerSketchesService.TDigestAdd:output_type -> waymaker.sketches.TDigestAddResponse + 50, // 53: waymaker.sketches.WaymakerSketchesService.TDigestQuantile:output_type -> waymaker.sketches.TDigestQuantileResponse + 52, // 54: waymaker.sketches.WaymakerSketchesService.TDigestMinMax:output_type -> waymaker.sketches.TDigestMinMaxResponse + 54, // 55: waymaker.sketches.WaymakerSketchesService.TDigestDelete:output_type -> waymaker.sketches.TDigestDeleteResponse + 56, // 56: waymaker.sketches.WaymakerSketchesService.ReplicateProbState:output_type -> waymaker.sketches.ReplicateProbStateResponse + 30, // [30:57] is the sub-list for method output_type + 3, // [3:30] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_sketches_proto_init() } +func file_sketches_proto_init() { + if File_sketches_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_sketches_proto_rawDesc), len(file_sketches_proto_rawDesc)), + NumEnums: 1, + NumMessages: 56, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_sketches_proto_goTypes, + DependencyIndexes: file_sketches_proto_depIdxs, + EnumInfos: file_sketches_proto_enumTypes, + MessageInfos: file_sketches_proto_msgTypes, + }.Build() + File_sketches_proto = out.File + file_sketches_proto_goTypes = nil + file_sketches_proto_depIdxs = nil +} diff --git a/go/genpb/sketches/sketches_grpc.pb.go b/go/genpb/sketches/sketches_grpc.pb.go new file mode 100644 index 0000000..631f5c5 --- /dev/null +++ b/go/genpb/sketches/sketches_grpc.pb.go @@ -0,0 +1,1126 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: sketches.proto + +package waymaker_sketches + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerSketchesService_BloomReserve_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomReserve" + WaymakerSketchesService_BloomAdd_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomAdd" + WaymakerSketchesService_BloomMultiAdd_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomMultiAdd" + WaymakerSketchesService_BloomExists_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomExists" + WaymakerSketchesService_BloomMultiExists_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomMultiExists" + WaymakerSketchesService_BloomInfo_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomInfo" + WaymakerSketchesService_BloomDelete_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/BloomDelete" + WaymakerSketchesService_HllReserve_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/HllReserve" + WaymakerSketchesService_HllAdd_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/HllAdd" + WaymakerSketchesService_HllCount_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/HllCount" + WaymakerSketchesService_HllMerge_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/HllMerge" + WaymakerSketchesService_HllDelete_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/HllDelete" + WaymakerSketchesService_CmsReserve_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/CmsReserve" + WaymakerSketchesService_CmsIncrBy_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/CmsIncrBy" + WaymakerSketchesService_CmsQuery_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/CmsQuery" + WaymakerSketchesService_CmsDelete_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/CmsDelete" + WaymakerSketchesService_TopKReserve_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TopKReserve" + WaymakerSketchesService_TopKAdd_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TopKAdd" + WaymakerSketchesService_TopKQuery_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TopKQuery" + WaymakerSketchesService_TopKList_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TopKList" + WaymakerSketchesService_TopKDelete_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TopKDelete" + WaymakerSketchesService_TDigestCreate_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TDigestCreate" + WaymakerSketchesService_TDigestAdd_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TDigestAdd" + WaymakerSketchesService_TDigestQuantile_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TDigestQuantile" + WaymakerSketchesService_TDigestMinMax_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TDigestMinMax" + WaymakerSketchesService_TDigestDelete_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/TDigestDelete" + WaymakerSketchesService_ReplicateProbState_FullMethodName = "/waymaker.sketches.WaymakerSketchesService/ReplicateProbState" +) + +// WaymakerSketchesServiceClient is the client API for WaymakerSketchesService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WaymakerSketchesServiceClient interface { + // ----- Bloom filter ----- + BloomReserve(ctx context.Context, in *BloomReserveRequest, opts ...grpc.CallOption) (*BloomReserveResponse, error) + BloomAdd(ctx context.Context, in *BloomAddRequest, opts ...grpc.CallOption) (*BloomAddResponse, error) + BloomMultiAdd(ctx context.Context, in *BloomMultiAddRequest, opts ...grpc.CallOption) (*BloomMultiAddResponse, error) + BloomExists(ctx context.Context, in *BloomExistsRequest, opts ...grpc.CallOption) (*BloomExistsResponse, error) + BloomMultiExists(ctx context.Context, in *BloomMultiExistsRequest, opts ...grpc.CallOption) (*BloomMultiExistsResponse, error) + BloomInfo(ctx context.Context, in *BloomInfoRequest, opts ...grpc.CallOption) (*BloomInfoResponse, error) + BloomDelete(ctx context.Context, in *BloomDeleteRequest, opts ...grpc.CallOption) (*BloomDeleteResponse, error) + // ----- HyperLogLog ----- + HllReserve(ctx context.Context, in *HllReserveRequest, opts ...grpc.CallOption) (*HllReserveResponse, error) + HllAdd(ctx context.Context, in *HllAddRequest, opts ...grpc.CallOption) (*HllAddResponse, error) + HllCount(ctx context.Context, in *HllCountRequest, opts ...grpc.CallOption) (*HllCountResponse, error) + HllMerge(ctx context.Context, in *HllMergeRequest, opts ...grpc.CallOption) (*HllMergeResponse, error) + HllDelete(ctx context.Context, in *HllDeleteRequest, opts ...grpc.CallOption) (*HllDeleteResponse, error) + // ----- Count-Min Sketch ----- + CmsReserve(ctx context.Context, in *CmsReserveRequest, opts ...grpc.CallOption) (*CmsReserveResponse, error) + CmsIncrBy(ctx context.Context, in *CmsIncrByRequest, opts ...grpc.CallOption) (*CmsIncrByResponse, error) + CmsQuery(ctx context.Context, in *CmsQueryRequest, opts ...grpc.CallOption) (*CmsQueryResponse, error) + CmsDelete(ctx context.Context, in *CmsDeleteRequest, opts ...grpc.CallOption) (*CmsDeleteResponse, error) + // ----- Top-K ----- + TopKReserve(ctx context.Context, in *TopKReserveRequest, opts ...grpc.CallOption) (*TopKReserveResponse, error) + TopKAdd(ctx context.Context, in *TopKAddRequest, opts ...grpc.CallOption) (*TopKAddResponse, error) + TopKQuery(ctx context.Context, in *TopKQueryRequest, opts ...grpc.CallOption) (*TopKQueryResponse, error) + TopKList(ctx context.Context, in *TopKListRequest, opts ...grpc.CallOption) (*TopKListResponse, error) + TopKDelete(ctx context.Context, in *TopKDeleteRequest, opts ...grpc.CallOption) (*TopKDeleteResponse, error) + // ----- t-digest ----- + TDigestCreate(ctx context.Context, in *TDigestCreateRequest, opts ...grpc.CallOption) (*TDigestCreateResponse, error) + TDigestAdd(ctx context.Context, in *TDigestAddRequest, opts ...grpc.CallOption) (*TDigestAddResponse, error) + TDigestQuantile(ctx context.Context, in *TDigestQuantileRequest, opts ...grpc.CallOption) (*TDigestQuantileResponse, error) + TDigestMinMax(ctx context.Context, in *TDigestMinMaxRequest, opts ...grpc.CallOption) (*TDigestMinMaxResponse, error) + TDigestDelete(ctx context.Context, in *TDigestDeleteRequest, opts ...grpc.CallOption) (*TDigestDeleteResponse, error) + // Internal: snapshot replication. Primary pushes serialized + // filter state to N-1 secondaries periodically. Version counter + // dedupes out-of-order pushes. + ReplicateProbState(ctx context.Context, in *ReplicateProbStateRequest, opts ...grpc.CallOption) (*ReplicateProbStateResponse, error) +} + +type waymakerSketchesServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerSketchesServiceClient(cc grpc.ClientConnInterface) WaymakerSketchesServiceClient { + return &waymakerSketchesServiceClient{cc} +} + +func (c *waymakerSketchesServiceClient) BloomReserve(ctx context.Context, in *BloomReserveRequest, opts ...grpc.CallOption) (*BloomReserveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomReserveResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomReserve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomAdd(ctx context.Context, in *BloomAddRequest, opts ...grpc.CallOption) (*BloomAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomAddResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomMultiAdd(ctx context.Context, in *BloomMultiAddRequest, opts ...grpc.CallOption) (*BloomMultiAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomMultiAddResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomMultiAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomExists(ctx context.Context, in *BloomExistsRequest, opts ...grpc.CallOption) (*BloomExistsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomExistsResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomExists_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomMultiExists(ctx context.Context, in *BloomMultiExistsRequest, opts ...grpc.CallOption) (*BloomMultiExistsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomMultiExistsResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomMultiExists_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomInfo(ctx context.Context, in *BloomInfoRequest, opts ...grpc.CallOption) (*BloomInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomInfoResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) BloomDelete(ctx context.Context, in *BloomDeleteRequest, opts ...grpc.CallOption) (*BloomDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(BloomDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_BloomDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) HllReserve(ctx context.Context, in *HllReserveRequest, opts ...grpc.CallOption) (*HllReserveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HllReserveResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_HllReserve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) HllAdd(ctx context.Context, in *HllAddRequest, opts ...grpc.CallOption) (*HllAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HllAddResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_HllAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) HllCount(ctx context.Context, in *HllCountRequest, opts ...grpc.CallOption) (*HllCountResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HllCountResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_HllCount_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) HllMerge(ctx context.Context, in *HllMergeRequest, opts ...grpc.CallOption) (*HllMergeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HllMergeResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_HllMerge_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) HllDelete(ctx context.Context, in *HllDeleteRequest, opts ...grpc.CallOption) (*HllDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(HllDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_HllDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) CmsReserve(ctx context.Context, in *CmsReserveRequest, opts ...grpc.CallOption) (*CmsReserveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CmsReserveResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_CmsReserve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) CmsIncrBy(ctx context.Context, in *CmsIncrByRequest, opts ...grpc.CallOption) (*CmsIncrByResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CmsIncrByResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_CmsIncrBy_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) CmsQuery(ctx context.Context, in *CmsQueryRequest, opts ...grpc.CallOption) (*CmsQueryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CmsQueryResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_CmsQuery_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) CmsDelete(ctx context.Context, in *CmsDeleteRequest, opts ...grpc.CallOption) (*CmsDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CmsDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_CmsDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TopKReserve(ctx context.Context, in *TopKReserveRequest, opts ...grpc.CallOption) (*TopKReserveResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TopKReserveResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TopKReserve_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TopKAdd(ctx context.Context, in *TopKAddRequest, opts ...grpc.CallOption) (*TopKAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TopKAddResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TopKAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TopKQuery(ctx context.Context, in *TopKQueryRequest, opts ...grpc.CallOption) (*TopKQueryResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TopKQueryResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TopKQuery_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TopKList(ctx context.Context, in *TopKListRequest, opts ...grpc.CallOption) (*TopKListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TopKListResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TopKList_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TopKDelete(ctx context.Context, in *TopKDeleteRequest, opts ...grpc.CallOption) (*TopKDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TopKDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TopKDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TDigestCreate(ctx context.Context, in *TDigestCreateRequest, opts ...grpc.CallOption) (*TDigestCreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TDigestCreateResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TDigestCreate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TDigestAdd(ctx context.Context, in *TDigestAddRequest, opts ...grpc.CallOption) (*TDigestAddResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TDigestAddResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TDigestAdd_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TDigestQuantile(ctx context.Context, in *TDigestQuantileRequest, opts ...grpc.CallOption) (*TDigestQuantileResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TDigestQuantileResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TDigestQuantile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TDigestMinMax(ctx context.Context, in *TDigestMinMaxRequest, opts ...grpc.CallOption) (*TDigestMinMaxResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TDigestMinMaxResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TDigestMinMax_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) TDigestDelete(ctx context.Context, in *TDigestDeleteRequest, opts ...grpc.CallOption) (*TDigestDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TDigestDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_TDigestDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerSketchesServiceClient) ReplicateProbState(ctx context.Context, in *ReplicateProbStateRequest, opts ...grpc.CallOption) (*ReplicateProbStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateProbStateResponse) + err := c.cc.Invoke(ctx, WaymakerSketchesService_ReplicateProbState_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WaymakerSketchesServiceServer is the server API for WaymakerSketchesService service. +// All implementations must embed UnimplementedWaymakerSketchesServiceServer +// for forward compatibility. +type WaymakerSketchesServiceServer interface { + // ----- Bloom filter ----- + BloomReserve(context.Context, *BloomReserveRequest) (*BloomReserveResponse, error) + BloomAdd(context.Context, *BloomAddRequest) (*BloomAddResponse, error) + BloomMultiAdd(context.Context, *BloomMultiAddRequest) (*BloomMultiAddResponse, error) + BloomExists(context.Context, *BloomExistsRequest) (*BloomExistsResponse, error) + BloomMultiExists(context.Context, *BloomMultiExistsRequest) (*BloomMultiExistsResponse, error) + BloomInfo(context.Context, *BloomInfoRequest) (*BloomInfoResponse, error) + BloomDelete(context.Context, *BloomDeleteRequest) (*BloomDeleteResponse, error) + // ----- HyperLogLog ----- + HllReserve(context.Context, *HllReserveRequest) (*HllReserveResponse, error) + HllAdd(context.Context, *HllAddRequest) (*HllAddResponse, error) + HllCount(context.Context, *HllCountRequest) (*HllCountResponse, error) + HllMerge(context.Context, *HllMergeRequest) (*HllMergeResponse, error) + HllDelete(context.Context, *HllDeleteRequest) (*HllDeleteResponse, error) + // ----- Count-Min Sketch ----- + CmsReserve(context.Context, *CmsReserveRequest) (*CmsReserveResponse, error) + CmsIncrBy(context.Context, *CmsIncrByRequest) (*CmsIncrByResponse, error) + CmsQuery(context.Context, *CmsQueryRequest) (*CmsQueryResponse, error) + CmsDelete(context.Context, *CmsDeleteRequest) (*CmsDeleteResponse, error) + // ----- Top-K ----- + TopKReserve(context.Context, *TopKReserveRequest) (*TopKReserveResponse, error) + TopKAdd(context.Context, *TopKAddRequest) (*TopKAddResponse, error) + TopKQuery(context.Context, *TopKQueryRequest) (*TopKQueryResponse, error) + TopKList(context.Context, *TopKListRequest) (*TopKListResponse, error) + TopKDelete(context.Context, *TopKDeleteRequest) (*TopKDeleteResponse, error) + // ----- t-digest ----- + TDigestCreate(context.Context, *TDigestCreateRequest) (*TDigestCreateResponse, error) + TDigestAdd(context.Context, *TDigestAddRequest) (*TDigestAddResponse, error) + TDigestQuantile(context.Context, *TDigestQuantileRequest) (*TDigestQuantileResponse, error) + TDigestMinMax(context.Context, *TDigestMinMaxRequest) (*TDigestMinMaxResponse, error) + TDigestDelete(context.Context, *TDigestDeleteRequest) (*TDigestDeleteResponse, error) + // Internal: snapshot replication. Primary pushes serialized + // filter state to N-1 secondaries periodically. Version counter + // dedupes out-of-order pushes. + ReplicateProbState(context.Context, *ReplicateProbStateRequest) (*ReplicateProbStateResponse, error) + mustEmbedUnimplementedWaymakerSketchesServiceServer() +} + +// UnimplementedWaymakerSketchesServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerSketchesServiceServer struct{} + +func (UnimplementedWaymakerSketchesServiceServer) BloomReserve(context.Context, *BloomReserveRequest) (*BloomReserveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomReserve not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomAdd(context.Context, *BloomAddRequest) (*BloomAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomAdd not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomMultiAdd(context.Context, *BloomMultiAddRequest) (*BloomMultiAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomMultiAdd not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomExists(context.Context, *BloomExistsRequest) (*BloomExistsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomExists not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomMultiExists(context.Context, *BloomMultiExistsRequest) (*BloomMultiExistsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomMultiExists not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomInfo(context.Context, *BloomInfoRequest) (*BloomInfoResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomInfo not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) BloomDelete(context.Context, *BloomDeleteRequest) (*BloomDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method BloomDelete not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) HllReserve(context.Context, *HllReserveRequest) (*HllReserveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HllReserve not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) HllAdd(context.Context, *HllAddRequest) (*HllAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HllAdd not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) HllCount(context.Context, *HllCountRequest) (*HllCountResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HllCount not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) HllMerge(context.Context, *HllMergeRequest) (*HllMergeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HllMerge not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) HllDelete(context.Context, *HllDeleteRequest) (*HllDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method HllDelete not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) CmsReserve(context.Context, *CmsReserveRequest) (*CmsReserveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CmsReserve not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) CmsIncrBy(context.Context, *CmsIncrByRequest) (*CmsIncrByResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CmsIncrBy not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) CmsQuery(context.Context, *CmsQueryRequest) (*CmsQueryResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CmsQuery not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) CmsDelete(context.Context, *CmsDeleteRequest) (*CmsDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CmsDelete not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TopKReserve(context.Context, *TopKReserveRequest) (*TopKReserveResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TopKReserve not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TopKAdd(context.Context, *TopKAddRequest) (*TopKAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TopKAdd not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TopKQuery(context.Context, *TopKQueryRequest) (*TopKQueryResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TopKQuery not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TopKList(context.Context, *TopKListRequest) (*TopKListResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TopKList not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TopKDelete(context.Context, *TopKDeleteRequest) (*TopKDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TopKDelete not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TDigestCreate(context.Context, *TDigestCreateRequest) (*TDigestCreateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TDigestCreate not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TDigestAdd(context.Context, *TDigestAddRequest) (*TDigestAddResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TDigestAdd not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TDigestQuantile(context.Context, *TDigestQuantileRequest) (*TDigestQuantileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TDigestQuantile not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TDigestMinMax(context.Context, *TDigestMinMaxRequest) (*TDigestMinMaxResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TDigestMinMax not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) TDigestDelete(context.Context, *TDigestDeleteRequest) (*TDigestDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method TDigestDelete not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) ReplicateProbState(context.Context, *ReplicateProbStateRequest) (*ReplicateProbStateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateProbState not implemented") +} +func (UnimplementedWaymakerSketchesServiceServer) mustEmbedUnimplementedWaymakerSketchesServiceServer() { +} +func (UnimplementedWaymakerSketchesServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerSketchesServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerSketchesServiceServer will +// result in compilation errors. +type UnsafeWaymakerSketchesServiceServer interface { + mustEmbedUnimplementedWaymakerSketchesServiceServer() +} + +func RegisterWaymakerSketchesServiceServer(s grpc.ServiceRegistrar, srv WaymakerSketchesServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerSketchesServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerSketchesService_ServiceDesc, srv) +} + +func _WaymakerSketchesService_BloomReserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomReserveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomReserve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomReserve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomReserve(ctx, req.(*BloomReserveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomAdd(ctx, req.(*BloomAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomMultiAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomMultiAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomMultiAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomMultiAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomMultiAdd(ctx, req.(*BloomMultiAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomExistsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomExists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomExists_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomExists(ctx, req.(*BloomExistsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomMultiExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomMultiExistsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomMultiExists(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomMultiExists_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomMultiExists(ctx, req.(*BloomMultiExistsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomInfo(ctx, req.(*BloomInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_BloomDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BloomDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).BloomDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_BloomDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).BloomDelete(ctx, req.(*BloomDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_HllReserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HllReserveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).HllReserve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_HllReserve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).HllReserve(ctx, req.(*HllReserveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_HllAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HllAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).HllAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_HllAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).HllAdd(ctx, req.(*HllAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_HllCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HllCountRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).HllCount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_HllCount_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).HllCount(ctx, req.(*HllCountRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_HllMerge_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HllMergeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).HllMerge(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_HllMerge_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).HllMerge(ctx, req.(*HllMergeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_HllDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HllDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).HllDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_HllDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).HllDelete(ctx, req.(*HllDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_CmsReserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CmsReserveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).CmsReserve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_CmsReserve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).CmsReserve(ctx, req.(*CmsReserveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_CmsIncrBy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CmsIncrByRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).CmsIncrBy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_CmsIncrBy_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).CmsIncrBy(ctx, req.(*CmsIncrByRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_CmsQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CmsQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).CmsQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_CmsQuery_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).CmsQuery(ctx, req.(*CmsQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_CmsDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CmsDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).CmsDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_CmsDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).CmsDelete(ctx, req.(*CmsDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TopKReserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TopKReserveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TopKReserve(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TopKReserve_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TopKReserve(ctx, req.(*TopKReserveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TopKAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TopKAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TopKAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TopKAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TopKAdd(ctx, req.(*TopKAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TopKQuery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TopKQueryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TopKQuery(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TopKQuery_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TopKQuery(ctx, req.(*TopKQueryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TopKList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TopKListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TopKList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TopKList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TopKList(ctx, req.(*TopKListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TopKDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TopKDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TopKDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TopKDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TopKDelete(ctx, req.(*TopKDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TDigestCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TDigestCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TDigestCreate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TDigestCreate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TDigestCreate(ctx, req.(*TDigestCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TDigestAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TDigestAddRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TDigestAdd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TDigestAdd_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TDigestAdd(ctx, req.(*TDigestAddRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TDigestQuantile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TDigestQuantileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TDigestQuantile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TDigestQuantile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TDigestQuantile(ctx, req.(*TDigestQuantileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TDigestMinMax_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TDigestMinMaxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TDigestMinMax(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TDigestMinMax_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TDigestMinMax(ctx, req.(*TDigestMinMaxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_TDigestDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TDigestDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).TDigestDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_TDigestDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).TDigestDelete(ctx, req.(*TDigestDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerSketchesService_ReplicateProbState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateProbStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerSketchesServiceServer).ReplicateProbState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerSketchesService_ReplicateProbState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerSketchesServiceServer).ReplicateProbState(ctx, req.(*ReplicateProbStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WaymakerSketchesService_ServiceDesc is the grpc.ServiceDesc for WaymakerSketchesService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerSketchesService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.sketches.WaymakerSketchesService", + HandlerType: (*WaymakerSketchesServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "BloomReserve", + Handler: _WaymakerSketchesService_BloomReserve_Handler, + }, + { + MethodName: "BloomAdd", + Handler: _WaymakerSketchesService_BloomAdd_Handler, + }, + { + MethodName: "BloomMultiAdd", + Handler: _WaymakerSketchesService_BloomMultiAdd_Handler, + }, + { + MethodName: "BloomExists", + Handler: _WaymakerSketchesService_BloomExists_Handler, + }, + { + MethodName: "BloomMultiExists", + Handler: _WaymakerSketchesService_BloomMultiExists_Handler, + }, + { + MethodName: "BloomInfo", + Handler: _WaymakerSketchesService_BloomInfo_Handler, + }, + { + MethodName: "BloomDelete", + Handler: _WaymakerSketchesService_BloomDelete_Handler, + }, + { + MethodName: "HllReserve", + Handler: _WaymakerSketchesService_HllReserve_Handler, + }, + { + MethodName: "HllAdd", + Handler: _WaymakerSketchesService_HllAdd_Handler, + }, + { + MethodName: "HllCount", + Handler: _WaymakerSketchesService_HllCount_Handler, + }, + { + MethodName: "HllMerge", + Handler: _WaymakerSketchesService_HllMerge_Handler, + }, + { + MethodName: "HllDelete", + Handler: _WaymakerSketchesService_HllDelete_Handler, + }, + { + MethodName: "CmsReserve", + Handler: _WaymakerSketchesService_CmsReserve_Handler, + }, + { + MethodName: "CmsIncrBy", + Handler: _WaymakerSketchesService_CmsIncrBy_Handler, + }, + { + MethodName: "CmsQuery", + Handler: _WaymakerSketchesService_CmsQuery_Handler, + }, + { + MethodName: "CmsDelete", + Handler: _WaymakerSketchesService_CmsDelete_Handler, + }, + { + MethodName: "TopKReserve", + Handler: _WaymakerSketchesService_TopKReserve_Handler, + }, + { + MethodName: "TopKAdd", + Handler: _WaymakerSketchesService_TopKAdd_Handler, + }, + { + MethodName: "TopKQuery", + Handler: _WaymakerSketchesService_TopKQuery_Handler, + }, + { + MethodName: "TopKList", + Handler: _WaymakerSketchesService_TopKList_Handler, + }, + { + MethodName: "TopKDelete", + Handler: _WaymakerSketchesService_TopKDelete_Handler, + }, + { + MethodName: "TDigestCreate", + Handler: _WaymakerSketchesService_TDigestCreate_Handler, + }, + { + MethodName: "TDigestAdd", + Handler: _WaymakerSketchesService_TDigestAdd_Handler, + }, + { + MethodName: "TDigestQuantile", + Handler: _WaymakerSketchesService_TDigestQuantile_Handler, + }, + { + MethodName: "TDigestMinMax", + Handler: _WaymakerSketchesService_TDigestMinMax_Handler, + }, + { + MethodName: "TDigestDelete", + Handler: _WaymakerSketchesService_TDigestDelete_Handler, + }, + { + MethodName: "ReplicateProbState", + Handler: _WaymakerSketchesService_ReplicateProbState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "sketches.proto", +} diff --git a/go/genpb/streams/waymaker_streams.pb.go b/go/genpb/streams/waymaker_streams.pb.go new file mode 100644 index 0000000..665be96 --- /dev/null +++ b/go/genpb/streams/waymaker_streams.pb.go @@ -0,0 +1,13981 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.34.1 +// source: waymaker_streams.proto + +package waymaker_streams + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type OnDropPolicy int32 + +const ( + OnDropPolicy_ON_DROP_HALT OnDropPolicy = 0 + OnDropPolicy_ON_DROP_SKIP_TO_FIRST_AVAILABLE OnDropPolicy = 1 +) + +// Enum value maps for OnDropPolicy. +var ( + OnDropPolicy_name = map[int32]string{ + 0: "ON_DROP_HALT", + 1: "ON_DROP_SKIP_TO_FIRST_AVAILABLE", + } + OnDropPolicy_value = map[string]int32{ + "ON_DROP_HALT": 0, + "ON_DROP_SKIP_TO_FIRST_AVAILABLE": 1, + } +) + +func (x OnDropPolicy) Enum() *OnDropPolicy { + p := new(OnDropPolicy) + *p = x + return p +} + +func (x OnDropPolicy) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (OnDropPolicy) Descriptor() protoreflect.EnumDescriptor { + return file_waymaker_streams_proto_enumTypes[0].Descriptor() +} + +func (OnDropPolicy) Type() protoreflect.EnumType { + return &file_waymaker_streams_proto_enumTypes[0] +} + +func (x OnDropPolicy) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use OnDropPolicy.Descriptor instead. +func (OnDropPolicy) EnumDescriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{0} +} + +type DeliveryPolicyType int32 + +const ( + DeliveryPolicyType_DELIVERY_ALL DeliveryPolicyType = 0 + DeliveryPolicyType_DELIVERY_LAST DeliveryPolicyType = 1 + DeliveryPolicyType_DELIVERY_BY_START_SEQ DeliveryPolicyType = 2 + DeliveryPolicyType_DELIVERY_BY_START_TIME DeliveryPolicyType = 3 +) + +// Enum value maps for DeliveryPolicyType. +var ( + DeliveryPolicyType_name = map[int32]string{ + 0: "DELIVERY_ALL", + 1: "DELIVERY_LAST", + 2: "DELIVERY_BY_START_SEQ", + 3: "DELIVERY_BY_START_TIME", + } + DeliveryPolicyType_value = map[string]int32{ + "DELIVERY_ALL": 0, + "DELIVERY_LAST": 1, + "DELIVERY_BY_START_SEQ": 2, + "DELIVERY_BY_START_TIME": 3, + } +) + +func (x DeliveryPolicyType) Enum() *DeliveryPolicyType { + p := new(DeliveryPolicyType) + *p = x + return p +} + +func (x DeliveryPolicyType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DeliveryPolicyType) Descriptor() protoreflect.EnumDescriptor { + return file_waymaker_streams_proto_enumTypes[1].Descriptor() +} + +func (DeliveryPolicyType) Type() protoreflect.EnumType { + return &file_waymaker_streams_proto_enumTypes[1] +} + +func (x DeliveryPolicyType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DeliveryPolicyType.Descriptor instead. +func (DeliveryPolicyType) EnumDescriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{1} +} + +// Identifies which kind of state change happened. The full +// WatchEvent carries one detail oneof matching this type. +type WatchEventType int32 + +const ( + WatchEventType_WATCH_UNKNOWN WatchEventType = 0 + WatchEventType_WATCH_STREAM_CREATED WatchEventType = 1 + WatchEventType_WATCH_STREAM_DELETED WatchEventType = 2 + WatchEventType_WATCH_STREAM_UPDATED WatchEventType = 3 + WatchEventType_WATCH_CONSUMER_CREATED WatchEventType = 4 + WatchEventType_WATCH_CONSUMER_DELETED WatchEventType = 5 + // Phase 3 — emitted on every apply of StreamAuthorityClaim or + // ClearStreamAuthority. `claimant_node_id == 0` in the detail + // distinguishes a clear from a set (since 0 isn't a valid node + // id). + WatchEventType_WATCH_STREAM_AUTHORITY_CHANGED WatchEventType = 6 +) + +// Enum value maps for WatchEventType. +var ( + WatchEventType_name = map[int32]string{ + 0: "WATCH_UNKNOWN", + 1: "WATCH_STREAM_CREATED", + 2: "WATCH_STREAM_DELETED", + 3: "WATCH_STREAM_UPDATED", + 4: "WATCH_CONSUMER_CREATED", + 5: "WATCH_CONSUMER_DELETED", + 6: "WATCH_STREAM_AUTHORITY_CHANGED", + } + WatchEventType_value = map[string]int32{ + "WATCH_UNKNOWN": 0, + "WATCH_STREAM_CREATED": 1, + "WATCH_STREAM_DELETED": 2, + "WATCH_STREAM_UPDATED": 3, + "WATCH_CONSUMER_CREATED": 4, + "WATCH_CONSUMER_DELETED": 5, + "WATCH_STREAM_AUTHORITY_CHANGED": 6, + } +) + +func (x WatchEventType) Enum() *WatchEventType { + p := new(WatchEventType) + *p = x + return p +} + +func (x WatchEventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (WatchEventType) Descriptor() protoreflect.EnumDescriptor { + return file_waymaker_streams_proto_enumTypes[2].Descriptor() +} + +func (WatchEventType) Type() protoreflect.EnumType { + return &file_waymaker_streams_proto_enumTypes[2] +} + +func (x WatchEventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use WatchEventType.Descriptor instead. +func (WatchEventType) EnumDescriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{2} +} + +// `Limits` retention with three optional bounds. Any bound that's +// unset (`*` field omitted) means "no limit on that dimension". +type LimitsRetention struct { + state protoimpl.MessageState `protogen:"open.v1"` + MaxAgeMs *uint64 `protobuf:"varint,1,opt,name=max_age_ms,json=maxAgeMs,proto3,oneof" json:"max_age_ms,omitempty"` + MaxMsgs *uint64 `protobuf:"varint,2,opt,name=max_msgs,json=maxMsgs,proto3,oneof" json:"max_msgs,omitempty"` + MaxBytes *uint64 `protobuf:"varint,3,opt,name=max_bytes,json=maxBytes,proto3,oneof" json:"max_bytes,omitempty"` + // `false` = block-aligned approximate pruning (default). `true` = + // per-message exact pruning. See STREAMS_SPEC.md §6. + StrictLimits bool `protobuf:"varint,4,opt,name=strict_limits,json=strictLimits,proto3" json:"strict_limits,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LimitsRetention) Reset() { + *x = LimitsRetention{} + mi := &file_waymaker_streams_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LimitsRetention) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LimitsRetention) ProtoMessage() {} + +func (x *LimitsRetention) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LimitsRetention.ProtoReflect.Descriptor instead. +func (*LimitsRetention) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{0} +} + +func (x *LimitsRetention) GetMaxAgeMs() uint64 { + if x != nil && x.MaxAgeMs != nil { + return *x.MaxAgeMs + } + return 0 +} + +func (x *LimitsRetention) GetMaxMsgs() uint64 { + if x != nil && x.MaxMsgs != nil { + return *x.MaxMsgs + } + return 0 +} + +func (x *LimitsRetention) GetMaxBytes() uint64 { + if x != nil && x.MaxBytes != nil { + return *x.MaxBytes + } + return 0 +} + +func (x *LimitsRetention) GetStrictLimits() bool { + if x != nil { + return x.StrictLimits + } + return false +} + +type WorkQueueRetention struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WorkQueueRetention) Reset() { + *x = WorkQueueRetention{} + mi := &file_waymaker_streams_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WorkQueueRetention) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WorkQueueRetention) ProtoMessage() {} + +func (x *WorkQueueRetention) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WorkQueueRetention.ProtoReflect.Descriptor instead. +func (*WorkQueueRetention) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{1} +} + +// `Interest` retention: drop a block once every consumer's +// `ack_floor` has advanced past its `last_seq`. With zero +// consumers, every block is eligible. Block-aligned (not +// per-message) so retention sweeps stay cheap. +type InterestRetention struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InterestRetention) Reset() { + *x = InterestRetention{} + mi := &file_waymaker_streams_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InterestRetention) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InterestRetention) ProtoMessage() {} + +func (x *InterestRetention) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InterestRetention.ProtoReflect.Descriptor instead. +func (*InterestRetention) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{2} +} + +type Retention struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Policy: + // + // *Retention_Limits + // *Retention_WorkQueue + // *Retention_Interest + Policy isRetention_Policy `protobuf_oneof:"policy"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Retention) Reset() { + *x = Retention{} + mi := &file_waymaker_streams_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Retention) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Retention) ProtoMessage() {} + +func (x *Retention) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Retention.ProtoReflect.Descriptor instead. +func (*Retention) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{3} +} + +func (x *Retention) GetPolicy() isRetention_Policy { + if x != nil { + return x.Policy + } + return nil +} + +func (x *Retention) GetLimits() *LimitsRetention { + if x != nil { + if x, ok := x.Policy.(*Retention_Limits); ok { + return x.Limits + } + } + return nil +} + +func (x *Retention) GetWorkQueue() *WorkQueueRetention { + if x != nil { + if x, ok := x.Policy.(*Retention_WorkQueue); ok { + return x.WorkQueue + } + } + return nil +} + +func (x *Retention) GetInterest() *InterestRetention { + if x != nil { + if x, ok := x.Policy.(*Retention_Interest); ok { + return x.Interest + } + } + return nil +} + +type isRetention_Policy interface { + isRetention_Policy() +} + +type Retention_Limits struct { + Limits *LimitsRetention `protobuf:"bytes,1,opt,name=limits,proto3,oneof"` +} + +type Retention_WorkQueue struct { + WorkQueue *WorkQueueRetention `protobuf:"bytes,2,opt,name=work_queue,json=workQueue,proto3,oneof"` +} + +type Retention_Interest struct { + Interest *InterestRetention `protobuf:"bytes,3,opt,name=interest,proto3,oneof"` +} + +func (*Retention_Limits) isRetention_Policy() {} + +func (*Retention_WorkQueue) isRetention_Policy() {} + +func (*Retention_Interest) isRetention_Policy() {} + +type StreamConfigPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Subject patterns this stream accepts. Empty Vec = no filter. + SubjectsFilter []string `protobuf:"bytes,2,rep,name=subjects_filter,json=subjectsFilter,proto3" json:"subjects_filter,omitempty"` + Retention *Retention `protobuf:"bytes,3,opt,name=retention,proto3" json:"retention,omitempty"` + // Messages per block; 0 = server default (currently 100_000). + BlockSize uint64 `protobuf:"varint,4,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"` + // Optional per-message size cap; 0 = no cap. + MaxMsgBytes uint64 `protobuf:"varint,5,opt,name=max_msg_bytes,json=maxMsgBytes,proto3" json:"max_msg_bytes,omitempty"` + // If true, the stream is stored entirely in memory — no redb + // file is created. State survives node failover via the + // existing replication path but a full-cluster restart loses + // it. Matches the NATS JetStream `memory` storage mode. + // Immutable after create. + Ephemeral bool `protobuf:"varint,6,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + // Cross-stream sources — this stream pulls messages from each + // listed source stream as a tail subscriber and appends them + // locally with provenance headers (`waymaker-source-stream`, + // `waymaker-source-seq`). See `SOURCES_DESIGN.md`. Slice 1 + // accepts at most one entry; the wire is `repeated` for forward + // compatibility with slice 2 (multi-source fan-in). + Sources []*StreamSourceConfigPb `protobuf:"bytes,7,rep,name=sources,proto3" json:"sources,omitempty"` + // Per-subject revision cap. `0` (default) = unbounded — history + // bounded only by stream-level retention. When N > 0, after a + // successful publish, older messages at that subject beyond the + // N most recent are dropped via per-message pruning. Mirrors + // NATS JetStream's MaxMsgsPerSubject. Backs KV's max_revisions. + MaxMsgsPerSubject uint64 `protobuf:"varint,8,opt,name=max_msgs_per_subject,json=maxMsgsPerSubject,proto3" json:"max_msgs_per_subject,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamConfigPb) Reset() { + *x = StreamConfigPb{} + mi := &file_waymaker_streams_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamConfigPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamConfigPb) ProtoMessage() {} + +func (x *StreamConfigPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamConfigPb.ProtoReflect.Descriptor instead. +func (*StreamConfigPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{4} +} + +func (x *StreamConfigPb) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *StreamConfigPb) GetSubjectsFilter() []string { + if x != nil { + return x.SubjectsFilter + } + return nil +} + +func (x *StreamConfigPb) GetRetention() *Retention { + if x != nil { + return x.Retention + } + return nil +} + +func (x *StreamConfigPb) GetBlockSize() uint64 { + if x != nil { + return x.BlockSize + } + return 0 +} + +func (x *StreamConfigPb) GetMaxMsgBytes() uint64 { + if x != nil { + return x.MaxMsgBytes + } + return 0 +} + +func (x *StreamConfigPb) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +func (x *StreamConfigPb) GetSources() []*StreamSourceConfigPb { + if x != nil { + return x.Sources + } + return nil +} + +func (x *StreamConfigPb) GetMaxMsgsPerSubject() uint64 { + if x != nil { + return x.MaxMsgsPerSubject + } + return 0 +} + +// One source feeding a sourcing stream. Slice 1 honours only +// `source_stream`; the remaining fields land in slice 2/3. +type StreamSourceConfigPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + SourceStream string `protobuf:"bytes,1,opt,name=source_stream,json=sourceStream,proto3" json:"source_stream,omitempty"` + // Optional NATS-style filter; empty = pull every subject. + // Honoured since slice 2B. + FilterSubject string `protobuf:"bytes,2,opt,name=filter_subject,json=filterSubject,proto3" json:"filter_subject,omitempty"` + // Start position. 0/0 = pull from beginning (slice 1 default). + // start_seq honoured since 2C. start_time_ms reserved (rejected). + StartSeq uint64 `protobuf:"varint,3,opt,name=start_seq,json=startSeq,proto3" json:"start_seq,omitempty"` + StartTimeMs int64 `protobuf:"varint,4,opt,name=start_time_ms,json=startTimeMs,proto3" json:"start_time_ms,omitempty"` + // Optional subject rewrite. Slice 3. + SubjectTransform *SubjectTransformPb `protobuf:"bytes,5,opt,name=subject_transform,json=subjectTransform,proto3" json:"subject_transform,omitempty"` + // Slice 2F: cap on the initial backfill window. When > 0 AND + // there's no persisted state for this (sourcing, source), the + // tail seeds its watermark at max(0, source.last_seq - + // max_initial_backfill) instead of pulling from seq 1. Once + // there's persisted state (i.e. after the first batch), this + // knob is ignored — the tail resumes from the persisted seq. + // Use 0 (default) for "unbounded" (slice 1 behaviour). + MaxInitialBackfill uint64 `protobuf:"varint,6,opt,name=max_initial_backfill,json=maxInitialBackfill,proto3" json:"max_initial_backfill,omitempty"` + // Slice 3: behaviour when the source's retention sweep drops + // messages past our last_sourced_seq (we've fallen behind and + // the source no longer has the messages we'd next pull). + // - ON_DROP_HALT (default, 0): tail surfaces a persistent + // error and stops advancing — operator must intervene. + // - ON_DROP_SKIP_TO_FIRST_AVAILABLE (1): tail jumps its + // watermark to source.first_seq - 1 and resumes, with + // a warn event surfaced via last_error for one cycle so + // operators can alert on it. + OnDrop OnDropPolicy `protobuf:"varint,7,opt,name=on_drop,json=onDrop,proto3,enum=waymaker.streams.OnDropPolicy" json:"on_drop,omitempty"` + // Slice 3: optional dead-letter stream. When the tail records + // an error (subject_transform mismatch, append_failed, + // on_drop=halt firing), publish a JSON record describing the + // event to this stream so operators can triage without + // scraping logs. Empty (default) = no DLQ. + DlqStream string `protobuf:"bytes,8,opt,name=dlq_stream,json=dlqStream,proto3" json:"dlq_stream,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamSourceConfigPb) Reset() { + *x = StreamSourceConfigPb{} + mi := &file_waymaker_streams_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamSourceConfigPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamSourceConfigPb) ProtoMessage() {} + +func (x *StreamSourceConfigPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamSourceConfigPb.ProtoReflect.Descriptor instead. +func (*StreamSourceConfigPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{5} +} + +func (x *StreamSourceConfigPb) GetSourceStream() string { + if x != nil { + return x.SourceStream + } + return "" +} + +func (x *StreamSourceConfigPb) GetFilterSubject() string { + if x != nil { + return x.FilterSubject + } + return "" +} + +func (x *StreamSourceConfigPb) GetStartSeq() uint64 { + if x != nil { + return x.StartSeq + } + return 0 +} + +func (x *StreamSourceConfigPb) GetStartTimeMs() int64 { + if x != nil { + return x.StartTimeMs + } + return 0 +} + +func (x *StreamSourceConfigPb) GetSubjectTransform() *SubjectTransformPb { + if x != nil { + return x.SubjectTransform + } + return nil +} + +func (x *StreamSourceConfigPb) GetMaxInitialBackfill() uint64 { + if x != nil { + return x.MaxInitialBackfill + } + return 0 +} + +func (x *StreamSourceConfigPb) GetOnDrop() OnDropPolicy { + if x != nil { + return x.OnDrop + } + return OnDropPolicy_ON_DROP_HALT +} + +func (x *StreamSourceConfigPb) GetDlqStream() string { + if x != nil { + return x.DlqStream + } + return "" +} + +type SubjectTransformPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + // NATS-style: e.g. "events.>" with destination "audit.{{wildcard(1)}}". + SourcePattern string `protobuf:"bytes,1,opt,name=source_pattern,json=sourcePattern,proto3" json:"source_pattern,omitempty"` + Destination string `protobuf:"bytes,2,opt,name=destination,proto3" json:"destination,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubjectTransformPb) Reset() { + *x = SubjectTransformPb{} + mi := &file_waymaker_streams_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubjectTransformPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubjectTransformPb) ProtoMessage() {} + +func (x *SubjectTransformPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubjectTransformPb.ProtoReflect.Descriptor instead. +func (*SubjectTransformPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{6} +} + +func (x *SubjectTransformPb) GetSourcePattern() string { + if x != nil { + return x.SourcePattern + } + return "" +} + +func (x *SubjectTransformPb) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +type StreamStatsPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + LastSeq uint64 `protobuf:"varint,1,opt,name=last_seq,json=lastSeq,proto3" json:"last_seq,omitempty"` + MsgCount uint64 `protobuf:"varint,2,opt,name=msg_count,json=msgCount,proto3" json:"msg_count,omitempty"` + Bytes uint64 `protobuf:"varint,3,opt,name=bytes,proto3" json:"bytes,omitempty"` + BlockCount uint64 `protobuf:"varint,4,opt,name=block_count,json=blockCount,proto3" json:"block_count,omitempty"` + // 0 if there are no blocks (empty stream). + FirstBlock uint64 `protobuf:"varint,5,opt,name=first_block,json=firstBlock,proto3" json:"first_block,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamStatsPb) Reset() { + *x = StreamStatsPb{} + mi := &file_waymaker_streams_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamStatsPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamStatsPb) ProtoMessage() {} + +func (x *StreamStatsPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamStatsPb.ProtoReflect.Descriptor instead. +func (*StreamStatsPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{7} +} + +func (x *StreamStatsPb) GetLastSeq() uint64 { + if x != nil { + return x.LastSeq + } + return 0 +} + +func (x *StreamStatsPb) GetMsgCount() uint64 { + if x != nil { + return x.MsgCount + } + return 0 +} + +func (x *StreamStatsPb) GetBytes() uint64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *StreamStatsPb) GetBlockCount() uint64 { + if x != nil { + return x.BlockCount + } + return 0 +} + +func (x *StreamStatsPb) GetFirstBlock() uint64 { + if x != nil { + return x.FirstBlock + } + return 0 +} + +type MessageHeader struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MessageHeader) Reset() { + *x = MessageHeader{} + mi := &file_waymaker_streams_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MessageHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageHeader) ProtoMessage() {} + +func (x *MessageHeader) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageHeader.ProtoReflect.Descriptor instead. +func (*MessageHeader) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{8} +} + +func (x *MessageHeader) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *MessageHeader) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +type MessagePb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + Headers []*MessageHeader `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"` + Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"` + // Delivery attempt count assigned by the consumer at fetch time. + // Populated only for Fetch responses; 0 otherwise. + DeliverCount uint32 `protobuf:"varint,6,opt,name=deliver_count,json=deliverCount,proto3" json:"deliver_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MessagePb) Reset() { + *x = MessagePb{} + mi := &file_waymaker_streams_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MessagePb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessagePb) ProtoMessage() {} + +func (x *MessagePb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessagePb.ProtoReflect.Descriptor instead. +func (*MessagePb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{9} +} + +func (x *MessagePb) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *MessagePb) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *MessagePb) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *MessagePb) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *MessagePb) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *MessagePb) GetDeliverCount() uint32 { + if x != nil { + return x.DeliverCount + } + return 0 +} + +type DeliveryPolicyPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type DeliveryPolicyType `protobuf:"varint,1,opt,name=type,proto3,enum=waymaker.streams.DeliveryPolicyType" json:"type,omitempty"` + // Used only when type == DELIVERY_BY_START_SEQ. + StartSeq uint64 `protobuf:"varint,2,opt,name=start_seq,json=startSeq,proto3" json:"start_seq,omitempty"` + // Used only when type == DELIVERY_BY_START_TIME. Wall-clock ms. + StartTimeMs int64 `protobuf:"varint,3,opt,name=start_time_ms,json=startTimeMs,proto3" json:"start_time_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeliveryPolicyPb) Reset() { + *x = DeliveryPolicyPb{} + mi := &file_waymaker_streams_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeliveryPolicyPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeliveryPolicyPb) ProtoMessage() {} + +func (x *DeliveryPolicyPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeliveryPolicyPb.ProtoReflect.Descriptor instead. +func (*DeliveryPolicyPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{10} +} + +func (x *DeliveryPolicyPb) GetType() DeliveryPolicyType { + if x != nil { + return x.Type + } + return DeliveryPolicyType_DELIVERY_ALL +} + +func (x *DeliveryPolicyPb) GetStartSeq() uint64 { + if x != nil { + return x.StartSeq + } + return 0 +} + +func (x *DeliveryPolicyPb) GetStartTimeMs() int64 { + if x != nil { + return x.StartTimeMs + } + return 0 +} + +type ConsumerConfigPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Empty = no filter. + FilterSubject string `protobuf:"bytes,2,opt,name=filter_subject,json=filterSubject,proto3" json:"filter_subject,omitempty"` + DeliveryPolicy *DeliveryPolicyPb `protobuf:"bytes,3,opt,name=delivery_policy,json=deliveryPolicy,proto3" json:"delivery_policy,omitempty"` + // 0 = server default (30s). + AckWaitMs uint64 `protobuf:"varint,4,opt,name=ack_wait_ms,json=ackWaitMs,proto3" json:"ack_wait_ms,omitempty"` + // 0 = server default (5). + MaxDeliver uint32 `protobuf:"varint,5,opt,name=max_deliver,json=maxDeliver,proto3" json:"max_deliver,omitempty"` + // Empty = no queue group. + DeliverGroup string `protobuf:"bytes,6,opt,name=deliver_group,json=deliverGroup,proto3" json:"deliver_group,omitempty"` + // Phase 2 dead-letter routing. When non-empty, every message + // this consumer drops after `max_deliver` attempts is republished + // into the same stream under this subject. Original metadata is + // preserved as `x-waymaker-dlq-*` headers. Empty = silent drop. + // The stream's `subjects_filter` must accept this subject — + // operators typically reserve a pattern like `dlq.>` and include + // it in the stream's filter. + DeadLetterSubject string `protobuf:"bytes,7,opt,name=dead_letter_subject,json=deadLetterSubject,proto3" json:"dead_letter_subject,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConsumerConfigPb) Reset() { + *x = ConsumerConfigPb{} + mi := &file_waymaker_streams_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConsumerConfigPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumerConfigPb) ProtoMessage() {} + +func (x *ConsumerConfigPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsumerConfigPb.ProtoReflect.Descriptor instead. +func (*ConsumerConfigPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{11} +} + +func (x *ConsumerConfigPb) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ConsumerConfigPb) GetFilterSubject() string { + if x != nil { + return x.FilterSubject + } + return "" +} + +func (x *ConsumerConfigPb) GetDeliveryPolicy() *DeliveryPolicyPb { + if x != nil { + return x.DeliveryPolicy + } + return nil +} + +func (x *ConsumerConfigPb) GetAckWaitMs() uint64 { + if x != nil { + return x.AckWaitMs + } + return 0 +} + +func (x *ConsumerConfigPb) GetMaxDeliver() uint32 { + if x != nil { + return x.MaxDeliver + } + return 0 +} + +func (x *ConsumerConfigPb) GetDeliverGroup() string { + if x != nil { + return x.DeliverGroup + } + return "" +} + +func (x *ConsumerConfigPb) GetDeadLetterSubject() string { + if x != nil { + return x.DeadLetterSubject + } + return "" +} + +type ConsumerStatePb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Config *ConsumerConfigPb `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + AckFloor uint64 `protobuf:"varint,2,opt,name=ack_floor,json=ackFloor,proto3" json:"ack_floor,omitempty"` + LastDelivered uint64 `protobuf:"varint,3,opt,name=last_delivered,json=lastDelivered,proto3" json:"last_delivered,omitempty"` + CreatedAtMs int64 `protobuf:"varint,4,opt,name=created_at_ms,json=createdAtMs,proto3" json:"created_at_ms,omitempty"` + RedeliveredDropped uint64 `protobuf:"varint,5,opt,name=redelivered_dropped,json=redeliveredDropped,proto3" json:"redelivered_dropped,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConsumerStatePb) Reset() { + *x = ConsumerStatePb{} + mi := &file_waymaker_streams_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConsumerStatePb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumerStatePb) ProtoMessage() {} + +func (x *ConsumerStatePb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsumerStatePb.ProtoReflect.Descriptor instead. +func (*ConsumerStatePb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{12} +} + +func (x *ConsumerStatePb) GetConfig() *ConsumerConfigPb { + if x != nil { + return x.Config + } + return nil +} + +func (x *ConsumerStatePb) GetAckFloor() uint64 { + if x != nil { + return x.AckFloor + } + return 0 +} + +func (x *ConsumerStatePb) GetLastDelivered() uint64 { + if x != nil { + return x.LastDelivered + } + return 0 +} + +func (x *ConsumerStatePb) GetCreatedAtMs() int64 { + if x != nil { + return x.CreatedAtMs + } + return 0 +} + +func (x *ConsumerStatePb) GetRedeliveredDropped() uint64 { + if x != nil { + return x.RedeliveredDropped + } + return 0 +} + +type CreateStreamRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Config *StreamConfigPb `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateStreamRequest) Reset() { + *x = CreateStreamRequest{} + mi := &file_waymaker_streams_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStreamRequest) ProtoMessage() {} + +func (x *CreateStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStreamRequest.ProtoReflect.Descriptor instead. +func (*CreateStreamRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{13} +} + +func (x *CreateStreamRequest) GetConfig() *StreamConfigPb { + if x != nil { + return x.Config + } + return nil +} + +type CreateStreamResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "already_exists" | "invalid_config" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateStreamResponse) Reset() { + *x = CreateStreamResponse{} + mi := &file_waymaker_streams_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateStreamResponse) ProtoMessage() {} + +func (x *CreateStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateStreamResponse.ProtoReflect.Descriptor instead. +func (*CreateStreamResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{14} +} + +func (x *CreateStreamResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateStreamResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateStreamResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteStreamRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteStreamRequest) Reset() { + *x = DeleteStreamRequest{} + mi := &file_waymaker_streams_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteStreamRequest) ProtoMessage() {} + +func (x *DeleteStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteStreamRequest.ProtoReflect.Descriptor instead. +func (*DeleteStreamRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{15} +} + +func (x *DeleteStreamRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteStreamResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteStreamResponse) Reset() { + *x = DeleteStreamResponse{} + mi := &file_waymaker_streams_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteStreamResponse) ProtoMessage() {} + +func (x *DeleteStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteStreamResponse.ProtoReflect.Descriptor instead. +func (*DeleteStreamResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{16} +} + +func (x *DeleteStreamResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteStreamResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteStreamResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type GetStreamInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStreamInfoRequest) Reset() { + *x = GetStreamInfoRequest{} + mi := &file_waymaker_streams_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStreamInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStreamInfoRequest) ProtoMessage() {} + +func (x *GetStreamInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStreamInfoRequest.ProtoReflect.Descriptor instead. +func (*GetStreamInfoRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{17} +} + +func (x *GetStreamInfoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetStreamInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Config *StreamConfigPb `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` + Stats *StreamStatsPb `protobuf:"bytes,5,opt,name=stats,proto3" json:"stats,omitempty"` + // Phase 3 — if a `stream_authority` override is active for this + // stream, the routing claimant + the fence epoch at which it was + // committed. Unset when the stream routes via the ring's hash + // owner. Useful for operators auditing "why is this stream on + // node N when the ring says M?". + AuthorityOverride *StreamAuthorityOverride `protobuf:"bytes,6,opt,name=authority_override,json=authorityOverride,proto3,oneof" json:"authority_override,omitempty"` + // The ring's hash owner for this stream (ignoring any override). + // When `authority_override` is set and `claimant_node_id != + // ring_owner_node_id`, the override is actively redirecting + // routing. 0 = the response node couldn't compute the ring owner + // (e.g. mid-membership-transition). + RingOwnerNodeId uint64 `protobuf:"varint,7,opt,name=ring_owner_node_id,json=ringOwnerNodeId,proto3" json:"ring_owner_node_id,omitempty"` + // Phase 3 — `true` when an operator has pinned this stream + // (auto-GC will not retire its override even when redundant). + Pinned bool `protobuf:"varint,8,opt,name=pinned,proto3" json:"pinned,omitempty"` + // Per-source tail state. Populated when this stream has + // `sources` set in its config and the request lands on the + // sourcing primary. Empty otherwise. + SourcesStatus []*SourceStatusPb `protobuf:"bytes,9,rep,name=sources_status,json=sourcesStatus,proto3" json:"sources_status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStreamInfoResponse) Reset() { + *x = GetStreamInfoResponse{} + mi := &file_waymaker_streams_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStreamInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStreamInfoResponse) ProtoMessage() {} + +func (x *GetStreamInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStreamInfoResponse.ProtoReflect.Descriptor instead. +func (*GetStreamInfoResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{18} +} + +func (x *GetStreamInfoResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetStreamInfoResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetStreamInfoResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetStreamInfoResponse) GetConfig() *StreamConfigPb { + if x != nil { + return x.Config + } + return nil +} + +func (x *GetStreamInfoResponse) GetStats() *StreamStatsPb { + if x != nil { + return x.Stats + } + return nil +} + +func (x *GetStreamInfoResponse) GetAuthorityOverride() *StreamAuthorityOverride { + if x != nil { + return x.AuthorityOverride + } + return nil +} + +func (x *GetStreamInfoResponse) GetRingOwnerNodeId() uint64 { + if x != nil { + return x.RingOwnerNodeId + } + return 0 +} + +func (x *GetStreamInfoResponse) GetPinned() bool { + if x != nil { + return x.Pinned + } + return false +} + +func (x *GetStreamInfoResponse) GetSourcesStatus() []*SourceStatusPb { + if x != nil { + return x.SourcesStatus + } + return nil +} + +type SourceStatusPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + SourceStream string `protobuf:"bytes,1,opt,name=source_stream,json=sourceStream,proto3" json:"source_stream,omitempty"` + // Last seq successfully appended to the sourcing stream. + LastSourcedSeq uint64 `protobuf:"varint,2,opt,name=last_sourced_seq,json=lastSourcedSeq,proto3" json:"last_sourced_seq,omitempty"` + // Total messages pulled since the tail task started. + PulledTotal uint64 `protobuf:"varint,3,opt,name=pulled_total,json=pulledTotal,proto3" json:"pulled_total,omitempty"` + // Most recent error message; empty when healthy. + LastError string `protobuf:"bytes,4,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"` + LastErrorTsMs int64 `protobuf:"varint,5,opt,name=last_error_ts_ms,json=lastErrorTsMs,proto3" json:"last_error_ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SourceStatusPb) Reset() { + *x = SourceStatusPb{} + mi := &file_waymaker_streams_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SourceStatusPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceStatusPb) ProtoMessage() {} + +func (x *SourceStatusPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceStatusPb.ProtoReflect.Descriptor instead. +func (*SourceStatusPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{19} +} + +func (x *SourceStatusPb) GetSourceStream() string { + if x != nil { + return x.SourceStream + } + return "" +} + +func (x *SourceStatusPb) GetLastSourcedSeq() uint64 { + if x != nil { + return x.LastSourcedSeq + } + return 0 +} + +func (x *SourceStatusPb) GetPulledTotal() uint64 { + if x != nil { + return x.PulledTotal + } + return 0 +} + +func (x *SourceStatusPb) GetLastError() string { + if x != nil { + return x.LastError + } + return "" +} + +func (x *SourceStatusPb) GetLastErrorTsMs() int64 { + if x != nil { + return x.LastErrorTsMs + } + return 0 +} + +type StreamAuthorityOverride struct { + state protoimpl.MessageState `protogen:"open.v1"` + ClaimantNodeId uint64 `protobuf:"varint,1,opt,name=claimant_node_id,json=claimantNodeId,proto3" json:"claimant_node_id,omitempty"` + FenceEpoch uint64 `protobuf:"varint,2,opt,name=fence_epoch,json=fenceEpoch,proto3" json:"fence_epoch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamAuthorityOverride) Reset() { + *x = StreamAuthorityOverride{} + mi := &file_waymaker_streams_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamAuthorityOverride) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamAuthorityOverride) ProtoMessage() {} + +func (x *StreamAuthorityOverride) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamAuthorityOverride.ProtoReflect.Descriptor instead. +func (*StreamAuthorityOverride) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{20} +} + +func (x *StreamAuthorityOverride) GetClaimantNodeId() uint64 { + if x != nil { + return x.ClaimantNodeId + } + return 0 +} + +func (x *StreamAuthorityOverride) GetFenceEpoch() uint64 { + if x != nil { + return x.FenceEpoch + } + return 0 +} + +type ClearStreamAuthorityRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClearStreamAuthorityRequest) Reset() { + *x = ClearStreamAuthorityRequest{} + mi := &file_waymaker_streams_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClearStreamAuthorityRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearStreamAuthorityRequest) ProtoMessage() {} + +func (x *ClearStreamAuthorityRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearStreamAuthorityRequest.ProtoReflect.Descriptor instead. +func (*ClearStreamAuthorityRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{21} +} + +func (x *ClearStreamAuthorityRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +type ClearStreamAuthorityResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_leader" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClearStreamAuthorityResponse) Reset() { + *x = ClearStreamAuthorityResponse{} + mi := &file_waymaker_streams_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClearStreamAuthorityResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClearStreamAuthorityResponse) ProtoMessage() {} + +func (x *ClearStreamAuthorityResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClearStreamAuthorityResponse.ProtoReflect.Descriptor instead. +func (*ClearStreamAuthorityResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{22} +} + +func (x *ClearStreamAuthorityResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ClearStreamAuthorityResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ClearStreamAuthorityResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ListStreamAuthorityOverridesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamAuthorityOverridesRequest) Reset() { + *x = ListStreamAuthorityOverridesRequest{} + mi := &file_waymaker_streams_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamAuthorityOverridesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamAuthorityOverridesRequest) ProtoMessage() {} + +func (x *ListStreamAuthorityOverridesRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStreamAuthorityOverridesRequest.ProtoReflect.Descriptor instead. +func (*ListStreamAuthorityOverridesRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{23} +} + +type ListStreamAuthorityOverridesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*AuthorityOverrideEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamAuthorityOverridesResponse) Reset() { + *x = ListStreamAuthorityOverridesResponse{} + mi := &file_waymaker_streams_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamAuthorityOverridesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamAuthorityOverridesResponse) ProtoMessage() {} + +func (x *ListStreamAuthorityOverridesResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStreamAuthorityOverridesResponse.ProtoReflect.Descriptor instead. +func (*ListStreamAuthorityOverridesResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{24} +} + +func (x *ListStreamAuthorityOverridesResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListStreamAuthorityOverridesResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ListStreamAuthorityOverridesResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListStreamAuthorityOverridesResponse) GetEntries() []*AuthorityOverrideEntry { + if x != nil { + return x.Entries + } + return nil +} + +type AuthorityOverrideEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + ClaimantNodeId uint64 `protobuf:"varint,2,opt,name=claimant_node_id,json=claimantNodeId,proto3" json:"claimant_node_id,omitempty"` + FenceEpoch uint64 `protobuf:"varint,3,opt,name=fence_epoch,json=fenceEpoch,proto3" json:"fence_epoch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthorityOverrideEntry) Reset() { + *x = AuthorityOverrideEntry{} + mi := &file_waymaker_streams_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthorityOverrideEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthorityOverrideEntry) ProtoMessage() {} + +func (x *AuthorityOverrideEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthorityOverrideEntry.ProtoReflect.Descriptor instead. +func (*AuthorityOverrideEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{25} +} + +func (x *AuthorityOverrideEntry) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *AuthorityOverrideEntry) GetClaimantNodeId() uint64 { + if x != nil { + return x.ClaimantNodeId + } + return 0 +} + +func (x *AuthorityOverrideEntry) GetFenceEpoch() uint64 { + if x != nil { + return x.FenceEpoch + } + return 0 +} + +type SetStreamPinnedRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Pinned bool `protobuf:"varint,2,opt,name=pinned,proto3" json:"pinned,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetStreamPinnedRequest) Reset() { + *x = SetStreamPinnedRequest{} + mi := &file_waymaker_streams_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetStreamPinnedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetStreamPinnedRequest) ProtoMessage() {} + +func (x *SetStreamPinnedRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetStreamPinnedRequest.ProtoReflect.Descriptor instead. +func (*SetStreamPinnedRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{26} +} + +func (x *SetStreamPinnedRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *SetStreamPinnedRequest) GetPinned() bool { + if x != nil { + return x.Pinned + } + return false +} + +type SetStreamPinnedResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_leader" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetStreamPinnedResponse) Reset() { + *x = SetStreamPinnedResponse{} + mi := &file_waymaker_streams_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetStreamPinnedResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetStreamPinnedResponse) ProtoMessage() {} + +func (x *SetStreamPinnedResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetStreamPinnedResponse.ProtoReflect.Descriptor instead. +func (*SetStreamPinnedResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{27} +} + +func (x *SetStreamPinnedResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetStreamPinnedResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetStreamPinnedResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ListStreamsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamsRequest) Reset() { + *x = ListStreamsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamsRequest) ProtoMessage() {} + +func (x *ListStreamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStreamsRequest.ProtoReflect.Descriptor instead. +func (*ListStreamsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{28} +} + +type ListStreamsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListStreamsResponse) Reset() { + *x = ListStreamsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListStreamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListStreamsResponse) ProtoMessage() {} + +func (x *ListStreamsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListStreamsResponse.ProtoReflect.Descriptor instead. +func (*ListStreamsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{29} +} + +func (x *ListStreamsResponse) GetNames() []string { + if x != nil { + return x.Names + } + return nil +} + +type GetStreamSourcesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStreamSourcesRequest) Reset() { + *x = GetStreamSourcesRequest{} + mi := &file_waymaker_streams_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStreamSourcesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStreamSourcesRequest) ProtoMessage() {} + +func (x *GetStreamSourcesRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStreamSourcesRequest.ProtoReflect.Descriptor instead. +func (*GetStreamSourcesRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{30} +} + +type GetStreamSourcesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*GetStreamSourcesEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStreamSourcesResponse) Reset() { + *x = GetStreamSourcesResponse{} + mi := &file_waymaker_streams_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStreamSourcesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStreamSourcesResponse) ProtoMessage() {} + +func (x *GetStreamSourcesResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStreamSourcesResponse.ProtoReflect.Descriptor instead. +func (*GetStreamSourcesResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{31} +} + +func (x *GetStreamSourcesResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetStreamSourcesResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetStreamSourcesResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetStreamSourcesResponse) GetEntries() []*GetStreamSourcesEntry { + if x != nil { + return x.Entries + } + return nil +} + +type GetStreamSourcesEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + SourcingStream string `protobuf:"bytes,1,opt,name=sourcing_stream,json=sourcingStream,proto3" json:"sourcing_stream,omitempty"` + SourceStream string `protobuf:"bytes,2,opt,name=source_stream,json=sourceStream,proto3" json:"source_stream,omitempty"` + LastSourcedSeq uint64 `protobuf:"varint,3,opt,name=last_sourced_seq,json=lastSourcedSeq,proto3" json:"last_sourced_seq,omitempty"` + PulledTotal uint64 `protobuf:"varint,4,opt,name=pulled_total,json=pulledTotal,proto3" json:"pulled_total,omitempty"` + LastError string `protobuf:"bytes,5,opt,name=last_error,json=lastError,proto3" json:"last_error,omitempty"` + LastErrorTsMs int64 `protobuf:"varint,6,opt,name=last_error_ts_ms,json=lastErrorTsMs,proto3" json:"last_error_ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetStreamSourcesEntry) Reset() { + *x = GetStreamSourcesEntry{} + mi := &file_waymaker_streams_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetStreamSourcesEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetStreamSourcesEntry) ProtoMessage() {} + +func (x *GetStreamSourcesEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetStreamSourcesEntry.ProtoReflect.Descriptor instead. +func (*GetStreamSourcesEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{32} +} + +func (x *GetStreamSourcesEntry) GetSourcingStream() string { + if x != nil { + return x.SourcingStream + } + return "" +} + +func (x *GetStreamSourcesEntry) GetSourceStream() string { + if x != nil { + return x.SourceStream + } + return "" +} + +func (x *GetStreamSourcesEntry) GetLastSourcedSeq() uint64 { + if x != nil { + return x.LastSourcedSeq + } + return 0 +} + +func (x *GetStreamSourcesEntry) GetPulledTotal() uint64 { + if x != nil { + return x.PulledTotal + } + return 0 +} + +func (x *GetStreamSourcesEntry) GetLastError() string { + if x != nil { + return x.LastError + } + return "" +} + +func (x *GetStreamSourcesEntry) GetLastErrorTsMs() int64 { + if x != nil { + return x.LastErrorTsMs + } + return 0 +} + +// Partial-update of the mutable subset of a stream's config. Fields +// that are present are applied; absent fields leave the existing +// on-disk value unchanged. Setting a Limits bound's optional to 0 is +// a valid way to *clear* that bound (equivalent to "no limit"); to +// leave it unchanged, omit the field. Immutable fields (name, +// subjects_filter, block_size, retention policy type) are not in +// this message — changing them requires a delete + recreate. +type UpdateStreamRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxAgeMs *uint64 `protobuf:"varint,2,opt,name=max_age_ms,json=maxAgeMs,proto3,oneof" json:"max_age_ms,omitempty"` + MaxMsgs *uint64 `protobuf:"varint,3,opt,name=max_msgs,json=maxMsgs,proto3,oneof" json:"max_msgs,omitempty"` + MaxBytes *uint64 `protobuf:"varint,4,opt,name=max_bytes,json=maxBytes,proto3,oneof" json:"max_bytes,omitempty"` + MaxMsgBytes *uint64 `protobuf:"varint,5,opt,name=max_msg_bytes,json=maxMsgBytes,proto3,oneof" json:"max_msg_bytes,omitempty"` + StrictLimits *bool `protobuf:"varint,6,opt,name=strict_limits,json=strictLimits,proto3,oneof" json:"strict_limits,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateStreamRequest) Reset() { + *x = UpdateStreamRequest{} + mi := &file_waymaker_streams_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateStreamRequest) ProtoMessage() {} + +func (x *UpdateStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateStreamRequest.ProtoReflect.Descriptor instead. +func (*UpdateStreamRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{33} +} + +func (x *UpdateStreamRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *UpdateStreamRequest) GetMaxAgeMs() uint64 { + if x != nil && x.MaxAgeMs != nil { + return *x.MaxAgeMs + } + return 0 +} + +func (x *UpdateStreamRequest) GetMaxMsgs() uint64 { + if x != nil && x.MaxMsgs != nil { + return *x.MaxMsgs + } + return 0 +} + +func (x *UpdateStreamRequest) GetMaxBytes() uint64 { + if x != nil && x.MaxBytes != nil { + return *x.MaxBytes + } + return 0 +} + +func (x *UpdateStreamRequest) GetMaxMsgBytes() uint64 { + if x != nil && x.MaxMsgBytes != nil { + return *x.MaxMsgBytes + } + return 0 +} + +func (x *UpdateStreamRequest) GetStrictLimits() bool { + if x != nil && x.StrictLimits != nil { + return *x.StrictLimits + } + return false +} + +type UpdateStreamResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "invalid_config" | "immutable_field" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Effective config after the update — what the next GetStreamInfo + // would return. Useful for clients that want to confirm what + // landed without a follow-up round trip. + Config *StreamConfigPb `protobuf:"bytes,4,opt,name=config,proto3" json:"config,omitempty"` + // Number of messages the primary pruned to bring stats under the + // new bounds. 0 = no prune (raise-only update, or already under). + // For drift monitoring. + Pruned uint64 `protobuf:"varint,5,opt,name=pruned,proto3" json:"pruned,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateStreamResponse) Reset() { + *x = UpdateStreamResponse{} + mi := &file_waymaker_streams_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateStreamResponse) ProtoMessage() {} + +func (x *UpdateStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateStreamResponse.ProtoReflect.Descriptor instead. +func (*UpdateStreamResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{34} +} + +func (x *UpdateStreamResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *UpdateStreamResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *UpdateStreamResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *UpdateStreamResponse) GetConfig() *StreamConfigPb { + if x != nil { + return x.Config + } + return nil +} + +func (x *UpdateStreamResponse) GetPruned() uint64 { + if x != nil { + return x.Pruned + } + return 0 +} + +type PublishRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + Headers []*MessageHeader `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"` + // 0 = server uses wall clock. + TsMs int64 `protobuf:"varint,5,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + // Optimistic-concurrency hint. When set, the server only + // commits the publish if the latest seq at `subject` matches + // `expected_last_seq` (use 0 to require "subject has never been + // published to"). On mismatch the response carries + // `result_code="wrong_revision"` and `seq` = the current actual + // last seq at the subject. Absent / unset = no check. + ExpectedLastSeq *uint64 `protobuf:"varint,6,opt,name=expected_last_seq,json=expectedLastSeq,proto3,oneof" json:"expected_last_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PublishRequest) Reset() { + *x = PublishRequest{} + mi := &file_waymaker_streams_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PublishRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishRequest) ProtoMessage() {} + +func (x *PublishRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead. +func (*PublishRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{35} +} + +func (x *PublishRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *PublishRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *PublishRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *PublishRequest) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *PublishRequest) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *PublishRequest) GetExpectedLastSeq() uint64 { + if x != nil && x.ExpectedLastSeq != nil { + return *x.ExpectedLastSeq + } + return 0 +} + +type PublishResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "subject_rejected" | "oversize" | "wrong_revision" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Seq uint64 `protobuf:"varint,4,opt,name=seq,proto3" json:"seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PublishResponse) Reset() { + *x = PublishResponse{} + mi := &file_waymaker_streams_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PublishResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PublishResponse) ProtoMessage() {} + +func (x *PublishResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PublishResponse.ProtoReflect.Descriptor instead. +func (*PublishResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{36} +} + +func (x *PublishResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PublishResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *PublishResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *PublishResponse) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +type FetchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + BatchSize uint32 `protobuf:"varint,3,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FetchRequest) Reset() { + *x = FetchRequest{} + mi := &file_waymaker_streams_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchRequest) ProtoMessage() {} + +func (x *FetchRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FetchRequest.ProtoReflect.Descriptor instead. +func (*FetchRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{37} +} + +func (x *FetchRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *FetchRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *FetchRequest) GetBatchSize() uint32 { + if x != nil { + return x.BatchSize + } + return 0 +} + +type FetchResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Messages []*MessagePb `protobuf:"bytes,4,rep,name=messages,proto3" json:"messages,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FetchResponse) Reset() { + *x = FetchResponse{} + mi := &file_waymaker_streams_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FetchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FetchResponse) ProtoMessage() {} + +func (x *FetchResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FetchResponse.ProtoReflect.Descriptor instead. +func (*FetchResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{38} +} + +func (x *FetchResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *FetchResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *FetchResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *FetchResponse) GetMessages() []*MessagePb { + if x != nil { + return x.Messages + } + return nil +} + +type AckRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AckRequest) Reset() { + *x = AckRequest{} + mi := &file_waymaker_streams_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckRequest) ProtoMessage() {} + +func (x *AckRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckRequest.ProtoReflect.Descriptor instead. +func (*AckRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{39} +} + +func (x *AckRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *AckRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *AckRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +type AckResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AckResponse) Reset() { + *x = AckResponse{} + mi := &file_waymaker_streams_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckResponse) ProtoMessage() {} + +func (x *AckResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckResponse.ProtoReflect.Descriptor instead. +func (*AckResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{40} +} + +func (x *AckResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AckResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *AckResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type NakRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` + // Wall-clock ms to defer redelivery. 0 = eligible immediately. + DelayMs uint64 `protobuf:"varint,4,opt,name=delay_ms,json=delayMs,proto3" json:"delay_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NakRequest) Reset() { + *x = NakRequest{} + mi := &file_waymaker_streams_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NakRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NakRequest) ProtoMessage() {} + +func (x *NakRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NakRequest.ProtoReflect.Descriptor instead. +func (*NakRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{41} +} + +func (x *NakRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *NakRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *NakRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *NakRequest) GetDelayMs() uint64 { + if x != nil { + return x.DelayMs + } + return 0 +} + +type NakResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NakResponse) Reset() { + *x = NakResponse{} + mi := &file_waymaker_streams_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NakResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NakResponse) ProtoMessage() {} + +func (x *NakResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NakResponse.ProtoReflect.Descriptor instead. +func (*NakResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{42} +} + +func (x *NakResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *NakResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *NakResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type TermRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TermRequest) Reset() { + *x = TermRequest{} + mi := &file_waymaker_streams_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TermRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TermRequest) ProtoMessage() {} + +func (x *TermRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TermRequest.ProtoReflect.Descriptor instead. +func (*TermRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{43} +} + +func (x *TermRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *TermRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *TermRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +type TermResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TermResponse) Reset() { + *x = TermResponse{} + mi := &file_waymaker_streams_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TermResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TermResponse) ProtoMessage() {} + +func (x *TermResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TermResponse.ProtoReflect.Descriptor instead. +func (*TermResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{44} +} + +func (x *TermResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *TermResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *TermResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type InProgressRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InProgressRequest) Reset() { + *x = InProgressRequest{} + mi := &file_waymaker_streams_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InProgressRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InProgressRequest) ProtoMessage() {} + +func (x *InProgressRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InProgressRequest.ProtoReflect.Descriptor instead. +func (*InProgressRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{45} +} + +func (x *InProgressRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *InProgressRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *InProgressRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +type InProgressResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InProgressResponse) Reset() { + *x = InProgressResponse{} + mi := &file_waymaker_streams_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InProgressResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InProgressResponse) ProtoMessage() {} + +func (x *InProgressResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InProgressResponse.ProtoReflect.Descriptor instead. +func (*InProgressResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{46} +} + +func (x *InProgressResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *InProgressResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *InProgressResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SubscribeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + // How many messages per server-side fetch. Smaller batches + // trade throughput for finer-grained per-message latency. 0 + // means use the server default (16). + BatchSize uint32 `protobuf:"varint,3,opt,name=batch_size,json=batchSize,proto3" json:"batch_size,omitempty"` + // If true, the server tears down the subscription after the + // first fetch returns 0 messages (after the initial backlog + // drains). Useful for one-shot replays. Default false — keep + // the stream open indefinitely and re-fetch on new appends. + StopWhenEmpty bool `protobuf:"varint,4,opt,name=stop_when_empty,json=stopWhenEmpty,proto3" json:"stop_when_empty,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubscribeRequest) Reset() { + *x = SubscribeRequest{} + mi := &file_waymaker_streams_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRequest) ProtoMessage() {} + +func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. +func (*SubscribeRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{47} +} + +func (x *SubscribeRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *SubscribeRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +func (x *SubscribeRequest) GetBatchSize() uint32 { + if x != nil { + return x.BatchSize + } + return 0 +} + +func (x *SubscribeRequest) GetStopWhenEmpty() bool { + if x != nil { + return x.StopWhenEmpty + } + return false +} + +// Server-streamed events on a Subscribe stream. Currently one +// variant — a delivered message — with a tail end-of-stream +// signal if the client requested `stop_when_empty`. +type SubscribeEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Event: + // + // *SubscribeEvent_Message + // *SubscribeEvent_Stopped + Event isSubscribeEvent_Event `protobuf_oneof:"event"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubscribeEvent) Reset() { + *x = SubscribeEvent{} + mi := &file_waymaker_streams_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubscribeEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeEvent) ProtoMessage() {} + +func (x *SubscribeEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeEvent.ProtoReflect.Descriptor instead. +func (*SubscribeEvent) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{48} +} + +func (x *SubscribeEvent) GetEvent() isSubscribeEvent_Event { + if x != nil { + return x.Event + } + return nil +} + +func (x *SubscribeEvent) GetMessage() *MessagePb { + if x != nil { + if x, ok := x.Event.(*SubscribeEvent_Message); ok { + return x.Message + } + } + return nil +} + +func (x *SubscribeEvent) GetStopped() *SubscribeStopped { + if x != nil { + if x, ok := x.Event.(*SubscribeEvent_Stopped); ok { + return x.Stopped + } + } + return nil +} + +type isSubscribeEvent_Event interface { + isSubscribeEvent_Event() +} + +type SubscribeEvent_Message struct { + Message *MessagePb `protobuf:"bytes,1,opt,name=message,proto3,oneof"` +} + +type SubscribeEvent_Stopped struct { + Stopped *SubscribeStopped `protobuf:"bytes,2,opt,name=stopped,proto3,oneof"` +} + +func (*SubscribeEvent_Message) isSubscribeEvent_Event() {} + +func (*SubscribeEvent_Stopped) isSubscribeEvent_Event() {} + +type SubscribeStopped struct { + state protoimpl.MessageState `protogen:"open.v1"` + Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubscribeStopped) Reset() { + *x = SubscribeStopped{} + mi := &file_waymaker_streams_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubscribeStopped) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeStopped) ProtoMessage() {} + +func (x *SubscribeStopped) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeStopped.ProtoReflect.Descriptor instead. +func (*SubscribeStopped) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{49} +} + +func (x *SubscribeStopped) GetReason() string { + if x != nil { + return x.Reason + } + return "" +} + +type CreateConsumerRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Config *ConsumerConfigPb `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateConsumerRequest) Reset() { + *x = CreateConsumerRequest{} + mi := &file_waymaker_streams_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateConsumerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateConsumerRequest) ProtoMessage() {} + +func (x *CreateConsumerRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateConsumerRequest.ProtoReflect.Descriptor instead. +func (*CreateConsumerRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{50} +} + +func (x *CreateConsumerRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *CreateConsumerRequest) GetConfig() *ConsumerConfigPb { + if x != nil { + return x.Config + } + return nil +} + +type CreateConsumerResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "already_exists" | "invalid_config" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateConsumerResponse) Reset() { + *x = CreateConsumerResponse{} + mi := &file_waymaker_streams_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateConsumerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateConsumerResponse) ProtoMessage() {} + +func (x *CreateConsumerResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateConsumerResponse.ProtoReflect.Descriptor instead. +func (*CreateConsumerResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{51} +} + +func (x *CreateConsumerResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateConsumerResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateConsumerResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteConsumerRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteConsumerRequest) Reset() { + *x = DeleteConsumerRequest{} + mi := &file_waymaker_streams_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteConsumerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteConsumerRequest) ProtoMessage() {} + +func (x *DeleteConsumerRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteConsumerRequest.ProtoReflect.Descriptor instead. +func (*DeleteConsumerRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{52} +} + +func (x *DeleteConsumerRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *DeleteConsumerRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +type DeleteConsumerResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteConsumerResponse) Reset() { + *x = DeleteConsumerResponse{} + mi := &file_waymaker_streams_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteConsumerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteConsumerResponse) ProtoMessage() {} + +func (x *DeleteConsumerResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteConsumerResponse.ProtoReflect.Descriptor instead. +func (*DeleteConsumerResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{53} +} + +func (x *DeleteConsumerResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteConsumerResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteConsumerResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ListConsumersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListConsumersRequest) Reset() { + *x = ListConsumersRequest{} + mi := &file_waymaker_streams_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListConsumersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConsumersRequest) ProtoMessage() {} + +func (x *ListConsumersRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListConsumersRequest.ProtoReflect.Descriptor instead. +func (*ListConsumersRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{54} +} + +func (x *ListConsumersRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +type ListConsumersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Consumers []*ConsumerStatePb `protobuf:"bytes,4,rep,name=consumers,proto3" json:"consumers,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListConsumersResponse) Reset() { + *x = ListConsumersResponse{} + mi := &file_waymaker_streams_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListConsumersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListConsumersResponse) ProtoMessage() {} + +func (x *ListConsumersResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListConsumersResponse.ProtoReflect.Descriptor instead. +func (*ListConsumersResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{55} +} + +func (x *ListConsumersResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListConsumersResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ListConsumersResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListConsumersResponse) GetConsumers() []*ConsumerStatePb { + if x != nil { + return x.Consumers + } + return nil +} + +type GetConsumerInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConsumerInfoRequest) Reset() { + *x = GetConsumerInfoRequest{} + mi := &file_waymaker_streams_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConsumerInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConsumerInfoRequest) ProtoMessage() {} + +func (x *GetConsumerInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[56] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConsumerInfoRequest.ProtoReflect.Descriptor instead. +func (*GetConsumerInfoRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{56} +} + +func (x *GetConsumerInfoRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *GetConsumerInfoRequest) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +type GetConsumerInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "no_such_consumer" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Consumer *ConsumerStatePb `protobuf:"bytes,4,opt,name=consumer,proto3" json:"consumer,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetConsumerInfoResponse) Reset() { + *x = GetConsumerInfoResponse{} + mi := &file_waymaker_streams_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetConsumerInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetConsumerInfoResponse) ProtoMessage() {} + +func (x *GetConsumerInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[57] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetConsumerInfoResponse.ProtoReflect.Descriptor instead. +func (*GetConsumerInfoResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{57} +} + +func (x *GetConsumerInfoResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetConsumerInfoResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetConsumerInfoResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetConsumerInfoResponse) GetConsumer() *ConsumerStatePb { + if x != nil { + return x.Consumer + } + return nil +} + +type TransferStreamRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransferStreamRequest) Reset() { + *x = TransferStreamRequest{} + mi := &file_waymaker_streams_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransferStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransferStreamRequest) ProtoMessage() {} + +func (x *TransferStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransferStreamRequest.ProtoReflect.Descriptor instead. +func (*TransferStreamRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{58} +} + +func (x *TransferStreamRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// One chunk of redb bytes plus end-of-stream signalling. The body is +// either `data` (a chunk of raw bytes — order-preserving via gRPC's +// stream ordering) or `summary` (the final marker carrying totals so +// the receiver can sanity-check what it got). Implementations should +// stream multiple `data` chunks followed by exactly one `summary`. +type TransferStreamChunk struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Body: + // + // *TransferStreamChunk_Data + // *TransferStreamChunk_Summary + Body isTransferStreamChunk_Body `protobuf_oneof:"body"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransferStreamChunk) Reset() { + *x = TransferStreamChunk{} + mi := &file_waymaker_streams_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransferStreamChunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransferStreamChunk) ProtoMessage() {} + +func (x *TransferStreamChunk) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransferStreamChunk.ProtoReflect.Descriptor instead. +func (*TransferStreamChunk) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{59} +} + +func (x *TransferStreamChunk) GetBody() isTransferStreamChunk_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *TransferStreamChunk) GetData() []byte { + if x != nil { + if x, ok := x.Body.(*TransferStreamChunk_Data); ok { + return x.Data + } + } + return nil +} + +func (x *TransferStreamChunk) GetSummary() *TransferStreamSummary { + if x != nil { + if x, ok := x.Body.(*TransferStreamChunk_Summary); ok { + return x.Summary + } + } + return nil +} + +type isTransferStreamChunk_Body interface { + isTransferStreamChunk_Body() +} + +type TransferStreamChunk_Data struct { + Data []byte `protobuf:"bytes,1,opt,name=data,proto3,oneof"` +} + +type TransferStreamChunk_Summary struct { + Summary *TransferStreamSummary `protobuf:"bytes,2,opt,name=summary,proto3,oneof"` +} + +func (*TransferStreamChunk_Data) isTransferStreamChunk_Body() {} + +func (*TransferStreamChunk_Summary) isTransferStreamChunk_Body() {} + +type TransferStreamSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + TotalBytes uint64 `protobuf:"varint,1,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // Last seq seen by the source at the moment of transfer — the + // receiver re-opens the file and verifies its stats match, surfacing + // any transfer corruption as a load failure. + StreamLastSeq uint64 `protobuf:"varint,2,opt,name=stream_last_seq,json=streamLastSeq,proto3" json:"stream_last_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransferStreamSummary) Reset() { + *x = TransferStreamSummary{} + mi := &file_waymaker_streams_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransferStreamSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransferStreamSummary) ProtoMessage() {} + +func (x *TransferStreamSummary) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[60] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransferStreamSummary.ProtoReflect.Descriptor instead. +func (*TransferStreamSummary) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{60} +} + +func (x *TransferStreamSummary) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *TransferStreamSummary) GetStreamLastSeq() uint64 { + if x != nil { + return x.StreamLastSeq + } + return 0 +} + +type MigrateStreamRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Stream to acquire. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Node ID currently holding the data. The receiver opens a + // `TransferStream` against this node via the existing proxy channel + // pool. Must be a current cluster member. + SourceNodeId uint64 `protobuf:"varint,2,opt,name=source_node_id,json=sourceNodeId,proto3" json:"source_node_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MigrateStreamRequest) Reset() { + *x = MigrateStreamRequest{} + mi := &file_waymaker_streams_proto_msgTypes[61] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MigrateStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MigrateStreamRequest) ProtoMessage() {} + +func (x *MigrateStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[61] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MigrateStreamRequest.ProtoReflect.Descriptor instead. +func (*MigrateStreamRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{61} +} + +func (x *MigrateStreamRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *MigrateStreamRequest) GetSourceNodeId() uint64 { + if x != nil { + return x.SourceNodeId + } + return 0 +} + +type MigrateStreamResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "source_busy" | "source_unreachable" | "already_exists" | "transfer_corrupted" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + TotalBytes uint64 `protobuf:"varint,4,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + StreamLastSeq uint64 `protobuf:"varint,5,opt,name=stream_last_seq,json=streamLastSeq,proto3" json:"stream_last_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MigrateStreamResponse) Reset() { + *x = MigrateStreamResponse{} + mi := &file_waymaker_streams_proto_msgTypes[62] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MigrateStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MigrateStreamResponse) ProtoMessage() {} + +func (x *MigrateStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[62] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MigrateStreamResponse.ProtoReflect.Descriptor instead. +func (*MigrateStreamResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{62} +} + +func (x *MigrateStreamResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *MigrateStreamResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *MigrateStreamResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *MigrateStreamResponse) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *MigrateStreamResponse) GetStreamLastSeq() uint64 { + if x != nil { + return x.StreamLastSeq + } + return 0 +} + +type GetClusterStreamStatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // When set, also include per-stream stats (msg_count, bytes, + // last_seq) for every stream on every node. Without this the + // response carries only per-node aggregates — much smaller, and + // sufficient for skew-based planning. + IncludePerStream bool `protobuf:"varint,1,opt,name=include_per_stream,json=includePerStream,proto3" json:"include_per_stream,omitempty"` + // Internal flag set on the fan-out sub-calls. When `true`, the + // receiving node skips fanning out to peers and reports only its + // own local registry. The orchestrator's outermost call leaves + // this `false` so a single round-trip from an operator pulls the + // whole cluster's view. Mirrors the lock proxy's `iteration` cap. + LocalOnly bool `protobuf:"varint,2,opt,name=local_only,json=localOnly,proto3" json:"local_only,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetClusterStreamStatsRequest) Reset() { + *x = GetClusterStreamStatsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[63] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetClusterStreamStatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClusterStreamStatsRequest) ProtoMessage() {} + +func (x *GetClusterStreamStatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[63] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetClusterStreamStatsRequest.ProtoReflect.Descriptor instead. +func (*GetClusterStreamStatsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{63} +} + +func (x *GetClusterStreamStatsRequest) GetIncludePerStream() bool { + if x != nil { + return x.IncludePerStream + } + return false +} + +func (x *GetClusterStreamStatsRequest) GetLocalOnly() bool { + if x != nil { + return x.LocalOnly + } + return false +} + +// One stream's stats as seen by its primary node. +type PerStreamStats struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OwnerNodeId uint64 `protobuf:"varint,2,opt,name=owner_node_id,json=ownerNodeId,proto3" json:"owner_node_id,omitempty"` + MsgCount uint64 `protobuf:"varint,3,opt,name=msg_count,json=msgCount,proto3" json:"msg_count,omitempty"` + Bytes uint64 `protobuf:"varint,4,opt,name=bytes,proto3" json:"bytes,omitempty"` + LastSeq uint64 `protobuf:"varint,5,opt,name=last_seq,json=lastSeq,proto3" json:"last_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PerStreamStats) Reset() { + *x = PerStreamStats{} + mi := &file_waymaker_streams_proto_msgTypes[64] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PerStreamStats) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PerStreamStats) ProtoMessage() {} + +func (x *PerStreamStats) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[64] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PerStreamStats.ProtoReflect.Descriptor instead. +func (*PerStreamStats) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{64} +} + +func (x *PerStreamStats) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PerStreamStats) GetOwnerNodeId() uint64 { + if x != nil { + return x.OwnerNodeId + } + return 0 +} + +func (x *PerStreamStats) GetMsgCount() uint64 { + if x != nil { + return x.MsgCount + } + return 0 +} + +func (x *PerStreamStats) GetBytes() uint64 { + if x != nil { + return x.Bytes + } + return 0 +} + +func (x *PerStreamStats) GetLastSeq() uint64 { + if x != nil { + return x.LastSeq + } + return 0 +} + +// Per-node summary. Bytes/msg counts are summed across the node's +// local streams. +type PerNodeSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + NodeId uint64 `protobuf:"varint,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + StreamCount uint64 `protobuf:"varint,2,opt,name=stream_count,json=streamCount,proto3" json:"stream_count,omitempty"` + TotalMsgCount uint64 `protobuf:"varint,3,opt,name=total_msg_count,json=totalMsgCount,proto3" json:"total_msg_count,omitempty"` + TotalBytes uint64 `protobuf:"varint,4,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // "ok" if the node responded; "unreachable" / "node_standby" / + // "internal" otherwise. The aggregator still emits a row per + // member node so the operator can see which nodes failed to report. + Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PerNodeSummary) Reset() { + *x = PerNodeSummary{} + mi := &file_waymaker_streams_proto_msgTypes[65] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PerNodeSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PerNodeSummary) ProtoMessage() {} + +func (x *PerNodeSummary) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[65] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PerNodeSummary.ProtoReflect.Descriptor instead. +func (*PerNodeSummary) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{65} +} + +func (x *PerNodeSummary) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *PerNodeSummary) GetStreamCount() uint64 { + if x != nil { + return x.StreamCount + } + return 0 +} + +func (x *PerNodeSummary) GetTotalMsgCount() uint64 { + if x != nil { + return x.TotalMsgCount + } + return 0 +} + +func (x *PerNodeSummary) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *PerNodeSummary) GetStatus() string { + if x != nil { + return x.Status + } + return "" +} + +type GetClusterStreamStatsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_leader" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Nodes []*PerNodeSummary `protobuf:"bytes,4,rep,name=nodes,proto3" json:"nodes,omitempty"` + // Populated when the request set `include_per_stream`. + Streams []*PerStreamStats `protobuf:"bytes,5,rep,name=streams,proto3" json:"streams,omitempty"` + // Cluster-wide totals + skew. `skew_count` = max stream_count - + // min stream_count across responding nodes. `skew_bytes` is the + // same in bytes. Both are 0 for a perfectly-balanced cluster. + TotalStreamCount uint64 `protobuf:"varint,6,opt,name=total_stream_count,json=totalStreamCount,proto3" json:"total_stream_count,omitempty"` + TotalMsgCount uint64 `protobuf:"varint,7,opt,name=total_msg_count,json=totalMsgCount,proto3" json:"total_msg_count,omitempty"` + TotalBytes uint64 `protobuf:"varint,8,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + SkewCount uint64 `protobuf:"varint,9,opt,name=skew_count,json=skewCount,proto3" json:"skew_count,omitempty"` + SkewBytes uint64 `protobuf:"varint,10,opt,name=skew_bytes,json=skewBytes,proto3" json:"skew_bytes,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetClusterStreamStatsResponse) Reset() { + *x = GetClusterStreamStatsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[66] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetClusterStreamStatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClusterStreamStatsResponse) ProtoMessage() {} + +func (x *GetClusterStreamStatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[66] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetClusterStreamStatsResponse.ProtoReflect.Descriptor instead. +func (*GetClusterStreamStatsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{66} +} + +func (x *GetClusterStreamStatsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetClusterStreamStatsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetClusterStreamStatsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetClusterStreamStatsResponse) GetNodes() []*PerNodeSummary { + if x != nil { + return x.Nodes + } + return nil +} + +func (x *GetClusterStreamStatsResponse) GetStreams() []*PerStreamStats { + if x != nil { + return x.Streams + } + return nil +} + +func (x *GetClusterStreamStatsResponse) GetTotalStreamCount() uint64 { + if x != nil { + return x.TotalStreamCount + } + return 0 +} + +func (x *GetClusterStreamStatsResponse) GetTotalMsgCount() uint64 { + if x != nil { + return x.TotalMsgCount + } + return 0 +} + +func (x *GetClusterStreamStatsResponse) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *GetClusterStreamStatsResponse) GetSkewCount() uint64 { + if x != nil { + return x.SkewCount + } + return 0 +} + +func (x *GetClusterStreamStatsResponse) GetSkewBytes() uint64 { + if x != nil { + return x.SkewBytes + } + return 0 +} + +type RebalancePlanEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TargetNodeId uint64 `protobuf:"varint,2,opt,name=target_node_id,json=targetNodeId,proto3" json:"target_node_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RebalancePlanEntry) Reset() { + *x = RebalancePlanEntry{} + mi := &file_waymaker_streams_proto_msgTypes[67] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RebalancePlanEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RebalancePlanEntry) ProtoMessage() {} + +func (x *RebalancePlanEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[67] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RebalancePlanEntry.ProtoReflect.Descriptor instead. +func (*RebalancePlanEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{67} +} + +func (x *RebalancePlanEntry) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RebalancePlanEntry) GetTargetNodeId() uint64 { + if x != nil { + return x.TargetNodeId + } + return 0 +} + +type RebalanceStreamsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Plan []*RebalancePlanEntry `protobuf:"bytes,1,rep,name=plan,proto3" json:"plan,omitempty"` + // Per-step `MigrateStream` timeout, in milliseconds. 0 = server + // default (currently 30s). + PerStepTimeoutMs uint64 `protobuf:"varint,2,opt,name=per_step_timeout_ms,json=perStepTimeoutMs,proto3" json:"per_step_timeout_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RebalanceStreamsRequest) Reset() { + *x = RebalanceStreamsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[68] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RebalanceStreamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RebalanceStreamsRequest) ProtoMessage() {} + +func (x *RebalanceStreamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[68] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RebalanceStreamsRequest.ProtoReflect.Descriptor instead. +func (*RebalanceStreamsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{68} +} + +func (x *RebalanceStreamsRequest) GetPlan() []*RebalancePlanEntry { + if x != nil { + return x.Plan + } + return nil +} + +func (x *RebalanceStreamsRequest) GetPerStepTimeoutMs() uint64 { + if x != nil { + return x.PerStepTimeoutMs + } + return 0 +} + +type RebalanceStepOutcome struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TargetNodeId uint64 `protobuf:"varint,2,opt,name=target_node_id,json=targetNodeId,proto3" json:"target_node_id,omitempty"` + Success bool `protobuf:"varint,3,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,4,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // mirrors MigrateStream codes + "skipped_same_node" / "no_source" + Message string `protobuf:"bytes,5,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RebalanceStepOutcome) Reset() { + *x = RebalanceStepOutcome{} + mi := &file_waymaker_streams_proto_msgTypes[69] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RebalanceStepOutcome) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RebalanceStepOutcome) ProtoMessage() {} + +func (x *RebalanceStepOutcome) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[69] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RebalanceStepOutcome.ProtoReflect.Descriptor instead. +func (*RebalanceStepOutcome) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{69} +} + +func (x *RebalanceStepOutcome) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *RebalanceStepOutcome) GetTargetNodeId() uint64 { + if x != nil { + return x.TargetNodeId + } + return 0 +} + +func (x *RebalanceStepOutcome) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RebalanceStepOutcome) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *RebalanceStepOutcome) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type RebalanceStreamsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` // true iff every step succeeded + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "partial" | "no_plan" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Steps []*RebalanceStepOutcome `protobuf:"bytes,4,rep,name=steps,proto3" json:"steps,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RebalanceStreamsResponse) Reset() { + *x = RebalanceStreamsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[70] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RebalanceStreamsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RebalanceStreamsResponse) ProtoMessage() {} + +func (x *RebalanceStreamsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[70] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RebalanceStreamsResponse.ProtoReflect.Descriptor instead. +func (*RebalanceStreamsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{70} +} + +func (x *RebalanceStreamsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RebalanceStreamsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *RebalanceStreamsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *RebalanceStreamsResponse) GetSteps() []*RebalanceStepOutcome { + if x != nil { + return x.Steps + } + return nil +} + +type WatchStreamsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchStreamsRequest) Reset() { + *x = WatchStreamsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[71] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchStreamsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchStreamsRequest) ProtoMessage() {} + +func (x *WatchStreamsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[71] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchStreamsRequest.ProtoReflect.Descriptor instead. +func (*WatchStreamsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{71} +} + +type StreamWatchDetail struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StreamWatchDetail) Reset() { + *x = StreamWatchDetail{} + mi := &file_waymaker_streams_proto_msgTypes[72] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StreamWatchDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StreamWatchDetail) ProtoMessage() {} + +func (x *StreamWatchDetail) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[72] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StreamWatchDetail.ProtoReflect.Descriptor instead. +func (*StreamWatchDetail) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{72} +} + +func (x *StreamWatchDetail) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type ConsumerWatchDetail struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Consumer string `protobuf:"bytes,2,opt,name=consumer,proto3" json:"consumer,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConsumerWatchDetail) Reset() { + *x = ConsumerWatchDetail{} + mi := &file_waymaker_streams_proto_msgTypes[73] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConsumerWatchDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumerWatchDetail) ProtoMessage() {} + +func (x *ConsumerWatchDetail) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[73] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsumerWatchDetail.ProtoReflect.Descriptor instead. +func (*ConsumerWatchDetail) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{73} +} + +func (x *ConsumerWatchDetail) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ConsumerWatchDetail) GetConsumer() string { + if x != nil { + return x.Consumer + } + return "" +} + +// Detail carried on WATCH_STREAM_AUTHORITY_CHANGED events. +// `claimant_node_id == 0` + `fence_epoch == 0` means the override +// was cleared (routing reverts to the ring's hash owner); +// otherwise the override is now `(claimant, fence_epoch)`. +type AuthorityWatchDetail struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + ClaimantNodeId uint64 `protobuf:"varint,2,opt,name=claimant_node_id,json=claimantNodeId,proto3" json:"claimant_node_id,omitempty"` + FenceEpoch uint64 `protobuf:"varint,3,opt,name=fence_epoch,json=fenceEpoch,proto3" json:"fence_epoch,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AuthorityWatchDetail) Reset() { + *x = AuthorityWatchDetail{} + mi := &file_waymaker_streams_proto_msgTypes[74] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AuthorityWatchDetail) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AuthorityWatchDetail) ProtoMessage() {} + +func (x *AuthorityWatchDetail) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[74] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AuthorityWatchDetail.ProtoReflect.Descriptor instead. +func (*AuthorityWatchDetail) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{74} +} + +func (x *AuthorityWatchDetail) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *AuthorityWatchDetail) GetClaimantNodeId() uint64 { + if x != nil { + return x.ClaimantNodeId + } + return 0 +} + +func (x *AuthorityWatchDetail) GetFenceEpoch() uint64 { + if x != nil { + return x.FenceEpoch + } + return 0 +} + +type ReadLatestAtSubjectRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReadLatestAtSubjectRequest) Reset() { + *x = ReadLatestAtSubjectRequest{} + mi := &file_waymaker_streams_proto_msgTypes[75] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReadLatestAtSubjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadLatestAtSubjectRequest) ProtoMessage() {} + +func (x *ReadLatestAtSubjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[75] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadLatestAtSubjectRequest.ProtoReflect.Descriptor instead. +func (*ReadLatestAtSubjectRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{75} +} + +func (x *ReadLatestAtSubjectRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ReadLatestAtSubjectRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +type ReadLatestAtSubjectResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Unset when no message has ever been published at this + // subject. Use the presence of `latest` to distinguish + // "subject is empty" from "no such stream" (the latter is in + // result_code). + Latest *MessagePb `protobuf:"bytes,4,opt,name=latest,proto3,oneof" json:"latest,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReadLatestAtSubjectResponse) Reset() { + *x = ReadLatestAtSubjectResponse{} + mi := &file_waymaker_streams_proto_msgTypes[76] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReadLatestAtSubjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReadLatestAtSubjectResponse) ProtoMessage() {} + +func (x *ReadLatestAtSubjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[76] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReadLatestAtSubjectResponse.ProtoReflect.Descriptor instead. +func (*ReadLatestAtSubjectResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{76} +} + +func (x *ReadLatestAtSubjectResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReadLatestAtSubjectResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReadLatestAtSubjectResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ReadLatestAtSubjectResponse) GetLatest() *MessagePb { + if x != nil { + return x.Latest + } + return nil +} + +type ListSubjectsByPrefixRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + // Empty prefix matches every subject in the stream. + Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3" json:"prefix,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSubjectsByPrefixRequest) Reset() { + *x = ListSubjectsByPrefixRequest{} + mi := &file_waymaker_streams_proto_msgTypes[77] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSubjectsByPrefixRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSubjectsByPrefixRequest) ProtoMessage() {} + +func (x *ListSubjectsByPrefixRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[77] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSubjectsByPrefixRequest.ProtoReflect.Descriptor instead. +func (*ListSubjectsByPrefixRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{77} +} + +func (x *ListSubjectsByPrefixRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ListSubjectsByPrefixRequest) GetPrefix() string { + if x != nil { + return x.Prefix + } + return "" +} + +type ListSubjectsByPrefixResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Subjects []string `protobuf:"bytes,4,rep,name=subjects,proto3" json:"subjects,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSubjectsByPrefixResponse) Reset() { + *x = ListSubjectsByPrefixResponse{} + mi := &file_waymaker_streams_proto_msgTypes[78] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSubjectsByPrefixResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSubjectsByPrefixResponse) ProtoMessage() {} + +func (x *ListSubjectsByPrefixResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[78] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSubjectsByPrefixResponse.ProtoReflect.Descriptor instead. +func (*ListSubjectsByPrefixResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{78} +} + +func (x *ListSubjectsByPrefixResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListSubjectsByPrefixResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ListSubjectsByPrefixResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListSubjectsByPrefixResponse) GetSubjects() []string { + if x != nil { + return x.Subjects + } + return nil +} + +type ScanExactAtSubjectRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + // Start scanning at seq >= `from_seq`. 0 = scan from the + // beginning of the stream. + FromSeq uint64 `protobuf:"varint,3,opt,name=from_seq,json=fromSeq,proto3" json:"from_seq,omitempty"` + // Cap on returned messages. 0 = server default (1000). + Limit uint64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScanExactAtSubjectRequest) Reset() { + *x = ScanExactAtSubjectRequest{} + mi := &file_waymaker_streams_proto_msgTypes[79] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScanExactAtSubjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScanExactAtSubjectRequest) ProtoMessage() {} + +func (x *ScanExactAtSubjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[79] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScanExactAtSubjectRequest.ProtoReflect.Descriptor instead. +func (*ScanExactAtSubjectRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{79} +} + +func (x *ScanExactAtSubjectRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ScanExactAtSubjectRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *ScanExactAtSubjectRequest) GetFromSeq() uint64 { + if x != nil { + return x.FromSeq + } + return 0 +} + +func (x *ScanExactAtSubjectRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type ScanExactAtSubjectResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Messages at the subject, in seq order. Empty if the subject + // has never been published to, or if the limit returned no + // results in the requested range. + Messages []*MessagePb `protobuf:"bytes,4,rep,name=messages,proto3" json:"messages,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScanExactAtSubjectResponse) Reset() { + *x = ScanExactAtSubjectResponse{} + mi := &file_waymaker_streams_proto_msgTypes[80] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScanExactAtSubjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScanExactAtSubjectResponse) ProtoMessage() {} + +func (x *ScanExactAtSubjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[80] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ScanExactAtSubjectResponse.ProtoReflect.Descriptor instead. +func (*ScanExactAtSubjectResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{80} +} + +func (x *ScanExactAtSubjectResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ScanExactAtSubjectResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ScanExactAtSubjectResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ScanExactAtSubjectResponse) GetMessages() []*MessagePb { + if x != nil { + return x.Messages + } + return nil +} + +type WatchEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Type WatchEventType `protobuf:"varint,1,opt,name=type,proto3,enum=waymaker.streams.WatchEventType" json:"type,omitempty"` + // Server wall-clock at emit time (ms since epoch). Useful for + // ordering across nodes when a client multiplexes watchers. + TsMs int64 `protobuf:"varint,2,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + // The watching node's id. For cluster-wide watch built on top of + // per-node streams, the client can deduplicate by (node_id, ts_ms, + // type, detail). + NodeId uint64 `protobuf:"varint,3,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // Types that are valid to be assigned to Detail: + // + // *WatchEvent_Stream + // *WatchEvent_Consumer + // *WatchEvent_Authority + Detail isWatchEvent_Detail `protobuf_oneof:"detail"` + // Set when this watcher fell behind the server's broadcast buffer + // and missed events. The receiver should treat this as an + // explicit "you missed N events" signal — typically by re-listing + // the cluster to catch back up. After this event, the stream + // continues with fresh events; client need not reconnect. + LaggedCount uint64 `protobuf:"varint,6,opt,name=lagged_count,json=laggedCount,proto3" json:"lagged_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WatchEvent) Reset() { + *x = WatchEvent{} + mi := &file_waymaker_streams_proto_msgTypes[81] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WatchEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WatchEvent) ProtoMessage() {} + +func (x *WatchEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[81] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WatchEvent.ProtoReflect.Descriptor instead. +func (*WatchEvent) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{81} +} + +func (x *WatchEvent) GetType() WatchEventType { + if x != nil { + return x.Type + } + return WatchEventType_WATCH_UNKNOWN +} + +func (x *WatchEvent) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *WatchEvent) GetNodeId() uint64 { + if x != nil { + return x.NodeId + } + return 0 +} + +func (x *WatchEvent) GetDetail() isWatchEvent_Detail { + if x != nil { + return x.Detail + } + return nil +} + +func (x *WatchEvent) GetStream() *StreamWatchDetail { + if x != nil { + if x, ok := x.Detail.(*WatchEvent_Stream); ok { + return x.Stream + } + } + return nil +} + +func (x *WatchEvent) GetConsumer() *ConsumerWatchDetail { + if x != nil { + if x, ok := x.Detail.(*WatchEvent_Consumer); ok { + return x.Consumer + } + } + return nil +} + +func (x *WatchEvent) GetAuthority() *AuthorityWatchDetail { + if x != nil { + if x, ok := x.Detail.(*WatchEvent_Authority); ok { + return x.Authority + } + } + return nil +} + +func (x *WatchEvent) GetLaggedCount() uint64 { + if x != nil { + return x.LaggedCount + } + return 0 +} + +type isWatchEvent_Detail interface { + isWatchEvent_Detail() +} + +type WatchEvent_Stream struct { + Stream *StreamWatchDetail `protobuf:"bytes,4,opt,name=stream,proto3,oneof"` +} + +type WatchEvent_Consumer struct { + Consumer *ConsumerWatchDetail `protobuf:"bytes,5,opt,name=consumer,proto3,oneof"` +} + +type WatchEvent_Authority struct { + Authority *AuthorityWatchDetail `protobuf:"bytes,7,opt,name=authority,proto3,oneof"` +} + +func (*WatchEvent_Stream) isWatchEvent_Detail() {} + +func (*WatchEvent_Consumer) isWatchEvent_Detail() {} + +func (*WatchEvent_Authority) isWatchEvent_Detail() {} + +// One pending-delivery entry shipped with a replication snapshot. +type PendingDeliveryPb struct { + state protoimpl.MessageState `protogen:"open.v1"` + Seq uint64 `protobuf:"varint,1,opt,name=seq,proto3" json:"seq,omitempty"` + DeliveredAtMs int64 `protobuf:"varint,2,opt,name=delivered_at_ms,json=deliveredAtMs,proto3" json:"delivered_at_ms,omitempty"` + DeliverCount uint32 `protobuf:"varint,3,opt,name=deliver_count,json=deliverCount,proto3" json:"deliver_count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PendingDeliveryPb) Reset() { + *x = PendingDeliveryPb{} + mi := &file_waymaker_streams_proto_msgTypes[82] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PendingDeliveryPb) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PendingDeliveryPb) ProtoMessage() {} + +func (x *PendingDeliveryPb) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[82] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PendingDeliveryPb.ProtoReflect.Descriptor instead. +func (*PendingDeliveryPb) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{82} +} + +func (x *PendingDeliveryPb) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *PendingDeliveryPb) GetDeliveredAtMs() int64 { + if x != nil { + return x.DeliveredAtMs + } + return 0 +} + +func (x *PendingDeliveryPb) GetDeliverCount() uint32 { + if x != nil { + return x.DeliverCount + } + return 0 +} + +// Full snapshot of one consumer's state at the moment the primary +// committed a fetch/ack/create. Includes the immutable config (so a +// secondary that has never seen this consumer can reconstruct it +// from this message alone), the floor/last_delivered counters, the +// active pending set, the create-time wall-clock, and the running +// `redelivered_dropped` total. +type ConsumerStateSnapshot struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Config *ConsumerConfigPb `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + AckFloor uint64 `protobuf:"varint,3,opt,name=ack_floor,json=ackFloor,proto3" json:"ack_floor,omitempty"` + LastDelivered uint64 `protobuf:"varint,4,opt,name=last_delivered,json=lastDelivered,proto3" json:"last_delivered,omitempty"` + CreatedAtMs int64 `protobuf:"varint,5,opt,name=created_at_ms,json=createdAtMs,proto3" json:"created_at_ms,omitempty"` + RedeliveredDropped uint64 `protobuf:"varint,6,opt,name=redelivered_dropped,json=redeliveredDropped,proto3" json:"redelivered_dropped,omitempty"` + Pending []*PendingDeliveryPb `protobuf:"bytes,7,rep,name=pending,proto3" json:"pending,omitempty"` + // Whether this snapshot represents a deleted consumer — secondaries + // remove the (stream, consumer) entry from their replica store + // rather than overwriting it. + Tombstone bool `protobuf:"varint,8,opt,name=tombstone,proto3" json:"tombstone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConsumerStateSnapshot) Reset() { + *x = ConsumerStateSnapshot{} + mi := &file_waymaker_streams_proto_msgTypes[83] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConsumerStateSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConsumerStateSnapshot) ProtoMessage() {} + +func (x *ConsumerStateSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[83] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConsumerStateSnapshot.ProtoReflect.Descriptor instead. +func (*ConsumerStateSnapshot) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{83} +} + +func (x *ConsumerStateSnapshot) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ConsumerStateSnapshot) GetConfig() *ConsumerConfigPb { + if x != nil { + return x.Config + } + return nil +} + +func (x *ConsumerStateSnapshot) GetAckFloor() uint64 { + if x != nil { + return x.AckFloor + } + return 0 +} + +func (x *ConsumerStateSnapshot) GetLastDelivered() uint64 { + if x != nil { + return x.LastDelivered + } + return 0 +} + +func (x *ConsumerStateSnapshot) GetCreatedAtMs() int64 { + if x != nil { + return x.CreatedAtMs + } + return 0 +} + +func (x *ConsumerStateSnapshot) GetRedeliveredDropped() uint64 { + if x != nil { + return x.RedeliveredDropped + } + return 0 +} + +func (x *ConsumerStateSnapshot) GetPending() []*PendingDeliveryPb { + if x != nil { + return x.Pending + } + return nil +} + +func (x *ConsumerStateSnapshot) GetTombstone() bool { + if x != nil { + return x.Tombstone + } + return false +} + +type ReplicateConsumerStateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Snapshot *ConsumerStateSnapshot `protobuf:"bytes,1,opt,name=snapshot,proto3" json:"snapshot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateConsumerStateRequest) Reset() { + *x = ReplicateConsumerStateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[84] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateConsumerStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateConsumerStateRequest) ProtoMessage() {} + +func (x *ReplicateConsumerStateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[84] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateConsumerStateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateConsumerStateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{84} +} + +func (x *ReplicateConsumerStateRequest) GetSnapshot() *ConsumerStateSnapshot { + if x != nil { + return x.Snapshot + } + return nil +} + +type ReplicateConsumerStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateConsumerStateResponse) Reset() { + *x = ReplicateConsumerStateResponse{} + mi := &file_waymaker_streams_proto_msgTypes[85] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateConsumerStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateConsumerStateResponse) ProtoMessage() {} + +func (x *ReplicateConsumerStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[85] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateConsumerStateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateConsumerStateResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{85} +} + +func (x *ReplicateConsumerStateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateConsumerStateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateConsumerStateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +// One snapshot of a source-tail's persisted progress, pushed from +// the primary to each secondary after each successful batch. +// `tombstone=true` signals "remove this entry" — sent when the +// sourcing stream is deleted so secondaries don't keep stale rows +// they might adopt later. +type SourceTailStateSnapshot struct { + state protoimpl.MessageState `protogen:"open.v1"` + SourcingStream string `protobuf:"bytes,1,opt,name=sourcing_stream,json=sourcingStream,proto3" json:"sourcing_stream,omitempty"` + SourceStream string `protobuf:"bytes,2,opt,name=source_stream,json=sourceStream,proto3" json:"source_stream,omitempty"` + LastSourcedSeq uint64 `protobuf:"varint,3,opt,name=last_sourced_seq,json=lastSourcedSeq,proto3" json:"last_sourced_seq,omitempty"` + PulledTotal uint64 `protobuf:"varint,4,opt,name=pulled_total,json=pulledTotal,proto3" json:"pulled_total,omitempty"` + UpdatedTsMs int64 `protobuf:"varint,5,opt,name=updated_ts_ms,json=updatedTsMs,proto3" json:"updated_ts_ms,omitempty"` + Tombstone bool `protobuf:"varint,6,opt,name=tombstone,proto3" json:"tombstone,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SourceTailStateSnapshot) Reset() { + *x = SourceTailStateSnapshot{} + mi := &file_waymaker_streams_proto_msgTypes[86] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SourceTailStateSnapshot) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SourceTailStateSnapshot) ProtoMessage() {} + +func (x *SourceTailStateSnapshot) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[86] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SourceTailStateSnapshot.ProtoReflect.Descriptor instead. +func (*SourceTailStateSnapshot) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{86} +} + +func (x *SourceTailStateSnapshot) GetSourcingStream() string { + if x != nil { + return x.SourcingStream + } + return "" +} + +func (x *SourceTailStateSnapshot) GetSourceStream() string { + if x != nil { + return x.SourceStream + } + return "" +} + +func (x *SourceTailStateSnapshot) GetLastSourcedSeq() uint64 { + if x != nil { + return x.LastSourcedSeq + } + return 0 +} + +func (x *SourceTailStateSnapshot) GetPulledTotal() uint64 { + if x != nil { + return x.PulledTotal + } + return 0 +} + +func (x *SourceTailStateSnapshot) GetUpdatedTsMs() int64 { + if x != nil { + return x.UpdatedTsMs + } + return 0 +} + +func (x *SourceTailStateSnapshot) GetTombstone() bool { + if x != nil { + return x.Tombstone + } + return false +} + +type ReplicateSourceTailStateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Snapshot *SourceTailStateSnapshot `protobuf:"bytes,1,opt,name=snapshot,proto3" json:"snapshot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateSourceTailStateRequest) Reset() { + *x = ReplicateSourceTailStateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[87] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateSourceTailStateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateSourceTailStateRequest) ProtoMessage() {} + +func (x *ReplicateSourceTailStateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[87] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateSourceTailStateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateSourceTailStateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{87} +} + +func (x *ReplicateSourceTailStateRequest) GetSnapshot() *SourceTailStateSnapshot { + if x != nil { + return x.Snapshot + } + return nil +} + +type ReplicateSourceTailStateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateSourceTailStateResponse) Reset() { + *x = ReplicateSourceTailStateResponse{} + mi := &file_waymaker_streams_proto_msgTypes[88] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateSourceTailStateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateSourceTailStateResponse) ProtoMessage() {} + +func (x *ReplicateSourceTailStateResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[88] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateSourceTailStateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateSourceTailStateResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{88} +} + +func (x *ReplicateSourceTailStateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateSourceTailStateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateSourceTailStateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ReplicateStreamCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Same shape as CreateStreamRequest's config — the secondary + // opens an identical stream in its replica registry so subsequent + // ReplicateMessage calls land in a config-matched file. + Config *StreamConfigPb `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamCreateRequest) Reset() { + *x = ReplicateStreamCreateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[89] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamCreateRequest) ProtoMessage() {} + +func (x *ReplicateStreamCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[89] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamCreateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateStreamCreateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{89} +} + +func (x *ReplicateStreamCreateRequest) GetConfig() *StreamConfigPb { + if x != nil { + return x.Config + } + return nil +} + +type ReplicateStreamCreateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "already_exists" | "invalid_config" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamCreateResponse) Reset() { + *x = ReplicateStreamCreateResponse{} + mi := &file_waymaker_streams_proto_msgTypes[90] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamCreateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamCreateResponse) ProtoMessage() {} + +func (x *ReplicateStreamCreateResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[90] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamCreateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateStreamCreateResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{90} +} + +func (x *ReplicateStreamCreateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateStreamCreateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateStreamCreateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ReplicateMessageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + // The seq the primary assigned. The secondary applies the message + // at this exact seq via `apply_replicated_append` (idempotent on + // replay, errors on out-of-order or divergence). + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"` + Payload []byte `protobuf:"bytes,4,opt,name=payload,proto3" json:"payload,omitempty"` + Headers []*MessageHeader `protobuf:"bytes,5,rep,name=headers,proto3" json:"headers,omitempty"` + TsMs int64 `protobuf:"varint,6,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateMessageRequest) Reset() { + *x = ReplicateMessageRequest{} + mi := &file_waymaker_streams_proto_msgTypes[91] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateMessageRequest) ProtoMessage() {} + +func (x *ReplicateMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[91] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateMessageRequest.ProtoReflect.Descriptor instead. +func (*ReplicateMessageRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{91} +} + +func (x *ReplicateMessageRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ReplicateMessageRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +func (x *ReplicateMessageRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *ReplicateMessageRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *ReplicateMessageRequest) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *ReplicateMessageRequest) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type ReplicateMessageResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "out_of_order" | "divergence" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Receiver's last_seq AFTER applying — primary uses this to detect + // when a secondary has fallen behind and needs a `MigrateStream` + // re-seed. + ReceiverLastSeq uint64 `protobuf:"varint,4,opt,name=receiver_last_seq,json=receiverLastSeq,proto3" json:"receiver_last_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateMessageResponse) Reset() { + *x = ReplicateMessageResponse{} + mi := &file_waymaker_streams_proto_msgTypes[92] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateMessageResponse) ProtoMessage() {} + +func (x *ReplicateMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[92] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateMessageResponse.ProtoReflect.Descriptor instead. +func (*ReplicateMessageResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{92} +} + +func (x *ReplicateMessageResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateMessageResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateMessageResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ReplicateMessageResponse) GetReceiverLastSeq() uint64 { + if x != nil { + return x.ReceiverLastSeq + } + return 0 +} + +type ReplicateStreamDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamDeleteRequest) Reset() { + *x = ReplicateStreamDeleteRequest{} + mi := &file_waymaker_streams_proto_msgTypes[93] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamDeleteRequest) ProtoMessage() {} + +func (x *ReplicateStreamDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[93] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamDeleteRequest.ProtoReflect.Descriptor instead. +func (*ReplicateStreamDeleteRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{93} +} + +func (x *ReplicateStreamDeleteRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type ReplicateStreamDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamDeleteResponse) Reset() { + *x = ReplicateStreamDeleteResponse{} + mi := &file_waymaker_streams_proto_msgTypes[94] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamDeleteResponse) ProtoMessage() {} + +func (x *ReplicateStreamDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[94] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamDeleteResponse.ProtoReflect.Descriptor instead. +func (*ReplicateStreamDeleteResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{94} +} + +func (x *ReplicateStreamDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateStreamDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateStreamDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ReplicateTruncateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + // Drop every message with seq < first_seq. Also raises the + // receiver's `last_seq` to at least `first_seq - 1` so a lagging + // secondary aligns with the primary's expected-next-seq for + // subsequent replication pushes. + FirstSeq uint64 `protobuf:"varint,2,opt,name=first_seq,json=firstSeq,proto3" json:"first_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateTruncateRequest) Reset() { + *x = ReplicateTruncateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[95] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateTruncateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateTruncateRequest) ProtoMessage() {} + +func (x *ReplicateTruncateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[95] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateTruncateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateTruncateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{95} +} + +func (x *ReplicateTruncateRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ReplicateTruncateRequest) GetFirstSeq() uint64 { + if x != nil { + return x.FirstSeq + } + return 0 +} + +type ReplicateTruncateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Number of messages the secondary actually dropped (0 on a no-op + // / idempotent re-call). For drift monitoring. + Dropped uint64 `protobuf:"varint,4,opt,name=dropped,proto3" json:"dropped,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateTruncateResponse) Reset() { + *x = ReplicateTruncateResponse{} + mi := &file_waymaker_streams_proto_msgTypes[96] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateTruncateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateTruncateResponse) ProtoMessage() {} + +func (x *ReplicateTruncateResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[96] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateTruncateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateTruncateResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{96} +} + +func (x *ReplicateTruncateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateTruncateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateTruncateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ReplicateTruncateResponse) GetDropped() uint64 { + if x != nil { + return x.Dropped + } + return 0 +} + +// Mirror of UpdateStreamRequest sent from the primary to each +// secondary after a successful UpdateStream. Same partial-update +// semantics: absent fields leave the secondary's on-disk value +// unchanged. The accompanying prune (if any) is replicated via the +// existing ReplicateTruncate path — this message carries only the +// config change. +type ReplicateStreamUpdateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxAgeMs *uint64 `protobuf:"varint,2,opt,name=max_age_ms,json=maxAgeMs,proto3,oneof" json:"max_age_ms,omitempty"` + MaxMsgs *uint64 `protobuf:"varint,3,opt,name=max_msgs,json=maxMsgs,proto3,oneof" json:"max_msgs,omitempty"` + MaxBytes *uint64 `protobuf:"varint,4,opt,name=max_bytes,json=maxBytes,proto3,oneof" json:"max_bytes,omitempty"` + MaxMsgBytes *uint64 `protobuf:"varint,5,opt,name=max_msg_bytes,json=maxMsgBytes,proto3,oneof" json:"max_msg_bytes,omitempty"` + StrictLimits *bool `protobuf:"varint,6,opt,name=strict_limits,json=strictLimits,proto3,oneof" json:"strict_limits,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamUpdateRequest) Reset() { + *x = ReplicateStreamUpdateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[97] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamUpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamUpdateRequest) ProtoMessage() {} + +func (x *ReplicateStreamUpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[97] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamUpdateRequest.ProtoReflect.Descriptor instead. +func (*ReplicateStreamUpdateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{97} +} + +func (x *ReplicateStreamUpdateRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ReplicateStreamUpdateRequest) GetMaxAgeMs() uint64 { + if x != nil && x.MaxAgeMs != nil { + return *x.MaxAgeMs + } + return 0 +} + +func (x *ReplicateStreamUpdateRequest) GetMaxMsgs() uint64 { + if x != nil && x.MaxMsgs != nil { + return *x.MaxMsgs + } + return 0 +} + +func (x *ReplicateStreamUpdateRequest) GetMaxBytes() uint64 { + if x != nil && x.MaxBytes != nil { + return *x.MaxBytes + } + return 0 +} + +func (x *ReplicateStreamUpdateRequest) GetMaxMsgBytes() uint64 { + if x != nil && x.MaxMsgBytes != nil { + return *x.MaxMsgBytes + } + return 0 +} + +func (x *ReplicateStreamUpdateRequest) GetStrictLimits() bool { + if x != nil && x.StrictLimits != nil { + return *x.StrictLimits + } + return false +} + +type ReplicateStreamUpdateResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateStreamUpdateResponse) Reset() { + *x = ReplicateStreamUpdateResponse{} + mi := &file_waymaker_streams_proto_msgTypes[98] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateStreamUpdateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateStreamUpdateResponse) ProtoMessage() {} + +func (x *ReplicateStreamUpdateResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[98] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateStreamUpdateResponse.ProtoReflect.Descriptor instead. +func (*ReplicateStreamUpdateResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{98} +} + +func (x *ReplicateStreamUpdateResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateStreamUpdateResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateStreamUpdateResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type ReplicateWorkQueueAckRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Stream string `protobuf:"bytes,1,opt,name=stream,proto3" json:"stream,omitempty"` + Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateWorkQueueAckRequest) Reset() { + *x = ReplicateWorkQueueAckRequest{} + mi := &file_waymaker_streams_proto_msgTypes[99] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateWorkQueueAckRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateWorkQueueAckRequest) ProtoMessage() {} + +func (x *ReplicateWorkQueueAckRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[99] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateWorkQueueAckRequest.ProtoReflect.Descriptor instead. +func (*ReplicateWorkQueueAckRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{99} +} + +func (x *ReplicateWorkQueueAckRequest) GetStream() string { + if x != nil { + return x.Stream + } + return "" +} + +func (x *ReplicateWorkQueueAckRequest) GetSeq() uint64 { + if x != nil { + return x.Seq + } + return 0 +} + +type ReplicateWorkQueueAckResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_stream" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Whether the secondary's replica had the seq present before the + // delete (the operation is idempotent, so `false` here is normal + // for a retry / late-arriving call). + WasPresent bool `protobuf:"varint,4,opt,name=was_present,json=wasPresent,proto3" json:"was_present,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReplicateWorkQueueAckResponse) Reset() { + *x = ReplicateWorkQueueAckResponse{} + mi := &file_waymaker_streams_proto_msgTypes[100] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReplicateWorkQueueAckResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReplicateWorkQueueAckResponse) ProtoMessage() {} + +func (x *ReplicateWorkQueueAckResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[100] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReplicateWorkQueueAckResponse.ProtoReflect.Descriptor instead. +func (*ReplicateWorkQueueAckResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{100} +} + +func (x *ReplicateWorkQueueAckResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ReplicateWorkQueueAckResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ReplicateWorkQueueAckResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ReplicateWorkQueueAckResponse) GetWasPresent() bool { + if x != nil { + return x.WasPresent + } + return false +} + +// Metadata about a stored object. Sent back on Get/Info/List; the +// server reconstructs this from the `objm.` message body +// (JSON-encoded) plus the message seq. Treat this message as a +// blob description, not a payload — payload is fetched via +// GetObject. +type ObjectInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Object name (the part after the bucket prefix). + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Total payload bytes across all chunks (after assembly). + TotalBytes uint64 `protobuf:"varint,2,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + // Bytes per chunk (last chunk may be smaller). 0 for empty + // objects. + ChunkSize uint64 `protobuf:"varint,3,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` + // Number of `objc..` messages required to reconstitute + // the payload. 0 for empty objects. + ChunkCount uint64 `protobuf:"varint,4,opt,name=chunk_count,json=chunkCount,proto3" json:"chunk_count,omitempty"` + // SHA-256 of the assembled payload, hex-encoded. Set by the + // server; verified by Get. + Sha256 string `protobuf:"bytes,5,opt,name=sha256,proto3" json:"sha256,omitempty"` + // Server wall-clock at metadata-publish time (ms since epoch). + TsMs int64 `protobuf:"varint,6,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + // Opaque headers the client attached at Put time. Preserved + // verbatim on Get. + Headers []*MessageHeader `protobuf:"bytes,7,rep,name=headers,proto3" json:"headers,omitempty"` + // The metadata message's seq number — doubles as the object + // revision id. A second Put with the same name bumps it. + MetadataSeq uint64 `protobuf:"varint,8,opt,name=metadata_seq,json=metadataSeq,proto3" json:"metadata_seq,omitempty"` + // Phase 5 — `true` when the object was Put with `dedupe=true`. + // Chunks are stored at `obj_chunk.` (shared across + // objects in the bucket); `false` for legacy `objc..`. + Deduped bool `protobuf:"varint,9,opt,name=deduped,proto3" json:"deduped,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectInfo) Reset() { + *x = ObjectInfo{} + mi := &file_waymaker_streams_proto_msgTypes[101] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectInfo) ProtoMessage() {} + +func (x *ObjectInfo) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[101] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectInfo.ProtoReflect.Descriptor instead. +func (*ObjectInfo) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{101} +} + +func (x *ObjectInfo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ObjectInfo) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *ObjectInfo) GetChunkSize() uint64 { + if x != nil { + return x.ChunkSize + } + return 0 +} + +func (x *ObjectInfo) GetChunkCount() uint64 { + if x != nil { + return x.ChunkCount + } + return 0 +} + +func (x *ObjectInfo) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + +func (x *ObjectInfo) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *ObjectInfo) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *ObjectInfo) GetMetadataSeq() uint64 { + if x != nil { + return x.MetadataSeq + } + return 0 +} + +func (x *ObjectInfo) GetDeduped() bool { + if x != nil { + return x.Deduped + } + return false +} + +type PutObjectRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` + // Bytes per chunk. 0 = server default (1 MiB). + ChunkSize uint64 `protobuf:"varint,4,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` + // Optional headers — preserved verbatim in the metadata blob. + Headers []*MessageHeader `protobuf:"bytes,5,rep,name=headers,proto3" json:"headers,omitempty"` + // Optional pre-computed SHA-256 hex; the server verifies after + // chunking + before publishing metadata. Empty = the server + // computes its own hash from the payload. + Sha256 string `protobuf:"bytes,6,opt,name=sha256,proto3" json:"sha256,omitempty"` + // Phase 5 cross-object dedupe. When set, each chunk is hashed + // and stored at the content-addressed subject `obj_chunk.`; + // identical content across objects shares storage. Metadata + // records the chunk hashes in order so Get can re-assemble. + // See `waymaker-streams/DEDUPE_DESIGN.md`. + Dedupe bool `protobuf:"varint,7,opt,name=dedupe,proto3" json:"dedupe,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutObjectRequest) Reset() { + *x = PutObjectRequest{} + mi := &file_waymaker_streams_proto_msgTypes[102] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutObjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutObjectRequest) ProtoMessage() {} + +func (x *PutObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[102] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutObjectRequest.ProtoReflect.Descriptor instead. +func (*PutObjectRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{102} +} + +func (x *PutObjectRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *PutObjectRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PutObjectRequest) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +func (x *PutObjectRequest) GetChunkSize() uint64 { + if x != nil { + return x.ChunkSize + } + return 0 +} + +func (x *PutObjectRequest) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *PutObjectRequest) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + +func (x *PutObjectRequest) GetDedupe() bool { + if x != nil { + return x.Dedupe + } + return false +} + +type PutObjectResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" | "sha_mismatch" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Info *ObjectInfo `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutObjectResponse) Reset() { + *x = PutObjectResponse{} + mi := &file_waymaker_streams_proto_msgTypes[103] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutObjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutObjectResponse) ProtoMessage() {} + +func (x *PutObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[103] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutObjectResponse.ProtoReflect.Descriptor instead. +func (*PutObjectResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{103} +} + +func (x *PutObjectResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *PutObjectResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *PutObjectResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *PutObjectResponse) GetInfo() *ObjectInfo { + if x != nil { + return x.Info + } + return nil +} + +// Streaming Put — first frame sets `start`; subsequent frames +// carry `data`. Each non-empty `data` becomes one chunk message +// in seq order. Last frame sets `finish=true` so the server +// commits metadata; closing the stream without `finish=true` +// leaves the upload aborted (orphan chunks). +type PutObjectStreamFrame struct { + state protoimpl.MessageState `protogen:"open.v1"` + Start *PutObjectStart `protobuf:"bytes,1,opt,name=start,proto3,oneof" json:"start,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Finish bool `protobuf:"varint,3,opt,name=finish,proto3" json:"finish,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutObjectStreamFrame) Reset() { + *x = PutObjectStreamFrame{} + mi := &file_waymaker_streams_proto_msgTypes[104] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutObjectStreamFrame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutObjectStreamFrame) ProtoMessage() {} + +func (x *PutObjectStreamFrame) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[104] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutObjectStreamFrame.ProtoReflect.Descriptor instead. +func (*PutObjectStreamFrame) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{104} +} + +func (x *PutObjectStreamFrame) GetStart() *PutObjectStart { + if x != nil { + return x.Start + } + return nil +} + +func (x *PutObjectStreamFrame) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *PutObjectStreamFrame) GetFinish() bool { + if x != nil { + return x.Finish + } + return false +} + +type PutObjectStart struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Bytes per chunk. 0 = server default. Note: with streaming Put + // the client controls chunk boundaries by frame size — this + // field is purely metadata-recorded, not used to re-chunk. + ChunkSize uint64 `protobuf:"varint,3,opt,name=chunk_size,json=chunkSize,proto3" json:"chunk_size,omitempty"` + Headers []*MessageHeader `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"` + // Optional SHA-256 hex. Server verifies against the running + // hash before committing metadata; mismatch aborts the Put + // (chunks already published become orphan; GC reclaims them). + Sha256 string `protobuf:"bytes,5,opt,name=sha256,proto3" json:"sha256,omitempty"` + // Phase 5 cross-object dedupe. When set, each chunk is hashed + // and stored at the content-addressed subject `obj_chunk.`; + // identical content across objects shares storage. See + // `waymaker-streams/DEDUPE_DESIGN.md`. + Dedupe bool `protobuf:"varint,6,opt,name=dedupe,proto3" json:"dedupe,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PutObjectStart) Reset() { + *x = PutObjectStart{} + mi := &file_waymaker_streams_proto_msgTypes[105] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PutObjectStart) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PutObjectStart) ProtoMessage() {} + +func (x *PutObjectStart) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[105] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PutObjectStart.ProtoReflect.Descriptor instead. +func (*PutObjectStart) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{105} +} + +func (x *PutObjectStart) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *PutObjectStart) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PutObjectStart) GetChunkSize() uint64 { + if x != nil { + return x.ChunkSize + } + return 0 +} + +func (x *PutObjectStart) GetHeaders() []*MessageHeader { + if x != nil { + return x.Headers + } + return nil +} + +func (x *PutObjectStart) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + +func (x *PutObjectStart) GetDedupe() bool { + if x != nil { + return x.Dedupe + } + return false +} + +type GetObjectRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectRequest) Reset() { + *x = GetObjectRequest{} + mi := &file_waymaker_streams_proto_msgTypes[106] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectRequest) ProtoMessage() {} + +func (x *GetObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[106] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectRequest.ProtoReflect.Descriptor instead. +func (*GetObjectRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{106} +} + +func (x *GetObjectRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *GetObjectRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetObjectResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" | "sha_mismatch" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Info *ObjectInfo `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` + Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectResponse) Reset() { + *x = GetObjectResponse{} + mi := &file_waymaker_streams_proto_msgTypes[107] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectResponse) ProtoMessage() {} + +func (x *GetObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[107] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectResponse.ProtoReflect.Descriptor instead. +func (*GetObjectResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{107} +} + +func (x *GetObjectResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetObjectResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetObjectResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetObjectResponse) GetInfo() *ObjectInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *GetObjectResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +// Streaming Get — first frame carries `info` (metadata only, no +// data); subsequent frames carry `data` (one per chunk). +// Final frame sets `done=true`. The server stops streaming on +// the first error; in particular `sha_mismatch` is sent as a +// gRPC Status (Aborted), not as a result_code in a frame. +type GetObjectStreamFrame struct { + state protoimpl.MessageState `protogen:"open.v1"` + Info *ObjectInfo `protobuf:"bytes,1,opt,name=info,proto3,oneof" json:"info,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Done bool `protobuf:"varint,3,opt,name=done,proto3" json:"done,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectStreamFrame) Reset() { + *x = GetObjectStreamFrame{} + mi := &file_waymaker_streams_proto_msgTypes[108] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectStreamFrame) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectStreamFrame) ProtoMessage() {} + +func (x *GetObjectStreamFrame) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[108] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectStreamFrame.ProtoReflect.Descriptor instead. +func (*GetObjectStreamFrame) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{108} +} + +func (x *GetObjectStreamFrame) GetInfo() *ObjectInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *GetObjectStreamFrame) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *GetObjectStreamFrame) GetDone() bool { + if x != nil { + return x.Done + } + return false +} + +type DeleteObjectRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteObjectRequest) Reset() { + *x = DeleteObjectRequest{} + mi := &file_waymaker_streams_proto_msgTypes[109] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteObjectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteObjectRequest) ProtoMessage() {} + +func (x *DeleteObjectRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[109] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteObjectRequest.ProtoReflect.Descriptor instead. +func (*DeleteObjectRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{109} +} + +func (x *DeleteObjectRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *DeleteObjectRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteObjectResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Tombstone metadata seq, useful for client confirmations. + TombstoneSeq uint64 `protobuf:"varint,4,opt,name=tombstone_seq,json=tombstoneSeq,proto3" json:"tombstone_seq,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteObjectResponse) Reset() { + *x = DeleteObjectResponse{} + mi := &file_waymaker_streams_proto_msgTypes[110] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteObjectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteObjectResponse) ProtoMessage() {} + +func (x *DeleteObjectResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[110] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteObjectResponse.ProtoReflect.Descriptor instead. +func (*DeleteObjectResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{110} +} + +func (x *DeleteObjectResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteObjectResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteObjectResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *DeleteObjectResponse) GetTombstoneSeq() uint64 { + if x != nil { + return x.TombstoneSeq + } + return 0 +} + +type GetObjectInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectInfoRequest) Reset() { + *x = GetObjectInfoRequest{} + mi := &file_waymaker_streams_proto_msgTypes[111] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectInfoRequest) ProtoMessage() {} + +func (x *GetObjectInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[111] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectInfoRequest.ProtoReflect.Descriptor instead. +func (*GetObjectInfoRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{111} +} + +func (x *GetObjectInfoRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *GetObjectInfoRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetObjectInfoResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "no_such_object" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Unset when the object name has no live metadata (never put, + // or tombstoned). + Info *ObjectInfo `protobuf:"bytes,4,opt,name=info,proto3,oneof" json:"info,omitempty"` + // True if the latest metadata is a tombstone (logical delete). + Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectInfoResponse) Reset() { + *x = GetObjectInfoResponse{} + mi := &file_waymaker_streams_proto_msgTypes[112] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectInfoResponse) ProtoMessage() {} + +func (x *GetObjectInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[112] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectInfoResponse.ProtoReflect.Descriptor instead. +func (*GetObjectInfoResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{112} +} + +func (x *GetObjectInfoResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetObjectInfoResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetObjectInfoResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetObjectInfoResponse) GetInfo() *ObjectInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *GetObjectInfoResponse) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type ListObjectsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + // Optional name prefix filter (no leading `objm.` — pass just + // the object-name prefix). + NamePrefix string `protobuf:"bytes,2,opt,name=name_prefix,json=namePrefix,proto3" json:"name_prefix,omitempty"` + // Include tombstoned entries? Default false. + IncludeDeleted bool `protobuf:"varint,3,opt,name=include_deleted,json=includeDeleted,proto3" json:"include_deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListObjectsRequest) Reset() { + *x = ListObjectsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[113] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListObjectsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListObjectsRequest) ProtoMessage() {} + +func (x *ListObjectsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[113] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListObjectsRequest.ProtoReflect.Descriptor instead. +func (*ListObjectsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{113} +} + +func (x *ListObjectsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *ListObjectsRequest) GetNamePrefix() string { + if x != nil { + return x.NamePrefix + } + return "" +} + +func (x *ListObjectsRequest) GetIncludeDeleted() bool { + if x != nil { + return x.IncludeDeleted + } + return false +} + +type ListObjectsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*ObjectListEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListObjectsResponse) Reset() { + *x = ListObjectsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[114] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListObjectsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListObjectsResponse) ProtoMessage() {} + +func (x *ListObjectsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[114] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListObjectsResponse.ProtoReflect.Descriptor instead. +func (*ListObjectsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{114} +} + +func (x *ListObjectsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListObjectsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ListObjectsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListObjectsResponse) GetEntries() []*ObjectListEntry { + if x != nil { + return x.Entries + } + return nil +} + +type ObjectListEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TotalBytes uint64 `protobuf:"varint,2,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + Deleted bool `protobuf:"varint,3,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectListEntry) Reset() { + *x = ObjectListEntry{} + mi := &file_waymaker_streams_proto_msgTypes[115] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectListEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectListEntry) ProtoMessage() {} + +func (x *ObjectListEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[115] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectListEntry.ProtoReflect.Descriptor instead. +func (*ObjectListEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{115} +} + +func (x *ObjectListEntry) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ObjectListEntry) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *ObjectListEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type ListObjectRevisionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // Start scanning at metadata seq >= `from_seq`. 0 = beginning. + FromSeq uint64 `protobuf:"varint,3,opt,name=from_seq,json=fromSeq,proto3" json:"from_seq,omitempty"` + // Cap on returned revisions. 0 = server default (100). + Limit uint64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListObjectRevisionsRequest) Reset() { + *x = ListObjectRevisionsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[116] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListObjectRevisionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListObjectRevisionsRequest) ProtoMessage() {} + +func (x *ListObjectRevisionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[116] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListObjectRevisionsRequest.ProtoReflect.Descriptor instead. +func (*ListObjectRevisionsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{116} +} + +func (x *ListObjectRevisionsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *ListObjectRevisionsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ListObjectRevisionsRequest) GetFromSeq() uint64 { + if x != nil { + return x.FromSeq + } + return 0 +} + +func (x *ListObjectRevisionsRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type ListObjectRevisionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revisions []*ObjectRevisionEntry `protobuf:"bytes,4,rep,name=revisions,proto3" json:"revisions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListObjectRevisionsResponse) Reset() { + *x = ListObjectRevisionsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[117] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListObjectRevisionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListObjectRevisionsResponse) ProtoMessage() {} + +func (x *ListObjectRevisionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[117] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListObjectRevisionsResponse.ProtoReflect.Descriptor instead. +func (*ListObjectRevisionsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{117} +} + +func (x *ListObjectRevisionsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *ListObjectRevisionsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *ListObjectRevisionsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *ListObjectRevisionsResponse) GetRevisions() []*ObjectRevisionEntry { + if x != nil { + return x.Revisions + } + return nil +} + +type GetObjectRangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Offset uint64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"` + // Bytes to return. 0 = whole tail (`total_bytes - offset`). + Len uint64 `protobuf:"varint,4,opt,name=len,proto3" json:"len,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectRangeRequest) Reset() { + *x = GetObjectRangeRequest{} + mi := &file_waymaker_streams_proto_msgTypes[118] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectRangeRequest) ProtoMessage() {} + +func (x *GetObjectRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[118] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectRangeRequest.ProtoReflect.Descriptor instead. +func (*GetObjectRangeRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{118} +} + +func (x *GetObjectRangeRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *GetObjectRangeRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *GetObjectRangeRequest) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *GetObjectRangeRequest) GetLen() uint64 { + if x != nil { + return x.Len + } + return 0 +} + +type GetObjectRangeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // The full object's info (size, hash, etc.). Useful for the + // client to know the total size when paginating. + Info *ObjectInfo `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"` + // Bytes [offset, offset + actual_len). `actual_len` may be less + // than the requested `len` when the range extends past the + // object's end. + ActualOffset uint64 `protobuf:"varint,5,opt,name=actual_offset,json=actualOffset,proto3" json:"actual_offset,omitempty"` + Payload []byte `protobuf:"bytes,6,opt,name=payload,proto3" json:"payload,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetObjectRangeResponse) Reset() { + *x = GetObjectRangeResponse{} + mi := &file_waymaker_streams_proto_msgTypes[119] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetObjectRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetObjectRangeResponse) ProtoMessage() {} + +func (x *GetObjectRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[119] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetObjectRangeResponse.ProtoReflect.Descriptor instead. +func (*GetObjectRangeResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{119} +} + +func (x *GetObjectRangeResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *GetObjectRangeResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *GetObjectRangeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetObjectRangeResponse) GetInfo() *ObjectInfo { + if x != nil { + return x.Info + } + return nil +} + +func (x *GetObjectRangeResponse) GetActualOffset() uint64 { + if x != nil { + return x.ActualOffset + } + return 0 +} + +func (x *GetObjectRangeResponse) GetPayload() []byte { + if x != nil { + return x.Payload + } + return nil +} + +type ObjectRevisionEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Metadata message seq — doubles as the revision id. + MetadataSeq uint64 `protobuf:"varint,1,opt,name=metadata_seq,json=metadataSeq,proto3" json:"metadata_seq,omitempty"` + // Always present, including for tombstones (where `deleted=true` + // and the other fields fall back to 0/empty). + Deleted bool `protobuf:"varint,2,opt,name=deleted,proto3" json:"deleted,omitempty"` + TotalBytes uint64 `protobuf:"varint,3,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"` + ChunkCount uint64 `protobuf:"varint,4,opt,name=chunk_count,json=chunkCount,proto3" json:"chunk_count,omitempty"` + Sha256 string `protobuf:"bytes,5,opt,name=sha256,proto3" json:"sha256,omitempty"` + TsMs int64 `protobuf:"varint,6,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ObjectRevisionEntry) Reset() { + *x = ObjectRevisionEntry{} + mi := &file_waymaker_streams_proto_msgTypes[120] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ObjectRevisionEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ObjectRevisionEntry) ProtoMessage() {} + +func (x *ObjectRevisionEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[120] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ObjectRevisionEntry.ProtoReflect.Descriptor instead. +func (*ObjectRevisionEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{120} +} + +func (x *ObjectRevisionEntry) GetMetadataSeq() uint64 { + if x != nil { + return x.MetadataSeq + } + return 0 +} + +func (x *ObjectRevisionEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +func (x *ObjectRevisionEntry) GetTotalBytes() uint64 { + if x != nil { + return x.TotalBytes + } + return 0 +} + +func (x *ObjectRevisionEntry) GetChunkCount() uint64 { + if x != nil { + return x.ChunkCount + } + return 0 +} + +func (x *ObjectRevisionEntry) GetSha256() string { + if x != nil { + return x.Sha256 + } + return "" +} + +func (x *ObjectRevisionEntry) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type KvCreateBucketRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` // 0 = unbounded + MaxValueSize uint64 `protobuf:"varint,3,opt,name=max_value_size,json=maxValueSize,proto3" json:"max_value_size,omitempty"` // 0 = no per-value cap + // Bucket-level TTL (ms). 0 = no time-based eviction. + // Bucket-level TTL is independent of per-key TTL set via KvPut. + MaxAgeMs uint64 `protobuf:"varint,4,opt,name=max_age_ms,json=maxAgeMs,proto3" json:"max_age_ms,omitempty"` + Ephemeral bool `protobuf:"varint,5,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateBucketRequest) Reset() { + *x = KvCreateBucketRequest{} + mi := &file_waymaker_streams_proto_msgTypes[121] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateBucketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateBucketRequest) ProtoMessage() {} + +func (x *KvCreateBucketRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[121] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateBucketRequest.ProtoReflect.Descriptor instead. +func (*KvCreateBucketRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{121} +} + +func (x *KvCreateBucketRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvCreateBucketRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *KvCreateBucketRequest) GetMaxValueSize() uint64 { + if x != nil { + return x.MaxValueSize + } + return 0 +} + +func (x *KvCreateBucketRequest) GetMaxAgeMs() uint64 { + if x != nil { + return x.MaxAgeMs + } + return 0 +} + +func (x *KvCreateBucketRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type KvCreateBucketResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "already_exists" | "invalid_config" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateBucketResponse) Reset() { + *x = KvCreateBucketResponse{} + mi := &file_waymaker_streams_proto_msgTypes[122] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateBucketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateBucketResponse) ProtoMessage() {} + +func (x *KvCreateBucketResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[122] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateBucketResponse.ProtoReflect.Descriptor instead. +func (*KvCreateBucketResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{122} +} + +func (x *KvCreateBucketResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvCreateBucketResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvCreateBucketResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type KvDeleteBucketRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteBucketRequest) Reset() { + *x = KvDeleteBucketRequest{} + mi := &file_waymaker_streams_proto_msgTypes[123] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteBucketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteBucketRequest) ProtoMessage() {} + +func (x *KvDeleteBucketRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[123] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteBucketRequest.ProtoReflect.Descriptor instead. +func (*KvDeleteBucketRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{123} +} + +func (x *KvDeleteBucketRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type KvDeleteBucketResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteBucketResponse) Reset() { + *x = KvDeleteBucketResponse{} + mi := &file_waymaker_streams_proto_msgTypes[124] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteBucketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteBucketResponse) ProtoMessage() {} + +func (x *KvDeleteBucketResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[124] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteBucketResponse.ProtoReflect.Descriptor instead. +func (*KvDeleteBucketResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{124} +} + +func (x *KvDeleteBucketResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvDeleteBucketResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvDeleteBucketResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type KvPutRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // Per-key TTL in milliseconds. 0 = no TTL. + TtlMs uint64 `protobuf:"varint,4,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutRequest) Reset() { + *x = KvPutRequest{} + mi := &file_waymaker_streams_proto_msgTypes[125] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutRequest) ProtoMessage() {} + +func (x *KvPutRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[125] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutRequest.ProtoReflect.Descriptor instead. +func (*KvPutRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{125} +} + +func (x *KvPutRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvPutRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvPutRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvPutRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvCreateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + TtlMs uint64 `protobuf:"varint,4,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvCreateRequest) Reset() { + *x = KvCreateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[126] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvCreateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvCreateRequest) ProtoMessage() {} + +func (x *KvCreateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[126] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvCreateRequest.ProtoReflect.Descriptor instead. +func (*KvCreateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{126} +} + +func (x *KvCreateRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvCreateRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvCreateRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvCreateRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvUpdateRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` + // The revision the caller believes is current. Server returns + // wrong_revision if mismatch. + ExpectedRevision uint64 `protobuf:"varint,4,opt,name=expected_revision,json=expectedRevision,proto3" json:"expected_revision,omitempty"` + TtlMs uint64 `protobuf:"varint,5,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvUpdateRequest) Reset() { + *x = KvUpdateRequest{} + mi := &file_waymaker_streams_proto_msgTypes[127] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvUpdateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvUpdateRequest) ProtoMessage() {} + +func (x *KvUpdateRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[127] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvUpdateRequest.ProtoReflect.Descriptor instead. +func (*KvUpdateRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{127} +} + +func (x *KvUpdateRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvUpdateRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvUpdateRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvUpdateRequest) GetExpectedRevision() uint64 { + if x != nil { + return x.ExpectedRevision + } + return 0 +} + +func (x *KvUpdateRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvPutResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + // "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Assigned revision (stream sequence) of the newly-written + // value. On wrong_revision, this is the *current* server-side + // revision the caller can retry against. + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutResponse) Reset() { + *x = KvPutResponse{} + mi := &file_waymaker_streams_proto_msgTypes[128] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutResponse) ProtoMessage() {} + +func (x *KvPutResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[128] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutResponse.ProtoReflect.Descriptor instead. +func (*KvPutResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{128} +} + +func (x *KvPutResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvPutResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvPutResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvPutResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type KvGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvGetRequest) Reset() { + *x = KvGetRequest{} + mi := &file_waymaker_streams_proto_msgTypes[129] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvGetRequest) ProtoMessage() {} + +func (x *KvGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[129] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvGetRequest.ProtoReflect.Descriptor instead. +func (*KvGetRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{129} +} + +func (x *KvGetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvGetRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Unset when the key has no value or is tombstoned. + Entry *KvEntry `protobuf:"bytes,4,opt,name=entry,proto3,oneof" json:"entry,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvGetResponse) Reset() { + *x = KvGetResponse{} + mi := &file_waymaker_streams_proto_msgTypes[130] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvGetResponse) ProtoMessage() {} + +func (x *KvGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[130] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvGetResponse.ProtoReflect.Descriptor instead. +func (*KvGetResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{130} +} + +func (x *KvGetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvGetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvGetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvGetResponse) GetEntry() *KvEntry { + if x != nil { + return x.Entry + } + return nil +} + +type KvEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvEntry) Reset() { + *x = KvEntry{} + mi := &file_waymaker_streams_proto_msgTypes[131] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvEntry) ProtoMessage() {} + +func (x *KvEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[131] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvEntry.ProtoReflect.Descriptor instead. +func (*KvEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{131} +} + +func (x *KvEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvEntry) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type KvDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteRequest) Reset() { + *x = KvDeleteRequest{} + mi := &file_waymaker_streams_proto_msgTypes[132] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteRequest) ProtoMessage() {} + +func (x *KvDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[132] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteRequest.ProtoReflect.Descriptor instead. +func (*KvDeleteRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{132} +} + +func (x *KvDeleteRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvDeleteRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` // "ok" | "no_such_bucket" | "internal" + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteResponse) Reset() { + *x = KvDeleteResponse{} + mi := &file_waymaker_streams_proto_msgTypes[133] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteResponse) ProtoMessage() {} + +func (x *KvDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[133] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteResponse.ProtoReflect.Descriptor instead. +func (*KvDeleteResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{133} +} + +func (x *KvDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvDeleteResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type KvKeysRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeysRequest) Reset() { + *x = KvKeysRequest{} + mi := &file_waymaker_streams_proto_msgTypes[134] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeysRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeysRequest) ProtoMessage() {} + +func (x *KvKeysRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[134] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeysRequest.ProtoReflect.Descriptor instead. +func (*KvKeysRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{134} +} + +func (x *KvKeysRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type KvKeysResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*KvKeyEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeysResponse) Reset() { + *x = KvKeysResponse{} + mi := &file_waymaker_streams_proto_msgTypes[135] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeysResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeysResponse) ProtoMessage() {} + +func (x *KvKeysResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[135] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeysResponse.ProtoReflect.Descriptor instead. +func (*KvKeysResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{135} +} + +func (x *KvKeysResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvKeysResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvKeysResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvKeysResponse) GetEntries() []*KvKeyEntry { + if x != nil { + return x.Entries + } + return nil +} + +type KvKeyEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + // True if the latest message at this key is a tombstone. + Deleted bool `protobuf:"varint,3,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvKeyEntry) Reset() { + *x = KvKeyEntry{} + mi := &file_waymaker_streams_proto_msgTypes[136] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvKeyEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvKeyEntry) ProtoMessage() {} + +func (x *KvKeyEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[136] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvKeyEntry.ProtoReflect.Descriptor instead. +func (*KvKeyEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{136} +} + +func (x *KvKeyEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvKeyEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvKeyEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type KvHistoryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + FromRevision uint64 `protobuf:"varint,3,opt,name=from_revision,json=fromRevision,proto3" json:"from_revision,omitempty"` // 0 = from beginning + Limit uint64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` // 0 = server default + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryRequest) Reset() { + *x = KvHistoryRequest{} + mi := &file_waymaker_streams_proto_msgTypes[137] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryRequest) ProtoMessage() {} + +func (x *KvHistoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[137] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryRequest.ProtoReflect.Descriptor instead. +func (*KvHistoryRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{137} +} + +func (x *KvHistoryRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvHistoryRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvHistoryRequest) GetFromRevision() uint64 { + if x != nil { + return x.FromRevision + } + return 0 +} + +func (x *KvHistoryRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type KvHistoryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*KvHistoryEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryResponse) Reset() { + *x = KvHistoryResponse{} + mi := &file_waymaker_streams_proto_msgTypes[138] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryResponse) ProtoMessage() {} + +func (x *KvHistoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[138] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryResponse.ProtoReflect.Descriptor instead. +func (*KvHistoryResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{138} +} + +func (x *KvHistoryResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *KvHistoryResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *KvHistoryResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *KvHistoryResponse) GetEntries() []*KvHistoryEntry { + if x != nil { + return x.Entries + } + return nil +} + +type KvHistoryEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + Deleted bool `protobuf:"varint,4,opt,name=deleted,proto3" json:"deleted,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvHistoryEntry) Reset() { + *x = KvHistoryEntry{} + mi := &file_waymaker_streams_proto_msgTypes[139] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvHistoryEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvHistoryEntry) ProtoMessage() {} + +func (x *KvHistoryEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[139] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvHistoryEntry.ProtoReflect.Descriptor instead. +func (*KvHistoryEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{139} +} + +func (x *KvHistoryEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvHistoryEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvHistoryEntry) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +func (x *KvHistoryEntry) GetDeleted() bool { + if x != nil { + return x.Deleted + } + return false +} + +type KvTouchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + TtlMs uint64 `protobuf:"varint,3,opt,name=ttl_ms,json=ttlMs,proto3" json:"ttl_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvTouchRequest) Reset() { + *x = KvTouchRequest{} + mi := &file_waymaker_streams_proto_msgTypes[140] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvTouchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvTouchRequest) ProtoMessage() {} + +func (x *KvTouchRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[140] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvTouchRequest.ProtoReflect.Descriptor instead. +func (*KvTouchRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{140} +} + +func (x *KvTouchRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvTouchRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvTouchRequest) GetTtlMs() uint64 { + if x != nil { + return x.TtlMs + } + return 0 +} + +type KvWatchRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + // Empty = watch every key in the bucket. Non-empty = watch only + // this key. + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvWatchRequest) Reset() { + *x = KvWatchRequest{} + mi := &file_waymaker_streams_proto_msgTypes[141] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvWatchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvWatchRequest) ProtoMessage() {} + +func (x *KvWatchRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[141] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvWatchRequest.ProtoReflect.Descriptor instead. +func (*KvWatchRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{141} +} + +func (x *KvWatchRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *KvWatchRequest) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +type KvWatchEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Event: + // + // *KvWatchEvent_Put + // *KvWatchEvent_Delete + Event isKvWatchEvent_Event `protobuf_oneof:"event"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvWatchEvent) Reset() { + *x = KvWatchEvent{} + mi := &file_waymaker_streams_proto_msgTypes[142] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvWatchEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvWatchEvent) ProtoMessage() {} + +func (x *KvWatchEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[142] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvWatchEvent.ProtoReflect.Descriptor instead. +func (*KvWatchEvent) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{142} +} + +func (x *KvWatchEvent) GetEvent() isKvWatchEvent_Event { + if x != nil { + return x.Event + } + return nil +} + +func (x *KvWatchEvent) GetPut() *KvPutEvent { + if x != nil { + if x, ok := x.Event.(*KvWatchEvent_Put); ok { + return x.Put + } + } + return nil +} + +func (x *KvWatchEvent) GetDelete() *KvDeleteEvent { + if x != nil { + if x, ok := x.Event.(*KvWatchEvent_Delete); ok { + return x.Delete + } + } + return nil +} + +type isKvWatchEvent_Event interface { + isKvWatchEvent_Event() +} + +type KvWatchEvent_Put struct { + Put *KvPutEvent `protobuf:"bytes,1,opt,name=put,proto3,oneof"` +} + +type KvWatchEvent_Delete struct { + Delete *KvDeleteEvent `protobuf:"bytes,2,opt,name=delete,proto3,oneof"` +} + +func (*KvWatchEvent_Put) isKvWatchEvent_Event() {} + +func (*KvWatchEvent_Delete) isKvWatchEvent_Event() {} + +type KvPutEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,4,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvPutEvent) Reset() { + *x = KvPutEvent{} + mi := &file_waymaker_streams_proto_msgTypes[143] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvPutEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvPutEvent) ProtoMessage() {} + +func (x *KvPutEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[143] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvPutEvent.ProtoReflect.Descriptor instead. +func (*KvPutEvent) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{143} +} + +func (x *KvPutEvent) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvPutEvent) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *KvPutEvent) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvPutEvent) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type KvDeleteEvent struct { + state protoimpl.MessageState `protogen:"open.v1"` + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"` + TsMs int64 `protobuf:"varint,3,opt,name=ts_ms,json=tsMs,proto3" json:"ts_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KvDeleteEvent) Reset() { + *x = KvDeleteEvent{} + mi := &file_waymaker_streams_proto_msgTypes[144] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KvDeleteEvent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KvDeleteEvent) ProtoMessage() {} + +func (x *KvDeleteEvent) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[144] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KvDeleteEvent.ProtoReflect.Descriptor instead. +func (*KvDeleteEvent) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{144} +} + +func (x *KvDeleteEvent) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *KvDeleteEvent) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +func (x *KvDeleteEvent) GetTsMs() int64 { + if x != nil { + return x.TsMs + } + return 0 +} + +type CreateHashStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + Ephemeral bool `protobuf:"varint,3,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateHashStoreRequest) Reset() { + *x = CreateHashStoreRequest{} + mi := &file_waymaker_streams_proto_msgTypes[145] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateHashStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHashStoreRequest) ProtoMessage() {} + +func (x *CreateHashStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[145] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateHashStoreRequest.ProtoReflect.Descriptor instead. +func (*CreateHashStoreRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{145} +} + +func (x *CreateHashStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateHashStoreRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateHashStoreRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateHashStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateHashStoreResponse) Reset() { + *x = CreateHashStoreResponse{} + mi := &file_waymaker_streams_proto_msgTypes[146] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateHashStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateHashStoreResponse) ProtoMessage() {} + +func (x *CreateHashStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[146] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateHashStoreResponse.ProtoReflect.Descriptor instead. +func (*CreateHashStoreResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{146} +} + +func (x *CreateHashStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateHashStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateHashStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteHashStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteHashStoreRequest) Reset() { + *x = DeleteHashStoreRequest{} + mi := &file_waymaker_streams_proto_msgTypes[147] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteHashStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteHashStoreRequest) ProtoMessage() {} + +func (x *DeleteHashStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[147] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteHashStoreRequest.ProtoReflect.Descriptor instead. +func (*DeleteHashStoreRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{147} +} + +func (x *DeleteHashStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteHashStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteHashStoreResponse) Reset() { + *x = DeleteHashStoreResponse{} + mi := &file_waymaker_streams_proto_msgTypes[148] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteHashStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteHashStoreResponse) ProtoMessage() {} + +func (x *DeleteHashStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[148] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteHashStoreResponse.ProtoReflect.Descriptor instead. +func (*DeleteHashStoreResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{148} +} + +func (x *DeleteHashStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteHashStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteHashStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HashSetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashSetRequest) Reset() { + *x = HashSetRequest{} + mi := &file_waymaker_streams_proto_msgTypes[149] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashSetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashSetRequest) ProtoMessage() {} + +func (x *HashSetRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[149] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashSetRequest.ProtoReflect.Descriptor instead. +func (*HashSetRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{149} +} + +func (x *HashSetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashSetRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashSetRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *HashSetRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type HashSetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Revision uint64 `protobuf:"varint,4,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashSetResponse) Reset() { + *x = HashSetResponse{} + mi := &file_waymaker_streams_proto_msgTypes[150] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashSetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashSetResponse) ProtoMessage() {} + +func (x *HashSetResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[150] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashSetResponse.ProtoReflect.Descriptor instead. +func (*HashSetResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{150} +} + +func (x *HashSetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashSetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashSetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashSetResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashGetRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetRequest) Reset() { + *x = HashGetRequest{} + mi := &file_waymaker_streams_proto_msgTypes[151] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetRequest) ProtoMessage() {} + +func (x *HashGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[151] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetRequest.ProtoReflect.Descriptor instead. +func (*HashGetRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{151} +} + +func (x *HashGetRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashGetRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashGetRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashGetResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Unset when the field has no value or is tombstoned. + Value []byte `protobuf:"bytes,4,opt,name=value,proto3,oneof" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,5,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetResponse) Reset() { + *x = HashGetResponse{} + mi := &file_waymaker_streams_proto_msgTypes[152] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetResponse) ProtoMessage() {} + +func (x *HashGetResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[152] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetResponse.ProtoReflect.Descriptor instead. +func (*HashGetResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{152} +} + +func (x *HashGetResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashGetResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashGetResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashGetResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *HashGetResponse) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashExistsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashExistsRequest) Reset() { + *x = HashExistsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[153] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashExistsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashExistsRequest) ProtoMessage() {} + +func (x *HashExistsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[153] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashExistsRequest.ProtoReflect.Descriptor instead. +func (*HashExistsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{153} +} + +func (x *HashExistsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashExistsRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashExistsRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashExistsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Exists bool `protobuf:"varint,4,opt,name=exists,proto3" json:"exists,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashExistsResponse) Reset() { + *x = HashExistsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[154] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashExistsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashExistsResponse) ProtoMessage() {} + +func (x *HashExistsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[154] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashExistsResponse.ProtoReflect.Descriptor instead. +func (*HashExistsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{154} +} + +func (x *HashExistsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashExistsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashExistsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashExistsResponse) GetExists() bool { + if x != nil { + return x.Exists + } + return false +} + +type HashDeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashDeleteRequest) Reset() { + *x = HashDeleteRequest{} + mi := &file_waymaker_streams_proto_msgTypes[155] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashDeleteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashDeleteRequest) ProtoMessage() {} + +func (x *HashDeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[155] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashDeleteRequest.ProtoReflect.Descriptor instead. +func (*HashDeleteRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{155} +} + +func (x *HashDeleteRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashDeleteRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +func (x *HashDeleteRequest) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +type HashDeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashDeleteResponse) Reset() { + *x = HashDeleteResponse{} + mi := &file_waymaker_streams_proto_msgTypes[156] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashDeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashDeleteResponse) ProtoMessage() {} + +func (x *HashDeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[156] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashDeleteResponse.ProtoReflect.Descriptor instead. +func (*HashDeleteResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{156} +} + +func (x *HashDeleteResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashDeleteResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashDeleteResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type HashGetAllRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetAllRequest) Reset() { + *x = HashGetAllRequest{} + mi := &file_waymaker_streams_proto_msgTypes[157] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetAllRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetAllRequest) ProtoMessage() {} + +func (x *HashGetAllRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[157] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetAllRequest.ProtoReflect.Descriptor instead. +func (*HashGetAllRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{157} +} + +func (x *HashGetAllRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashGetAllRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashGetAllResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Entries []*HashFieldEntry `protobuf:"bytes,4,rep,name=entries,proto3" json:"entries,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashGetAllResponse) Reset() { + *x = HashGetAllResponse{} + mi := &file_waymaker_streams_proto_msgTypes[158] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashGetAllResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashGetAllResponse) ProtoMessage() {} + +func (x *HashGetAllResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[158] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashGetAllResponse.ProtoReflect.Descriptor instead. +func (*HashGetAllResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{158} +} + +func (x *HashGetAllResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashGetAllResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashGetAllResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashGetAllResponse) GetEntries() []*HashFieldEntry { + if x != nil { + return x.Entries + } + return nil +} + +type HashFieldEntry struct { + state protoimpl.MessageState `protogen:"open.v1"` + Field string `protobuf:"bytes,1,opt,name=field,proto3" json:"field,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Revision uint64 `protobuf:"varint,3,opt,name=revision,proto3" json:"revision,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldEntry) Reset() { + *x = HashFieldEntry{} + mi := &file_waymaker_streams_proto_msgTypes[159] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldEntry) ProtoMessage() {} + +func (x *HashFieldEntry) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[159] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldEntry.ProtoReflect.Descriptor instead. +func (*HashFieldEntry) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{159} +} + +func (x *HashFieldEntry) GetField() string { + if x != nil { + return x.Field + } + return "" +} + +func (x *HashFieldEntry) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *HashFieldEntry) GetRevision() uint64 { + if x != nil { + return x.Revision + } + return 0 +} + +type HashFieldsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldsRequest) Reset() { + *x = HashFieldsRequest{} + mi := &file_waymaker_streams_proto_msgTypes[160] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldsRequest) ProtoMessage() {} + +func (x *HashFieldsRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[160] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldsRequest.ProtoReflect.Descriptor instead. +func (*HashFieldsRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{160} +} + +func (x *HashFieldsRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashFieldsRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashFieldsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Fields []string `protobuf:"bytes,4,rep,name=fields,proto3" json:"fields,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashFieldsResponse) Reset() { + *x = HashFieldsResponse{} + mi := &file_waymaker_streams_proto_msgTypes[161] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashFieldsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashFieldsResponse) ProtoMessage() {} + +func (x *HashFieldsResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[161] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashFieldsResponse.ProtoReflect.Descriptor instead. +func (*HashFieldsResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{161} +} + +func (x *HashFieldsResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashFieldsResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashFieldsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashFieldsResponse) GetFields() []string { + if x != nil { + return x.Fields + } + return nil +} + +type HashLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + HashKey string `protobuf:"bytes,2,opt,name=hash_key,json=hashKey,proto3" json:"hash_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashLenRequest) Reset() { + *x = HashLenRequest{} + mi := &file_waymaker_streams_proto_msgTypes[162] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashLenRequest) ProtoMessage() {} + +func (x *HashLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[162] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashLenRequest.ProtoReflect.Descriptor instead. +func (*HashLenRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{162} +} + +func (x *HashLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *HashLenRequest) GetHashKey() string { + if x != nil { + return x.HashKey + } + return "" +} + +type HashLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashLenResponse) Reset() { + *x = HashLenResponse{} + mi := &file_waymaker_streams_proto_msgTypes[163] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashLenResponse) ProtoMessage() {} + +func (x *HashLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[163] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashLenResponse.ProtoReflect.Descriptor instead. +func (*HashLenResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{163} +} + +func (x *HashLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *HashLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *HashLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *HashLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type CreateSetStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + Ephemeral bool `protobuf:"varint,3,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSetStoreRequest) Reset() { + *x = CreateSetStoreRequest{} + mi := &file_waymaker_streams_proto_msgTypes[164] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSetStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSetStoreRequest) ProtoMessage() {} + +func (x *CreateSetStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[164] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSetStoreRequest.ProtoReflect.Descriptor instead. +func (*CreateSetStoreRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{164} +} + +func (x *CreateSetStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateSetStoreRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateSetStoreRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateSetStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSetStoreResponse) Reset() { + *x = CreateSetStoreResponse{} + mi := &file_waymaker_streams_proto_msgTypes[165] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSetStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSetStoreResponse) ProtoMessage() {} + +func (x *CreateSetStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[165] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSetStoreResponse.ProtoReflect.Descriptor instead. +func (*CreateSetStoreResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{165} +} + +func (x *CreateSetStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateSetStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateSetStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteSetStoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSetStoreRequest) Reset() { + *x = DeleteSetStoreRequest{} + mi := &file_waymaker_streams_proto_msgTypes[166] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSetStoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSetStoreRequest) ProtoMessage() {} + +func (x *DeleteSetStoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[166] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSetStoreRequest.ProtoReflect.Descriptor instead. +func (*DeleteSetStoreRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{166} +} + +func (x *DeleteSetStoreRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteSetStoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteSetStoreResponse) Reset() { + *x = DeleteSetStoreResponse{} + mi := &file_waymaker_streams_proto_msgTypes[167] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteSetStoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSetStoreResponse) ProtoMessage() {} + +func (x *DeleteSetStoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[167] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSetStoreResponse.ProtoReflect.Descriptor instead. +func (*DeleteSetStoreResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{167} +} + +func (x *DeleteSetStoreResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteSetStoreResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteSetStoreResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetAddRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAddRequest) Reset() { + *x = SetAddRequest{} + mi := &file_waymaker_streams_proto_msgTypes[168] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAddRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAddRequest) ProtoMessage() {} + +func (x *SetAddRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[168] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetAddRequest.ProtoReflect.Descriptor instead. +func (*SetAddRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{168} +} + +func (x *SetAddRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetAddRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetAddRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetAddResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetAddResponse) Reset() { + *x = SetAddResponse{} + mi := &file_waymaker_streams_proto_msgTypes[169] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetAddResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetAddResponse) ProtoMessage() {} + +func (x *SetAddResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[169] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetAddResponse.ProtoReflect.Descriptor instead. +func (*SetAddResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{169} +} + +func (x *SetAddResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetAddResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetAddResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetRemoveRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetRemoveRequest) Reset() { + *x = SetRemoveRequest{} + mi := &file_waymaker_streams_proto_msgTypes[170] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetRemoveRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRemoveRequest) ProtoMessage() {} + +func (x *SetRemoveRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[170] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRemoveRequest.ProtoReflect.Descriptor instead. +func (*SetRemoveRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{170} +} + +func (x *SetRemoveRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetRemoveRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetRemoveRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetRemoveResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetRemoveResponse) Reset() { + *x = SetRemoveResponse{} + mi := &file_waymaker_streams_proto_msgTypes[171] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetRemoveResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetRemoveResponse) ProtoMessage() {} + +func (x *SetRemoveResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[171] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetRemoveResponse.ProtoReflect.Descriptor instead. +func (*SetRemoveResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{171} +} + +func (x *SetRemoveResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetRemoveResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetRemoveResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type SetIsMemberRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetIsMemberRequest) Reset() { + *x = SetIsMemberRequest{} + mi := &file_waymaker_streams_proto_msgTypes[172] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetIsMemberRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetIsMemberRequest) ProtoMessage() {} + +func (x *SetIsMemberRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[172] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetIsMemberRequest.ProtoReflect.Descriptor instead. +func (*SetIsMemberRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{172} +} + +func (x *SetIsMemberRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetIsMemberRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +func (x *SetIsMemberRequest) GetMember() string { + if x != nil { + return x.Member + } + return "" +} + +type SetIsMemberResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + IsMember bool `protobuf:"varint,4,opt,name=is_member,json=isMember,proto3" json:"is_member,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetIsMemberResponse) Reset() { + *x = SetIsMemberResponse{} + mi := &file_waymaker_streams_proto_msgTypes[173] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetIsMemberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetIsMemberResponse) ProtoMessage() {} + +func (x *SetIsMemberResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[173] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetIsMemberResponse.ProtoReflect.Descriptor instead. +func (*SetIsMemberResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{173} +} + +func (x *SetIsMemberResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetIsMemberResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetIsMemberResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetIsMemberResponse) GetIsMember() bool { + if x != nil { + return x.IsMember + } + return false +} + +type SetMembersRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetMembersRequest) Reset() { + *x = SetMembersRequest{} + mi := &file_waymaker_streams_proto_msgTypes[174] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetMembersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetMembersRequest) ProtoMessage() {} + +func (x *SetMembersRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[174] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetMembersRequest.ProtoReflect.Descriptor instead. +func (*SetMembersRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{174} +} + +func (x *SetMembersRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetMembersRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +type SetMembersResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Members []string `protobuf:"bytes,4,rep,name=members,proto3" json:"members,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetMembersResponse) Reset() { + *x = SetMembersResponse{} + mi := &file_waymaker_streams_proto_msgTypes[175] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetMembersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetMembersResponse) ProtoMessage() {} + +func (x *SetMembersResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[175] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetMembersResponse.ProtoReflect.Descriptor instead. +func (*SetMembersResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{175} +} + +func (x *SetMembersResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetMembersResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetMembersResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetMembersResponse) GetMembers() []string { + if x != nil { + return x.Members + } + return nil +} + +type SetLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + SetKey string `protobuf:"bytes,2,opt,name=set_key,json=setKey,proto3" json:"set_key,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetLenRequest) Reset() { + *x = SetLenRequest{} + mi := &file_waymaker_streams_proto_msgTypes[176] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetLenRequest) ProtoMessage() {} + +func (x *SetLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[176] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetLenRequest.ProtoReflect.Descriptor instead. +func (*SetLenRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{176} +} + +func (x *SetLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *SetLenRequest) GetSetKey() string { + if x != nil { + return x.SetKey + } + return "" +} + +type SetLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetLenResponse) Reset() { + *x = SetLenResponse{} + mi := &file_waymaker_streams_proto_msgTypes[177] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetLenResponse) ProtoMessage() {} + +func (x *SetLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[177] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetLenResponse.ProtoReflect.Descriptor instead. +func (*SetLenResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{177} +} + +func (x *SetLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *SetLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *SetLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *SetLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +type CreateQueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + MaxBytes uint64 `protobuf:"varint,2,opt,name=max_bytes,json=maxBytes,proto3" json:"max_bytes,omitempty"` + MaxMessages uint64 `protobuf:"varint,3,opt,name=max_messages,json=maxMessages,proto3" json:"max_messages,omitempty"` + Ephemeral bool `protobuf:"varint,4,opt,name=ephemeral,proto3" json:"ephemeral,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateQueueRequest) Reset() { + *x = CreateQueueRequest{} + mi := &file_waymaker_streams_proto_msgTypes[178] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateQueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateQueueRequest) ProtoMessage() {} + +func (x *CreateQueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[178] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateQueueRequest.ProtoReflect.Descriptor instead. +func (*CreateQueueRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{178} +} + +func (x *CreateQueueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *CreateQueueRequest) GetMaxBytes() uint64 { + if x != nil { + return x.MaxBytes + } + return 0 +} + +func (x *CreateQueueRequest) GetMaxMessages() uint64 { + if x != nil { + return x.MaxMessages + } + return 0 +} + +func (x *CreateQueueRequest) GetEphemeral() bool { + if x != nil { + return x.Ephemeral + } + return false +} + +type CreateQueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateQueueResponse) Reset() { + *x = CreateQueueResponse{} + mi := &file_waymaker_streams_proto_msgTypes[179] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateQueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateQueueResponse) ProtoMessage() {} + +func (x *CreateQueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[179] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateQueueResponse.ProtoReflect.Descriptor instead. +func (*CreateQueueResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{179} +} + +func (x *CreateQueueResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *CreateQueueResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *CreateQueueResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type DeleteQueueRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteQueueRequest) Reset() { + *x = DeleteQueueRequest{} + mi := &file_waymaker_streams_proto_msgTypes[180] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteQueueRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteQueueRequest) ProtoMessage() {} + +func (x *DeleteQueueRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[180] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteQueueRequest.ProtoReflect.Descriptor instead. +func (*DeleteQueueRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{180} +} + +func (x *DeleteQueueRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteQueueResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteQueueResponse) Reset() { + *x = DeleteQueueResponse{} + mi := &file_waymaker_streams_proto_msgTypes[181] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteQueueResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteQueueResponse) ProtoMessage() {} + +func (x *DeleteQueueResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[181] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteQueueResponse.ProtoReflect.Descriptor instead. +func (*DeleteQueueResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{181} +} + +func (x *DeleteQueueResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *DeleteQueueResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *DeleteQueueResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type QueuePushRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePushRequest) Reset() { + *x = QueuePushRequest{} + mi := &file_waymaker_streams_proto_msgTypes[182] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePushRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePushRequest) ProtoMessage() {} + +func (x *QueuePushRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[182] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePushRequest.ProtoReflect.Descriptor instead. +func (*QueuePushRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{182} +} + +func (x *QueuePushRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *QueuePushRequest) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueuePushResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePushResponse) Reset() { + *x = QueuePushResponse{} + mi := &file_waymaker_streams_proto_msgTypes[183] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePushResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePushResponse) ProtoMessage() {} + +func (x *QueuePushResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[183] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePushResponse.ProtoReflect.Descriptor instead. +func (*QueuePushResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{183} +} + +func (x *QueuePushResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueuePushResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueuePushResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueuePushResponse) GetSequence() uint64 { + if x != nil { + return x.Sequence + } + return 0 +} + +type QueuePopRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePopRequest) Reset() { + *x = QueuePopRequest{} + mi := &file_waymaker_streams_proto_msgTypes[184] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePopRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePopRequest) ProtoMessage() {} + +func (x *QueuePopRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[184] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePopRequest.ProtoReflect.Descriptor instead. +func (*QueuePopRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{184} +} + +func (x *QueuePopRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type QueuePopResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + // Unset when the queue is empty. + Value []byte `protobuf:"bytes,4,opt,name=value,proto3,oneof" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueuePopResponse) Reset() { + *x = QueuePopResponse{} + mi := &file_waymaker_streams_proto_msgTypes[185] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueuePopResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueuePopResponse) ProtoMessage() {} + +func (x *QueuePopResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[185] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueuePopResponse.ProtoReflect.Descriptor instead. +func (*QueuePopResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{185} +} + +func (x *QueuePopResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueuePopResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueuePopResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueuePopResponse) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +type QueueRangeRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + FromSequence uint64 `protobuf:"varint,2,opt,name=from_sequence,json=fromSequence,proto3" json:"from_sequence,omitempty"` + Limit uint64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRangeRequest) Reset() { + *x = QueueRangeRequest{} + mi := &file_waymaker_streams_proto_msgTypes[186] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRangeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRangeRequest) ProtoMessage() {} + +func (x *QueueRangeRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[186] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRangeRequest.ProtoReflect.Descriptor instead. +func (*QueueRangeRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{186} +} + +func (x *QueueRangeRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +func (x *QueueRangeRequest) GetFromSequence() uint64 { + if x != nil { + return x.FromSequence + } + return 0 +} + +func (x *QueueRangeRequest) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +type QueueRangeResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Values [][]byte `protobuf:"bytes,4,rep,name=values,proto3" json:"values,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueRangeResponse) Reset() { + *x = QueueRangeResponse{} + mi := &file_waymaker_streams_proto_msgTypes[187] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueRangeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueRangeResponse) ProtoMessage() {} + +func (x *QueueRangeResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[187] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueRangeResponse.ProtoReflect.Descriptor instead. +func (*QueueRangeResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{187} +} + +func (x *QueueRangeResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueueRangeResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueueRangeResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueueRangeResponse) GetValues() [][]byte { + if x != nil { + return x.Values + } + return nil +} + +type QueueLenRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Bucket string `protobuf:"bytes,1,opt,name=bucket,proto3" json:"bucket,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueLenRequest) Reset() { + *x = QueueLenRequest{} + mi := &file_waymaker_streams_proto_msgTypes[188] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueLenRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueLenRequest) ProtoMessage() {} + +func (x *QueueLenRequest) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[188] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueLenRequest.ProtoReflect.Descriptor instead. +func (*QueueLenRequest) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{188} +} + +func (x *QueueLenRequest) GetBucket() string { + if x != nil { + return x.Bucket + } + return "" +} + +type QueueLenResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + ResultCode string `protobuf:"bytes,2,opt,name=result_code,json=resultCode,proto3" json:"result_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + Count uint64 `protobuf:"varint,4,opt,name=count,proto3" json:"count,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueueLenResponse) Reset() { + *x = QueueLenResponse{} + mi := &file_waymaker_streams_proto_msgTypes[189] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueueLenResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueueLenResponse) ProtoMessage() {} + +func (x *QueueLenResponse) ProtoReflect() protoreflect.Message { + mi := &file_waymaker_streams_proto_msgTypes[189] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueueLenResponse.ProtoReflect.Descriptor instead. +func (*QueueLenResponse) Descriptor() ([]byte, []int) { + return file_waymaker_streams_proto_rawDescGZIP(), []int{189} +} + +func (x *QueueLenResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *QueueLenResponse) GetResultCode() string { + if x != nil { + return x.ResultCode + } + return "" +} + +func (x *QueueLenResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *QueueLenResponse) GetCount() uint64 { + if x != nil { + return x.Count + } + return 0 +} + +var File_waymaker_streams_proto protoreflect.FileDescriptor + +const file_waymaker_streams_proto_rawDesc = "" + + "\n" + + "\x16waymaker_streams.proto\x12\x10waymaker.streams\"\xc5\x01\n" + + "\x0fLimitsRetention\x12!\n" + + "\n" + + "max_age_ms\x18\x01 \x01(\x04H\x00R\bmaxAgeMs\x88\x01\x01\x12\x1e\n" + + "\bmax_msgs\x18\x02 \x01(\x04H\x01R\amaxMsgs\x88\x01\x01\x12 \n" + + "\tmax_bytes\x18\x03 \x01(\x04H\x02R\bmaxBytes\x88\x01\x01\x12#\n" + + "\rstrict_limits\x18\x04 \x01(\bR\fstrictLimitsB\r\n" + + "\v_max_age_msB\v\n" + + "\t_max_msgsB\f\n" + + "\n" + + "_max_bytes\"\x14\n" + + "\x12WorkQueueRetention\"\x13\n" + + "\x11InterestRetention\"\xdc\x01\n" + + "\tRetention\x12;\n" + + "\x06limits\x18\x01 \x01(\v2!.waymaker.streams.LimitsRetentionH\x00R\x06limits\x12E\n" + + "\n" + + "work_queue\x18\x02 \x01(\v2$.waymaker.streams.WorkQueueRetentionH\x00R\tworkQueue\x12A\n" + + "\binterest\x18\x03 \x01(\v2#.waymaker.streams.InterestRetentionH\x00R\binterestB\b\n" + + "\x06policy\"\xdc\x02\n" + + "\x0eStreamConfigPb\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12'\n" + + "\x0fsubjects_filter\x18\x02 \x03(\tR\x0esubjectsFilter\x129\n" + + "\tretention\x18\x03 \x01(\v2\x1b.waymaker.streams.RetentionR\tretention\x12\x1d\n" + + "\n" + + "block_size\x18\x04 \x01(\x04R\tblockSize\x12\"\n" + + "\rmax_msg_bytes\x18\x05 \x01(\x04R\vmaxMsgBytes\x12\x1c\n" + + "\tephemeral\x18\x06 \x01(\bR\tephemeral\x12@\n" + + "\asources\x18\a \x03(\v2&.waymaker.streams.StreamSourceConfigPbR\asources\x12/\n" + + "\x14max_msgs_per_subject\x18\b \x01(\x04R\x11maxMsgsPerSubject\"\x80\x03\n" + + "\x14StreamSourceConfigPb\x12#\n" + + "\rsource_stream\x18\x01 \x01(\tR\fsourceStream\x12%\n" + + "\x0efilter_subject\x18\x02 \x01(\tR\rfilterSubject\x12\x1b\n" + + "\tstart_seq\x18\x03 \x01(\x04R\bstartSeq\x12\"\n" + + "\rstart_time_ms\x18\x04 \x01(\x03R\vstartTimeMs\x12Q\n" + + "\x11subject_transform\x18\x05 \x01(\v2$.waymaker.streams.SubjectTransformPbR\x10subjectTransform\x120\n" + + "\x14max_initial_backfill\x18\x06 \x01(\x04R\x12maxInitialBackfill\x127\n" + + "\aon_drop\x18\a \x01(\x0e2\x1e.waymaker.streams.OnDropPolicyR\x06onDrop\x12\x1d\n" + + "\n" + + "dlq_stream\x18\b \x01(\tR\tdlqStream\"]\n" + + "\x12SubjectTransformPb\x12%\n" + + "\x0esource_pattern\x18\x01 \x01(\tR\rsourcePattern\x12 \n" + + "\vdestination\x18\x02 \x01(\tR\vdestination\"\x9f\x01\n" + + "\rStreamStatsPb\x12\x19\n" + + "\blast_seq\x18\x01 \x01(\x04R\alastSeq\x12\x1b\n" + + "\tmsg_count\x18\x02 \x01(\x04R\bmsgCount\x12\x14\n" + + "\x05bytes\x18\x03 \x01(\x04R\x05bytes\x12\x1f\n" + + "\vblock_count\x18\x04 \x01(\x04R\n" + + "blockCount\x12\x1f\n" + + "\vfirst_block\x18\x05 \x01(\x04R\n" + + "firstBlock\"7\n" + + "\rMessageHeader\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value\"\xc6\x01\n" + + "\tMessagePb\x12\x10\n" + + "\x03seq\x18\x01 \x01(\x04R\x03seq\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\x129\n" + + "\aheaders\x18\x04 \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12\x18\n" + + "\apayload\x18\x05 \x01(\fR\apayload\x12#\n" + + "\rdeliver_count\x18\x06 \x01(\rR\fdeliverCount\"\x8d\x01\n" + + "\x10DeliveryPolicyPb\x128\n" + + "\x04type\x18\x01 \x01(\x0e2$.waymaker.streams.DeliveryPolicyTypeR\x04type\x12\x1b\n" + + "\tstart_seq\x18\x02 \x01(\x04R\bstartSeq\x12\"\n" + + "\rstart_time_ms\x18\x03 \x01(\x03R\vstartTimeMs\"\xb0\x02\n" + + "\x10ConsumerConfigPb\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12%\n" + + "\x0efilter_subject\x18\x02 \x01(\tR\rfilterSubject\x12K\n" + + "\x0fdelivery_policy\x18\x03 \x01(\v2\".waymaker.streams.DeliveryPolicyPbR\x0edeliveryPolicy\x12\x1e\n" + + "\vack_wait_ms\x18\x04 \x01(\x04R\tackWaitMs\x12\x1f\n" + + "\vmax_deliver\x18\x05 \x01(\rR\n" + + "maxDeliver\x12#\n" + + "\rdeliver_group\x18\x06 \x01(\tR\fdeliverGroup\x12.\n" + + "\x13dead_letter_subject\x18\a \x01(\tR\x11deadLetterSubject\"\xe6\x01\n" + + "\x0fConsumerStatePb\x12:\n" + + "\x06config\x18\x01 \x01(\v2\".waymaker.streams.ConsumerConfigPbR\x06config\x12\x1b\n" + + "\tack_floor\x18\x02 \x01(\x04R\backFloor\x12%\n" + + "\x0elast_delivered\x18\x03 \x01(\x04R\rlastDelivered\x12\"\n" + + "\rcreated_at_ms\x18\x04 \x01(\x03R\vcreatedAtMs\x12/\n" + + "\x13redelivered_dropped\x18\x05 \x01(\x04R\x12redeliveredDropped\"O\n" + + "\x13CreateStreamRequest\x128\n" + + "\x06config\x18\x01 \x01(\v2 .waymaker.streams.StreamConfigPbR\x06config\"k\n" + + "\x14CreateStreamResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\")\n" + + "\x13DeleteStreamRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"k\n" + + "\x14DeleteStreamResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"*\n" + + "\x14GetStreamInfoRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"\xe1\x03\n" + + "\x15GetStreamInfoResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x128\n" + + "\x06config\x18\x04 \x01(\v2 .waymaker.streams.StreamConfigPbR\x06config\x125\n" + + "\x05stats\x18\x05 \x01(\v2\x1f.waymaker.streams.StreamStatsPbR\x05stats\x12]\n" + + "\x12authority_override\x18\x06 \x01(\v2).waymaker.streams.StreamAuthorityOverrideH\x00R\x11authorityOverride\x88\x01\x01\x12+\n" + + "\x12ring_owner_node_id\x18\a \x01(\x04R\x0fringOwnerNodeId\x12\x16\n" + + "\x06pinned\x18\b \x01(\bR\x06pinned\x12G\n" + + "\x0esources_status\x18\t \x03(\v2 .waymaker.streams.SourceStatusPbR\rsourcesStatusB\x15\n" + + "\x13_authority_override\"\xca\x01\n" + + "\x0eSourceStatusPb\x12#\n" + + "\rsource_stream\x18\x01 \x01(\tR\fsourceStream\x12(\n" + + "\x10last_sourced_seq\x18\x02 \x01(\x04R\x0elastSourcedSeq\x12!\n" + + "\fpulled_total\x18\x03 \x01(\x04R\vpulledTotal\x12\x1d\n" + + "\n" + + "last_error\x18\x04 \x01(\tR\tlastError\x12'\n" + + "\x10last_error_ts_ms\x18\x05 \x01(\x03R\rlastErrorTsMs\"d\n" + + "\x17StreamAuthorityOverride\x12(\n" + + "\x10claimant_node_id\x18\x01 \x01(\x04R\x0eclaimantNodeId\x12\x1f\n" + + "\vfence_epoch\x18\x02 \x01(\x04R\n" + + "fenceEpoch\"5\n" + + "\x1bClearStreamAuthorityRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\"s\n" + + "\x1cClearStreamAuthorityResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"%\n" + + "#ListStreamAuthorityOverridesRequest\"\xbf\x01\n" + + "$ListStreamAuthorityOverridesResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12B\n" + + "\aentries\x18\x04 \x03(\v2(.waymaker.streams.AuthorityOverrideEntryR\aentries\"{\n" + + "\x16AuthorityOverrideEntry\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12(\n" + + "\x10claimant_node_id\x18\x02 \x01(\x04R\x0eclaimantNodeId\x12\x1f\n" + + "\vfence_epoch\x18\x03 \x01(\x04R\n" + + "fenceEpoch\"H\n" + + "\x16SetStreamPinnedRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x16\n" + + "\x06pinned\x18\x02 \x01(\bR\x06pinned\"n\n" + + "\x17SetStreamPinnedResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\x14\n" + + "\x12ListStreamsRequest\"+\n" + + "\x13ListStreamsResponse\x12\x14\n" + + "\x05names\x18\x01 \x03(\tR\x05names\"\x19\n" + + "\x17GetStreamSourcesRequest\"\xb2\x01\n" + + "\x18GetStreamSourcesResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12A\n" + + "\aentries\x18\x04 \x03(\v2'.waymaker.streams.GetStreamSourcesEntryR\aentries\"\xfa\x01\n" + + "\x15GetStreamSourcesEntry\x12'\n" + + "\x0fsourcing_stream\x18\x01 \x01(\tR\x0esourcingStream\x12#\n" + + "\rsource_stream\x18\x02 \x01(\tR\fsourceStream\x12(\n" + + "\x10last_sourced_seq\x18\x03 \x01(\x04R\x0elastSourcedSeq\x12!\n" + + "\fpulled_total\x18\x04 \x01(\x04R\vpulledTotal\x12\x1d\n" + + "\n" + + "last_error\x18\x05 \x01(\tR\tlastError\x12'\n" + + "\x10last_error_ts_ms\x18\x06 \x01(\x03R\rlastErrorTsMs\"\xaf\x02\n" + + "\x13UpdateStreamRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + + "\n" + + "max_age_ms\x18\x02 \x01(\x04H\x00R\bmaxAgeMs\x88\x01\x01\x12\x1e\n" + + "\bmax_msgs\x18\x03 \x01(\x04H\x01R\amaxMsgs\x88\x01\x01\x12 \n" + + "\tmax_bytes\x18\x04 \x01(\x04H\x02R\bmaxBytes\x88\x01\x01\x12'\n" + + "\rmax_msg_bytes\x18\x05 \x01(\x04H\x03R\vmaxMsgBytes\x88\x01\x01\x12(\n" + + "\rstrict_limits\x18\x06 \x01(\bH\x04R\fstrictLimits\x88\x01\x01B\r\n" + + "\v_max_age_msB\v\n" + + "\t_max_msgsB\f\n" + + "\n" + + "_max_bytesB\x10\n" + + "\x0e_max_msg_bytesB\x10\n" + + "\x0e_strict_limits\"\xbd\x01\n" + + "\x14UpdateStreamResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x128\n" + + "\x06config\x18\x04 \x01(\v2 .waymaker.streams.StreamConfigPbR\x06config\x12\x16\n" + + "\x06pruned\x18\x05 \x01(\x04R\x06pruned\"\xf3\x01\n" + + "\x0ePublishRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\x12\x18\n" + + "\apayload\x18\x03 \x01(\fR\apayload\x129\n" + + "\aheaders\x18\x04 \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12\x13\n" + + "\x05ts_ms\x18\x05 \x01(\x03R\x04tsMs\x12/\n" + + "\x11expected_last_seq\x18\x06 \x01(\x04H\x00R\x0fexpectedLastSeq\x88\x01\x01B\x14\n" + + "\x12_expected_last_seq\"x\n" + + "\x0fPublishResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x10\n" + + "\x03seq\x18\x04 \x01(\x04R\x03seq\"a\n" + + "\fFetchRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x1d\n" + + "\n" + + "batch_size\x18\x03 \x01(\rR\tbatchSize\"\x9d\x01\n" + + "\rFetchResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x127\n" + + "\bmessages\x18\x04 \x03(\v2\x1b.waymaker.streams.MessagePbR\bmessages\"R\n" + + "\n" + + "AckRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x10\n" + + "\x03seq\x18\x03 \x01(\x04R\x03seq\"b\n" + + "\vAckResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"m\n" + + "\n" + + "NakRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x10\n" + + "\x03seq\x18\x03 \x01(\x04R\x03seq\x12\x19\n" + + "\bdelay_ms\x18\x04 \x01(\x04R\adelayMs\"b\n" + + "\vNakResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"S\n" + + "\vTermRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x10\n" + + "\x03seq\x18\x03 \x01(\x04R\x03seq\"c\n" + + "\fTermResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"Y\n" + + "\x11InProgressRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x10\n" + + "\x03seq\x18\x03 \x01(\x04R\x03seq\"i\n" + + "\x12InProgressResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\x8d\x01\n" + + "\x10SubscribeRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\x12\x1d\n" + + "\n" + + "batch_size\x18\x03 \x01(\rR\tbatchSize\x12&\n" + + "\x0fstop_when_empty\x18\x04 \x01(\bR\rstopWhenEmpty\"\x92\x01\n" + + "\x0eSubscribeEvent\x127\n" + + "\amessage\x18\x01 \x01(\v2\x1b.waymaker.streams.MessagePbH\x00R\amessage\x12>\n" + + "\astopped\x18\x02 \x01(\v2\".waymaker.streams.SubscribeStoppedH\x00R\astoppedB\a\n" + + "\x05event\"*\n" + + "\x10SubscribeStopped\x12\x16\n" + + "\x06reason\x18\x01 \x01(\tR\x06reason\"k\n" + + "\x15CreateConsumerRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12:\n" + + "\x06config\x18\x02 \x01(\v2\".waymaker.streams.ConsumerConfigPbR\x06config\"m\n" + + "\x16CreateConsumerResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"K\n" + + "\x15DeleteConsumerRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\"m\n" + + "\x16DeleteConsumerResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\".\n" + + "\x14ListConsumersRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\"\xad\x01\n" + + "\x15ListConsumersResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12?\n" + + "\tconsumers\x18\x04 \x03(\v2!.waymaker.streams.ConsumerStatePbR\tconsumers\"L\n" + + "\x16GetConsumerInfoRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\"\xad\x01\n" + + "\x17GetConsumerInfoResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12=\n" + + "\bconsumer\x18\x04 \x01(\v2!.waymaker.streams.ConsumerStatePbR\bconsumer\"+\n" + + "\x15TransferStreamRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"x\n" + + "\x13TransferStreamChunk\x12\x14\n" + + "\x04data\x18\x01 \x01(\fH\x00R\x04data\x12C\n" + + "\asummary\x18\x02 \x01(\v2'.waymaker.streams.TransferStreamSummaryH\x00R\asummaryB\x06\n" + + "\x04body\"`\n" + + "\x15TransferStreamSummary\x12\x1f\n" + + "\vtotal_bytes\x18\x01 \x01(\x04R\n" + + "totalBytes\x12&\n" + + "\x0fstream_last_seq\x18\x02 \x01(\x04R\rstreamLastSeq\"P\n" + + "\x14MigrateStreamRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12$\n" + + "\x0esource_node_id\x18\x02 \x01(\x04R\fsourceNodeId\"\xb5\x01\n" + + "\x15MigrateStreamResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1f\n" + + "\vtotal_bytes\x18\x04 \x01(\x04R\n" + + "totalBytes\x12&\n" + + "\x0fstream_last_seq\x18\x05 \x01(\x04R\rstreamLastSeq\"k\n" + + "\x1cGetClusterStreamStatsRequest\x12,\n" + + "\x12include_per_stream\x18\x01 \x01(\bR\x10includePerStream\x12\x1d\n" + + "\n" + + "local_only\x18\x02 \x01(\bR\tlocalOnly\"\x96\x01\n" + + "\x0ePerStreamStats\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\"\n" + + "\rowner_node_id\x18\x02 \x01(\x04R\vownerNodeId\x12\x1b\n" + + "\tmsg_count\x18\x03 \x01(\x04R\bmsgCount\x12\x14\n" + + "\x05bytes\x18\x04 \x01(\x04R\x05bytes\x12\x19\n" + + "\blast_seq\x18\x05 \x01(\x04R\alastSeq\"\xad\x01\n" + + "\x0ePerNodeSummary\x12\x17\n" + + "\anode_id\x18\x01 \x01(\x04R\x06nodeId\x12!\n" + + "\fstream_count\x18\x02 \x01(\x04R\vstreamCount\x12&\n" + + "\x0ftotal_msg_count\x18\x03 \x01(\x04R\rtotalMsgCount\x12\x1f\n" + + "\vtotal_bytes\x18\x04 \x01(\x04R\n" + + "totalBytes\x12\x16\n" + + "\x06status\x18\x05 \x01(\tR\x06status\"\x9d\x03\n" + + "\x1dGetClusterStreamStatsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x126\n" + + "\x05nodes\x18\x04 \x03(\v2 .waymaker.streams.PerNodeSummaryR\x05nodes\x12:\n" + + "\astreams\x18\x05 \x03(\v2 .waymaker.streams.PerStreamStatsR\astreams\x12,\n" + + "\x12total_stream_count\x18\x06 \x01(\x04R\x10totalStreamCount\x12&\n" + + "\x0ftotal_msg_count\x18\a \x01(\x04R\rtotalMsgCount\x12\x1f\n" + + "\vtotal_bytes\x18\b \x01(\x04R\n" + + "totalBytes\x12\x1d\n" + + "\n" + + "skew_count\x18\t \x01(\x04R\tskewCount\x12\x1d\n" + + "\n" + + "skew_bytes\x18\n" + + " \x01(\x04R\tskewBytes\"N\n" + + "\x12RebalancePlanEntry\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12$\n" + + "\x0etarget_node_id\x18\x02 \x01(\x04R\ftargetNodeId\"\x82\x01\n" + + "\x17RebalanceStreamsRequest\x128\n" + + "\x04plan\x18\x01 \x03(\v2$.waymaker.streams.RebalancePlanEntryR\x04plan\x12-\n" + + "\x13per_step_timeout_ms\x18\x02 \x01(\x04R\x10perStepTimeoutMs\"\xa5\x01\n" + + "\x14RebalanceStepOutcome\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12$\n" + + "\x0etarget_node_id\x18\x02 \x01(\x04R\ftargetNodeId\x12\x18\n" + + "\asuccess\x18\x03 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x04 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x05 \x01(\tR\amessage\"\xad\x01\n" + + "\x18RebalanceStreamsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12<\n" + + "\x05steps\x18\x04 \x03(\v2&.waymaker.streams.RebalanceStepOutcomeR\x05steps\"\x15\n" + + "\x13WatchStreamsRequest\"'\n" + + "\x11StreamWatchDetail\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"I\n" + + "\x13ConsumerWatchDetail\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1a\n" + + "\bconsumer\x18\x02 \x01(\tR\bconsumer\"y\n" + + "\x14AuthorityWatchDetail\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12(\n" + + "\x10claimant_node_id\x18\x02 \x01(\x04R\x0eclaimantNodeId\x12\x1f\n" + + "\vfence_epoch\x18\x03 \x01(\x04R\n" + + "fenceEpoch\"N\n" + + "\x1aReadLatestAtSubjectRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\"\xb7\x01\n" + + "\x1bReadLatestAtSubjectResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x128\n" + + "\x06latest\x18\x04 \x01(\v2\x1b.waymaker.streams.MessagePbH\x00R\x06latest\x88\x01\x01B\t\n" + + "\a_latest\"M\n" + + "\x1bListSubjectsByPrefixRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x16\n" + + "\x06prefix\x18\x02 \x01(\tR\x06prefix\"\x8f\x01\n" + + "\x1cListSubjectsByPrefixResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\bsubjects\x18\x04 \x03(\tR\bsubjects\"~\n" + + "\x19ScanExactAtSubjectRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\x12\x19\n" + + "\bfrom_seq\x18\x03 \x01(\x04R\afromSeq\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x04R\x05limit\"\xaa\x01\n" + + "\x1aScanExactAtSubjectResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x127\n" + + "\bmessages\x18\x04 \x03(\v2\x1b.waymaker.streams.MessagePbR\bmessages\"\xe9\x02\n" + + "\n" + + "WatchEvent\x124\n" + + "\x04type\x18\x01 \x01(\x0e2 .waymaker.streams.WatchEventTypeR\x04type\x12\x13\n" + + "\x05ts_ms\x18\x02 \x01(\x03R\x04tsMs\x12\x17\n" + + "\anode_id\x18\x03 \x01(\x04R\x06nodeId\x12=\n" + + "\x06stream\x18\x04 \x01(\v2#.waymaker.streams.StreamWatchDetailH\x00R\x06stream\x12C\n" + + "\bconsumer\x18\x05 \x01(\v2%.waymaker.streams.ConsumerWatchDetailH\x00R\bconsumer\x12F\n" + + "\tauthority\x18\a \x01(\v2&.waymaker.streams.AuthorityWatchDetailH\x00R\tauthority\x12!\n" + + "\flagged_count\x18\x06 \x01(\x04R\vlaggedCountB\b\n" + + "\x06detail\"r\n" + + "\x11PendingDeliveryPb\x12\x10\n" + + "\x03seq\x18\x01 \x01(\x04R\x03seq\x12&\n" + + "\x0fdelivered_at_ms\x18\x02 \x01(\x03R\rdeliveredAtMs\x12#\n" + + "\rdeliver_count\x18\x03 \x01(\rR\fdeliverCount\"\xe1\x02\n" + + "\x15ConsumerStateSnapshot\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12:\n" + + "\x06config\x18\x02 \x01(\v2\".waymaker.streams.ConsumerConfigPbR\x06config\x12\x1b\n" + + "\tack_floor\x18\x03 \x01(\x04R\backFloor\x12%\n" + + "\x0elast_delivered\x18\x04 \x01(\x04R\rlastDelivered\x12\"\n" + + "\rcreated_at_ms\x18\x05 \x01(\x03R\vcreatedAtMs\x12/\n" + + "\x13redelivered_dropped\x18\x06 \x01(\x04R\x12redeliveredDropped\x12=\n" + + "\apending\x18\a \x03(\v2#.waymaker.streams.PendingDeliveryPbR\apending\x12\x1c\n" + + "\ttombstone\x18\b \x01(\bR\ttombstone\"d\n" + + "\x1dReplicateConsumerStateRequest\x12C\n" + + "\bsnapshot\x18\x01 \x01(\v2'.waymaker.streams.ConsumerStateSnapshotR\bsnapshot\"u\n" + + "\x1eReplicateConsumerStateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\xf6\x01\n" + + "\x17SourceTailStateSnapshot\x12'\n" + + "\x0fsourcing_stream\x18\x01 \x01(\tR\x0esourcingStream\x12#\n" + + "\rsource_stream\x18\x02 \x01(\tR\fsourceStream\x12(\n" + + "\x10last_sourced_seq\x18\x03 \x01(\x04R\x0elastSourcedSeq\x12!\n" + + "\fpulled_total\x18\x04 \x01(\x04R\vpulledTotal\x12\"\n" + + "\rupdated_ts_ms\x18\x05 \x01(\x03R\vupdatedTsMs\x12\x1c\n" + + "\ttombstone\x18\x06 \x01(\bR\ttombstone\"h\n" + + "\x1fReplicateSourceTailStateRequest\x12E\n" + + "\bsnapshot\x18\x01 \x01(\v2).waymaker.streams.SourceTailStateSnapshotR\bsnapshot\"w\n" + + " ReplicateSourceTailStateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"X\n" + + "\x1cReplicateStreamCreateRequest\x128\n" + + "\x06config\x18\x01 \x01(\v2 .waymaker.streams.StreamConfigPbR\x06config\"t\n" + + "\x1dReplicateStreamCreateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"\xc7\x01\n" + + "\x17ReplicateMessageRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x10\n" + + "\x03seq\x18\x02 \x01(\x04R\x03seq\x12\x18\n" + + "\asubject\x18\x03 \x01(\tR\asubject\x12\x18\n" + + "\apayload\x18\x04 \x01(\fR\apayload\x129\n" + + "\aheaders\x18\x05 \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12\x13\n" + + "\x05ts_ms\x18\x06 \x01(\x03R\x04tsMs\"\x9b\x01\n" + + "\x18ReplicateMessageResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12*\n" + + "\x11receiver_last_seq\x18\x04 \x01(\x04R\x0freceiverLastSeq\"2\n" + + "\x1cReplicateStreamDeleteRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"t\n" + + "\x1dReplicateStreamDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"O\n" + + "\x18ReplicateTruncateRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x1b\n" + + "\tfirst_seq\x18\x02 \x01(\x04R\bfirstSeq\"\x8a\x01\n" + + "\x19ReplicateTruncateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\adropped\x18\x04 \x01(\x04R\adropped\"\xb8\x02\n" + + "\x1cReplicateStreamUpdateRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12!\n" + + "\n" + + "max_age_ms\x18\x02 \x01(\x04H\x00R\bmaxAgeMs\x88\x01\x01\x12\x1e\n" + + "\bmax_msgs\x18\x03 \x01(\x04H\x01R\amaxMsgs\x88\x01\x01\x12 \n" + + "\tmax_bytes\x18\x04 \x01(\x04H\x02R\bmaxBytes\x88\x01\x01\x12'\n" + + "\rmax_msg_bytes\x18\x05 \x01(\x04H\x03R\vmaxMsgBytes\x88\x01\x01\x12(\n" + + "\rstrict_limits\x18\x06 \x01(\bH\x04R\fstrictLimits\x88\x01\x01B\r\n" + + "\v_max_age_msB\v\n" + + "\t_max_msgsB\f\n" + + "\n" + + "_max_bytesB\x10\n" + + "\x0e_max_msg_bytesB\x10\n" + + "\x0e_strict_limits\"t\n" + + "\x1dReplicateStreamUpdateResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"H\n" + + "\x1cReplicateWorkQueueAckRequest\x12\x16\n" + + "\x06stream\x18\x01 \x01(\tR\x06stream\x12\x10\n" + + "\x03seq\x18\x02 \x01(\x04R\x03seq\"\x95\x01\n" + + "\x1dReplicateWorkQueueAckResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1f\n" + + "\vwas_present\x18\x04 \x01(\bR\n" + + "wasPresent\"\xa6\x02\n" + + "\n" + + "ObjectInfo\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\vtotal_bytes\x18\x02 \x01(\x04R\n" + + "totalBytes\x12\x1d\n" + + "\n" + + "chunk_size\x18\x03 \x01(\x04R\tchunkSize\x12\x1f\n" + + "\vchunk_count\x18\x04 \x01(\x04R\n" + + "chunkCount\x12\x16\n" + + "\x06sha256\x18\x05 \x01(\tR\x06sha256\x12\x13\n" + + "\x05ts_ms\x18\x06 \x01(\x03R\x04tsMs\x129\n" + + "\aheaders\x18\a \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12!\n" + + "\fmetadata_seq\x18\b \x01(\x04R\vmetadataSeq\x12\x18\n" + + "\adeduped\x18\t \x01(\bR\adeduped\"\xe2\x01\n" + + "\x10PutObjectRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n" + + "\apayload\x18\x03 \x01(\fR\apayload\x12\x1d\n" + + "\n" + + "chunk_size\x18\x04 \x01(\x04R\tchunkSize\x129\n" + + "\aheaders\x18\x05 \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12\x16\n" + + "\x06sha256\x18\x06 \x01(\tR\x06sha256\x12\x16\n" + + "\x06dedupe\x18\a \x01(\bR\x06dedupe\"\x9a\x01\n" + + "\x11PutObjectResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x120\n" + + "\x04info\x18\x04 \x01(\v2\x1c.waymaker.streams.ObjectInfoR\x04info\"\x89\x01\n" + + "\x14PutObjectStreamFrame\x12;\n" + + "\x05start\x18\x01 \x01(\v2 .waymaker.streams.PutObjectStartH\x00R\x05start\x88\x01\x01\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\x12\x16\n" + + "\x06finish\x18\x03 \x01(\bR\x06finishB\b\n" + + "\x06_start\"\xc6\x01\n" + + "\x0ePutObjectStart\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x1d\n" + + "\n" + + "chunk_size\x18\x03 \x01(\x04R\tchunkSize\x129\n" + + "\aheaders\x18\x04 \x03(\v2\x1f.waymaker.streams.MessageHeaderR\aheaders\x12\x16\n" + + "\x06sha256\x18\x05 \x01(\tR\x06sha256\x12\x16\n" + + "\x06dedupe\x18\x06 \x01(\bR\x06dedupe\">\n" + + "\x10GetObjectRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\"\xb4\x01\n" + + "\x11GetObjectResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x120\n" + + "\x04info\x18\x04 \x01(\v2\x1c.waymaker.streams.ObjectInfoR\x04info\x12\x18\n" + + "\apayload\x18\x05 \x01(\fR\apayload\"~\n" + + "\x14GetObjectStreamFrame\x125\n" + + "\x04info\x18\x01 \x01(\v2\x1c.waymaker.streams.ObjectInfoH\x00R\x04info\x88\x01\x01\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\x12\x12\n" + + "\x04done\x18\x03 \x01(\bR\x04doneB\a\n" + + "\x05_info\"A\n" + + "\x13DeleteObjectRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\"\x90\x01\n" + + "\x14DeleteObjectResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12#\n" + + "\rtombstone_seq\x18\x04 \x01(\x04R\ftombstoneSeq\"B\n" + + "\x14GetObjectInfoRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\"\xc6\x01\n" + + "\x15GetObjectInfoResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x125\n" + + "\x04info\x18\x04 \x01(\v2\x1c.waymaker.streams.ObjectInfoH\x00R\x04info\x88\x01\x01\x12\x18\n" + + "\adeleted\x18\x05 \x01(\bR\adeletedB\a\n" + + "\x05_info\"v\n" + + "\x12ListObjectsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x1f\n" + + "\vname_prefix\x18\x02 \x01(\tR\n" + + "namePrefix\x12'\n" + + "\x0finclude_deleted\x18\x03 \x01(\bR\x0eincludeDeleted\"\xa7\x01\n" + + "\x13ListObjectsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12;\n" + + "\aentries\x18\x04 \x03(\v2!.waymaker.streams.ObjectListEntryR\aentries\"`\n" + + "\x0fObjectListEntry\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\vtotal_bytes\x18\x02 \x01(\x04R\n" + + "totalBytes\x12\x18\n" + + "\adeleted\x18\x03 \x01(\bR\adeleted\"y\n" + + "\x1aListObjectRevisionsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x19\n" + + "\bfrom_seq\x18\x03 \x01(\x04R\afromSeq\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x04R\x05limit\"\xb7\x01\n" + + "\x1bListObjectRevisionsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12C\n" + + "\trevisions\x18\x04 \x03(\v2%.waymaker.streams.ObjectRevisionEntryR\trevisions\"m\n" + + "\x15GetObjectRangeRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + + "\x06offset\x18\x03 \x01(\x04R\x06offset\x12\x10\n" + + "\x03len\x18\x04 \x01(\x04R\x03len\"\xde\x01\n" + + "\x16GetObjectRangeResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x120\n" + + "\x04info\x18\x04 \x01(\v2\x1c.waymaker.streams.ObjectInfoR\x04info\x12#\n" + + "\ractual_offset\x18\x05 \x01(\x04R\factualOffset\x12\x18\n" + + "\apayload\x18\x06 \x01(\fR\apayload\"\xc1\x01\n" + + "\x13ObjectRevisionEntry\x12!\n" + + "\fmetadata_seq\x18\x01 \x01(\x04R\vmetadataSeq\x12\x18\n" + + "\adeleted\x18\x02 \x01(\bR\adeleted\x12\x1f\n" + + "\vtotal_bytes\x18\x03 \x01(\x04R\n" + + "totalBytes\x12\x1f\n" + + "\vchunk_count\x18\x04 \x01(\x04R\n" + + "chunkCount\x12\x16\n" + + "\x06sha256\x18\x05 \x01(\tR\x06sha256\x12\x13\n" + + "\x05ts_ms\x18\x06 \x01(\x03R\x04tsMs\"\xae\x01\n" + + "\x15KvCreateBucketRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12$\n" + + "\x0emax_value_size\x18\x03 \x01(\x04R\fmaxValueSize\x12\x1c\n" + + "\n" + + "max_age_ms\x18\x04 \x01(\x04R\bmaxAgeMs\x12\x1c\n" + + "\tephemeral\x18\x05 \x01(\bR\tephemeral\"m\n" + + "\x16KvCreateBucketResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"/\n" + + "\x15KvDeleteBucketRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"m\n" + + "\x16KvDeleteBucketResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"e\n" + + "\fKvPutRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12\x15\n" + + "\x06ttl_ms\x18\x04 \x01(\x04R\x05ttlMs\"h\n" + + "\x0fKvCreateRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12\x15\n" + + "\x06ttl_ms\x18\x04 \x01(\x04R\x05ttlMs\"\x95\x01\n" + + "\x0fKvUpdateRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x03 \x01(\fR\x05value\x12+\n" + + "\x11expected_revision\x18\x04 \x01(\x04R\x10expectedRevision\x12\x15\n" + + "\x06ttl_ms\x18\x05 \x01(\x04R\x05ttlMs\"\x80\x01\n" + + "\rKvPutResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"8\n" + + "\fKvGetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"\xa4\x01\n" + + "\rKvGetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x124\n" + + "\x05entry\x18\x04 \x01(\v2\x19.waymaker.streams.KvEntryH\x00R\x05entry\x88\x01\x01B\b\n" + + "\x06_entry\"P\n" + + "\aKvEntry\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\";\n" + + "\x0fKvDeleteRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"\x83\x01\n" + + "\x10KvDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"'\n" + + "\rKvKeysRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"\x9d\x01\n" + + "\x0eKvKeysResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x126\n" + + "\aentries\x18\x04 \x03(\v2\x1c.waymaker.streams.KvKeyEntryR\aentries\"T\n" + + "\n" + + "KvKeyEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x18\n" + + "\adeleted\x18\x03 \x01(\bR\adeleted\"w\n" + + "\x10KvHistoryRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12#\n" + + "\rfrom_revision\x18\x03 \x01(\x04R\ffromRevision\x12\x14\n" + + "\x05limit\x18\x04 \x01(\x04R\x05limit\"\xa4\x01\n" + + "\x11KvHistoryResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12:\n" + + "\aentries\x18\x04 \x03(\v2 .waymaker.streams.KvHistoryEntryR\aentries\"q\n" + + "\x0eKvHistoryEntry\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\x12\x18\n" + + "\adeleted\x18\x04 \x01(\bR\adeleted\"Q\n" + + "\x0eKvTouchRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\x12\x15\n" + + "\x06ttl_ms\x18\x03 \x01(\x04R\x05ttlMs\":\n" + + "\x0eKvWatchRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x10\n" + + "\x03key\x18\x02 \x01(\tR\x03key\"\x84\x01\n" + + "\fKvWatchEvent\x120\n" + + "\x03put\x18\x01 \x01(\v2\x1c.waymaker.streams.KvPutEventH\x00R\x03put\x129\n" + + "\x06delete\x18\x02 \x01(\v2\x1f.waymaker.streams.KvDeleteEventH\x00R\x06deleteB\a\n" + + "\x05event\"e\n" + + "\n" + + "KvPutEvent\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x04 \x01(\x03R\x04tsMs\"R\n" + + "\rKvDeleteEvent\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x1a\n" + + "\brevision\x18\x02 \x01(\x04R\brevision\x12\x13\n" + + "\x05ts_ms\x18\x03 \x01(\x03R\x04tsMs\"g\n" + + "\x16CreateHashStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12\x1c\n" + + "\tephemeral\x18\x03 \x01(\bR\tephemeral\"n\n" + + "\x17CreateHashStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\",\n" + + "\x16DeleteHashStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"n\n" + + "\x17DeleteHashStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"o\n" + + "\x0eHashSetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\x12\x14\n" + + "\x05value\x18\x04 \x01(\fR\x05value\"\x82\x01\n" + + "\x0fHashSetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\brevision\x18\x04 \x01(\x04R\brevision\"Y\n" + + "\x0eHashGetRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"\xa7\x01\n" + + "\x0fHashGetResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x19\n" + + "\x05value\x18\x04 \x01(\fH\x00R\x05value\x88\x01\x01\x12\x1a\n" + + "\brevision\x18\x05 \x01(\x04R\brevisionB\b\n" + + "\x06_value\"\\\n" + + "\x11HashExistsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"\x81\x01\n" + + "\x12HashExistsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06exists\x18\x04 \x01(\bR\x06exists\"\\\n" + + "\x11HashDeleteRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\x12\x14\n" + + "\x05field\x18\x03 \x01(\tR\x05field\"i\n" + + "\x12HashDeleteResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"F\n" + + "\x11HashGetAllRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"\xa5\x01\n" + + "\x12HashGetAllResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12:\n" + + "\aentries\x18\x04 \x03(\v2 .waymaker.streams.HashFieldEntryR\aentries\"X\n" + + "\x0eHashFieldEntry\x12\x14\n" + + "\x05field\x18\x01 \x01(\tR\x05field\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\x12\x1a\n" + + "\brevision\x18\x03 \x01(\x04R\brevision\"F\n" + + "\x11HashFieldsRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"\x81\x01\n" + + "\x12HashFieldsResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06fields\x18\x04 \x03(\tR\x06fields\"C\n" + + "\x0eHashLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x19\n" + + "\bhash_key\x18\x02 \x01(\tR\ahashKey\"|\n" + + "\x0fHashLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count\"f\n" + + "\x15CreateSetStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12\x1c\n" + + "\tephemeral\x18\x03 \x01(\bR\tephemeral\"m\n" + + "\x16CreateSetStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"+\n" + + "\x15DeleteSetStoreRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"m\n" + + "\x16DeleteSetStoreResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"X\n" + + "\rSetAddRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"e\n" + + "\x0eSetAddResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"[\n" + + "\x10SetRemoveRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"h\n" + + "\x11SetRemoveResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"]\n" + + "\x12SetIsMemberRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\x12\x16\n" + + "\x06member\x18\x03 \x01(\tR\x06member\"\x87\x01\n" + + "\x13SetIsMemberResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1b\n" + + "\tis_member\x18\x04 \x01(\bR\bisMember\"D\n" + + "\x11SetMembersRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\"\x83\x01\n" + + "\x12SetMembersResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x18\n" + + "\amembers\x18\x04 \x03(\tR\amembers\"@\n" + + "\rSetLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x17\n" + + "\aset_key\x18\x02 \x01(\tR\x06setKey\"{\n" + + "\x0eSetLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count\"\x86\x01\n" + + "\x12CreateQueueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1b\n" + + "\tmax_bytes\x18\x02 \x01(\x04R\bmaxBytes\x12!\n" + + "\fmax_messages\x18\x03 \x01(\x04R\vmaxMessages\x12\x1c\n" + + "\tephemeral\x18\x04 \x01(\bR\tephemeral\"j\n" + + "\x13CreateQueueResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"(\n" + + "\x12DeleteQueueRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"j\n" + + "\x13DeleteQueueResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\"@\n" + + "\x10QueuePushRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"\x84\x01\n" + + "\x11QueuePushResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x1a\n" + + "\bsequence\x18\x04 \x01(\x04R\bsequence\")\n" + + "\x0fQueuePopRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"\x8c\x01\n" + + "\x10QueuePopResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x19\n" + + "\x05value\x18\x04 \x01(\fH\x00R\x05value\x88\x01\x01B\b\n" + + "\x06_value\"f\n" + + "\x11QueueRangeRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\x12#\n" + + "\rfrom_sequence\x18\x02 \x01(\x04R\ffromSequence\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x04R\x05limit\"\x81\x01\n" + + "\x12QueueRangeResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x16\n" + + "\x06values\x18\x04 \x03(\fR\x06values\")\n" + + "\x0fQueueLenRequest\x12\x16\n" + + "\x06bucket\x18\x01 \x01(\tR\x06bucket\"}\n" + + "\x10QueueLenResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x1f\n" + + "\vresult_code\x18\x02 \x01(\tR\n" + + "resultCode\x12\x18\n" + + "\amessage\x18\x03 \x01(\tR\amessage\x12\x14\n" + + "\x05count\x18\x04 \x01(\x04R\x05count*E\n" + + "\fOnDropPolicy\x12\x10\n" + + "\fON_DROP_HALT\x10\x00\x12#\n" + + "\x1fON_DROP_SKIP_TO_FIRST_AVAILABLE\x10\x01*p\n" + + "\x12DeliveryPolicyType\x12\x10\n" + + "\fDELIVERY_ALL\x10\x00\x12\x11\n" + + "\rDELIVERY_LAST\x10\x01\x12\x19\n" + + "\x15DELIVERY_BY_START_SEQ\x10\x02\x12\x1a\n" + + "\x16DELIVERY_BY_START_TIME\x10\x03*\xcd\x01\n" + + "\x0eWatchEventType\x12\x11\n" + + "\rWATCH_UNKNOWN\x10\x00\x12\x18\n" + + "\x14WATCH_STREAM_CREATED\x10\x01\x12\x18\n" + + "\x14WATCH_STREAM_DELETED\x10\x02\x12\x18\n" + + "\x14WATCH_STREAM_UPDATED\x10\x03\x12\x1a\n" + + "\x16WATCH_CONSUMER_CREATED\x10\x04\x12\x1a\n" + + "\x16WATCH_CONSUMER_DELETED\x10\x05\x12\"\n" + + "\x1eWATCH_STREAM_AUTHORITY_CHANGED\x10\x062\xfd#\n" + + "\x16WaymakerStreamsService\x12]\n" + + "\fCreateStream\x12%.waymaker.streams.CreateStreamRequest\x1a&.waymaker.streams.CreateStreamResponse\x12]\n" + + "\fDeleteStream\x12%.waymaker.streams.DeleteStreamRequest\x1a&.waymaker.streams.DeleteStreamResponse\x12`\n" + + "\rGetStreamInfo\x12&.waymaker.streams.GetStreamInfoRequest\x1a'.waymaker.streams.GetStreamInfoResponse\x12Z\n" + + "\vListStreams\x12$.waymaker.streams.ListStreamsRequest\x1a%.waymaker.streams.ListStreamsResponse\x12i\n" + + "\x10GetStreamSources\x12).waymaker.streams.GetStreamSourcesRequest\x1a*.waymaker.streams.GetStreamSourcesResponse\x12]\n" + + "\fUpdateStream\x12%.waymaker.streams.UpdateStreamRequest\x1a&.waymaker.streams.UpdateStreamResponse\x12N\n" + + "\aPublish\x12 .waymaker.streams.PublishRequest\x1a!.waymaker.streams.PublishResponse\x12H\n" + + "\x05Fetch\x12\x1e.waymaker.streams.FetchRequest\x1a\x1f.waymaker.streams.FetchResponse\x12B\n" + + "\x03Ack\x12\x1c.waymaker.streams.AckRequest\x1a\x1d.waymaker.streams.AckResponse\x12B\n" + + "\x03Nak\x12\x1c.waymaker.streams.NakRequest\x1a\x1d.waymaker.streams.NakResponse\x12E\n" + + "\x04Term\x12\x1d.waymaker.streams.TermRequest\x1a\x1e.waymaker.streams.TermResponse\x12W\n" + + "\n" + + "InProgress\x12#.waymaker.streams.InProgressRequest\x1a$.waymaker.streams.InProgressResponse\x12S\n" + + "\tSubscribe\x12\".waymaker.streams.SubscribeRequest\x1a .waymaker.streams.SubscribeEvent0\x01\x12c\n" + + "\x0eCreateConsumer\x12'.waymaker.streams.CreateConsumerRequest\x1a(.waymaker.streams.CreateConsumerResponse\x12c\n" + + "\x0eDeleteConsumer\x12'.waymaker.streams.DeleteConsumerRequest\x1a(.waymaker.streams.DeleteConsumerResponse\x12`\n" + + "\rListConsumers\x12&.waymaker.streams.ListConsumersRequest\x1a'.waymaker.streams.ListConsumersResponse\x12f\n" + + "\x0fGetConsumerInfo\x12(.waymaker.streams.GetConsumerInfoRequest\x1a).waymaker.streams.GetConsumerInfoResponse\x12b\n" + + "\x0eTransferStream\x12'.waymaker.streams.TransferStreamRequest\x1a%.waymaker.streams.TransferStreamChunk0\x01\x12`\n" + + "\rMigrateStream\x12&.waymaker.streams.MigrateStreamRequest\x1a'.waymaker.streams.MigrateStreamResponse\x12x\n" + + "\x15GetClusterStreamStats\x12..waymaker.streams.GetClusterStreamStatsRequest\x1a/.waymaker.streams.GetClusterStreamStatsResponse\x12U\n" + + "\fWatchStreams\x12%.waymaker.streams.WatchStreamsRequest\x1a\x1c.waymaker.streams.WatchEvent0\x01\x12r\n" + + "\x13ReadLatestAtSubject\x12,.waymaker.streams.ReadLatestAtSubjectRequest\x1a-.waymaker.streams.ReadLatestAtSubjectResponse\x12u\n" + + "\x14ListSubjectsByPrefix\x12-.waymaker.streams.ListSubjectsByPrefixRequest\x1a..waymaker.streams.ListSubjectsByPrefixResponse\x12o\n" + + "\x12ScanExactAtSubject\x12+.waymaker.streams.ScanExactAtSubjectRequest\x1a,.waymaker.streams.ScanExactAtSubjectResponse\x12u\n" + + "\x14ClearStreamAuthority\x12-.waymaker.streams.ClearStreamAuthorityRequest\x1a..waymaker.streams.ClearStreamAuthorityResponse\x12\x8d\x01\n" + + "\x1cListStreamAuthorityOverrides\x125.waymaker.streams.ListStreamAuthorityOverridesRequest\x1a6.waymaker.streams.ListStreamAuthorityOverridesResponse\x12f\n" + + "\x0fSetStreamPinned\x12(.waymaker.streams.SetStreamPinnedRequest\x1a).waymaker.streams.SetStreamPinnedResponse\x12T\n" + + "\tPutObject\x12\".waymaker.streams.PutObjectRequest\x1a#.waymaker.streams.PutObjectResponse\x12T\n" + + "\tGetObject\x12\".waymaker.streams.GetObjectRequest\x1a#.waymaker.streams.GetObjectResponse\x12]\n" + + "\fDeleteObject\x12%.waymaker.streams.DeleteObjectRequest\x1a&.waymaker.streams.DeleteObjectResponse\x12`\n" + + "\rGetObjectInfo\x12&.waymaker.streams.GetObjectInfoRequest\x1a'.waymaker.streams.GetObjectInfoResponse\x12Z\n" + + "\vListObjects\x12$.waymaker.streams.ListObjectsRequest\x1a%.waymaker.streams.ListObjectsResponse\x12`\n" + + "\x0fPutObjectStream\x12&.waymaker.streams.PutObjectStreamFrame\x1a#.waymaker.streams.PutObjectResponse(\x01\x12_\n" + + "\x0fGetObjectStream\x12\".waymaker.streams.GetObjectRequest\x1a&.waymaker.streams.GetObjectStreamFrame0\x01\x12r\n" + + "\x13ListObjectRevisions\x12,.waymaker.streams.ListObjectRevisionsRequest\x1a-.waymaker.streams.ListObjectRevisionsResponse\x12c\n" + + "\x0eGetObjectRange\x12'.waymaker.streams.GetObjectRangeRequest\x1a(.waymaker.streams.GetObjectRangeResponse\x12i\n" + + "\x10RebalanceStreams\x12).waymaker.streams.RebalanceStreamsRequest\x1a*.waymaker.streams.RebalanceStreamsResponse\x12{\n" + + "\x16ReplicateConsumerState\x12/.waymaker.streams.ReplicateConsumerStateRequest\x1a0.waymaker.streams.ReplicateConsumerStateResponse\x12\x81\x01\n" + + "\x18ReplicateSourceTailState\x121.waymaker.streams.ReplicateSourceTailStateRequest\x1a2.waymaker.streams.ReplicateSourceTailStateResponse\x12x\n" + + "\x15ReplicateStreamCreate\x12..waymaker.streams.ReplicateStreamCreateRequest\x1a/.waymaker.streams.ReplicateStreamCreateResponse\x12i\n" + + "\x10ReplicateMessage\x12).waymaker.streams.ReplicateMessageRequest\x1a*.waymaker.streams.ReplicateMessageResponse\x12x\n" + + "\x15ReplicateStreamDelete\x12..waymaker.streams.ReplicateStreamDeleteRequest\x1a/.waymaker.streams.ReplicateStreamDeleteResponse\x12l\n" + + "\x11ReplicateTruncate\x12*.waymaker.streams.ReplicateTruncateRequest\x1a+.waymaker.streams.ReplicateTruncateResponse\x12x\n" + + "\x15ReplicateStreamUpdate\x12..waymaker.streams.ReplicateStreamUpdateRequest\x1a/.waymaker.streams.ReplicateStreamUpdateResponse\x12x\n" + + "\x15ReplicateWorkQueueAck\x12..waymaker.streams.ReplicateWorkQueueAckRequest\x1a/.waymaker.streams.ReplicateWorkQueueAckResponseB\x18Z\x16/apis/waymaker_streamsb\x06proto3" + +var ( + file_waymaker_streams_proto_rawDescOnce sync.Once + file_waymaker_streams_proto_rawDescData []byte +) + +func file_waymaker_streams_proto_rawDescGZIP() []byte { + file_waymaker_streams_proto_rawDescOnce.Do(func() { + file_waymaker_streams_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_waymaker_streams_proto_rawDesc), len(file_waymaker_streams_proto_rawDesc))) + }) + return file_waymaker_streams_proto_rawDescData +} + +var file_waymaker_streams_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_waymaker_streams_proto_msgTypes = make([]protoimpl.MessageInfo, 190) +var file_waymaker_streams_proto_goTypes = []any{ + (OnDropPolicy)(0), // 0: waymaker.streams.OnDropPolicy + (DeliveryPolicyType)(0), // 1: waymaker.streams.DeliveryPolicyType + (WatchEventType)(0), // 2: waymaker.streams.WatchEventType + (*LimitsRetention)(nil), // 3: waymaker.streams.LimitsRetention + (*WorkQueueRetention)(nil), // 4: waymaker.streams.WorkQueueRetention + (*InterestRetention)(nil), // 5: waymaker.streams.InterestRetention + (*Retention)(nil), // 6: waymaker.streams.Retention + (*StreamConfigPb)(nil), // 7: waymaker.streams.StreamConfigPb + (*StreamSourceConfigPb)(nil), // 8: waymaker.streams.StreamSourceConfigPb + (*SubjectTransformPb)(nil), // 9: waymaker.streams.SubjectTransformPb + (*StreamStatsPb)(nil), // 10: waymaker.streams.StreamStatsPb + (*MessageHeader)(nil), // 11: waymaker.streams.MessageHeader + (*MessagePb)(nil), // 12: waymaker.streams.MessagePb + (*DeliveryPolicyPb)(nil), // 13: waymaker.streams.DeliveryPolicyPb + (*ConsumerConfigPb)(nil), // 14: waymaker.streams.ConsumerConfigPb + (*ConsumerStatePb)(nil), // 15: waymaker.streams.ConsumerStatePb + (*CreateStreamRequest)(nil), // 16: waymaker.streams.CreateStreamRequest + (*CreateStreamResponse)(nil), // 17: waymaker.streams.CreateStreamResponse + (*DeleteStreamRequest)(nil), // 18: waymaker.streams.DeleteStreamRequest + (*DeleteStreamResponse)(nil), // 19: waymaker.streams.DeleteStreamResponse + (*GetStreamInfoRequest)(nil), // 20: waymaker.streams.GetStreamInfoRequest + (*GetStreamInfoResponse)(nil), // 21: waymaker.streams.GetStreamInfoResponse + (*SourceStatusPb)(nil), // 22: waymaker.streams.SourceStatusPb + (*StreamAuthorityOverride)(nil), // 23: waymaker.streams.StreamAuthorityOverride + (*ClearStreamAuthorityRequest)(nil), // 24: waymaker.streams.ClearStreamAuthorityRequest + (*ClearStreamAuthorityResponse)(nil), // 25: waymaker.streams.ClearStreamAuthorityResponse + (*ListStreamAuthorityOverridesRequest)(nil), // 26: waymaker.streams.ListStreamAuthorityOverridesRequest + (*ListStreamAuthorityOverridesResponse)(nil), // 27: waymaker.streams.ListStreamAuthorityOverridesResponse + (*AuthorityOverrideEntry)(nil), // 28: waymaker.streams.AuthorityOverrideEntry + (*SetStreamPinnedRequest)(nil), // 29: waymaker.streams.SetStreamPinnedRequest + (*SetStreamPinnedResponse)(nil), // 30: waymaker.streams.SetStreamPinnedResponse + (*ListStreamsRequest)(nil), // 31: waymaker.streams.ListStreamsRequest + (*ListStreamsResponse)(nil), // 32: waymaker.streams.ListStreamsResponse + (*GetStreamSourcesRequest)(nil), // 33: waymaker.streams.GetStreamSourcesRequest + (*GetStreamSourcesResponse)(nil), // 34: waymaker.streams.GetStreamSourcesResponse + (*GetStreamSourcesEntry)(nil), // 35: waymaker.streams.GetStreamSourcesEntry + (*UpdateStreamRequest)(nil), // 36: waymaker.streams.UpdateStreamRequest + (*UpdateStreamResponse)(nil), // 37: waymaker.streams.UpdateStreamResponse + (*PublishRequest)(nil), // 38: waymaker.streams.PublishRequest + (*PublishResponse)(nil), // 39: waymaker.streams.PublishResponse + (*FetchRequest)(nil), // 40: waymaker.streams.FetchRequest + (*FetchResponse)(nil), // 41: waymaker.streams.FetchResponse + (*AckRequest)(nil), // 42: waymaker.streams.AckRequest + (*AckResponse)(nil), // 43: waymaker.streams.AckResponse + (*NakRequest)(nil), // 44: waymaker.streams.NakRequest + (*NakResponse)(nil), // 45: waymaker.streams.NakResponse + (*TermRequest)(nil), // 46: waymaker.streams.TermRequest + (*TermResponse)(nil), // 47: waymaker.streams.TermResponse + (*InProgressRequest)(nil), // 48: waymaker.streams.InProgressRequest + (*InProgressResponse)(nil), // 49: waymaker.streams.InProgressResponse + (*SubscribeRequest)(nil), // 50: waymaker.streams.SubscribeRequest + (*SubscribeEvent)(nil), // 51: waymaker.streams.SubscribeEvent + (*SubscribeStopped)(nil), // 52: waymaker.streams.SubscribeStopped + (*CreateConsumerRequest)(nil), // 53: waymaker.streams.CreateConsumerRequest + (*CreateConsumerResponse)(nil), // 54: waymaker.streams.CreateConsumerResponse + (*DeleteConsumerRequest)(nil), // 55: waymaker.streams.DeleteConsumerRequest + (*DeleteConsumerResponse)(nil), // 56: waymaker.streams.DeleteConsumerResponse + (*ListConsumersRequest)(nil), // 57: waymaker.streams.ListConsumersRequest + (*ListConsumersResponse)(nil), // 58: waymaker.streams.ListConsumersResponse + (*GetConsumerInfoRequest)(nil), // 59: waymaker.streams.GetConsumerInfoRequest + (*GetConsumerInfoResponse)(nil), // 60: waymaker.streams.GetConsumerInfoResponse + (*TransferStreamRequest)(nil), // 61: waymaker.streams.TransferStreamRequest + (*TransferStreamChunk)(nil), // 62: waymaker.streams.TransferStreamChunk + (*TransferStreamSummary)(nil), // 63: waymaker.streams.TransferStreamSummary + (*MigrateStreamRequest)(nil), // 64: waymaker.streams.MigrateStreamRequest + (*MigrateStreamResponse)(nil), // 65: waymaker.streams.MigrateStreamResponse + (*GetClusterStreamStatsRequest)(nil), // 66: waymaker.streams.GetClusterStreamStatsRequest + (*PerStreamStats)(nil), // 67: waymaker.streams.PerStreamStats + (*PerNodeSummary)(nil), // 68: waymaker.streams.PerNodeSummary + (*GetClusterStreamStatsResponse)(nil), // 69: waymaker.streams.GetClusterStreamStatsResponse + (*RebalancePlanEntry)(nil), // 70: waymaker.streams.RebalancePlanEntry + (*RebalanceStreamsRequest)(nil), // 71: waymaker.streams.RebalanceStreamsRequest + (*RebalanceStepOutcome)(nil), // 72: waymaker.streams.RebalanceStepOutcome + (*RebalanceStreamsResponse)(nil), // 73: waymaker.streams.RebalanceStreamsResponse + (*WatchStreamsRequest)(nil), // 74: waymaker.streams.WatchStreamsRequest + (*StreamWatchDetail)(nil), // 75: waymaker.streams.StreamWatchDetail + (*ConsumerWatchDetail)(nil), // 76: waymaker.streams.ConsumerWatchDetail + (*AuthorityWatchDetail)(nil), // 77: waymaker.streams.AuthorityWatchDetail + (*ReadLatestAtSubjectRequest)(nil), // 78: waymaker.streams.ReadLatestAtSubjectRequest + (*ReadLatestAtSubjectResponse)(nil), // 79: waymaker.streams.ReadLatestAtSubjectResponse + (*ListSubjectsByPrefixRequest)(nil), // 80: waymaker.streams.ListSubjectsByPrefixRequest + (*ListSubjectsByPrefixResponse)(nil), // 81: waymaker.streams.ListSubjectsByPrefixResponse + (*ScanExactAtSubjectRequest)(nil), // 82: waymaker.streams.ScanExactAtSubjectRequest + (*ScanExactAtSubjectResponse)(nil), // 83: waymaker.streams.ScanExactAtSubjectResponse + (*WatchEvent)(nil), // 84: waymaker.streams.WatchEvent + (*PendingDeliveryPb)(nil), // 85: waymaker.streams.PendingDeliveryPb + (*ConsumerStateSnapshot)(nil), // 86: waymaker.streams.ConsumerStateSnapshot + (*ReplicateConsumerStateRequest)(nil), // 87: waymaker.streams.ReplicateConsumerStateRequest + (*ReplicateConsumerStateResponse)(nil), // 88: waymaker.streams.ReplicateConsumerStateResponse + (*SourceTailStateSnapshot)(nil), // 89: waymaker.streams.SourceTailStateSnapshot + (*ReplicateSourceTailStateRequest)(nil), // 90: waymaker.streams.ReplicateSourceTailStateRequest + (*ReplicateSourceTailStateResponse)(nil), // 91: waymaker.streams.ReplicateSourceTailStateResponse + (*ReplicateStreamCreateRequest)(nil), // 92: waymaker.streams.ReplicateStreamCreateRequest + (*ReplicateStreamCreateResponse)(nil), // 93: waymaker.streams.ReplicateStreamCreateResponse + (*ReplicateMessageRequest)(nil), // 94: waymaker.streams.ReplicateMessageRequest + (*ReplicateMessageResponse)(nil), // 95: waymaker.streams.ReplicateMessageResponse + (*ReplicateStreamDeleteRequest)(nil), // 96: waymaker.streams.ReplicateStreamDeleteRequest + (*ReplicateStreamDeleteResponse)(nil), // 97: waymaker.streams.ReplicateStreamDeleteResponse + (*ReplicateTruncateRequest)(nil), // 98: waymaker.streams.ReplicateTruncateRequest + (*ReplicateTruncateResponse)(nil), // 99: waymaker.streams.ReplicateTruncateResponse + (*ReplicateStreamUpdateRequest)(nil), // 100: waymaker.streams.ReplicateStreamUpdateRequest + (*ReplicateStreamUpdateResponse)(nil), // 101: waymaker.streams.ReplicateStreamUpdateResponse + (*ReplicateWorkQueueAckRequest)(nil), // 102: waymaker.streams.ReplicateWorkQueueAckRequest + (*ReplicateWorkQueueAckResponse)(nil), // 103: waymaker.streams.ReplicateWorkQueueAckResponse + (*ObjectInfo)(nil), // 104: waymaker.streams.ObjectInfo + (*PutObjectRequest)(nil), // 105: waymaker.streams.PutObjectRequest + (*PutObjectResponse)(nil), // 106: waymaker.streams.PutObjectResponse + (*PutObjectStreamFrame)(nil), // 107: waymaker.streams.PutObjectStreamFrame + (*PutObjectStart)(nil), // 108: waymaker.streams.PutObjectStart + (*GetObjectRequest)(nil), // 109: waymaker.streams.GetObjectRequest + (*GetObjectResponse)(nil), // 110: waymaker.streams.GetObjectResponse + (*GetObjectStreamFrame)(nil), // 111: waymaker.streams.GetObjectStreamFrame + (*DeleteObjectRequest)(nil), // 112: waymaker.streams.DeleteObjectRequest + (*DeleteObjectResponse)(nil), // 113: waymaker.streams.DeleteObjectResponse + (*GetObjectInfoRequest)(nil), // 114: waymaker.streams.GetObjectInfoRequest + (*GetObjectInfoResponse)(nil), // 115: waymaker.streams.GetObjectInfoResponse + (*ListObjectsRequest)(nil), // 116: waymaker.streams.ListObjectsRequest + (*ListObjectsResponse)(nil), // 117: waymaker.streams.ListObjectsResponse + (*ObjectListEntry)(nil), // 118: waymaker.streams.ObjectListEntry + (*ListObjectRevisionsRequest)(nil), // 119: waymaker.streams.ListObjectRevisionsRequest + (*ListObjectRevisionsResponse)(nil), // 120: waymaker.streams.ListObjectRevisionsResponse + (*GetObjectRangeRequest)(nil), // 121: waymaker.streams.GetObjectRangeRequest + (*GetObjectRangeResponse)(nil), // 122: waymaker.streams.GetObjectRangeResponse + (*ObjectRevisionEntry)(nil), // 123: waymaker.streams.ObjectRevisionEntry + (*KvCreateBucketRequest)(nil), // 124: waymaker.streams.KvCreateBucketRequest + (*KvCreateBucketResponse)(nil), // 125: waymaker.streams.KvCreateBucketResponse + (*KvDeleteBucketRequest)(nil), // 126: waymaker.streams.KvDeleteBucketRequest + (*KvDeleteBucketResponse)(nil), // 127: waymaker.streams.KvDeleteBucketResponse + (*KvPutRequest)(nil), // 128: waymaker.streams.KvPutRequest + (*KvCreateRequest)(nil), // 129: waymaker.streams.KvCreateRequest + (*KvUpdateRequest)(nil), // 130: waymaker.streams.KvUpdateRequest + (*KvPutResponse)(nil), // 131: waymaker.streams.KvPutResponse + (*KvGetRequest)(nil), // 132: waymaker.streams.KvGetRequest + (*KvGetResponse)(nil), // 133: waymaker.streams.KvGetResponse + (*KvEntry)(nil), // 134: waymaker.streams.KvEntry + (*KvDeleteRequest)(nil), // 135: waymaker.streams.KvDeleteRequest + (*KvDeleteResponse)(nil), // 136: waymaker.streams.KvDeleteResponse + (*KvKeysRequest)(nil), // 137: waymaker.streams.KvKeysRequest + (*KvKeysResponse)(nil), // 138: waymaker.streams.KvKeysResponse + (*KvKeyEntry)(nil), // 139: waymaker.streams.KvKeyEntry + (*KvHistoryRequest)(nil), // 140: waymaker.streams.KvHistoryRequest + (*KvHistoryResponse)(nil), // 141: waymaker.streams.KvHistoryResponse + (*KvHistoryEntry)(nil), // 142: waymaker.streams.KvHistoryEntry + (*KvTouchRequest)(nil), // 143: waymaker.streams.KvTouchRequest + (*KvWatchRequest)(nil), // 144: waymaker.streams.KvWatchRequest + (*KvWatchEvent)(nil), // 145: waymaker.streams.KvWatchEvent + (*KvPutEvent)(nil), // 146: waymaker.streams.KvPutEvent + (*KvDeleteEvent)(nil), // 147: waymaker.streams.KvDeleteEvent + (*CreateHashStoreRequest)(nil), // 148: waymaker.streams.CreateHashStoreRequest + (*CreateHashStoreResponse)(nil), // 149: waymaker.streams.CreateHashStoreResponse + (*DeleteHashStoreRequest)(nil), // 150: waymaker.streams.DeleteHashStoreRequest + (*DeleteHashStoreResponse)(nil), // 151: waymaker.streams.DeleteHashStoreResponse + (*HashSetRequest)(nil), // 152: waymaker.streams.HashSetRequest + (*HashSetResponse)(nil), // 153: waymaker.streams.HashSetResponse + (*HashGetRequest)(nil), // 154: waymaker.streams.HashGetRequest + (*HashGetResponse)(nil), // 155: waymaker.streams.HashGetResponse + (*HashExistsRequest)(nil), // 156: waymaker.streams.HashExistsRequest + (*HashExistsResponse)(nil), // 157: waymaker.streams.HashExistsResponse + (*HashDeleteRequest)(nil), // 158: waymaker.streams.HashDeleteRequest + (*HashDeleteResponse)(nil), // 159: waymaker.streams.HashDeleteResponse + (*HashGetAllRequest)(nil), // 160: waymaker.streams.HashGetAllRequest + (*HashGetAllResponse)(nil), // 161: waymaker.streams.HashGetAllResponse + (*HashFieldEntry)(nil), // 162: waymaker.streams.HashFieldEntry + (*HashFieldsRequest)(nil), // 163: waymaker.streams.HashFieldsRequest + (*HashFieldsResponse)(nil), // 164: waymaker.streams.HashFieldsResponse + (*HashLenRequest)(nil), // 165: waymaker.streams.HashLenRequest + (*HashLenResponse)(nil), // 166: waymaker.streams.HashLenResponse + (*CreateSetStoreRequest)(nil), // 167: waymaker.streams.CreateSetStoreRequest + (*CreateSetStoreResponse)(nil), // 168: waymaker.streams.CreateSetStoreResponse + (*DeleteSetStoreRequest)(nil), // 169: waymaker.streams.DeleteSetStoreRequest + (*DeleteSetStoreResponse)(nil), // 170: waymaker.streams.DeleteSetStoreResponse + (*SetAddRequest)(nil), // 171: waymaker.streams.SetAddRequest + (*SetAddResponse)(nil), // 172: waymaker.streams.SetAddResponse + (*SetRemoveRequest)(nil), // 173: waymaker.streams.SetRemoveRequest + (*SetRemoveResponse)(nil), // 174: waymaker.streams.SetRemoveResponse + (*SetIsMemberRequest)(nil), // 175: waymaker.streams.SetIsMemberRequest + (*SetIsMemberResponse)(nil), // 176: waymaker.streams.SetIsMemberResponse + (*SetMembersRequest)(nil), // 177: waymaker.streams.SetMembersRequest + (*SetMembersResponse)(nil), // 178: waymaker.streams.SetMembersResponse + (*SetLenRequest)(nil), // 179: waymaker.streams.SetLenRequest + (*SetLenResponse)(nil), // 180: waymaker.streams.SetLenResponse + (*CreateQueueRequest)(nil), // 181: waymaker.streams.CreateQueueRequest + (*CreateQueueResponse)(nil), // 182: waymaker.streams.CreateQueueResponse + (*DeleteQueueRequest)(nil), // 183: waymaker.streams.DeleteQueueRequest + (*DeleteQueueResponse)(nil), // 184: waymaker.streams.DeleteQueueResponse + (*QueuePushRequest)(nil), // 185: waymaker.streams.QueuePushRequest + (*QueuePushResponse)(nil), // 186: waymaker.streams.QueuePushResponse + (*QueuePopRequest)(nil), // 187: waymaker.streams.QueuePopRequest + (*QueuePopResponse)(nil), // 188: waymaker.streams.QueuePopResponse + (*QueueRangeRequest)(nil), // 189: waymaker.streams.QueueRangeRequest + (*QueueRangeResponse)(nil), // 190: waymaker.streams.QueueRangeResponse + (*QueueLenRequest)(nil), // 191: waymaker.streams.QueueLenRequest + (*QueueLenResponse)(nil), // 192: waymaker.streams.QueueLenResponse +} +var file_waymaker_streams_proto_depIdxs = []int32{ + 3, // 0: waymaker.streams.Retention.limits:type_name -> waymaker.streams.LimitsRetention + 4, // 1: waymaker.streams.Retention.work_queue:type_name -> waymaker.streams.WorkQueueRetention + 5, // 2: waymaker.streams.Retention.interest:type_name -> waymaker.streams.InterestRetention + 6, // 3: waymaker.streams.StreamConfigPb.retention:type_name -> waymaker.streams.Retention + 8, // 4: waymaker.streams.StreamConfigPb.sources:type_name -> waymaker.streams.StreamSourceConfigPb + 9, // 5: waymaker.streams.StreamSourceConfigPb.subject_transform:type_name -> waymaker.streams.SubjectTransformPb + 0, // 6: waymaker.streams.StreamSourceConfigPb.on_drop:type_name -> waymaker.streams.OnDropPolicy + 11, // 7: waymaker.streams.MessagePb.headers:type_name -> waymaker.streams.MessageHeader + 1, // 8: waymaker.streams.DeliveryPolicyPb.type:type_name -> waymaker.streams.DeliveryPolicyType + 13, // 9: waymaker.streams.ConsumerConfigPb.delivery_policy:type_name -> waymaker.streams.DeliveryPolicyPb + 14, // 10: waymaker.streams.ConsumerStatePb.config:type_name -> waymaker.streams.ConsumerConfigPb + 7, // 11: waymaker.streams.CreateStreamRequest.config:type_name -> waymaker.streams.StreamConfigPb + 7, // 12: waymaker.streams.GetStreamInfoResponse.config:type_name -> waymaker.streams.StreamConfigPb + 10, // 13: waymaker.streams.GetStreamInfoResponse.stats:type_name -> waymaker.streams.StreamStatsPb + 23, // 14: waymaker.streams.GetStreamInfoResponse.authority_override:type_name -> waymaker.streams.StreamAuthorityOverride + 22, // 15: waymaker.streams.GetStreamInfoResponse.sources_status:type_name -> waymaker.streams.SourceStatusPb + 28, // 16: waymaker.streams.ListStreamAuthorityOverridesResponse.entries:type_name -> waymaker.streams.AuthorityOverrideEntry + 35, // 17: waymaker.streams.GetStreamSourcesResponse.entries:type_name -> waymaker.streams.GetStreamSourcesEntry + 7, // 18: waymaker.streams.UpdateStreamResponse.config:type_name -> waymaker.streams.StreamConfigPb + 11, // 19: waymaker.streams.PublishRequest.headers:type_name -> waymaker.streams.MessageHeader + 12, // 20: waymaker.streams.FetchResponse.messages:type_name -> waymaker.streams.MessagePb + 12, // 21: waymaker.streams.SubscribeEvent.message:type_name -> waymaker.streams.MessagePb + 52, // 22: waymaker.streams.SubscribeEvent.stopped:type_name -> waymaker.streams.SubscribeStopped + 14, // 23: waymaker.streams.CreateConsumerRequest.config:type_name -> waymaker.streams.ConsumerConfigPb + 15, // 24: waymaker.streams.ListConsumersResponse.consumers:type_name -> waymaker.streams.ConsumerStatePb + 15, // 25: waymaker.streams.GetConsumerInfoResponse.consumer:type_name -> waymaker.streams.ConsumerStatePb + 63, // 26: waymaker.streams.TransferStreamChunk.summary:type_name -> waymaker.streams.TransferStreamSummary + 68, // 27: waymaker.streams.GetClusterStreamStatsResponse.nodes:type_name -> waymaker.streams.PerNodeSummary + 67, // 28: waymaker.streams.GetClusterStreamStatsResponse.streams:type_name -> waymaker.streams.PerStreamStats + 70, // 29: waymaker.streams.RebalanceStreamsRequest.plan:type_name -> waymaker.streams.RebalancePlanEntry + 72, // 30: waymaker.streams.RebalanceStreamsResponse.steps:type_name -> waymaker.streams.RebalanceStepOutcome + 12, // 31: waymaker.streams.ReadLatestAtSubjectResponse.latest:type_name -> waymaker.streams.MessagePb + 12, // 32: waymaker.streams.ScanExactAtSubjectResponse.messages:type_name -> waymaker.streams.MessagePb + 2, // 33: waymaker.streams.WatchEvent.type:type_name -> waymaker.streams.WatchEventType + 75, // 34: waymaker.streams.WatchEvent.stream:type_name -> waymaker.streams.StreamWatchDetail + 76, // 35: waymaker.streams.WatchEvent.consumer:type_name -> waymaker.streams.ConsumerWatchDetail + 77, // 36: waymaker.streams.WatchEvent.authority:type_name -> waymaker.streams.AuthorityWatchDetail + 14, // 37: waymaker.streams.ConsumerStateSnapshot.config:type_name -> waymaker.streams.ConsumerConfigPb + 85, // 38: waymaker.streams.ConsumerStateSnapshot.pending:type_name -> waymaker.streams.PendingDeliveryPb + 86, // 39: waymaker.streams.ReplicateConsumerStateRequest.snapshot:type_name -> waymaker.streams.ConsumerStateSnapshot + 89, // 40: waymaker.streams.ReplicateSourceTailStateRequest.snapshot:type_name -> waymaker.streams.SourceTailStateSnapshot + 7, // 41: waymaker.streams.ReplicateStreamCreateRequest.config:type_name -> waymaker.streams.StreamConfigPb + 11, // 42: waymaker.streams.ReplicateMessageRequest.headers:type_name -> waymaker.streams.MessageHeader + 11, // 43: waymaker.streams.ObjectInfo.headers:type_name -> waymaker.streams.MessageHeader + 11, // 44: waymaker.streams.PutObjectRequest.headers:type_name -> waymaker.streams.MessageHeader + 104, // 45: waymaker.streams.PutObjectResponse.info:type_name -> waymaker.streams.ObjectInfo + 108, // 46: waymaker.streams.PutObjectStreamFrame.start:type_name -> waymaker.streams.PutObjectStart + 11, // 47: waymaker.streams.PutObjectStart.headers:type_name -> waymaker.streams.MessageHeader + 104, // 48: waymaker.streams.GetObjectResponse.info:type_name -> waymaker.streams.ObjectInfo + 104, // 49: waymaker.streams.GetObjectStreamFrame.info:type_name -> waymaker.streams.ObjectInfo + 104, // 50: waymaker.streams.GetObjectInfoResponse.info:type_name -> waymaker.streams.ObjectInfo + 118, // 51: waymaker.streams.ListObjectsResponse.entries:type_name -> waymaker.streams.ObjectListEntry + 123, // 52: waymaker.streams.ListObjectRevisionsResponse.revisions:type_name -> waymaker.streams.ObjectRevisionEntry + 104, // 53: waymaker.streams.GetObjectRangeResponse.info:type_name -> waymaker.streams.ObjectInfo + 134, // 54: waymaker.streams.KvGetResponse.entry:type_name -> waymaker.streams.KvEntry + 139, // 55: waymaker.streams.KvKeysResponse.entries:type_name -> waymaker.streams.KvKeyEntry + 142, // 56: waymaker.streams.KvHistoryResponse.entries:type_name -> waymaker.streams.KvHistoryEntry + 146, // 57: waymaker.streams.KvWatchEvent.put:type_name -> waymaker.streams.KvPutEvent + 147, // 58: waymaker.streams.KvWatchEvent.delete:type_name -> waymaker.streams.KvDeleteEvent + 162, // 59: waymaker.streams.HashGetAllResponse.entries:type_name -> waymaker.streams.HashFieldEntry + 16, // 60: waymaker.streams.WaymakerStreamsService.CreateStream:input_type -> waymaker.streams.CreateStreamRequest + 18, // 61: waymaker.streams.WaymakerStreamsService.DeleteStream:input_type -> waymaker.streams.DeleteStreamRequest + 20, // 62: waymaker.streams.WaymakerStreamsService.GetStreamInfo:input_type -> waymaker.streams.GetStreamInfoRequest + 31, // 63: waymaker.streams.WaymakerStreamsService.ListStreams:input_type -> waymaker.streams.ListStreamsRequest + 33, // 64: waymaker.streams.WaymakerStreamsService.GetStreamSources:input_type -> waymaker.streams.GetStreamSourcesRequest + 36, // 65: waymaker.streams.WaymakerStreamsService.UpdateStream:input_type -> waymaker.streams.UpdateStreamRequest + 38, // 66: waymaker.streams.WaymakerStreamsService.Publish:input_type -> waymaker.streams.PublishRequest + 40, // 67: waymaker.streams.WaymakerStreamsService.Fetch:input_type -> waymaker.streams.FetchRequest + 42, // 68: waymaker.streams.WaymakerStreamsService.Ack:input_type -> waymaker.streams.AckRequest + 44, // 69: waymaker.streams.WaymakerStreamsService.Nak:input_type -> waymaker.streams.NakRequest + 46, // 70: waymaker.streams.WaymakerStreamsService.Term:input_type -> waymaker.streams.TermRequest + 48, // 71: waymaker.streams.WaymakerStreamsService.InProgress:input_type -> waymaker.streams.InProgressRequest + 50, // 72: waymaker.streams.WaymakerStreamsService.Subscribe:input_type -> waymaker.streams.SubscribeRequest + 53, // 73: waymaker.streams.WaymakerStreamsService.CreateConsumer:input_type -> waymaker.streams.CreateConsumerRequest + 55, // 74: waymaker.streams.WaymakerStreamsService.DeleteConsumer:input_type -> waymaker.streams.DeleteConsumerRequest + 57, // 75: waymaker.streams.WaymakerStreamsService.ListConsumers:input_type -> waymaker.streams.ListConsumersRequest + 59, // 76: waymaker.streams.WaymakerStreamsService.GetConsumerInfo:input_type -> waymaker.streams.GetConsumerInfoRequest + 61, // 77: waymaker.streams.WaymakerStreamsService.TransferStream:input_type -> waymaker.streams.TransferStreamRequest + 64, // 78: waymaker.streams.WaymakerStreamsService.MigrateStream:input_type -> waymaker.streams.MigrateStreamRequest + 66, // 79: waymaker.streams.WaymakerStreamsService.GetClusterStreamStats:input_type -> waymaker.streams.GetClusterStreamStatsRequest + 74, // 80: waymaker.streams.WaymakerStreamsService.WatchStreams:input_type -> waymaker.streams.WatchStreamsRequest + 78, // 81: waymaker.streams.WaymakerStreamsService.ReadLatestAtSubject:input_type -> waymaker.streams.ReadLatestAtSubjectRequest + 80, // 82: waymaker.streams.WaymakerStreamsService.ListSubjectsByPrefix:input_type -> waymaker.streams.ListSubjectsByPrefixRequest + 82, // 83: waymaker.streams.WaymakerStreamsService.ScanExactAtSubject:input_type -> waymaker.streams.ScanExactAtSubjectRequest + 24, // 84: waymaker.streams.WaymakerStreamsService.ClearStreamAuthority:input_type -> waymaker.streams.ClearStreamAuthorityRequest + 26, // 85: waymaker.streams.WaymakerStreamsService.ListStreamAuthorityOverrides:input_type -> waymaker.streams.ListStreamAuthorityOverridesRequest + 29, // 86: waymaker.streams.WaymakerStreamsService.SetStreamPinned:input_type -> waymaker.streams.SetStreamPinnedRequest + 105, // 87: waymaker.streams.WaymakerStreamsService.PutObject:input_type -> waymaker.streams.PutObjectRequest + 109, // 88: waymaker.streams.WaymakerStreamsService.GetObject:input_type -> waymaker.streams.GetObjectRequest + 112, // 89: waymaker.streams.WaymakerStreamsService.DeleteObject:input_type -> waymaker.streams.DeleteObjectRequest + 114, // 90: waymaker.streams.WaymakerStreamsService.GetObjectInfo:input_type -> waymaker.streams.GetObjectInfoRequest + 116, // 91: waymaker.streams.WaymakerStreamsService.ListObjects:input_type -> waymaker.streams.ListObjectsRequest + 107, // 92: waymaker.streams.WaymakerStreamsService.PutObjectStream:input_type -> waymaker.streams.PutObjectStreamFrame + 109, // 93: waymaker.streams.WaymakerStreamsService.GetObjectStream:input_type -> waymaker.streams.GetObjectRequest + 119, // 94: waymaker.streams.WaymakerStreamsService.ListObjectRevisions:input_type -> waymaker.streams.ListObjectRevisionsRequest + 121, // 95: waymaker.streams.WaymakerStreamsService.GetObjectRange:input_type -> waymaker.streams.GetObjectRangeRequest + 71, // 96: waymaker.streams.WaymakerStreamsService.RebalanceStreams:input_type -> waymaker.streams.RebalanceStreamsRequest + 87, // 97: waymaker.streams.WaymakerStreamsService.ReplicateConsumerState:input_type -> waymaker.streams.ReplicateConsumerStateRequest + 90, // 98: waymaker.streams.WaymakerStreamsService.ReplicateSourceTailState:input_type -> waymaker.streams.ReplicateSourceTailStateRequest + 92, // 99: waymaker.streams.WaymakerStreamsService.ReplicateStreamCreate:input_type -> waymaker.streams.ReplicateStreamCreateRequest + 94, // 100: waymaker.streams.WaymakerStreamsService.ReplicateMessage:input_type -> waymaker.streams.ReplicateMessageRequest + 96, // 101: waymaker.streams.WaymakerStreamsService.ReplicateStreamDelete:input_type -> waymaker.streams.ReplicateStreamDeleteRequest + 98, // 102: waymaker.streams.WaymakerStreamsService.ReplicateTruncate:input_type -> waymaker.streams.ReplicateTruncateRequest + 100, // 103: waymaker.streams.WaymakerStreamsService.ReplicateStreamUpdate:input_type -> waymaker.streams.ReplicateStreamUpdateRequest + 102, // 104: waymaker.streams.WaymakerStreamsService.ReplicateWorkQueueAck:input_type -> waymaker.streams.ReplicateWorkQueueAckRequest + 17, // 105: waymaker.streams.WaymakerStreamsService.CreateStream:output_type -> waymaker.streams.CreateStreamResponse + 19, // 106: waymaker.streams.WaymakerStreamsService.DeleteStream:output_type -> waymaker.streams.DeleteStreamResponse + 21, // 107: waymaker.streams.WaymakerStreamsService.GetStreamInfo:output_type -> waymaker.streams.GetStreamInfoResponse + 32, // 108: waymaker.streams.WaymakerStreamsService.ListStreams:output_type -> waymaker.streams.ListStreamsResponse + 34, // 109: waymaker.streams.WaymakerStreamsService.GetStreamSources:output_type -> waymaker.streams.GetStreamSourcesResponse + 37, // 110: waymaker.streams.WaymakerStreamsService.UpdateStream:output_type -> waymaker.streams.UpdateStreamResponse + 39, // 111: waymaker.streams.WaymakerStreamsService.Publish:output_type -> waymaker.streams.PublishResponse + 41, // 112: waymaker.streams.WaymakerStreamsService.Fetch:output_type -> waymaker.streams.FetchResponse + 43, // 113: waymaker.streams.WaymakerStreamsService.Ack:output_type -> waymaker.streams.AckResponse + 45, // 114: waymaker.streams.WaymakerStreamsService.Nak:output_type -> waymaker.streams.NakResponse + 47, // 115: waymaker.streams.WaymakerStreamsService.Term:output_type -> waymaker.streams.TermResponse + 49, // 116: waymaker.streams.WaymakerStreamsService.InProgress:output_type -> waymaker.streams.InProgressResponse + 51, // 117: waymaker.streams.WaymakerStreamsService.Subscribe:output_type -> waymaker.streams.SubscribeEvent + 54, // 118: waymaker.streams.WaymakerStreamsService.CreateConsumer:output_type -> waymaker.streams.CreateConsumerResponse + 56, // 119: waymaker.streams.WaymakerStreamsService.DeleteConsumer:output_type -> waymaker.streams.DeleteConsumerResponse + 58, // 120: waymaker.streams.WaymakerStreamsService.ListConsumers:output_type -> waymaker.streams.ListConsumersResponse + 60, // 121: waymaker.streams.WaymakerStreamsService.GetConsumerInfo:output_type -> waymaker.streams.GetConsumerInfoResponse + 62, // 122: waymaker.streams.WaymakerStreamsService.TransferStream:output_type -> waymaker.streams.TransferStreamChunk + 65, // 123: waymaker.streams.WaymakerStreamsService.MigrateStream:output_type -> waymaker.streams.MigrateStreamResponse + 69, // 124: waymaker.streams.WaymakerStreamsService.GetClusterStreamStats:output_type -> waymaker.streams.GetClusterStreamStatsResponse + 84, // 125: waymaker.streams.WaymakerStreamsService.WatchStreams:output_type -> waymaker.streams.WatchEvent + 79, // 126: waymaker.streams.WaymakerStreamsService.ReadLatestAtSubject:output_type -> waymaker.streams.ReadLatestAtSubjectResponse + 81, // 127: waymaker.streams.WaymakerStreamsService.ListSubjectsByPrefix:output_type -> waymaker.streams.ListSubjectsByPrefixResponse + 83, // 128: waymaker.streams.WaymakerStreamsService.ScanExactAtSubject:output_type -> waymaker.streams.ScanExactAtSubjectResponse + 25, // 129: waymaker.streams.WaymakerStreamsService.ClearStreamAuthority:output_type -> waymaker.streams.ClearStreamAuthorityResponse + 27, // 130: waymaker.streams.WaymakerStreamsService.ListStreamAuthorityOverrides:output_type -> waymaker.streams.ListStreamAuthorityOverridesResponse + 30, // 131: waymaker.streams.WaymakerStreamsService.SetStreamPinned:output_type -> waymaker.streams.SetStreamPinnedResponse + 106, // 132: waymaker.streams.WaymakerStreamsService.PutObject:output_type -> waymaker.streams.PutObjectResponse + 110, // 133: waymaker.streams.WaymakerStreamsService.GetObject:output_type -> waymaker.streams.GetObjectResponse + 113, // 134: waymaker.streams.WaymakerStreamsService.DeleteObject:output_type -> waymaker.streams.DeleteObjectResponse + 115, // 135: waymaker.streams.WaymakerStreamsService.GetObjectInfo:output_type -> waymaker.streams.GetObjectInfoResponse + 117, // 136: waymaker.streams.WaymakerStreamsService.ListObjects:output_type -> waymaker.streams.ListObjectsResponse + 106, // 137: waymaker.streams.WaymakerStreamsService.PutObjectStream:output_type -> waymaker.streams.PutObjectResponse + 111, // 138: waymaker.streams.WaymakerStreamsService.GetObjectStream:output_type -> waymaker.streams.GetObjectStreamFrame + 120, // 139: waymaker.streams.WaymakerStreamsService.ListObjectRevisions:output_type -> waymaker.streams.ListObjectRevisionsResponse + 122, // 140: waymaker.streams.WaymakerStreamsService.GetObjectRange:output_type -> waymaker.streams.GetObjectRangeResponse + 73, // 141: waymaker.streams.WaymakerStreamsService.RebalanceStreams:output_type -> waymaker.streams.RebalanceStreamsResponse + 88, // 142: waymaker.streams.WaymakerStreamsService.ReplicateConsumerState:output_type -> waymaker.streams.ReplicateConsumerStateResponse + 91, // 143: waymaker.streams.WaymakerStreamsService.ReplicateSourceTailState:output_type -> waymaker.streams.ReplicateSourceTailStateResponse + 93, // 144: waymaker.streams.WaymakerStreamsService.ReplicateStreamCreate:output_type -> waymaker.streams.ReplicateStreamCreateResponse + 95, // 145: waymaker.streams.WaymakerStreamsService.ReplicateMessage:output_type -> waymaker.streams.ReplicateMessageResponse + 97, // 146: waymaker.streams.WaymakerStreamsService.ReplicateStreamDelete:output_type -> waymaker.streams.ReplicateStreamDeleteResponse + 99, // 147: waymaker.streams.WaymakerStreamsService.ReplicateTruncate:output_type -> waymaker.streams.ReplicateTruncateResponse + 101, // 148: waymaker.streams.WaymakerStreamsService.ReplicateStreamUpdate:output_type -> waymaker.streams.ReplicateStreamUpdateResponse + 103, // 149: waymaker.streams.WaymakerStreamsService.ReplicateWorkQueueAck:output_type -> waymaker.streams.ReplicateWorkQueueAckResponse + 105, // [105:150] is the sub-list for method output_type + 60, // [60:105] is the sub-list for method input_type + 60, // [60:60] is the sub-list for extension type_name + 60, // [60:60] is the sub-list for extension extendee + 0, // [0:60] is the sub-list for field type_name +} + +func init() { file_waymaker_streams_proto_init() } +func file_waymaker_streams_proto_init() { + if File_waymaker_streams_proto != nil { + return + } + file_waymaker_streams_proto_msgTypes[0].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[3].OneofWrappers = []any{ + (*Retention_Limits)(nil), + (*Retention_WorkQueue)(nil), + (*Retention_Interest)(nil), + } + file_waymaker_streams_proto_msgTypes[18].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[33].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[35].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[48].OneofWrappers = []any{ + (*SubscribeEvent_Message)(nil), + (*SubscribeEvent_Stopped)(nil), + } + file_waymaker_streams_proto_msgTypes[59].OneofWrappers = []any{ + (*TransferStreamChunk_Data)(nil), + (*TransferStreamChunk_Summary)(nil), + } + file_waymaker_streams_proto_msgTypes[76].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[81].OneofWrappers = []any{ + (*WatchEvent_Stream)(nil), + (*WatchEvent_Consumer)(nil), + (*WatchEvent_Authority)(nil), + } + file_waymaker_streams_proto_msgTypes[97].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[104].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[108].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[112].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[130].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[142].OneofWrappers = []any{ + (*KvWatchEvent_Put)(nil), + (*KvWatchEvent_Delete)(nil), + } + file_waymaker_streams_proto_msgTypes[152].OneofWrappers = []any{} + file_waymaker_streams_proto_msgTypes[185].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_waymaker_streams_proto_rawDesc), len(file_waymaker_streams_proto_rawDesc)), + NumEnums: 3, + NumMessages: 190, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_waymaker_streams_proto_goTypes, + DependencyIndexes: file_waymaker_streams_proto_depIdxs, + EnumInfos: file_waymaker_streams_proto_enumTypes, + MessageInfos: file_waymaker_streams_proto_msgTypes, + }.Build() + File_waymaker_streams_proto = out.File + file_waymaker_streams_proto_goTypes = nil + file_waymaker_streams_proto_depIdxs = nil +} diff --git a/go/genpb/streams/waymaker_streams_grpc.pb.go b/go/genpb/streams/waymaker_streams_grpc.pb.go new file mode 100644 index 0000000..7c16386 --- /dev/null +++ b/go/genpb/streams/waymaker_streams_grpc.pb.go @@ -0,0 +1,2180 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.34.1 +// source: waymaker_streams.proto + +package waymaker_streams + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + WaymakerStreamsService_CreateStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/CreateStream" + WaymakerStreamsService_DeleteStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/DeleteStream" + WaymakerStreamsService_GetStreamInfo_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetStreamInfo" + WaymakerStreamsService_ListStreams_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListStreams" + WaymakerStreamsService_GetStreamSources_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetStreamSources" + WaymakerStreamsService_UpdateStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/UpdateStream" + WaymakerStreamsService_Publish_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Publish" + WaymakerStreamsService_Fetch_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Fetch" + WaymakerStreamsService_Ack_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Ack" + WaymakerStreamsService_Nak_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Nak" + WaymakerStreamsService_Term_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Term" + WaymakerStreamsService_InProgress_FullMethodName = "/waymaker.streams.WaymakerStreamsService/InProgress" + WaymakerStreamsService_Subscribe_FullMethodName = "/waymaker.streams.WaymakerStreamsService/Subscribe" + WaymakerStreamsService_CreateConsumer_FullMethodName = "/waymaker.streams.WaymakerStreamsService/CreateConsumer" + WaymakerStreamsService_DeleteConsumer_FullMethodName = "/waymaker.streams.WaymakerStreamsService/DeleteConsumer" + WaymakerStreamsService_ListConsumers_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListConsumers" + WaymakerStreamsService_GetConsumerInfo_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetConsumerInfo" + WaymakerStreamsService_TransferStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/TransferStream" + WaymakerStreamsService_MigrateStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/MigrateStream" + WaymakerStreamsService_GetClusterStreamStats_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetClusterStreamStats" + WaymakerStreamsService_WatchStreams_FullMethodName = "/waymaker.streams.WaymakerStreamsService/WatchStreams" + WaymakerStreamsService_ReadLatestAtSubject_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReadLatestAtSubject" + WaymakerStreamsService_ListSubjectsByPrefix_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListSubjectsByPrefix" + WaymakerStreamsService_ScanExactAtSubject_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ScanExactAtSubject" + WaymakerStreamsService_ClearStreamAuthority_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ClearStreamAuthority" + WaymakerStreamsService_ListStreamAuthorityOverrides_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListStreamAuthorityOverrides" + WaymakerStreamsService_SetStreamPinned_FullMethodName = "/waymaker.streams.WaymakerStreamsService/SetStreamPinned" + WaymakerStreamsService_PutObject_FullMethodName = "/waymaker.streams.WaymakerStreamsService/PutObject" + WaymakerStreamsService_GetObject_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetObject" + WaymakerStreamsService_DeleteObject_FullMethodName = "/waymaker.streams.WaymakerStreamsService/DeleteObject" + WaymakerStreamsService_GetObjectInfo_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetObjectInfo" + WaymakerStreamsService_ListObjects_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListObjects" + WaymakerStreamsService_PutObjectStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/PutObjectStream" + WaymakerStreamsService_GetObjectStream_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetObjectStream" + WaymakerStreamsService_ListObjectRevisions_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ListObjectRevisions" + WaymakerStreamsService_GetObjectRange_FullMethodName = "/waymaker.streams.WaymakerStreamsService/GetObjectRange" + WaymakerStreamsService_RebalanceStreams_FullMethodName = "/waymaker.streams.WaymakerStreamsService/RebalanceStreams" + WaymakerStreamsService_ReplicateConsumerState_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateConsumerState" + WaymakerStreamsService_ReplicateSourceTailState_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateSourceTailState" + WaymakerStreamsService_ReplicateStreamCreate_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateStreamCreate" + WaymakerStreamsService_ReplicateMessage_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateMessage" + WaymakerStreamsService_ReplicateStreamDelete_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateStreamDelete" + WaymakerStreamsService_ReplicateTruncate_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateTruncate" + WaymakerStreamsService_ReplicateStreamUpdate_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateStreamUpdate" + WaymakerStreamsService_ReplicateWorkQueueAck_FullMethodName = "/waymaker.streams.WaymakerStreamsService/ReplicateWorkQueueAck" +) + +// WaymakerStreamsServiceClient is the client API for WaymakerStreamsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type WaymakerStreamsServiceClient interface { + // --- Stream lifecycle --- + CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error) + DeleteStream(ctx context.Context, in *DeleteStreamRequest, opts ...grpc.CallOption) (*DeleteStreamResponse, error) + GetStreamInfo(ctx context.Context, in *GetStreamInfoRequest, opts ...grpc.CallOption) (*GetStreamInfoResponse, error) + ListStreams(ctx context.Context, in *ListStreamsRequest, opts ...grpc.CallOption) (*ListStreamsResponse, error) + // Slice 3 cross-stream sources admin: enumerate every + // (sourcing, source) tail running on this node, with current + // last_sourced_seq + pulled_total + last_error. Useful for + // operators auditing the cluster's source topology without + // ListStreams + GetStreamInfo per stream. + GetStreamSources(ctx context.Context, in *GetStreamSourcesRequest, opts ...grpc.CallOption) (*GetStreamSourcesResponse, error) + // Update the *mutable* subset of a stream's config — the Limits + // retention bounds (max_age_ms / max_msgs / max_bytes), the per- + // message size cap, and the strict-limits toggle. Immutable fields + // (name, subjects_filter, block_size, retention policy type) are + // not touched. Lowering a bound triggers an immediate prune to + // bring stats under the new limit; the primary fans the resulting + // truncation out via `ReplicateTruncate` so secondaries mirror. + // Partial-update semantics: only fields explicitly set in the + // request are applied; unset fields leave the on-disk value + // unchanged. + UpdateStream(ctx context.Context, in *UpdateStreamRequest, opts ...grpc.CallOption) (*UpdateStreamResponse, error) + // --- Messages --- + Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) + Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) + Ack(ctx context.Context, in *AckRequest, opts ...grpc.CallOption) (*AckResponse, error) + // Negative-acknowledge: server resets the pending entry's + // delivered_at_ms so the next fetch redelivers. `delay_ms` defers + // eligibility by that wall-clock window (0 = immediate). The + // message's `deliver_count` keeps climbing toward `max_deliver`. + Nak(ctx context.Context, in *NakRequest, opts ...grpc.CallOption) (*NakResponse, error) + // Terminal-acknowledge: drop the pending entry permanently + // without redelivery, regardless of `max_deliver`. Does NOT + // trigger WorkQueue delete — other consumers can still observe + // the message. + Term(ctx context.Context, in *TermRequest, opts ...grpc.CallOption) (*TermResponse, error) + // Heartbeat-acknowledge: bump delivered_at_ms = now to extend + // the ack_wait window. `deliver_count` is unchanged. + InProgress(ctx context.Context, in *InProgressRequest, opts ...grpc.CallOption) (*InProgressResponse, error) + // Push-mode delivery: the server fetches in a loop and streams + // each delivered message back to the client as it arrives. The + // client acks via the unary Ack RPC just like pull-mode. The + // stream stays open until the client disconnects, the server + // returns an error, or the consumer is deleted. Wakes + // immediately on new appends via the storage layer's subscribe + // primitive — no polling for empty streams. + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeEvent], error) + // --- Consumers --- + CreateConsumer(ctx context.Context, in *CreateConsumerRequest, opts ...grpc.CallOption) (*CreateConsumerResponse, error) + DeleteConsumer(ctx context.Context, in *DeleteConsumerRequest, opts ...grpc.CallOption) (*DeleteConsumerResponse, error) + ListConsumers(ctx context.Context, in *ListConsumersRequest, opts ...grpc.CallOption) (*ListConsumersResponse, error) + GetConsumerInfo(ctx context.Context, in *GetConsumerInfoRequest, opts ...grpc.CallOption) (*GetConsumerInfoResponse, error) + // --- Rebalancing (Phase 1: operator-driven only) --- + // + // The current owner of a stream serves its raw redb bytes to a peer + // that's pulling the stream over. The handler atomically removes the + // stream from its local registry first, refusing the call if any + // outside reference is still live (operator must drain writers). On + // RPC success the source deletes the local file. See + // STREAMS_SPEC.md §11 for the model and limitations (no automatic + // ring-change sweep yet; the operator is responsible for triggering + // a migrate when membership moves a stream's authority). + TransferStream(ctx context.Context, in *TransferStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TransferStreamChunk], error) + // Admin trigger on the receiving side: pull stream `name` from + // `source_node_id`'s `TransferStream` and own it locally. + MigrateStream(ctx context.Context, in *MigrateStreamRequest, opts ...grpc.CallOption) (*MigrateStreamResponse, error) + // Cluster-wide stream inventory + skew report. The receiving node + // queries every cluster member's local `StreamsRegistry` (via the + // existing proxy channel pool) and aggregates the result. Used by + // operators to identify hash-skew imbalance before triggering + // `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + GetClusterStreamStats(ctx context.Context, in *GetClusterStreamStatsRequest, opts ...grpc.CallOption) (*GetClusterStreamStatsResponse, error) + // Server-streamed admin watch — emits a WatchEvent each time the + // local node's state mutates (stream / consumer create / delete / + // update). Useful for live dashboards or service-discovery + // clients that want to react to topology changes without + // polling. Local-only for now: each watcher sees events generated + // on the node it connected to. Cluster-wide watch can be built + // on top via a fan-out client; the server doesn't fan out + // automatically because the events would arrive out of any + // single-source ordering anyway under proxy hops. + WatchStreams(ctx context.Context, in *WatchStreamsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchEvent], error) + // Read the latest message at a given subject within a stream. + // The foundation for KV-style "last-value wins" lookups on top + // of a stream — KV put = Publish to `.`; KV get = + // this RPC against the same subject. Returns the full + // MessagePb (including headers) so callers can detect KV + // tombstones (`wmkv.tombstone` header). + // + // Returns `success: true` with `message` unset when no message + // has ever been published at this subject (or all have been + // pruned). Routes via `try_route!` like every other per-stream + // RPC. + ReadLatestAtSubject(ctx context.Context, in *ReadLatestAtSubjectRequest, opts ...grpc.CallOption) (*ReadLatestAtSubjectResponse, error) + // List every distinct subject in `stream` whose name starts + // with `prefix`. Cost is O(matching subjects); independent of + // message count. The foundation for `streams-cli kv-keys` and + // service-discovery-style "everything under this namespace" + // lookups. Returns subjects whose latest message is a + // tombstone too — clients that want live-keys-only filter + // tombstones via a follow-up `ReadLatestAtSubject`. + ListSubjectsByPrefix(ctx context.Context, in *ListSubjectsByPrefixRequest, opts ...grpc.CallOption) (*ListSubjectsByPrefixResponse, error) + // Scan all messages published at an exact subject within + // `stream`, in seq order, starting at `from_seq` (0 = from the + // beginning), bounded by `limit`. The foundation for + // `streams-cli kv-history` — operators want to inspect every + // value ever published under a KV key (including tombstones) + // for debugging/audit. Cost is O(matching messages); independent + // of total stream size. Routes via `try_route!` like every + // other per-stream RPC. + ScanExactAtSubject(ctx context.Context, in *ScanExactAtSubjectRequest, opts ...grpc.CallOption) (*ScanExactAtSubjectResponse, error) + // Remove a Phase 3 per-stream authority override. Routing + // reverts to the ring's hash owner. Idempotent: clearing a + // stream with no override succeeds silently. Operators use this + // to retire a stale override (e.g. after a ring shift made the + // override redundant). Commits via a Raft entry so the clear + // applies on every node before the response returns. + ClearStreamAuthority(ctx context.Context, in *ClearStreamAuthorityRequest, opts ...grpc.CallOption) (*ClearStreamAuthorityResponse, error) + // List every Phase 3 stream_authority override active on the + // responding node. The map is Raft-replicated, so any node's + // response reflects the cluster-wide view (modulo apply lag). + // Useful for ops triage when an unexpected number of overrides + // shows up on /metrics. No fan-out — single-node RPC; the + // returned set is the canonical truth. + ListStreamAuthorityOverrides(ctx context.Context, in *ListStreamAuthorityOverridesRequest, opts ...grpc.CallOption) (*ListStreamAuthorityOverridesResponse, error) + // Toggle pinned state for `stream`. Pinned streams are exempt + // from the auto-GC sweep that retires redundant overrides — use + // when you want a stream to stay on its current authority node + // even if the ring shifts to make the override redundant. + // Idempotent. Independent of the override itself (pinning a + // stream with no override is benign; the marker sits dormant). + SetStreamPinned(ctx context.Context, in *SetStreamPinnedRequest, opts ...grpc.CallOption) (*SetStreamPinnedResponse, error) + PutObject(ctx context.Context, in *PutObjectRequest, opts ...grpc.CallOption) (*PutObjectResponse, error) + GetObject(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (*GetObjectResponse, error) + DeleteObject(ctx context.Context, in *DeleteObjectRequest, opts ...grpc.CallOption) (*DeleteObjectResponse, error) + GetObjectInfo(ctx context.Context, in *GetObjectInfoRequest, opts ...grpc.CallOption) (*GetObjectInfoResponse, error) + ListObjects(ctx context.Context, in *ListObjectsRequest, opts ...grpc.CallOption) (*ListObjectsResponse, error) + // Client-streamed PutObject for arbitrary-size objects. First + // frame MUST set `start { bucket, name, chunk_size, headers, + // sha256 }`. Subsequent frames carry `data` only — each frame's + // `data` is ONE chunk message at `objc..`. The server + // accumulates a running SHA-256 and total-byte count, publishes + // chunks as they arrive (replication fires async), and on the + // last frame (`finish=true`) publishes the metadata. A client + // disconnect before `finish=true` leaves orphan chunks; the GC + // sweep cleans them up. + PutObjectStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PutObjectStreamFrame, PutObjectResponse], error) + // Server-streamed GetObject. First frame carries `info`; + // subsequent frames carry `data` only — one per chunk. Last + // frame sets `done=true`. The client reassembles; the response + // is sent over the wire in chunk-sized pieces so memory usage + // stays bounded on both sides. + GetObjectStream(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetObjectStreamFrame], error) + // Every revision of `name`'s metadata in seq order — covers + // overwrites + tombstones. Returns one entry per metadata + // message at `objm.`. Chunks are not enumerated; this RPC + // is for object versioning / audit, not for binary diffing. + ListObjectRevisions(ctx context.Context, in *ListObjectRevisionsRequest, opts ...grpc.CallOption) (*ListObjectRevisionsResponse, error) + // Read a byte range `[offset, offset + len)` from an object's + // assembled payload. Only the chunks that intersect the range + // are loaded server-side — useful for resumable downloads of + // large objects. + // - `offset + len > total_bytes` → returns whatever bytes exist + // in the range (success, possibly empty). + // - `offset > total_bytes` → returns empty payload (success). + // - `len == 0` → returns empty payload (success). + GetObjectRange(ctx context.Context, in *GetObjectRangeRequest, opts ...grpc.CallOption) (*GetObjectRangeResponse, error) + // Operator-driven rebalance. Takes an explicit plan — a list of + // (stream, target_node) — and executes each step by issuing a + // `MigrateStream` to the target. The plan is *not* auto-generated; + // the operator (or a future automatic planner) is responsible for + // building it from a `GetClusterStreamStats` snapshot. Steps run + // sequentially with a per-step timeout; the response carries + // per-step outcomes so partial success is visible. + RebalanceStreams(ctx context.Context, in *RebalanceStreamsRequest, opts ...grpc.CallOption) (*RebalanceStreamsResponse, error) + // --- Consumer-state replication (Phase 2 §G) --- + // + // The primary for a stream pushes its consumers' full state to the + // stream's `replication_factor - 1` secondaries after every + // state-mutating consumer operation (create_consumer, fetch, ack, + // delete_consumer). The push is fire-and-forget on the primary's + // side — the client RPC has already returned to the caller; the + // replication runs in a background task. Secondaries hold the + // snapshot in memory; adoption-on-failover is a future slice. + ReplicateConsumerState(ctx context.Context, in *ReplicateConsumerStateRequest, opts ...grpc.CallOption) (*ReplicateConsumerStateResponse, error) + // --- Cross-stream sources state replication (slice 2E) --- + // + // The primary for a sourcing stream pushes the current per-source + // tail watermark to each secondary after every successful batch + // (i.e. once per ~128 source messages). Secondaries persist the + // snapshot via their own SourceTailStore so that on adoption (ring + // shift → secondary becomes primary), `spawn_source_tail_tasks` + // reads the replicated state and resumes from `last_sourced_seq + 1` + // instead of re-pulling from `start_seq` (which would emit + // duplicates with already-replicated provenance headers). + ReplicateSourceTailState(ctx context.Context, in *ReplicateSourceTailStateRequest, opts ...grpc.CallOption) (*ReplicateSourceTailStateResponse, error) + // --- Stream-data replication (Phase 3, chunk 1) --- + // + // The primary for a stream pushes: + // 1. ReplicateStreamCreate once at create time, so secondaries + // know what stream to open in their replica registry with + // what config (block_size, retention, max_msg_bytes, etc.). + // 2. ReplicateMessage on every successful Publish, with the + // seq the primary assigned, so the secondary's replica + // mirrors the message log by seq exactly. + // + // Replica streams live in a per-node "replica registry" rooted at + // `/replicas/.redb`, distinct from the + // primary-owned namespace. The streams handler never serves + // client requests from the replica — it's purely catastrophe + // recovery state until the (future) adoption-on-failover slice + // promotes a replica to primary. + ReplicateStreamCreate(ctx context.Context, in *ReplicateStreamCreateRequest, opts ...grpc.CallOption) (*ReplicateStreamCreateResponse, error) + ReplicateMessage(ctx context.Context, in *ReplicateMessageRequest, opts ...grpc.CallOption) (*ReplicateMessageResponse, error) + // Tear down the replica when the primary deletes the stream. + // Idempotent — missing replica is success. + ReplicateStreamDelete(ctx context.Context, in *ReplicateStreamDeleteRequest, opts ...grpc.CallOption) (*ReplicateStreamDeleteResponse, error) + // The primary's retention sweep removed messages below + // `first_seq`; the secondary mirrors the same truncation so its + // replica's first_seq advances in lockstep. Idempotent. + ReplicateTruncate(ctx context.Context, in *ReplicateTruncateRequest, opts ...grpc.CallOption) (*ReplicateTruncateResponse, error) + // The primary applied an UpdateStream; secondaries mirror the + // mutable subset of the config so a future failover lands on a + // replica whose retention matches the primary's. Carries the same + // narrow shape as UpdateStreamRequest — only the mutable fields, + // with partial-update semantics. + ReplicateStreamUpdate(ctx context.Context, in *ReplicateStreamUpdateRequest, opts ...grpc.CallOption) (*ReplicateStreamUpdateResponse, error) + // Under `RetentionPolicy::WorkQueue` the primary deletes a message + // on ack (delete-on-first-ack). Without this fan-out, secondaries' + // replica files would still hold the acked message — and after a + // failover, a fresh consumer on the new primary would see it and + // re-deliver, breaking the "each message belongs to exactly one + // consumer at a time" invariant. Idempotent: missing seq on + // secondary is success. + ReplicateWorkQueueAck(ctx context.Context, in *ReplicateWorkQueueAckRequest, opts ...grpc.CallOption) (*ReplicateWorkQueueAckResponse, error) +} + +type waymakerStreamsServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewWaymakerStreamsServiceClient(cc grpc.ClientConnInterface) WaymakerStreamsServiceClient { + return &waymakerStreamsServiceClient{cc} +} + +func (c *waymakerStreamsServiceClient) CreateStream(ctx context.Context, in *CreateStreamRequest, opts ...grpc.CallOption) (*CreateStreamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateStreamResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_CreateStream_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) DeleteStream(ctx context.Context, in *DeleteStreamRequest, opts ...grpc.CallOption) (*DeleteStreamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteStreamResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_DeleteStream_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetStreamInfo(ctx context.Context, in *GetStreamInfoRequest, opts ...grpc.CallOption) (*GetStreamInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetStreamInfoResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetStreamInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ListStreams(ctx context.Context, in *ListStreamsRequest, opts ...grpc.CallOption) (*ListStreamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListStreamsResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListStreams_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetStreamSources(ctx context.Context, in *GetStreamSourcesRequest, opts ...grpc.CallOption) (*GetStreamSourcesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetStreamSourcesResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetStreamSources_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) UpdateStream(ctx context.Context, in *UpdateStreamRequest, opts ...grpc.CallOption) (*UpdateStreamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UpdateStreamResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_UpdateStream_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PublishResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_Publish_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(FetchResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_Fetch_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Ack(ctx context.Context, in *AckRequest, opts ...grpc.CallOption) (*AckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AckResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_Ack_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Nak(ctx context.Context, in *NakRequest, opts ...grpc.CallOption) (*NakResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(NakResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_Nak_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Term(ctx context.Context, in *TermRequest, opts ...grpc.CallOption) (*TermResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(TermResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_Term_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) InProgress(ctx context.Context, in *InProgressRequest, opts ...grpc.CallOption) (*InProgressResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(InProgressResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_InProgress_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SubscribeEvent], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerStreamsService_ServiceDesc.Streams[0], WaymakerStreamsService_Subscribe_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[SubscribeRequest, SubscribeEvent]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_SubscribeClient = grpc.ServerStreamingClient[SubscribeEvent] + +func (c *waymakerStreamsServiceClient) CreateConsumer(ctx context.Context, in *CreateConsumerRequest, opts ...grpc.CallOption) (*CreateConsumerResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateConsumerResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_CreateConsumer_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) DeleteConsumer(ctx context.Context, in *DeleteConsumerRequest, opts ...grpc.CallOption) (*DeleteConsumerResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteConsumerResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_DeleteConsumer_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ListConsumers(ctx context.Context, in *ListConsumersRequest, opts ...grpc.CallOption) (*ListConsumersResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListConsumersResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListConsumers_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetConsumerInfo(ctx context.Context, in *GetConsumerInfoRequest, opts ...grpc.CallOption) (*GetConsumerInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetConsumerInfoResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetConsumerInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) TransferStream(ctx context.Context, in *TransferStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[TransferStreamChunk], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerStreamsService_ServiceDesc.Streams[1], WaymakerStreamsService_TransferStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[TransferStreamRequest, TransferStreamChunk]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_TransferStreamClient = grpc.ServerStreamingClient[TransferStreamChunk] + +func (c *waymakerStreamsServiceClient) MigrateStream(ctx context.Context, in *MigrateStreamRequest, opts ...grpc.CallOption) (*MigrateStreamResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MigrateStreamResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_MigrateStream_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetClusterStreamStats(ctx context.Context, in *GetClusterStreamStatsRequest, opts ...grpc.CallOption) (*GetClusterStreamStatsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetClusterStreamStatsResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetClusterStreamStats_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) WatchStreams(ctx context.Context, in *WatchStreamsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchEvent], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerStreamsService_ServiceDesc.Streams[2], WaymakerStreamsService_WatchStreams_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[WatchStreamsRequest, WatchEvent]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_WatchStreamsClient = grpc.ServerStreamingClient[WatchEvent] + +func (c *waymakerStreamsServiceClient) ReadLatestAtSubject(ctx context.Context, in *ReadLatestAtSubjectRequest, opts ...grpc.CallOption) (*ReadLatestAtSubjectResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReadLatestAtSubjectResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReadLatestAtSubject_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ListSubjectsByPrefix(ctx context.Context, in *ListSubjectsByPrefixRequest, opts ...grpc.CallOption) (*ListSubjectsByPrefixResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListSubjectsByPrefixResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListSubjectsByPrefix_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ScanExactAtSubject(ctx context.Context, in *ScanExactAtSubjectRequest, opts ...grpc.CallOption) (*ScanExactAtSubjectResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ScanExactAtSubjectResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ScanExactAtSubject_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ClearStreamAuthority(ctx context.Context, in *ClearStreamAuthorityRequest, opts ...grpc.CallOption) (*ClearStreamAuthorityResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ClearStreamAuthorityResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ClearStreamAuthority_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ListStreamAuthorityOverrides(ctx context.Context, in *ListStreamAuthorityOverridesRequest, opts ...grpc.CallOption) (*ListStreamAuthorityOverridesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListStreamAuthorityOverridesResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListStreamAuthorityOverrides_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) SetStreamPinned(ctx context.Context, in *SetStreamPinnedRequest, opts ...grpc.CallOption) (*SetStreamPinnedResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SetStreamPinnedResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_SetStreamPinned_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) PutObject(ctx context.Context, in *PutObjectRequest, opts ...grpc.CallOption) (*PutObjectResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PutObjectResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_PutObject_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetObject(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (*GetObjectResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetObjectResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetObject_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) DeleteObject(ctx context.Context, in *DeleteObjectRequest, opts ...grpc.CallOption) (*DeleteObjectResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteObjectResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_DeleteObject_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetObjectInfo(ctx context.Context, in *GetObjectInfoRequest, opts ...grpc.CallOption) (*GetObjectInfoResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetObjectInfoResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetObjectInfo_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ListObjects(ctx context.Context, in *ListObjectsRequest, opts ...grpc.CallOption) (*ListObjectsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListObjectsResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListObjects_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) PutObjectStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[PutObjectStreamFrame, PutObjectResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerStreamsService_ServiceDesc.Streams[3], WaymakerStreamsService_PutObjectStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[PutObjectStreamFrame, PutObjectResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_PutObjectStreamClient = grpc.ClientStreamingClient[PutObjectStreamFrame, PutObjectResponse] + +func (c *waymakerStreamsServiceClient) GetObjectStream(ctx context.Context, in *GetObjectRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetObjectStreamFrame], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &WaymakerStreamsService_ServiceDesc.Streams[4], WaymakerStreamsService_GetObjectStream_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[GetObjectRequest, GetObjectStreamFrame]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_GetObjectStreamClient = grpc.ServerStreamingClient[GetObjectStreamFrame] + +func (c *waymakerStreamsServiceClient) ListObjectRevisions(ctx context.Context, in *ListObjectRevisionsRequest, opts ...grpc.CallOption) (*ListObjectRevisionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ListObjectRevisionsResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ListObjectRevisions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) GetObjectRange(ctx context.Context, in *GetObjectRangeRequest, opts ...grpc.CallOption) (*GetObjectRangeResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetObjectRangeResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_GetObjectRange_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) RebalanceStreams(ctx context.Context, in *RebalanceStreamsRequest, opts ...grpc.CallOption) (*RebalanceStreamsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RebalanceStreamsResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_RebalanceStreams_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateConsumerState(ctx context.Context, in *ReplicateConsumerStateRequest, opts ...grpc.CallOption) (*ReplicateConsumerStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateConsumerStateResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateConsumerState_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateSourceTailState(ctx context.Context, in *ReplicateSourceTailStateRequest, opts ...grpc.CallOption) (*ReplicateSourceTailStateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateSourceTailStateResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateSourceTailState_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateStreamCreate(ctx context.Context, in *ReplicateStreamCreateRequest, opts ...grpc.CallOption) (*ReplicateStreamCreateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateStreamCreateResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateStreamCreate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateMessage(ctx context.Context, in *ReplicateMessageRequest, opts ...grpc.CallOption) (*ReplicateMessageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateMessageResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateMessage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateStreamDelete(ctx context.Context, in *ReplicateStreamDeleteRequest, opts ...grpc.CallOption) (*ReplicateStreamDeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateStreamDeleteResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateStreamDelete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateTruncate(ctx context.Context, in *ReplicateTruncateRequest, opts ...grpc.CallOption) (*ReplicateTruncateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateTruncateResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateTruncate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateStreamUpdate(ctx context.Context, in *ReplicateStreamUpdateRequest, opts ...grpc.CallOption) (*ReplicateStreamUpdateResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateStreamUpdateResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateStreamUpdate_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *waymakerStreamsServiceClient) ReplicateWorkQueueAck(ctx context.Context, in *ReplicateWorkQueueAckRequest, opts ...grpc.CallOption) (*ReplicateWorkQueueAckResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReplicateWorkQueueAckResponse) + err := c.cc.Invoke(ctx, WaymakerStreamsService_ReplicateWorkQueueAck_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// WaymakerStreamsServiceServer is the server API for WaymakerStreamsService service. +// All implementations must embed UnimplementedWaymakerStreamsServiceServer +// for forward compatibility. +type WaymakerStreamsServiceServer interface { + // --- Stream lifecycle --- + CreateStream(context.Context, *CreateStreamRequest) (*CreateStreamResponse, error) + DeleteStream(context.Context, *DeleteStreamRequest) (*DeleteStreamResponse, error) + GetStreamInfo(context.Context, *GetStreamInfoRequest) (*GetStreamInfoResponse, error) + ListStreams(context.Context, *ListStreamsRequest) (*ListStreamsResponse, error) + // Slice 3 cross-stream sources admin: enumerate every + // (sourcing, source) tail running on this node, with current + // last_sourced_seq + pulled_total + last_error. Useful for + // operators auditing the cluster's source topology without + // ListStreams + GetStreamInfo per stream. + GetStreamSources(context.Context, *GetStreamSourcesRequest) (*GetStreamSourcesResponse, error) + // Update the *mutable* subset of a stream's config — the Limits + // retention bounds (max_age_ms / max_msgs / max_bytes), the per- + // message size cap, and the strict-limits toggle. Immutable fields + // (name, subjects_filter, block_size, retention policy type) are + // not touched. Lowering a bound triggers an immediate prune to + // bring stats under the new limit; the primary fans the resulting + // truncation out via `ReplicateTruncate` so secondaries mirror. + // Partial-update semantics: only fields explicitly set in the + // request are applied; unset fields leave the on-disk value + // unchanged. + UpdateStream(context.Context, *UpdateStreamRequest) (*UpdateStreamResponse, error) + // --- Messages --- + Publish(context.Context, *PublishRequest) (*PublishResponse, error) + Fetch(context.Context, *FetchRequest) (*FetchResponse, error) + Ack(context.Context, *AckRequest) (*AckResponse, error) + // Negative-acknowledge: server resets the pending entry's + // delivered_at_ms so the next fetch redelivers. `delay_ms` defers + // eligibility by that wall-clock window (0 = immediate). The + // message's `deliver_count` keeps climbing toward `max_deliver`. + Nak(context.Context, *NakRequest) (*NakResponse, error) + // Terminal-acknowledge: drop the pending entry permanently + // without redelivery, regardless of `max_deliver`. Does NOT + // trigger WorkQueue delete — other consumers can still observe + // the message. + Term(context.Context, *TermRequest) (*TermResponse, error) + // Heartbeat-acknowledge: bump delivered_at_ms = now to extend + // the ack_wait window. `deliver_count` is unchanged. + InProgress(context.Context, *InProgressRequest) (*InProgressResponse, error) + // Push-mode delivery: the server fetches in a loop and streams + // each delivered message back to the client as it arrives. The + // client acks via the unary Ack RPC just like pull-mode. The + // stream stays open until the client disconnects, the server + // returns an error, or the consumer is deleted. Wakes + // immediately on new appends via the storage layer's subscribe + // primitive — no polling for empty streams. + Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeEvent]) error + // --- Consumers --- + CreateConsumer(context.Context, *CreateConsumerRequest) (*CreateConsumerResponse, error) + DeleteConsumer(context.Context, *DeleteConsumerRequest) (*DeleteConsumerResponse, error) + ListConsumers(context.Context, *ListConsumersRequest) (*ListConsumersResponse, error) + GetConsumerInfo(context.Context, *GetConsumerInfoRequest) (*GetConsumerInfoResponse, error) + // --- Rebalancing (Phase 1: operator-driven only) --- + // + // The current owner of a stream serves its raw redb bytes to a peer + // that's pulling the stream over. The handler atomically removes the + // stream from its local registry first, refusing the call if any + // outside reference is still live (operator must drain writers). On + // RPC success the source deletes the local file. See + // STREAMS_SPEC.md §11 for the model and limitations (no automatic + // ring-change sweep yet; the operator is responsible for triggering + // a migrate when membership moves a stream's authority). + TransferStream(*TransferStreamRequest, grpc.ServerStreamingServer[TransferStreamChunk]) error + // Admin trigger on the receiving side: pull stream `name` from + // `source_node_id`'s `TransferStream` and own it locally. + MigrateStream(context.Context, *MigrateStreamRequest) (*MigrateStreamResponse, error) + // Cluster-wide stream inventory + skew report. The receiving node + // queries every cluster member's local `StreamsRegistry` (via the + // existing proxy channel pool) and aggregates the result. Used by + // operators to identify hash-skew imbalance before triggering + // `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + GetClusterStreamStats(context.Context, *GetClusterStreamStatsRequest) (*GetClusterStreamStatsResponse, error) + // Server-streamed admin watch — emits a WatchEvent each time the + // local node's state mutates (stream / consumer create / delete / + // update). Useful for live dashboards or service-discovery + // clients that want to react to topology changes without + // polling. Local-only for now: each watcher sees events generated + // on the node it connected to. Cluster-wide watch can be built + // on top via a fan-out client; the server doesn't fan out + // automatically because the events would arrive out of any + // single-source ordering anyway under proxy hops. + WatchStreams(*WatchStreamsRequest, grpc.ServerStreamingServer[WatchEvent]) error + // Read the latest message at a given subject within a stream. + // The foundation for KV-style "last-value wins" lookups on top + // of a stream — KV put = Publish to `.`; KV get = + // this RPC against the same subject. Returns the full + // MessagePb (including headers) so callers can detect KV + // tombstones (`wmkv.tombstone` header). + // + // Returns `success: true` with `message` unset when no message + // has ever been published at this subject (or all have been + // pruned). Routes via `try_route!` like every other per-stream + // RPC. + ReadLatestAtSubject(context.Context, *ReadLatestAtSubjectRequest) (*ReadLatestAtSubjectResponse, error) + // List every distinct subject in `stream` whose name starts + // with `prefix`. Cost is O(matching subjects); independent of + // message count. The foundation for `streams-cli kv-keys` and + // service-discovery-style "everything under this namespace" + // lookups. Returns subjects whose latest message is a + // tombstone too — clients that want live-keys-only filter + // tombstones via a follow-up `ReadLatestAtSubject`. + ListSubjectsByPrefix(context.Context, *ListSubjectsByPrefixRequest) (*ListSubjectsByPrefixResponse, error) + // Scan all messages published at an exact subject within + // `stream`, in seq order, starting at `from_seq` (0 = from the + // beginning), bounded by `limit`. The foundation for + // `streams-cli kv-history` — operators want to inspect every + // value ever published under a KV key (including tombstones) + // for debugging/audit. Cost is O(matching messages); independent + // of total stream size. Routes via `try_route!` like every + // other per-stream RPC. + ScanExactAtSubject(context.Context, *ScanExactAtSubjectRequest) (*ScanExactAtSubjectResponse, error) + // Remove a Phase 3 per-stream authority override. Routing + // reverts to the ring's hash owner. Idempotent: clearing a + // stream with no override succeeds silently. Operators use this + // to retire a stale override (e.g. after a ring shift made the + // override redundant). Commits via a Raft entry so the clear + // applies on every node before the response returns. + ClearStreamAuthority(context.Context, *ClearStreamAuthorityRequest) (*ClearStreamAuthorityResponse, error) + // List every Phase 3 stream_authority override active on the + // responding node. The map is Raft-replicated, so any node's + // response reflects the cluster-wide view (modulo apply lag). + // Useful for ops triage when an unexpected number of overrides + // shows up on /metrics. No fan-out — single-node RPC; the + // returned set is the canonical truth. + ListStreamAuthorityOverrides(context.Context, *ListStreamAuthorityOverridesRequest) (*ListStreamAuthorityOverridesResponse, error) + // Toggle pinned state for `stream`. Pinned streams are exempt + // from the auto-GC sweep that retires redundant overrides — use + // when you want a stream to stay on its current authority node + // even if the ring shifts to make the override redundant. + // Idempotent. Independent of the override itself (pinning a + // stream with no override is benign; the marker sits dormant). + SetStreamPinned(context.Context, *SetStreamPinnedRequest) (*SetStreamPinnedResponse, error) + PutObject(context.Context, *PutObjectRequest) (*PutObjectResponse, error) + GetObject(context.Context, *GetObjectRequest) (*GetObjectResponse, error) + DeleteObject(context.Context, *DeleteObjectRequest) (*DeleteObjectResponse, error) + GetObjectInfo(context.Context, *GetObjectInfoRequest) (*GetObjectInfoResponse, error) + ListObjects(context.Context, *ListObjectsRequest) (*ListObjectsResponse, error) + // Client-streamed PutObject for arbitrary-size objects. First + // frame MUST set `start { bucket, name, chunk_size, headers, + // sha256 }`. Subsequent frames carry `data` only — each frame's + // `data` is ONE chunk message at `objc..`. The server + // accumulates a running SHA-256 and total-byte count, publishes + // chunks as they arrive (replication fires async), and on the + // last frame (`finish=true`) publishes the metadata. A client + // disconnect before `finish=true` leaves orphan chunks; the GC + // sweep cleans them up. + PutObjectStream(grpc.ClientStreamingServer[PutObjectStreamFrame, PutObjectResponse]) error + // Server-streamed GetObject. First frame carries `info`; + // subsequent frames carry `data` only — one per chunk. Last + // frame sets `done=true`. The client reassembles; the response + // is sent over the wire in chunk-sized pieces so memory usage + // stays bounded on both sides. + GetObjectStream(*GetObjectRequest, grpc.ServerStreamingServer[GetObjectStreamFrame]) error + // Every revision of `name`'s metadata in seq order — covers + // overwrites + tombstones. Returns one entry per metadata + // message at `objm.`. Chunks are not enumerated; this RPC + // is for object versioning / audit, not for binary diffing. + ListObjectRevisions(context.Context, *ListObjectRevisionsRequest) (*ListObjectRevisionsResponse, error) + // Read a byte range `[offset, offset + len)` from an object's + // assembled payload. Only the chunks that intersect the range + // are loaded server-side — useful for resumable downloads of + // large objects. + // - `offset + len > total_bytes` → returns whatever bytes exist + // in the range (success, possibly empty). + // - `offset > total_bytes` → returns empty payload (success). + // - `len == 0` → returns empty payload (success). + GetObjectRange(context.Context, *GetObjectRangeRequest) (*GetObjectRangeResponse, error) + // Operator-driven rebalance. Takes an explicit plan — a list of + // (stream, target_node) — and executes each step by issuing a + // `MigrateStream` to the target. The plan is *not* auto-generated; + // the operator (or a future automatic planner) is responsible for + // building it from a `GetClusterStreamStats` snapshot. Steps run + // sequentially with a per-step timeout; the response carries + // per-step outcomes so partial success is visible. + RebalanceStreams(context.Context, *RebalanceStreamsRequest) (*RebalanceStreamsResponse, error) + // --- Consumer-state replication (Phase 2 §G) --- + // + // The primary for a stream pushes its consumers' full state to the + // stream's `replication_factor - 1` secondaries after every + // state-mutating consumer operation (create_consumer, fetch, ack, + // delete_consumer). The push is fire-and-forget on the primary's + // side — the client RPC has already returned to the caller; the + // replication runs in a background task. Secondaries hold the + // snapshot in memory; adoption-on-failover is a future slice. + ReplicateConsumerState(context.Context, *ReplicateConsumerStateRequest) (*ReplicateConsumerStateResponse, error) + // --- Cross-stream sources state replication (slice 2E) --- + // + // The primary for a sourcing stream pushes the current per-source + // tail watermark to each secondary after every successful batch + // (i.e. once per ~128 source messages). Secondaries persist the + // snapshot via their own SourceTailStore so that on adoption (ring + // shift → secondary becomes primary), `spawn_source_tail_tasks` + // reads the replicated state and resumes from `last_sourced_seq + 1` + // instead of re-pulling from `start_seq` (which would emit + // duplicates with already-replicated provenance headers). + ReplicateSourceTailState(context.Context, *ReplicateSourceTailStateRequest) (*ReplicateSourceTailStateResponse, error) + // --- Stream-data replication (Phase 3, chunk 1) --- + // + // The primary for a stream pushes: + // 1. ReplicateStreamCreate once at create time, so secondaries + // know what stream to open in their replica registry with + // what config (block_size, retention, max_msg_bytes, etc.). + // 2. ReplicateMessage on every successful Publish, with the + // seq the primary assigned, so the secondary's replica + // mirrors the message log by seq exactly. + // + // Replica streams live in a per-node "replica registry" rooted at + // `/replicas/.redb`, distinct from the + // primary-owned namespace. The streams handler never serves + // client requests from the replica — it's purely catastrophe + // recovery state until the (future) adoption-on-failover slice + // promotes a replica to primary. + ReplicateStreamCreate(context.Context, *ReplicateStreamCreateRequest) (*ReplicateStreamCreateResponse, error) + ReplicateMessage(context.Context, *ReplicateMessageRequest) (*ReplicateMessageResponse, error) + // Tear down the replica when the primary deletes the stream. + // Idempotent — missing replica is success. + ReplicateStreamDelete(context.Context, *ReplicateStreamDeleteRequest) (*ReplicateStreamDeleteResponse, error) + // The primary's retention sweep removed messages below + // `first_seq`; the secondary mirrors the same truncation so its + // replica's first_seq advances in lockstep. Idempotent. + ReplicateTruncate(context.Context, *ReplicateTruncateRequest) (*ReplicateTruncateResponse, error) + // The primary applied an UpdateStream; secondaries mirror the + // mutable subset of the config so a future failover lands on a + // replica whose retention matches the primary's. Carries the same + // narrow shape as UpdateStreamRequest — only the mutable fields, + // with partial-update semantics. + ReplicateStreamUpdate(context.Context, *ReplicateStreamUpdateRequest) (*ReplicateStreamUpdateResponse, error) + // Under `RetentionPolicy::WorkQueue` the primary deletes a message + // on ack (delete-on-first-ack). Without this fan-out, secondaries' + // replica files would still hold the acked message — and after a + // failover, a fresh consumer on the new primary would see it and + // re-deliver, breaking the "each message belongs to exactly one + // consumer at a time" invariant. Idempotent: missing seq on + // secondary is success. + ReplicateWorkQueueAck(context.Context, *ReplicateWorkQueueAckRequest) (*ReplicateWorkQueueAckResponse, error) + mustEmbedUnimplementedWaymakerStreamsServiceServer() +} + +// UnimplementedWaymakerStreamsServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedWaymakerStreamsServiceServer struct{} + +func (UnimplementedWaymakerStreamsServiceServer) CreateStream(context.Context, *CreateStreamRequest) (*CreateStreamResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) DeleteStream(context.Context, *DeleteStreamRequest) (*DeleteStreamResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetStreamInfo(context.Context, *GetStreamInfoRequest) (*GetStreamInfoResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetStreamInfo not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListStreams(context.Context, *ListStreamsRequest) (*ListStreamsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListStreams not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetStreamSources(context.Context, *GetStreamSourcesRequest) (*GetStreamSourcesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetStreamSources not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) UpdateStream(context.Context, *UpdateStreamRequest) (*UpdateStreamResponse, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Publish(context.Context, *PublishRequest) (*PublishResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Publish not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Fetch(context.Context, *FetchRequest) (*FetchResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Fetch not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Ack(context.Context, *AckRequest) (*AckResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Ack not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Nak(context.Context, *NakRequest) (*NakResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Nak not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Term(context.Context, *TermRequest) (*TermResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Term not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) InProgress(context.Context, *InProgressRequest) (*InProgressResponse, error) { + return nil, status.Error(codes.Unimplemented, "method InProgress not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[SubscribeEvent]) error { + return status.Error(codes.Unimplemented, "method Subscribe not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) CreateConsumer(context.Context, *CreateConsumerRequest) (*CreateConsumerResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateConsumer not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) DeleteConsumer(context.Context, *DeleteConsumerRequest) (*DeleteConsumerResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteConsumer not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListConsumers(context.Context, *ListConsumersRequest) (*ListConsumersResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListConsumers not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetConsumerInfo(context.Context, *GetConsumerInfoRequest) (*GetConsumerInfoResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetConsumerInfo not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) TransferStream(*TransferStreamRequest, grpc.ServerStreamingServer[TransferStreamChunk]) error { + return status.Error(codes.Unimplemented, "method TransferStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) MigrateStream(context.Context, *MigrateStreamRequest) (*MigrateStreamResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MigrateStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetClusterStreamStats(context.Context, *GetClusterStreamStatsRequest) (*GetClusterStreamStatsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetClusterStreamStats not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) WatchStreams(*WatchStreamsRequest, grpc.ServerStreamingServer[WatchEvent]) error { + return status.Error(codes.Unimplemented, "method WatchStreams not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReadLatestAtSubject(context.Context, *ReadLatestAtSubjectRequest) (*ReadLatestAtSubjectResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReadLatestAtSubject not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListSubjectsByPrefix(context.Context, *ListSubjectsByPrefixRequest) (*ListSubjectsByPrefixResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListSubjectsByPrefix not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ScanExactAtSubject(context.Context, *ScanExactAtSubjectRequest) (*ScanExactAtSubjectResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ScanExactAtSubject not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ClearStreamAuthority(context.Context, *ClearStreamAuthorityRequest) (*ClearStreamAuthorityResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ClearStreamAuthority not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListStreamAuthorityOverrides(context.Context, *ListStreamAuthorityOverridesRequest) (*ListStreamAuthorityOverridesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListStreamAuthorityOverrides not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) SetStreamPinned(context.Context, *SetStreamPinnedRequest) (*SetStreamPinnedResponse, error) { + return nil, status.Error(codes.Unimplemented, "method SetStreamPinned not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) PutObject(context.Context, *PutObjectRequest) (*PutObjectResponse, error) { + return nil, status.Error(codes.Unimplemented, "method PutObject not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetObject(context.Context, *GetObjectRequest) (*GetObjectResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetObject not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) DeleteObject(context.Context, *DeleteObjectRequest) (*DeleteObjectResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteObject not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetObjectInfo(context.Context, *GetObjectInfoRequest) (*GetObjectInfoResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetObjectInfo not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListObjects(context.Context, *ListObjectsRequest) (*ListObjectsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListObjects not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) PutObjectStream(grpc.ClientStreamingServer[PutObjectStreamFrame, PutObjectResponse]) error { + return status.Error(codes.Unimplemented, "method PutObjectStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetObjectStream(*GetObjectRequest, grpc.ServerStreamingServer[GetObjectStreamFrame]) error { + return status.Error(codes.Unimplemented, "method GetObjectStream not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ListObjectRevisions(context.Context, *ListObjectRevisionsRequest) (*ListObjectRevisionsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ListObjectRevisions not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) GetObjectRange(context.Context, *GetObjectRangeRequest) (*GetObjectRangeResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetObjectRange not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) RebalanceStreams(context.Context, *RebalanceStreamsRequest) (*RebalanceStreamsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RebalanceStreams not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateConsumerState(context.Context, *ReplicateConsumerStateRequest) (*ReplicateConsumerStateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateConsumerState not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateSourceTailState(context.Context, *ReplicateSourceTailStateRequest) (*ReplicateSourceTailStateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateSourceTailState not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateStreamCreate(context.Context, *ReplicateStreamCreateRequest) (*ReplicateStreamCreateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateStreamCreate not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateMessage(context.Context, *ReplicateMessageRequest) (*ReplicateMessageResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateMessage not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateStreamDelete(context.Context, *ReplicateStreamDeleteRequest) (*ReplicateStreamDeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateStreamDelete not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateTruncate(context.Context, *ReplicateTruncateRequest) (*ReplicateTruncateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateTruncate not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateStreamUpdate(context.Context, *ReplicateStreamUpdateRequest) (*ReplicateStreamUpdateResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateStreamUpdate not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) ReplicateWorkQueueAck(context.Context, *ReplicateWorkQueueAckRequest) (*ReplicateWorkQueueAckResponse, error) { + return nil, status.Error(codes.Unimplemented, "method ReplicateWorkQueueAck not implemented") +} +func (UnimplementedWaymakerStreamsServiceServer) mustEmbedUnimplementedWaymakerStreamsServiceServer() { +} +func (UnimplementedWaymakerStreamsServiceServer) testEmbeddedByValue() {} + +// UnsafeWaymakerStreamsServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to WaymakerStreamsServiceServer will +// result in compilation errors. +type UnsafeWaymakerStreamsServiceServer interface { + mustEmbedUnimplementedWaymakerStreamsServiceServer() +} + +func RegisterWaymakerStreamsServiceServer(s grpc.ServiceRegistrar, srv WaymakerStreamsServiceServer) { + // If the following call panics, it indicates UnimplementedWaymakerStreamsServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&WaymakerStreamsService_ServiceDesc, srv) +} + +func _WaymakerStreamsService_CreateStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateStreamRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).CreateStream(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_CreateStream_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).CreateStream(ctx, req.(*CreateStreamRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_DeleteStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteStreamRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).DeleteStream(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_DeleteStream_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).DeleteStream(ctx, req.(*DeleteStreamRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetStreamInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStreamInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetStreamInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetStreamInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetStreamInfo(ctx, req.(*GetStreamInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ListStreams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStreamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListStreams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListStreams_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListStreams(ctx, req.(*ListStreamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetStreamSources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetStreamSourcesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetStreamSources(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetStreamSources_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetStreamSources(ctx, req.(*GetStreamSourcesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_UpdateStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateStreamRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).UpdateStream(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_UpdateStream_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).UpdateStream(ctx, req.(*UpdateStreamRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Publish_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PublishRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).Publish(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_Publish_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).Publish(ctx, req.(*PublishRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FetchRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).Fetch(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_Fetch_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).Fetch(ctx, req.(*FetchRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Ack_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).Ack(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_Ack_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).Ack(ctx, req.(*AckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Nak_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NakRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).Nak(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_Nak_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).Nak(ctx, req.(*NakRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Term_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TermRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).Term(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_Term_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).Term(ctx, req.(*TermRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_InProgress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InProgressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).InProgress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_InProgress_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).InProgress(ctx, req.(*InProgressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerStreamsServiceServer).Subscribe(m, &grpc.GenericServerStream[SubscribeRequest, SubscribeEvent]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_SubscribeServer = grpc.ServerStreamingServer[SubscribeEvent] + +func _WaymakerStreamsService_CreateConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateConsumerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).CreateConsumer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_CreateConsumer_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).CreateConsumer(ctx, req.(*CreateConsumerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_DeleteConsumer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteConsumerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).DeleteConsumer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_DeleteConsumer_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).DeleteConsumer(ctx, req.(*DeleteConsumerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ListConsumers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListConsumersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListConsumers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListConsumers_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListConsumers(ctx, req.(*ListConsumersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetConsumerInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetConsumerInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetConsumerInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetConsumerInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetConsumerInfo(ctx, req.(*GetConsumerInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_TransferStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(TransferStreamRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerStreamsServiceServer).TransferStream(m, &grpc.GenericServerStream[TransferStreamRequest, TransferStreamChunk]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_TransferStreamServer = grpc.ServerStreamingServer[TransferStreamChunk] + +func _WaymakerStreamsService_MigrateStream_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MigrateStreamRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).MigrateStream(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_MigrateStream_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).MigrateStream(ctx, req.(*MigrateStreamRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetClusterStreamStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetClusterStreamStatsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetClusterStreamStats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetClusterStreamStats_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetClusterStreamStats(ctx, req.(*GetClusterStreamStatsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_WatchStreams_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(WatchStreamsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerStreamsServiceServer).WatchStreams(m, &grpc.GenericServerStream[WatchStreamsRequest, WatchEvent]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_WatchStreamsServer = grpc.ServerStreamingServer[WatchEvent] + +func _WaymakerStreamsService_ReadLatestAtSubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadLatestAtSubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReadLatestAtSubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReadLatestAtSubject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReadLatestAtSubject(ctx, req.(*ReadLatestAtSubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ListSubjectsByPrefix_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListSubjectsByPrefixRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListSubjectsByPrefix(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListSubjectsByPrefix_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListSubjectsByPrefix(ctx, req.(*ListSubjectsByPrefixRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ScanExactAtSubject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ScanExactAtSubjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ScanExactAtSubject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ScanExactAtSubject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ScanExactAtSubject(ctx, req.(*ScanExactAtSubjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ClearStreamAuthority_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearStreamAuthorityRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ClearStreamAuthority(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ClearStreamAuthority_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ClearStreamAuthority(ctx, req.(*ClearStreamAuthorityRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ListStreamAuthorityOverrides_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListStreamAuthorityOverridesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListStreamAuthorityOverrides(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListStreamAuthorityOverrides_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListStreamAuthorityOverrides(ctx, req.(*ListStreamAuthorityOverridesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_SetStreamPinned_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetStreamPinnedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).SetStreamPinned(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_SetStreamPinned_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).SetStreamPinned(ctx, req.(*SetStreamPinnedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_PutObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PutObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).PutObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_PutObject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).PutObject(ctx, req.(*PutObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetObject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetObject(ctx, req.(*GetObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_DeleteObject_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteObjectRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).DeleteObject(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_DeleteObject_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).DeleteObject(ctx, req.(*DeleteObjectRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetObjectInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetObjectInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetObjectInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetObjectInfo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetObjectInfo(ctx, req.(*GetObjectInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ListObjects_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListObjectsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListObjects(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListObjects_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListObjects(ctx, req.(*ListObjectsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_PutObjectStream_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(WaymakerStreamsServiceServer).PutObjectStream(&grpc.GenericServerStream[PutObjectStreamFrame, PutObjectResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_PutObjectStreamServer = grpc.ClientStreamingServer[PutObjectStreamFrame, PutObjectResponse] + +func _WaymakerStreamsService_GetObjectStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetObjectRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WaymakerStreamsServiceServer).GetObjectStream(m, &grpc.GenericServerStream[GetObjectRequest, GetObjectStreamFrame]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type WaymakerStreamsService_GetObjectStreamServer = grpc.ServerStreamingServer[GetObjectStreamFrame] + +func _WaymakerStreamsService_ListObjectRevisions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListObjectRevisionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ListObjectRevisions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ListObjectRevisions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ListObjectRevisions(ctx, req.(*ListObjectRevisionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_GetObjectRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetObjectRangeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).GetObjectRange(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_GetObjectRange_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).GetObjectRange(ctx, req.(*GetObjectRangeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_RebalanceStreams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RebalanceStreamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).RebalanceStreams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_RebalanceStreams_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).RebalanceStreams(ctx, req.(*RebalanceStreamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateConsumerState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateConsumerStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateConsumerState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateConsumerState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateConsumerState(ctx, req.(*ReplicateConsumerStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateSourceTailState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateSourceTailStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateSourceTailState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateSourceTailState_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateSourceTailState(ctx, req.(*ReplicateSourceTailStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateStreamCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateStreamCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamCreate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateStreamCreate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamCreate(ctx, req.(*ReplicateStreamCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateMessage(ctx, req.(*ReplicateMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateStreamDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateStreamDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamDelete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateStreamDelete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamDelete(ctx, req.(*ReplicateStreamDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateTruncate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateTruncateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateTruncate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateTruncate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateTruncate(ctx, req.(*ReplicateTruncateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateStreamUpdate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateStreamUpdateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamUpdate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateStreamUpdate_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateStreamUpdate(ctx, req.(*ReplicateStreamUpdateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WaymakerStreamsService_ReplicateWorkQueueAck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReplicateWorkQueueAckRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WaymakerStreamsServiceServer).ReplicateWorkQueueAck(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WaymakerStreamsService_ReplicateWorkQueueAck_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WaymakerStreamsServiceServer).ReplicateWorkQueueAck(ctx, req.(*ReplicateWorkQueueAckRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// WaymakerStreamsService_ServiceDesc is the grpc.ServiceDesc for WaymakerStreamsService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var WaymakerStreamsService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "waymaker.streams.WaymakerStreamsService", + HandlerType: (*WaymakerStreamsServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateStream", + Handler: _WaymakerStreamsService_CreateStream_Handler, + }, + { + MethodName: "DeleteStream", + Handler: _WaymakerStreamsService_DeleteStream_Handler, + }, + { + MethodName: "GetStreamInfo", + Handler: _WaymakerStreamsService_GetStreamInfo_Handler, + }, + { + MethodName: "ListStreams", + Handler: _WaymakerStreamsService_ListStreams_Handler, + }, + { + MethodName: "GetStreamSources", + Handler: _WaymakerStreamsService_GetStreamSources_Handler, + }, + { + MethodName: "UpdateStream", + Handler: _WaymakerStreamsService_UpdateStream_Handler, + }, + { + MethodName: "Publish", + Handler: _WaymakerStreamsService_Publish_Handler, + }, + { + MethodName: "Fetch", + Handler: _WaymakerStreamsService_Fetch_Handler, + }, + { + MethodName: "Ack", + Handler: _WaymakerStreamsService_Ack_Handler, + }, + { + MethodName: "Nak", + Handler: _WaymakerStreamsService_Nak_Handler, + }, + { + MethodName: "Term", + Handler: _WaymakerStreamsService_Term_Handler, + }, + { + MethodName: "InProgress", + Handler: _WaymakerStreamsService_InProgress_Handler, + }, + { + MethodName: "CreateConsumer", + Handler: _WaymakerStreamsService_CreateConsumer_Handler, + }, + { + MethodName: "DeleteConsumer", + Handler: _WaymakerStreamsService_DeleteConsumer_Handler, + }, + { + MethodName: "ListConsumers", + Handler: _WaymakerStreamsService_ListConsumers_Handler, + }, + { + MethodName: "GetConsumerInfo", + Handler: _WaymakerStreamsService_GetConsumerInfo_Handler, + }, + { + MethodName: "MigrateStream", + Handler: _WaymakerStreamsService_MigrateStream_Handler, + }, + { + MethodName: "GetClusterStreamStats", + Handler: _WaymakerStreamsService_GetClusterStreamStats_Handler, + }, + { + MethodName: "ReadLatestAtSubject", + Handler: _WaymakerStreamsService_ReadLatestAtSubject_Handler, + }, + { + MethodName: "ListSubjectsByPrefix", + Handler: _WaymakerStreamsService_ListSubjectsByPrefix_Handler, + }, + { + MethodName: "ScanExactAtSubject", + Handler: _WaymakerStreamsService_ScanExactAtSubject_Handler, + }, + { + MethodName: "ClearStreamAuthority", + Handler: _WaymakerStreamsService_ClearStreamAuthority_Handler, + }, + { + MethodName: "ListStreamAuthorityOverrides", + Handler: _WaymakerStreamsService_ListStreamAuthorityOverrides_Handler, + }, + { + MethodName: "SetStreamPinned", + Handler: _WaymakerStreamsService_SetStreamPinned_Handler, + }, + { + MethodName: "PutObject", + Handler: _WaymakerStreamsService_PutObject_Handler, + }, + { + MethodName: "GetObject", + Handler: _WaymakerStreamsService_GetObject_Handler, + }, + { + MethodName: "DeleteObject", + Handler: _WaymakerStreamsService_DeleteObject_Handler, + }, + { + MethodName: "GetObjectInfo", + Handler: _WaymakerStreamsService_GetObjectInfo_Handler, + }, + { + MethodName: "ListObjects", + Handler: _WaymakerStreamsService_ListObjects_Handler, + }, + { + MethodName: "ListObjectRevisions", + Handler: _WaymakerStreamsService_ListObjectRevisions_Handler, + }, + { + MethodName: "GetObjectRange", + Handler: _WaymakerStreamsService_GetObjectRange_Handler, + }, + { + MethodName: "RebalanceStreams", + Handler: _WaymakerStreamsService_RebalanceStreams_Handler, + }, + { + MethodName: "ReplicateConsumerState", + Handler: _WaymakerStreamsService_ReplicateConsumerState_Handler, + }, + { + MethodName: "ReplicateSourceTailState", + Handler: _WaymakerStreamsService_ReplicateSourceTailState_Handler, + }, + { + MethodName: "ReplicateStreamCreate", + Handler: _WaymakerStreamsService_ReplicateStreamCreate_Handler, + }, + { + MethodName: "ReplicateMessage", + Handler: _WaymakerStreamsService_ReplicateMessage_Handler, + }, + { + MethodName: "ReplicateStreamDelete", + Handler: _WaymakerStreamsService_ReplicateStreamDelete_Handler, + }, + { + MethodName: "ReplicateTruncate", + Handler: _WaymakerStreamsService_ReplicateTruncate_Handler, + }, + { + MethodName: "ReplicateStreamUpdate", + Handler: _WaymakerStreamsService_ReplicateStreamUpdate_Handler, + }, + { + MethodName: "ReplicateWorkQueueAck", + Handler: _WaymakerStreamsService_ReplicateWorkQueueAck_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Subscribe", + Handler: _WaymakerStreamsService_Subscribe_Handler, + ServerStreams: true, + }, + { + StreamName: "TransferStream", + Handler: _WaymakerStreamsService_TransferStream_Handler, + ServerStreams: true, + }, + { + StreamName: "WatchStreams", + Handler: _WaymakerStreamsService_WatchStreams_Handler, + ServerStreams: true, + }, + { + StreamName: "PutObjectStream", + Handler: _WaymakerStreamsService_PutObjectStream_Handler, + ClientStreams: true, + }, + { + StreamName: "GetObjectStream", + Handler: _WaymakerStreamsService_GetObjectStream_Handler, + ServerStreams: true, + }, + }, + Metadata: "waymaker_streams.proto", +} diff --git a/go/go.mod b/go/go.mod new file mode 100644 index 0000000..7455acb --- /dev/null +++ b/go/go.mod @@ -0,0 +1,15 @@ +module git.awesomike.com/pub/waymaker-client/go + +go 1.26.2 + +require ( + google.golang.org/grpc v1.81.1 + google.golang.org/protobuf v1.36.11 +) + +require ( + golang.org/x/net v0.51.0 // indirect + golang.org/x/sys v0.42.0 // indirect + golang.org/x/text v0.34.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 // indirect +) diff --git a/go/go.sum b/go/go.sum new file mode 100644 index 0000000..44c671d --- /dev/null +++ b/go/go.sum @@ -0,0 +1,38 @@ +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= +golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= +golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171 h1:ggcbiqK8WWh6l1dnltU4BgWGIGo+EVYxCaAPih/zQXQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260226221140-a57be14db171/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/go/kv.go b/go/kv.go new file mode 100644 index 0000000..c0ec8b7 --- /dev/null +++ b/go/kv.go @@ -0,0 +1,348 @@ +package waymaker + +// KV subsystem — thin RPC binding over the server's Kv* RPCs. +// All conventions (subject patterns, tombstone marker, TTL header) live +// server-side in waymaker_streams::wire_conventions. This client just +// calls the typed RPCs — no subject-level knowledge required. +// +// Entry points on *Client: +// - client.CreateKV(ctx, KVConfig{…}) +// - client.GetOrCreateKV(ctx, KVConfig{…}) +// - client.KV(name) — handle without creation +// - client.DeleteKV(ctx, name) + +import ( + "context" + "io" + "time" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/kv" +) + +// KVConfig is the bucket creation config. +type KVConfig struct { + Name string + MaxBytes *uint64 + MaxValueSize *uint64 + MaxAge *time.Duration + Ephemeral bool + // MaxRevisions caps per-key revision count. 0 = unbounded. + MaxRevisions uint64 +} + +// Bucket is a reference to a KV bucket. Cheap to copy. +type Bucket struct { + client *Client + Name string +} + +func newBucket(c *Client, name string) *Bucket { + return &Bucket{client: c, Name: name} +} + +// Put stores value under key. Latest-write-wins. Returns the new revision. +func (b *Bucket) Put(ctx context.Context, key string, value []byte) (uint64, error) { + return b.putInternal(ctx, key, value, 0) +} + +// PutWithTTL stores value under key with a per-key TTL. +func (b *Bucket) PutWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) (uint64, error) { + return b.putInternal(ctx, key, value, uint64(ttl.Milliseconds())) +} + +func (b *Bucket) putInternal(ctx context.Context, key string, value []byte, ttlMs uint64) (uint64, error) { + c := b.client.kvClient() + r, err := c.Put(ctx, &pb.KvPutRequest{ + Bucket: b.Name, + Key: key, + Value: value, + TtlMs: ttlMs, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetRevision(), nil +} + +// Create is an atomic create — fails with code "wrong_revision" if the key +// already exists. +func (b *Bucket) Create(ctx context.Context, key string, value []byte) (uint64, error) { + c := b.client.kvClient() + r, err := c.Create(ctx, &pb.KvCreateRequest{ + Bucket: b.Name, + Key: key, + Value: value, + TtlMs: 0, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetRevision(), nil +} + +// Update is a CAS update — succeeds only if current revision matches +// expectedRevision. +func (b *Bucket) Update(ctx context.Context, key string, value []byte, expectedRevision uint64) (uint64, error) { + c := b.client.kvClient() + r, err := c.Update(ctx, &pb.KvUpdateRequest{ + Bucket: b.Name, + Key: key, + Value: value, + ExpectedRevision: expectedRevision, + TtlMs: 0, + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetRevision(), nil +} + +// Get returns the latest value. Returns (nil, nil) when absent or +// tombstoned. +func (b *Bucket) Get(ctx context.Context, key string) ([]byte, error) { + v, _, err := b.GetWithRevision(ctx, key) + return v, err +} + +// GetWithRevision returns the latest value + revision (for chaining CAS). +// Returns (nil, 0, nil) when absent or tombstoned. +func (b *Bucket) GetWithRevision(ctx context.Context, key string) ([]byte, uint64, error) { + c := b.client.kvClient() + r, err := c.Get(ctx, &pb.KvGetRequest{Bucket: b.Name, Key: key}) + if err != nil { + return nil, 0, rpcErr(err) + } + if !r.GetSuccess() { + return nil, 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + e := r.GetEntry() + if e == nil { + return nil, 0, nil + } + return e.GetValue(), e.GetRevision(), nil +} + +// Delete tombstones key. +func (b *Bucket) Delete(ctx context.Context, key string) error { + c := b.client.kvClient() + r, err := c.Delete(ctx, &pb.KvDeleteRequest{Bucket: b.Name, Key: key}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Touch extends the TTL on key without changing its value. +func (b *Bucket) Touch(ctx context.Context, key string, ttl time.Duration) (uint64, error) { + c := b.client.kvClient() + r, err := c.Touch(ctx, &pb.KvTouchRequest{ + Bucket: b.Name, + Key: key, + TtlMs: uint64(ttl.Milliseconds()), + }) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetRevision(), nil +} + +// Keys lists every non-tombstoned key in the bucket. +func (b *Bucket) Keys(ctx context.Context) ([]string, error) { + c := b.client.kvClient() + r, err := c.Keys(ctx, &pb.KvKeysRequest{Bucket: b.Name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + var out []string + for _, e := range r.GetEntries() { + if !e.GetDeleted() { + out = append(out, e.GetKey()) + } + } + return out, nil +} + +// HistoryEntry is one revision of a key. +type HistoryEntry struct { + Value []byte + Revision uint64 + TsMs int64 + Tombstone bool +} + +// History returns historical values at key in publish order. +func (b *Bucket) History(ctx context.Context, key string) ([]HistoryEntry, error) { + c := b.client.kvClient() + r, err := c.History(ctx, &pb.KvHistoryRequest{ + Bucket: b.Name, + Key: key, + FromRevision: 0, + Limit: 0, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]HistoryEntry, len(r.GetEntries())) + for i, e := range r.GetEntries() { + out[i] = HistoryEntry{ + Value: e.GetValue(), + Revision: e.GetRevision(), + TsMs: e.GetTsMs(), + Tombstone: e.GetDeleted(), + } + } + return out, nil +} + +// KVEvent is a live change event delivered by Watch. +type KVEvent struct { + // Put is non-nil for a put event. + Put *KVPutEvent + // Delete is non-nil for a delete event. + Delete *KVDeleteEvent +} + +// KVPutEvent carries a put notification. +type KVPutEvent struct { + Key string + Value []byte + Revision uint64 + TsMs int64 +} + +// KVDeleteEvent carries a delete/tombstone notification. +type KVDeleteEvent struct { + Key string + Revision uint64 + TsMs int64 +} + +// WatchStream is a live watch on a KV bucket. +type WatchStream struct { + inner pb.WaymakerKvService_WatchClient +} + +// Next blocks until the next event arrives or an error occurs. +// Returns (zero, nil) on normal end-of-stream. +func (w *WatchStream) Next() (KVEvent, error) { + for { + ev, err := w.inner.Recv() + if err != nil { + if err == io.EOF { + return KVEvent{}, nil + } + return KVEvent{}, rpcErr(err) + } + switch e := ev.GetEvent().(type) { + case *pb.KvWatchEvent_Put: + return KVEvent{Put: &KVPutEvent{ + Key: e.Put.GetKey(), + Value: e.Put.GetValue(), + Revision: e.Put.GetRevision(), + TsMs: e.Put.GetTsMs(), + }}, nil + case *pb.KvWatchEvent_Delete: + return KVEvent{Delete: &KVDeleteEvent{ + Key: e.Delete.GetKey(), + Revision: e.Delete.GetRevision(), + TsMs: e.Delete.GetTsMs(), + }}, nil + } + } +} + +// Watch opens a live watch on key. +func (b *Bucket) Watch(ctx context.Context, key string) (*WatchStream, error) { + return b.watchInner(ctx, key) +} + +// WatchAll opens a live watch on every key in the bucket. +func (b *Bucket) WatchAll(ctx context.Context) (*WatchStream, error) { + return b.watchInner(ctx, "") +} + +func (b *Bucket) watchInner(ctx context.Context, key string) (*WatchStream, error) { + c := b.client.kvClient() + stream, err := c.Watch(ctx, &pb.KvWatchRequest{Bucket: b.Name, Key: key}) + if err != nil { + return nil, rpcErr(err) + } + return &WatchStream{inner: stream}, nil +} + +// --- Client entry points --- + +// CreateKV creates a new KV bucket. +func (c *Client) CreateKV(ctx context.Context, config KVConfig) (*Bucket, error) { + kvc := c.kvClient() + var maxAgeMs uint64 + if config.MaxAge != nil { + maxAgeMs = uint64(config.MaxAge.Milliseconds()) + } + r, err := kvc.CreateBucket(ctx, &pb.KvCreateBucketRequest{ + Bucket: config.Name, + MaxBytes: uint64OrZero(config.MaxBytes), + MaxValueSize: uint64OrZero(config.MaxValueSize), + MaxAgeMs: maxAgeMs, + Ephemeral: config.Ephemeral, + MaxRevisions: config.MaxRevisions, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newBucket(c, config.Name), nil +} + +// GetOrCreateKV is the idempotent create-or-get. +func (c *Client) GetOrCreateKV(ctx context.Context, config KVConfig) (*Bucket, error) { + b, err := c.CreateKV(ctx, config) + if err == nil { + return b, nil + } + if IsServerCode(err, "already_exists") { + return newBucket(c, config.Name), nil + } + return nil, err +} + +// KV returns a bucket handle without verifying existence. +func (c *Client) KV(name string) *Bucket { + return newBucket(c, name) +} + +// DeleteKV deletes the KV bucket. +func (c *Client) DeleteKV(ctx context.Context, name string) error { + kvc := c.kvClient() + r, err := kvc.DeleteBucket(ctx, &pb.KvDeleteBucketRequest{Bucket: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} diff --git a/go/lock.go b/go/lock.go new file mode 100644 index 0000000..b5220ce --- /dev/null +++ b/go/lock.go @@ -0,0 +1,774 @@ +package waymaker + +// Locks subsystem — wraps the rwlock RPCs (Lock / ReadLock / UnLock / +// LeaseStatus / ExtendLease / MultiLock). +// +// Entry points live on *Client: +// - client.AcquireLock(ctx, key, LockConfig{…}) — exclusive (write) lock +// - client.AcquireReadLock(ctx, key, LockConfig{…}) — shared (read) lock +// - client.LeaseStatus(ctx, key, id) +// - client.MultiLock(ctx, keys, LockConfig{…}) +// +// The returned *Lock keeps a background goroutine that holds the server +// event stream open and, if that stream drops (e.g. the key's primary +// bounces), transparently re-binds it and re-confirms ownership — reusing +// the original RequestID so a still-held lease is recovered rather than +// re-contended. The lock's live state is published through Lock.Watch(). + +import ( + "context" + "fmt" + "io" + "sync" + "time" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/locks" + "google.golang.org/grpc" +) + +// Ensure grpc is used (it's imported for CallOption in ListAcquiredLocks). +var _ = grpc.EmptyCallOption{} + +// --- Scope --- + +// Scope is the fence-token durability tier. It controls ONE thing: how +// durable the per-key fence_token counter (a monotonic uint64) is across +// failures. It does NOT control whether the lease survives node failures +// (that is replication_factor), nor mutual exclusion (you must still +// fence at the side-effect level). +type Scope int32 + +const ( + // ScopeEphemeral — counter in RAM on the owning node. Resets on + // process restart or hash-ring rebalance. Fastest; no I/O. + ScopeEphemeral Scope = 1 + // ScopeLocal — counter persisted to disk on the owning node. + // Survives process restart; resets on ring rebalance. + ScopeLocal Scope = 2 + // ScopeQuorum — Raft-replicated per-key counter, cluster-wide + // monotonic. Survives any single-node failure. + ScopeQuorum Scope = 3 +) + +// --- LockConfig --- + +// LockConfig is the acquire configuration. Zero value is valid: +// MaxWait defaults to 1 hour, LeaseTTL to 30 s, RequesterApplication +// to "waymaker-client-go". RequestID is auto-filled with a UUID if empty. +type LockConfig struct { + // MaxWait is how long the server will block waiting for the lock. + // Zero means try-acquire (fail immediately if contended). + // Default: 1 hour. + MaxWait time.Duration + // LeaseTTL is how long the lease lives once acquired. + // Default: 30 s. + LeaseTTL time.Duration + // Priority class — higher values jump the wait queue. + Priority uint32 + // Scope controls fence-token durability. + Scope Scope + // RequesterInfo is free-form metadata for server-side audit. + RequesterInfo string + // RequesterApplication is the application name. + // Default: "waymaker-client-go". + RequesterApplication string + // RequestID is the idempotency key for retries of the same acquire. + // Auto-filled with a UUID if empty. + RequestID string +} + +func (c LockConfig) withDefaults() LockConfig { + if c.MaxWait == 0 { + c.MaxWait = time.Hour + } + if c.LeaseTTL == 0 { + c.LeaseTTL = 30 * time.Second + } + if c.RequesterApplication == "" { + c.RequesterApplication = "waymaker-client-go" + } + if c.RequestID == "" { + c.RequestID = newUUID() + } + if c.Scope == 0 { + c.Scope = ScopeEphemeral + } + return c +} + +func durationToMs(d time.Duration) uint32 { + ms := d.Milliseconds() + if ms < 0 { + return 0 + } + if ms > int64(^uint32(0)) { + return ^uint32(0) + } + return uint32(ms) +} + +func (c LockConfig) toLockRequest(key string) *pb.LockRequest { + return &pb.LockRequest{ + Key: key, + MaxWaitPeriod: durationToMs(c.MaxWait), + MaxLeasePeriod: durationToMs(c.LeaseTTL), + Priority: c.Priority, + RequesterInfo: c.RequesterInfo, + RequesterApplication: c.RequesterApplication, + RequestId: c.RequestID, + FenceScope: pb.FenceScope(c.Scope), + } +} + +// --- Lease --- + +// Lease holds the details of a currently-held lock lease. +type Lease struct { + ID string + Key string + AcquiredAtMs int64 + LeaseExpiresAtMs int64 + FenceToken uint64 + Priority uint32 +} + +func leaseFromPB(l *pb.Lease) Lease { + return Lease{ + ID: l.GetId(), + Key: l.GetKey(), + AcquiredAtMs: l.GetCreatedAt(), + LeaseExpiresAtMs: l.GetLeaseExpiresAt(), + FenceToken: l.GetFenceToken(), + Priority: l.GetPriority(), + } +} + +// --- LockState --- + +// LockState is a live snapshot of a held lock, delivered through +// Lock.Watch(). FenceToken and ID change only if the lock was lost +// and transparently re-won after a primary failure; Lost flips to true +// once the client gives up re-establishing ownership. +type LockState struct { + // ID is the lease id. Stable across transparent re-binds. + ID string + // FenceToken is the current fence token. Re-read before every + // fenced side effect. + FenceToken uint64 + // LeaseExpiresAtMs is the lease expiry epoch (ms). + LeaseExpiresAtMs int64 + // Lost is true once the client could no longer prove ownership. + // A lost holder MUST stop acting as the holder. + Lost bool +} + +// --- Lock --- + +// Lock is an acquired lock handle. Dropping the handle does NOT +// auto-release the lock — call Unlock explicitly (or let the lease +// expire). This matches the underlying RPC semantics. +// +// A background goroutine keeps the server event stream open. If the +// stream drops — typically because the key's primary bounced — the +// goroutine transparently re-binds it, reusing the original RequestID +// so a still-held lease is recovered rather than re-contended. The +// lease itself is kept alive by the server's TTL plus SpawnRenewal, +// independent of the stream. +type Lock struct { + client *Client + Key string + + mu sync.RWMutex + state LockState + + // stateCh is closed and replaced whenever state changes, so + // Watch() receivers can block on the current channel. + stateCh chan struct{} + + // stopCh is closed to signal the hold goroutine to stop. + stopCh chan struct{} + // stopOnce guards the single close of stopCh. + stopOnce sync.Once + + holdDone chan struct{} +} + +// ID returns the current lease id (live). +func (l *Lock) ID() string { + l.mu.RLock() + defer l.mu.RUnlock() + return l.state.ID +} + +// FenceToken returns the current fence token (live). Re-read before +// every fenced side effect. +func (l *Lock) FenceToken() uint64 { + l.mu.RLock() + defer l.mu.RUnlock() + return l.state.FenceToken +} + +// LeaseExpiresAtMs returns the lease expiry epoch ms (live). +func (l *Lock) LeaseExpiresAtMs() int64 { + l.mu.RLock() + defer l.mu.RUnlock() + return l.state.LeaseExpiresAtMs +} + +// IsLost returns true once the client has lost the lock and could not +// re-win it. A lost holder must stop acting as the holder. +func (l *Lock) IsLost() bool { + l.mu.RLock() + defer l.mu.RUnlock() + return l.state.Lost +} + +// State returns a copy of the current LockState. +func (l *Lock) State() LockState { + l.mu.RLock() + defer l.mu.RUnlock() + return l.state +} + +// Watch returns a channel that is closed each time the lock state changes. +// Callers should call State() (or the individual accessors) after receiving +// from the channel to get the updated values. A new channel is returned on +// each call; each caller gets independent notification. +// +// Usage: +// +// ch := lock.Watch() +// for { +// <-ch +// if lock.IsLost() { ... } +// ch = lock.Watch() // re-subscribe for next change +// } +func (l *Lock) Watch() <-chan struct{} { + l.mu.RLock() + defer l.mu.RUnlock() + return l.stateCh +} + +// publishState updates the internal state and notifies watchers. +// Must be called with mu held for write. +func (l *Lock) publishLocked(next LockState) { + if l.state == next { + return + } + l.state = next + old := l.stateCh + l.stateCh = make(chan struct{}) + close(old) +} + +// Extend the lease by additional duration. +func (l *Lock) Extend(ctx context.Context, additional time.Duration) (Lease, error) { + c := l.client.locksClient() + r, err := c.ExtendLease(ctx, &pb.ExtendLeaseRequest{ + Key: l.Key, + Id: l.ID(), + LeaseTimeout: durationToMs(additional), + }) + if err != nil { + return Lease{}, rpcErr(err) + } + if !r.GetSuccess() { + return Lease{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + lease := r.GetLease() + if lease == nil { + return Lease{}, serverErr("internal", "missing lease in ExtendLease response") + } + return leaseFromPB(lease), nil +} + +// Unlock releases the lock. After this returns, the server-side state +// is gone. The background hold goroutine is stopped before the UnLock +// RPC is sent so it cannot re-acquire a lock the caller is releasing. +func (l *Lock) Unlock(ctx context.Context) error { + // Signal the hold goroutine to stop FIRST so it cannot race with + // the UnLock RPC and resurrect a just-released lock. + l.stop() + // Wait for the hold goroutine to finish before sending UnLock, so + // we don't race a re-acquire with the explicit release. + <-l.holdDone + + id := l.ID() + c := l.client.locksClient() + r, err := c.UnLock(ctx, &pb.UnLockRequest{ + Key: l.Key, + Id: id, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +func (l *Lock) stop() { + l.stopOnce.Do(func() { + close(l.stopCh) + }) +} + +// RenewalHandle keeps a background renewal task alive. Drop it (or call +// Stop) to halt renewal cleanly. +type RenewalHandle struct { + stopCh chan struct{} + stopOnce sync.Once + done chan struct{} +} + +// Stop halts the renewal task. After this returns, no further +// ExtendLease RPCs will be sent. +func (h *RenewalHandle) Stop() { + h.stopOnce.Do(func() { + close(h.stopCh) + }) + <-h.done +} + +// SpawnRenewal spawns a background goroutine that periodically extends +// the lease. Returns a RenewalHandle — call Stop() or let it be +// garbage-collected (which aborts the goroutine) to halt renewal. +// +// The renewal reads the live id each tick so a transparent re-acquire +// after a primary failure renews the correct lease. +// +// The timer fires the TTL renewal at every after the first tick (which +// is skipped — the caller has the freshly-acquired lease). The extend +// call is bounded to every duration so a hung server can't freeze the +// renewal task. +func (l *Lock) SpawnRenewal(every time.Duration) *RenewalHandle { + h := &RenewalHandle{ + stopCh: make(chan struct{}), + done: make(chan struct{}), + } + ttl := every * 2 + if ttl > time.Duration(^uint32(0))*time.Millisecond { + ttl = time.Duration(^uint32(0)) * time.Millisecond + } + + go func() { + defer close(h.done) + ticker := time.NewTicker(every) + defer ticker.Stop() + // Skip the first tick so we don't extend immediately after acquire. + select { + case <-ticker.C: + // discard the first tick + case <-h.stopCh: + return + case <-l.stopCh: + return + } + for { + select { + case <-h.stopCh: + return + case <-l.stopCh: + return + case <-ticker.C: + state := l.State() + if state.Lost { + continue + } + ctx, cancel := context.WithTimeout(context.Background(), every) + c := l.client.locksClient() + _, _ = c.ExtendLease(ctx, &pb.ExtendLeaseRequest{ + Key: l.Key, + Id: state.ID, + LeaseTimeout: durationToMs(ttl), + }) + cancel() + } + } + }() + return h +} + +// --- background hold-loop internals --- + +const ( + holdBaseBackoff = 200 * time.Millisecond + holdMaxBackoff = 10 * time.Second + holdRPCTimeout = 10 * time.Second +) + +type drainResult int + +const ( + drainStopped drainResult = iota // stop signal received + drainDisconnected // stream ended; try to re-establish +) + +type reboundResult struct { + stream pb.WaymakerService_LockClient + id string + fence uint64 + exp int64 + ok bool +} + +type ownershipResult int + +const ( + ownershipHeld ownershipResult = iota + ownershipLost + ownershipUnknown +) + +// drainStream reads events from stream until it closes, stop is signalled, +// or the lease is reported gone. Heartbeat / Acquired events update lock state. +func (l *Lock) drainStream(stream pb.WaymakerService_LockClient) drainResult { + for { + // Check stop before blocking on Recv. + select { + case <-l.stopCh: + return drainStopped + default: + } + + // Use a channel to race Recv against stopCh. + type recvResult struct { + ev *pb.LockEvent + err error + } + ch := make(chan recvResult, 1) + go func() { + ev, err := stream.Recv() + ch <- recvResult{ev, err} + }() + + select { + case <-l.stopCh: + return drainStopped + case res := <-ch: + if res.err != nil { + // io.EOF or any other error: stream ended. + return drainDisconnected + } + ev := res.ev + switch ev.GetEventType() { + case pb.LockEventType_Heartbeat: + l.mu.Lock() + next := l.state + next.LeaseExpiresAtMs = ev.GetLeaseExpiresAt() + l.publishLocked(next) + l.mu.Unlock() + + case pb.LockEventType_Acquired: + l.mu.Lock() + next := LockState{ + ID: ev.GetId(), + FenceToken: ev.GetFenceToken(), + LeaseExpiresAtMs: ev.GetLeaseExpiresAt(), + Lost: false, + } + l.publishLocked(next) + l.mu.Unlock() + + case pb.LockEventType_Expired, pb.LockEventType_Failed: + return drainDisconnected + + default: + // Waiting, Unknown: ignore. + } + } + } +} + +// reacquire tries one idempotent re-acquire (max_wait=0) using the +// original request_id. Returns reboundResult.ok=true on success. +func (l *Lock) reacquire(read bool, req *pb.LockRequest) reboundResult { + ctx, cancel := context.WithTimeout(context.Background(), holdRPCTimeout) + defer cancel() + + var stream pb.WaymakerService_LockClient + var err error + c := l.client.locksClient() + if read { + stream, err = c.ReadLock(ctx, req) + } else { + stream, err = c.Lock(ctx, req) + } + if err != nil { + return reboundResult{} + } + + for { + ev, err := stream.Recv() + if err != nil { + return reboundResult{} + } + switch ev.GetEventType() { + case pb.LockEventType_Acquired: + return reboundResult{ + stream: stream, + id: ev.GetId(), + fence: ev.GetFenceToken(), + exp: ev.GetLeaseExpiresAt(), + ok: true, + } + case pb.LockEventType_Failed, pb.LockEventType_Expired: + return reboundResult{} + default: + // Waiting, Heartbeat — keep reading. + } + } +} + +// confirmOwnership checks whether the lock's current id still owns the key. +func (l *Lock) confirmOwnership(key, id string) (ownershipResult, int64) { + ctx, cancel := context.WithTimeout(context.Background(), holdRPCTimeout) + defer cancel() + c := l.client.locksClient() + r, err := c.LeaseStatus(ctx, &pb.LeaseStatusRequest{Key: key, Id: id}) + if err != nil { + return ownershipUnknown, 0 + } + if !r.GetSuccess() || r.GetLease() == nil { + return ownershipLost, 0 + } + return ownershipHeld, r.GetLease().GetLeaseExpiresAt() +} + +// holdLoop is the background goroutine. It drains the stream, re-binds on +// drop, and marks the lock lost only when ownership cannot be confirmed. +func (l *Lock) holdLoop(read bool, stream pb.WaymakerService_LockClient, reacquireReq *pb.LockRequest) { + defer close(l.holdDone) + + for { + switch l.drainStream(stream) { + case drainStopped: + return + case drainDisconnected: + // Fall through to re-establish. + } + + backoff := holdBaseBackoff + for { + select { + case <-l.stopCh: + return + default: + } + + rb := l.reacquire(read, reacquireReq) + if rb.ok { + l.mu.Lock() + l.publishLocked(LockState{ + ID: rb.id, + FenceToken: rb.fence, + LeaseExpiresAtMs: rb.exp, + Lost: false, + }) + l.mu.Unlock() + stream = rb.stream + break // resume draining the fresh stream + } + + // Could not re-acquire. Check if we still hold the lease. + curID := l.ID() + own, exp := l.confirmOwnership(l.Key, curID) + switch own { + case ownershipHeld: + l.mu.Lock() + next := l.state + next.LeaseExpiresAtMs = exp + l.publishLocked(next) + l.mu.Unlock() + case ownershipUnknown: + // Transient — back off and retry. + case ownershipLost: + l.mu.Lock() + next := l.state + next.Lost = true + l.publishLocked(next) + l.mu.Unlock() + return + } + + select { + case <-l.stopCh: + return + case <-time.After(backoff): + } + backoff *= 2 + if backoff > holdMaxBackoff { + backoff = holdMaxBackoff + } + continue + } + // Broke out of inner loop — resume outer drain loop. + } +} + +// --- Client entry points --- + +// AcquireLock acquires an exclusive (write) lock. Blocks for at most +// config.MaxWait; returns an error with Code=="expired" if the wait +// elapses without a grant. +func (c *Client) AcquireLock(ctx context.Context, key string, config LockConfig) (*Lock, error) { + return c.acquireLockInner(ctx, key, config, false) +} + +// AcquireReadLock acquires a shared (read) lock. +func (c *Client) AcquireReadLock(ctx context.Context, key string, config LockConfig) (*Lock, error) { + return c.acquireLockInner(ctx, key, config, true) +} + +func (c *Client) acquireLockInner(ctx context.Context, key string, config LockConfig, read bool) (*Lock, error) { + config = config.withDefaults() + req := config.toLockRequest(key) + + // Template for the re-acquire: same request_id (idempotent recovery) + // but max_wait = 0 so it never blocks. + // Construct fresh to avoid copying a proto message (contains sync.Mutex). + reacquireReq := &pb.LockRequest{ + Key: req.Key, + MaxWaitPeriod: 0, + MaxLeasePeriod: req.MaxLeasePeriod, + Priority: req.Priority, + RequesterInfo: req.RequesterInfo, + RequesterApplication: req.RequesterApplication, + RequestId: req.RequestId, + FenceScope: req.FenceScope, + } + + lc := c.locksClient() + var stream pb.WaymakerService_LockClient + var err error + if read { + stream, err = lc.ReadLock(ctx, req) + } else { + stream, err = lc.Lock(ctx, req) + } + if err != nil { + return nil, rpcErr(err) + } + + // Consume events until Acquired / Failed / Expired. + for { + ev, err := stream.Recv() + if err != nil { + if err == io.EOF { + return nil, serverErr("stream_closed", "lock stream closed before acquire") + } + return nil, rpcErr(err) + } + switch ev.GetEventType() { + case pb.LockEventType_Acquired: + init := LockState{ + ID: ev.GetId(), + FenceToken: ev.GetFenceToken(), + LeaseExpiresAtMs: ev.GetLeaseExpiresAt(), + Lost: false, + } + lock := &Lock{ + client: c, + Key: key, + state: init, + stateCh: make(chan struct{}), + stopCh: make(chan struct{}), + holdDone: make(chan struct{}), + } + go lock.holdLoop(read, stream, reacquireReq) + return lock, nil + + case pb.LockEventType_Failed: + return nil, serverErr("failed", ev.GetMessage()) + case pb.LockEventType_Expired: + return nil, serverErr("expired", ev.GetMessage()) + default: + // Waiting / Heartbeat / Unknown — keep reading. + } + } +} + +// LeaseStatus queries the current state of a lock by id. +func (c *Client) LeaseStatus(ctx context.Context, key, id string) (Lease, error) { + lc := c.locksClient() + r, err := lc.LeaseStatus(ctx, &pb.LeaseStatusRequest{Key: key, Id: id}) + if err != nil { + return Lease{}, rpcErr(err) + } + if !r.GetSuccess() { + return Lease{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + lease := r.GetLease() + if lease == nil { + return Lease{}, serverErr("internal", "missing lease in LeaseStatus response") + } + return leaseFromPB(lease), nil +} + +// MultiLockKey is one entry in a MultiLock request. +type MultiLockKey struct { + Key string + WriteLock bool +} + +// MultiLock acquires N locks atomically. The server sorts keys to +// guarantee deadlock-free ordering. On any failure every partial lock is +// released before the call returns. +// +// Returns leases in the server's acquisition order (lexicographic by key). +func (c *Client) MultiLock(ctx context.Context, keys []MultiLockKey, config LockConfig) ([]Lease, error) { + config = config.withDefaults() + pbKeys := make([]*pb.MultiLockKey, len(keys)) + for i, k := range keys { + pbKeys[i] = &pb.MultiLockKey{Key: k.Key, WriteLock: k.WriteLock} + } + lc := c.locksClient() + r, err := lc.MultiLock(ctx, &pb.MultiLockRequest{ + Keys: pbKeys, + MaxWaitPeriod: durationToMs(config.MaxWait), + MaxLeasePeriod: durationToMs(config.LeaseTTL), + Priority: config.Priority, + RequesterInfo: config.RequesterInfo, + RequesterApplication: config.RequesterApplication, + RequestId: config.RequestID, + FenceScope: pb.FenceScope(config.Scope), + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + leases := make([]Lease, len(r.GetLeases())) + for i, l := range r.GetLeases() { + leases[i] = leaseFromPB(l) + } + return leases, nil +} + +// ListAcquiredLocks returns every lock currently held on the node +// serving the request. Optionally filtered by key prefix. +func (c *Client) ListAcquiredLocks(ctx context.Context, keyPrefix string, opts ...grpc.CallOption) ([]*pb.AcquiredLock, error) { + lc := c.locksClient() + r, err := lc.ListAcquiredLocks(ctx, &pb.ListAcquiredLocksRequest{KeyPrefix: keyPrefix}, opts...) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr("list_failed", "ListAcquiredLocks returned success=false") + } + return r.GetLocks(), nil +} + +// --- UUID helper (no external dependency) --- + +func newUUID() string { + // Simple time-based UUID v4 using crypto/rand. + b := make([]byte, 16) + _, _ = cryptoRandRead(b) + b[6] = (b[6] & 0x0f) | 0x40 + b[8] = (b[8] & 0x3f) | 0x80 + return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", + b[0:4], b[4:6], b[6:8], b[8:10], b[10:16]) +} diff --git a/go/object.go b/go/object.go new file mode 100644 index 0000000..3884f73 --- /dev/null +++ b/go/object.go @@ -0,0 +1,302 @@ +package waymaker + +// Object store subsystem — chunked Put/Get/Delete/List/Revisions backed by +// the streams service's PutObject/GetObject RPCs. +// +// An object-store bucket maps to a stream. The wrapper hides the wire +// convention behind a per-bucket *ObjectStore handle. +// +// Entry points on *Client: +// - client.CreateObjectStore(ctx, ObjectStoreConfig{…}) +// - client.GetOrCreateObjectStore(ctx, ObjectStoreConfig{…}) +// - client.ObjectStore(name) — handle without creation + +import ( + "context" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/streams" +) + +// DefaultChunkSize is the server-side default chunk size (1 MiB). +const DefaultChunkSize uint64 = 1024 * 1024 + +// ObjectStoreConfig is the bucket creation config. +type ObjectStoreConfig struct { + Name string + MaxBytes *uint64 + Ephemeral bool +} + +// ObjectInfo is the metadata of a stored object. +type ObjectInfo struct { + Name string + TotalBytes uint64 + ChunkCount uint64 + ChunkSize uint64 + SHA256 string + TsMs int64 + Headers [][2]string + Revision uint64 // metadata sequence + Deduped bool +} + +func objectInfoFromPB(i *pb.ObjectInfo) ObjectInfo { + hdrs := make([][2]string, len(i.GetHeaders())) + for j, h := range i.GetHeaders() { + hdrs[j] = [2]string{h.GetKey(), h.GetValue()} + } + return ObjectInfo{ + Name: i.GetName(), + TotalBytes: i.GetTotalBytes(), + ChunkCount: i.GetChunkCount(), + ChunkSize: i.GetChunkSize(), + SHA256: i.GetSha256(), + TsMs: i.GetTsMs(), + Headers: hdrs, + Revision: i.GetMetadataSeq(), + Deduped: i.GetDeduped(), + } +} + +// ObjectEntry is one row returned by ObjectStore.List. +type ObjectEntry struct { + Name string + TotalBytes uint64 + Deleted bool +} + +// ObjectRevision is one metadata revision returned by ObjectStore.Revisions. +type ObjectRevision struct { + MetadataSeq uint64 + TotalBytes uint64 + SHA256 string + TsMs int64 + Deleted bool +} + +// PutOptions controls optional Put parameters. +type PutOptions struct { + ChunkSize uint64 // 0 = server default + Headers [][2]string + SHA256 string // optional pre-computed SHA-256 hex + Dedupe bool +} + +// ObjectStore is a reference to an object-store bucket. +type ObjectStore struct { + client *Client + Name string +} + +func newObjectStore(c *Client, name string) *ObjectStore { + return &ObjectStore{client: c, Name: name} +} + +// Put uploads a small-to-medium object (whole payload in one RPC). +func (s *ObjectStore) Put(ctx context.Context, name string, payload []byte) (ObjectInfo, error) { + return s.PutWith(ctx, name, payload, PutOptions{}) +} + +// PutWith uploads with explicit options. +func (s *ObjectStore) PutWith(ctx context.Context, name string, payload []byte, opts PutOptions) (ObjectInfo, error) { + pbHeaders := make([]*pb.MessageHeader, len(opts.Headers)) + for i, h := range opts.Headers { + pbHeaders[i] = &pb.MessageHeader{Key: h[0], Value: h[1]} + } + c := s.client.streamsClient() + r, err := c.PutObject(ctx, &pb.PutObjectRequest{ + Bucket: s.Name, + Name: name, + Payload: payload, + ChunkSize: opts.ChunkSize, + Headers: pbHeaders, + Sha256: opts.SHA256, + Dedupe: opts.Dedupe, + }) + if err != nil { + return ObjectInfo{}, rpcErr(err) + } + if !r.GetSuccess() { + return ObjectInfo{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + info := r.GetInfo() + if info == nil { + return ObjectInfo{}, serverErr("internal", "missing info in PutObject response") + } + return objectInfoFromPB(info), nil +} + +// Get retrieves an object's payload and metadata. +func (s *ObjectStore) Get(ctx context.Context, name string) (ObjectInfo, []byte, error) { + c := s.client.streamsClient() + r, err := c.GetObject(ctx, &pb.GetObjectRequest{Bucket: s.Name, Name: name}) + if err != nil { + return ObjectInfo{}, nil, rpcErr(err) + } + if !r.GetSuccess() { + return ObjectInfo{}, nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + info := r.GetInfo() + if info == nil { + return ObjectInfo{}, nil, serverErr("internal", "missing info in GetObject response") + } + return objectInfoFromPB(info), r.GetPayload(), nil +} + +// GetRange reads a byte range of an object's payload. len=0 reads to EOF. +func (s *ObjectStore) GetRange(ctx context.Context, name string, offset, length uint64) (ObjectInfo, uint64, []byte, error) { + c := s.client.streamsClient() + r, err := c.GetObjectRange(ctx, &pb.GetObjectRangeRequest{ + Bucket: s.Name, + Name: name, + Offset: offset, + Len: length, + }) + if err != nil { + return ObjectInfo{}, 0, nil, rpcErr(err) + } + if !r.GetSuccess() { + return ObjectInfo{}, 0, nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + info := r.GetInfo() + if info == nil { + return ObjectInfo{}, 0, nil, serverErr("internal", "missing info in GetObjectRange response") + } + return objectInfoFromPB(info), r.GetActualOffset(), r.GetPayload(), nil +} + +// Info returns object metadata without the payload. Returns (zero, nil) if +// the object has been deleted. +func (s *ObjectStore) Info(ctx context.Context, name string) (*ObjectInfo, error) { + c := s.client.streamsClient() + r, err := c.GetObjectInfo(ctx, &pb.GetObjectInfoRequest{Bucket: s.Name, Name: name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + if r.GetDeleted() { + return nil, nil + } + if r.GetInfo() == nil { + return nil, nil + } + info := objectInfoFromPB(r.GetInfo()) + return &info, nil +} + +// Delete tombstones an object. Returns the tombstone sequence number. +func (s *ObjectStore) Delete(ctx context.Context, name string) (uint64, error) { + c := s.client.streamsClient() + r, err := c.DeleteObject(ctx, &pb.DeleteObjectRequest{Bucket: s.Name, Name: name}) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetTombstoneSeq(), nil +} + +// List lists objects in the bucket matching namePrefix. Tombstoned entries +// are excluded. +func (s *ObjectStore) List(ctx context.Context, namePrefix string) ([]ObjectEntry, error) { + return s.listInner(ctx, namePrefix, false) +} + +// ListWithDeleted lists objects including tombstoned entries. +func (s *ObjectStore) ListWithDeleted(ctx context.Context, namePrefix string) ([]ObjectEntry, error) { + return s.listInner(ctx, namePrefix, true) +} + +func (s *ObjectStore) listInner(ctx context.Context, namePrefix string, includeDeleted bool) ([]ObjectEntry, error) { + c := s.client.streamsClient() + r, err := c.ListObjects(ctx, &pb.ListObjectsRequest{ + Bucket: s.Name, + NamePrefix: namePrefix, + IncludeDeleted: includeDeleted, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]ObjectEntry, len(r.GetEntries())) + for i, e := range r.GetEntries() { + out[i] = ObjectEntry{ + Name: e.GetName(), + TotalBytes: e.GetTotalBytes(), + Deleted: e.GetDeleted(), + } + } + return out, nil +} + +// Revisions lists every metadata revision of name in sequence order. +func (s *ObjectStore) Revisions(ctx context.Context, name string) ([]ObjectRevision, error) { + c := s.client.streamsClient() + r, err := c.ListObjectRevisions(ctx, &pb.ListObjectRevisionsRequest{ + Bucket: s.Name, + Name: name, + FromSeq: 0, + Limit: 0, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]ObjectRevision, len(r.GetRevisions())) + for i, rev := range r.GetRevisions() { + out[i] = ObjectRevision{ + MetadataSeq: rev.GetMetadataSeq(), + TotalBytes: rev.GetTotalBytes(), + SHA256: rev.GetSha256(), + TsMs: rev.GetTsMs(), + Deleted: rev.GetDeleted(), + } + } + return out, nil +} + +// --- Client entry points --- + +// CreateObjectStore creates a new object-store bucket. +func (c *Client) CreateObjectStore(ctx context.Context, config ObjectStoreConfig) (*ObjectStore, error) { + sc := StreamConfig{ + Name: config.Name, + Subjects: []string{"objm.>", "objc.>"}, + Retention: RetentionLimits, + MaxBytes: config.MaxBytes, + Ephemeral: config.Ephemeral, + } + _, err := c.CreateStream(ctx, sc) + if err != nil { + return nil, err + } + return newObjectStore(c, config.Name), nil +} + +// GetOrCreateObjectStore is the idempotent create-or-get. +func (c *Client) GetOrCreateObjectStore(ctx context.Context, config ObjectStoreConfig) (*ObjectStore, error) { + sc := StreamConfig{ + Name: config.Name, + Subjects: []string{"objm.>", "objc.>"}, + Retention: RetentionLimits, + MaxBytes: config.MaxBytes, + Ephemeral: config.Ephemeral, + } + _, err := c.GetOrCreateStream(ctx, sc) + if err != nil { + return nil, err + } + return newObjectStore(c, config.Name), nil +} + +// ObjectStoreHandle returns a handle without verifying existence. +func (c *Client) ObjectStoreHandle(name string) *ObjectStore { + return newObjectStore(c, name) +} diff --git a/go/sketches.go b/go/sketches.go new file mode 100644 index 0000000..806a2bb --- /dev/null +++ b/go/sketches.go @@ -0,0 +1,501 @@ +package waymaker + +// Sketches subsystem — Bloom filter, HyperLogLog, Count-Min Sketch, Top-K, +// t-digest. Thin RPC bindings over WaymakerSketchesService. +// +// Entry points on *Client: +// Bloom: CreateBloom / Bloom(name) / DeleteBloom +// HLL: CreateHLL / HLL(name) / DeleteHLL +// CMS: CreateCMS / CMS(name) / DeleteCMS +// TopK: CreateTopK / TopK(name) / DeleteTopK +// TDigest: CreateTDigest / TDigest(name) / DeleteTDigest + +import ( + "context" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/sketches" +) + +// ============================================================ +// Bloom filter +// ============================================================ + +// BloomConfig is the Bloom filter creation config. +type BloomConfig struct { + Name string + Capacity uint64 + // ErrorRate is the target false-positive rate (e.g. 0.01 for 1%). + // 0 = server default (0.01). + ErrorRate float64 +} + +// BloomInfo is diagnostic information about a Bloom filter. +type BloomInfo struct { + Capacity uint64 + ErrorRate float64 + BitsSet uint64 + BitCount uint64 + HashCount uint32 + ItemsAdded uint64 +} + +// Bloom is a reference to a Bloom filter. +type Bloom struct { + client *Client + Name string +} + +func newBloom(c *Client, name string) *Bloom { return &Bloom{client: c, Name: name} } + +// Add adds item to the filter. +func (b *Bloom) Add(ctx context.Context, item []byte) error { + c := b.client.sketchesClient() + r, err := c.BloomAdd(ctx, &pb.BloomAddRequest{Name: b.Name, Item: item}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// AddMany adds multiple items. +func (b *Bloom) AddMany(ctx context.Context, items [][]byte) error { + c := b.client.sketchesClient() + r, err := c.BloomMultiAdd(ctx, &pb.BloomMultiAddRequest{Name: b.Name, Items: items}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Exists tests membership. true = probably present; false = definitely absent. +func (b *Bloom) Exists(ctx context.Context, item []byte) (bool, error) { + c := b.client.sketchesClient() + r, err := c.BloomExists(ctx, &pb.BloomExistsRequest{Name: b.Name, Item: item}) + if err != nil { + return false, rpcErr(err) + } + if !r.GetSuccess() { + return false, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetExists(), nil +} + +// ExistsMany tests membership for multiple items. +func (b *Bloom) ExistsMany(ctx context.Context, items [][]byte) ([]bool, error) { + c := b.client.sketchesClient() + r, err := c.BloomMultiExists(ctx, &pb.BloomMultiExistsRequest{Name: b.Name, Items: items}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetExists(), nil +} + +// Info returns diagnostic info about the filter. +func (b *Bloom) Info(ctx context.Context) (BloomInfo, error) { + c := b.client.sketchesClient() + r, err := c.BloomInfo(ctx, &pb.BloomInfoRequest{Name: b.Name}) + if err != nil { + return BloomInfo{}, rpcErr(err) + } + if !r.GetSuccess() { + return BloomInfo{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + return BloomInfo{ + Capacity: r.GetCapacity(), + ErrorRate: r.GetErrorRate(), + BitsSet: r.GetBitsSet(), + BitCount: r.GetBitCount(), + HashCount: r.GetHashCount(), + ItemsAdded: r.GetItemsAdded(), + }, nil +} + +func (c *Client) CreateBloom(ctx context.Context, config BloomConfig) (*Bloom, error) { + sc := c.sketchesClient() + r, err := sc.BloomReserve(ctx, &pb.BloomReserveRequest{ + Name: config.Name, + Capacity: config.Capacity, + ErrorRate: config.ErrorRate, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newBloom(c, config.Name), nil +} + +func (c *Client) BloomHandle(name string) *Bloom { return newBloom(c, name) } + +func (c *Client) DeleteBloom(ctx context.Context, name string) error { + sc := c.sketchesClient() + r, err := sc.BloomDelete(ctx, &pb.BloomDeleteRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// HyperLogLog +// ============================================================ + +// HLLConfig is the HLL creation config. +type HLLConfig struct { + Name string + // Precision controls register count: 2^Precision. Valid range 4..18. + // 0 = server default (14, ~1% error). + Precision uint32 +} + +// HLL is a reference to a HyperLogLog. +type HLL struct { + client *Client + Name string +} + +func newHLL(c *Client, name string) *HLL { return &HLL{client: c, Name: name} } + +// Add adds items to the estimator. +func (h *HLL) Add(ctx context.Context, items [][]byte) error { + c := h.client.sketchesClient() + r, err := c.HllAdd(ctx, &pb.HllAddRequest{Name: h.Name, Items: items}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Count returns the estimated cardinality. +func (h *HLL) Count(ctx context.Context) (uint64, error) { + c := h.client.sketchesClient() + r, err := c.HllCount(ctx, &pb.HllCountRequest{Name: h.Name}) + if err != nil { + return 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetEstimate(), nil +} + +// MergeFrom merges sources into this HLL (union of registers). +func (h *HLL) MergeFrom(ctx context.Context, sources []string) error { + c := h.client.sketchesClient() + r, err := c.HllMerge(ctx, &pb.HllMergeRequest{Destination: h.Name, Sources: sources}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +func (c *Client) CreateHLL(ctx context.Context, config HLLConfig) (*HLL, error) { + sc := c.sketchesClient() + r, err := sc.HllReserve(ctx, &pb.HllReserveRequest{Name: config.Name, Precision: config.Precision}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newHLL(c, config.Name), nil +} + +func (c *Client) HLLHandle(name string) *HLL { return newHLL(c, name) } + +func (c *Client) DeleteHLL(ctx context.Context, name string) error { + sc := c.sketchesClient() + r, err := sc.HllDelete(ctx, &pb.HllDeleteRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// Count-Min Sketch +// ============================================================ + +// CMSConfig is the CMS creation config. +type CMSConfig struct { + Name string + Width uint64 // 0 = server default + Depth uint64 // 0 = server default +} + +// CMSIncrItem is one (item, count) pair for CMS.Incr. +type CMSIncrItem struct { + Item []byte + Count uint64 +} + +// CMS is a reference to a Count-Min Sketch. +type CMS struct { + client *Client + Name string +} + +func newCMS(c *Client, name string) *CMS { return &CMS{client: c, Name: name} } + +// Incr increments counts. Returns one estimate per input item. +func (c *CMS) Incr(ctx context.Context, items []CMSIncrItem) ([]uint64, error) { + sc := c.client.sketchesClient() + pbItems := make([]*pb.CmsIncrByItem, len(items)) + for i, it := range items { + pbItems[i] = &pb.CmsIncrByItem{Item: it.Item, Count: it.Count} + } + r, err := sc.CmsIncrBy(ctx, &pb.CmsIncrByRequest{Name: c.Name, Items: pbItems}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetCounts(), nil +} + +// Query returns estimated frequencies for items. +func (c *CMS) Query(ctx context.Context, items [][]byte) ([]uint64, error) { + sc := c.client.sketchesClient() + r, err := sc.CmsQuery(ctx, &pb.CmsQueryRequest{Name: c.Name, Items: items}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetCounts(), nil +} + +func (c *Client) CreateCMS(ctx context.Context, config CMSConfig) (*CMS, error) { + sc := c.sketchesClient() + r, err := sc.CmsReserve(ctx, &pb.CmsReserveRequest{Name: config.Name, Width: config.Width, Depth: config.Depth}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newCMS(c, config.Name), nil +} + +func (c *Client) CMSHandle(name string) *CMS { return newCMS(c, name) } + +func (c *Client) DeleteCMS(ctx context.Context, name string) error { + sc := c.sketchesClient() + r, err := sc.CmsDelete(ctx, &pb.CmsDeleteRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// Top-K +// ============================================================ + +// TopKConfig is the Top-K creation config. +type TopKConfig struct { + Name string + K uint32 + Width uint64 // 0 = server default + Depth uint64 // 0 = server default + Decay float64 // 0 = server default +} + +// TopKListEntry is one (item, count) in the top-K list. +type TopKListEntry struct { + Item []byte + Count uint64 +} + +// TopK is a reference to a Top-K sketch. +type TopK struct { + client *Client + Name string +} + +func newTopK(c *Client, name string) *TopK { return &TopK{client: c, Name: name} } + +// Add adds items. Returns one evicted item per slot (empty bytes if none). +func (t *TopK) Add(ctx context.Context, items [][]byte) ([][]byte, error) { + c := t.client.sketchesClient() + r, err := c.TopKAdd(ctx, &pb.TopKAddRequest{Name: t.Name, Items: items}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetEvicted(), nil +} + +// Query tests whether items are in the top-K list. +func (t *TopK) Query(ctx context.Context, items [][]byte) ([]bool, error) { + c := t.client.sketchesClient() + r, err := c.TopKQuery(ctx, &pb.TopKQueryRequest{Name: t.Name, Items: items}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetInTopK(), nil +} + +// List returns the current top-K list. +func (t *TopK) List(ctx context.Context) ([]TopKListEntry, error) { + c := t.client.sketchesClient() + r, err := c.TopKList(ctx, &pb.TopKListRequest{Name: t.Name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]TopKListEntry, len(r.GetEntries())) + for i, e := range r.GetEntries() { + out[i] = TopKListEntry{Item: e.GetItem(), Count: e.GetCount()} + } + return out, nil +} + +func (c *Client) CreateTopK(ctx context.Context, config TopKConfig) (*TopK, error) { + sc := c.sketchesClient() + r, err := sc.TopKReserve(ctx, &pb.TopKReserveRequest{ + Name: config.Name, + K: config.K, + Width: config.Width, + Depth: config.Depth, + Decay: config.Decay, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newTopK(c, config.Name), nil +} + +func (c *Client) TopKHandle(name string) *TopK { return newTopK(c, name) } + +func (c *Client) DeleteTopK(ctx context.Context, name string) error { + sc := c.sketchesClient() + r, err := sc.TopKDelete(ctx, &pb.TopKDeleteRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// ============================================================ +// t-digest +// ============================================================ + +// TDigestConfig is the t-digest creation config. +type TDigestConfig struct { + Name string + Compression uint32 // 0 = server default +} + +// TDigest is a reference to a t-digest quantile sketch. +type TDigest struct { + client *Client + Name string +} + +func newTDigest(c *Client, name string) *TDigest { return &TDigest{client: c, Name: name} } + +// Add adds values to the sketch. +func (t *TDigest) Add(ctx context.Context, values []float64) error { + c := t.client.sketchesClient() + r, err := c.TDigestAdd(ctx, &pb.TDigestAddRequest{Name: t.Name, Values: values}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Quantile computes quantile estimates. One result per input quantile. +func (t *TDigest) Quantile(ctx context.Context, quantiles []float64) ([]float64, error) { + c := t.client.sketchesClient() + r, err := c.TDigestQuantile(ctx, &pb.TDigestQuantileRequest{Name: t.Name, Quantiles: quantiles}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetValues(), nil +} + +// MinMax returns the minimum and maximum observed values. +func (t *TDigest) MinMax(ctx context.Context) (min, max float64, err error) { + c := t.client.sketchesClient() + r, err := c.TDigestMinMax(ctx, &pb.TDigestMinMaxRequest{Name: t.Name}) + if err != nil { + return 0, 0, rpcErr(err) + } + if !r.GetSuccess() { + return 0, 0, serverErr(r.GetResultCode(), r.GetMessage()) + } + return r.GetMin(), r.GetMax(), nil +} + +func (c *Client) CreateTDigest(ctx context.Context, config TDigestConfig) (*TDigest, error) { + sc := c.sketchesClient() + r, err := sc.TDigestCreate(ctx, &pb.TDigestCreateRequest{Name: config.Name, Compression: config.Compression}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newTDigest(c, config.Name), nil +} + +func (c *Client) TDigestHandle(name string) *TDigest { return newTDigest(c, name) } + +func (c *Client) DeleteTDigest(ctx context.Context, name string) error { + sc := c.sketchesClient() + r, err := sc.TDigestDelete(ctx, &pb.TDigestDeleteRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} diff --git a/go/stream.go b/go/stream.go new file mode 100644 index 0000000..155df92 --- /dev/null +++ b/go/stream.go @@ -0,0 +1,673 @@ +package waymaker + +// Streams subsystem — wraps the stream lifecycle, publish, fetch, and +// consumer (push + pull) RPCs. +// +// Entry points on *Client: +// - client.CreateStream(ctx, StreamConfig{…}) +// - client.GetStream(ctx, name) +// - client.GetOrCreateStream(ctx, StreamConfig{…}) +// - client.UpdateStream(ctx, name, StreamUpdate{…}) +// - client.DeleteStream(ctx, name) + +import ( + "context" + "io" + "time" + + pb "git.awesomike.com/pub/waymaker-client/go/genpb/streams" +) + +// --- Retention policy --- + +// RetentionPolicy controls how the stream prunes old messages. +type RetentionPolicy int + +const ( + RetentionLimits RetentionPolicy = iota // size/age limits; default + RetentionWorkQueue // exactly-once work queue + RetentionInterest // retain while consumers exist +) + +// --- StreamSource --- + +// OnDropPolicy controls what a cross-stream tail does when the source +// drops messages past the last-sourced seq. +type OnDropPolicy int + +const ( + OnDropHalt OnDropPolicy = 0 + OnDropSkipToFirstAvailable OnDropPolicy = 1 +) + +// SubjectTransform is a NATS-style subject rewrite for cross-stream sources. +type SubjectTransform struct { + SourcePattern string + Destination string +} + +// StreamSource identifies a stream to tail from. +type StreamSource struct { + SourceStream string + FilterSubject string + StartSeq uint64 + StartTimeMs int64 + MaxInitialBackfill uint64 + SubjectTransform *SubjectTransform + OnDrop OnDropPolicy + DlqStream string +} + +// --- StreamConfig --- + +// StreamConfig is the creation config for a stream. +type StreamConfig struct { + Name string + Subjects []string + Retention RetentionPolicy + MaxAge time.Duration + MaxMessages *uint64 + MaxBytes *uint64 + MaxMessageSize *uint64 + BlockSize uint64 + StrictLimits bool + Ephemeral bool + MaxMsgsPerSubject uint64 + Sources []StreamSource +} + +func (c StreamConfig) toPB() *pb.StreamConfigPb { + var retention *pb.Retention + switch c.Retention { + case RetentionWorkQueue: + retention = &pb.Retention{Policy: &pb.Retention_WorkQueue{WorkQueue: &pb.WorkQueueRetention{}}} + case RetentionInterest: + retention = &pb.Retention{Policy: &pb.Retention_Interest{Interest: &pb.InterestRetention{}}} + default: // RetentionLimits + var maxAgeMs *uint64 + if c.MaxAge > 0 { + v := uint64(c.MaxAge.Milliseconds()) + maxAgeMs = &v + } + retention = &pb.Retention{ + Policy: &pb.Retention_Limits{ + Limits: &pb.LimitsRetention{ + MaxAgeMs: maxAgeMs, + MaxMsgs: c.MaxMessages, + MaxBytes: c.MaxBytes, + StrictLimits: c.StrictLimits, + }, + }, + } + } + + sources := make([]*pb.StreamSourceConfigPb, len(c.Sources)) + for i, s := range c.Sources { + var onDrop pb.OnDropPolicy + if s.OnDrop == OnDropSkipToFirstAvailable { + onDrop = pb.OnDropPolicy_ON_DROP_SKIP_TO_FIRST_AVAILABLE + } + src := &pb.StreamSourceConfigPb{ + SourceStream: s.SourceStream, + FilterSubject: s.FilterSubject, + StartSeq: s.StartSeq, + StartTimeMs: s.StartTimeMs, + MaxInitialBackfill: s.MaxInitialBackfill, + OnDrop: onDrop, + DlqStream: s.DlqStream, + } + if s.SubjectTransform != nil { + src.SubjectTransform = &pb.SubjectTransformPb{ + SourcePattern: s.SubjectTransform.SourcePattern, + Destination: s.SubjectTransform.Destination, + } + } + sources[i] = src + } + + return &pb.StreamConfigPb{ + Name: c.Name, + SubjectsFilter: c.Subjects, + Retention: retention, + BlockSize: c.BlockSize, + MaxMsgBytes: uint64OrZero(c.MaxMessageSize), + Ephemeral: c.Ephemeral, + MaxMsgsPerSubject: c.MaxMsgsPerSubject, + Sources: sources, + } +} + +func uint64OrZero(p *uint64) uint64 { + if p == nil { + return 0 + } + return *p +} + +// --- StreamUpdate --- + +// StreamUpdate carries the mutable subset of a stream's config. +// Nil fields are not touched server-side. +type StreamUpdate struct { + MaxAge *time.Duration + MaxMessages *uint64 + MaxBytes *uint64 + MaxMsgBytes *uint64 + StrictLimits *bool +} + +// --- SourceStatus --- + +// SourceStatus is one row of per-(sourcing, source) status. +type SourceStatus struct { + SourcingStream string + SourceStream string + LastSourcedSeq uint64 + PulledTotal uint64 + LastError string + LastErrorTsMs int64 +} + +// --- PublishAck --- + +// PublishAck is returned by Stream.Publish. +type PublishAck struct { + Sequence uint64 +} + +// --- Stream handle --- + +// Stream is a reference to a stream on the server. Cheap to copy. +type Stream struct { + client *Client + Name string +} + +func newStream(c *Client, name string) *Stream { + return &Stream{client: c, Name: name} +} + +// Publish sends a message into this stream. +func (s *Stream) Publish(ctx context.Context, subject string, payload []byte) (PublishAck, error) { + return s.PublishWithHeaders(ctx, subject, nil, payload) +} + +// PublishWithHeaders publishes with explicit headers. +func (s *Stream) PublishWithHeaders(ctx context.Context, subject string, headers [][2]string, payload []byte) (PublishAck, error) { + pbHeaders := make([]*pb.MessageHeader, len(headers)) + for i, h := range headers { + pbHeaders[i] = &pb.MessageHeader{Key: h[0], Value: h[1]} + } + c := s.client.streamsClient() + r, err := c.Publish(ctx, &pb.PublishRequest{ + Stream: s.Name, + Subject: subject, + Payload: payload, + Headers: pbHeaders, + }) + if err != nil { + return PublishAck{}, rpcErr(err) + } + if !r.GetSuccess() { + return PublishAck{}, serverErr(r.GetResultCode(), r.GetMessage()) + } + return PublishAck{Sequence: r.GetSeq()}, nil +} + +// SourcesStatus returns the per-source tail status for this stream. +func (s *Stream) SourcesStatus(ctx context.Context) ([]SourceStatus, error) { + c := s.client.streamsClient() + r, err := c.GetStreamInfo(ctx, &pb.GetStreamInfoRequest{Name: s.Name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]SourceStatus, len(r.GetSourcesStatus())) + for i, ss := range r.GetSourcesStatus() { + out[i] = SourceStatus{ + SourcingStream: s.Name, + SourceStream: ss.GetSourceStream(), + LastSourcedSeq: ss.GetLastSourcedSeq(), + PulledTotal: ss.GetPulledTotal(), + LastError: ss.GetLastError(), + LastErrorTsMs: ss.GetLastErrorTsMs(), + } + } + return out, nil +} + +// CreateConsumer creates a new consumer on this stream. +func (s *Stream) CreateConsumer(ctx context.Context, config ConsumerConfig) (*Consumer, error) { + if config.DurableName == "" { + return nil, invalidErr("ConsumerConfig.DurableName is required") + } + c := s.client.streamsClient() + r, err := c.CreateConsumer(ctx, &pb.CreateConsumerRequest{ + Stream: s.Name, + Config: config.toPB(), + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newConsumer(s.client, s.Name, config.DurableName), nil +} + +// GetOrCreateConsumer is the idempotent variant. +func (s *Stream) GetOrCreateConsumer(ctx context.Context, config ConsumerConfig) (*Consumer, error) { + if config.DurableName == "" { + return nil, invalidErr("ConsumerConfig.DurableName is required") + } + c, err := s.GetConsumer(ctx, config.DurableName) + if err == nil { + return c, nil + } + if IsServerCode(err, "no_such_consumer") { + return s.CreateConsumer(ctx, config) + } + return nil, err +} + +// GetConsumer returns a handle to an existing consumer. +func (s *Stream) GetConsumer(ctx context.Context, name string) (*Consumer, error) { + c := s.client.streamsClient() + r, err := c.GetConsumerInfo(ctx, &pb.GetConsumerInfoRequest{ + Stream: s.Name, + Consumer: name, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newConsumer(s.client, s.Name, name), nil +} + +// DeleteConsumer deletes a consumer by name. +func (s *Stream) DeleteConsumer(ctx context.Context, name string) error { + c := s.client.streamsClient() + r, err := c.DeleteConsumer(ctx, &pb.DeleteConsumerRequest{ + Stream: s.Name, + Consumer: name, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// --- Consumer --- + +// DeliverPolicy controls where a consumer starts delivering. +type DeliverPolicy int + +const ( + DeliverAll DeliverPolicy = iota // from the first message + DeliverNew // from messages published after subscription + DeliverLast // from the last message + DeliverByStartSeq // from a given sequence + DeliverByStartTime // from a given timestamp +) + +// ConsumerConfig is the consumer creation config. +type ConsumerConfig struct { + DurableName string + FilterSubject string + DeliverPolicy DeliverPolicy + StartSeq uint64 // for DeliverByStartSeq + StartTimeMs int64 // for DeliverByStartTime + AckWait time.Duration + MaxDeliver uint32 + DeliverGroup string + DeadLetterSubject string +} + +func (c ConsumerConfig) toPB() *pb.ConsumerConfigPb { + ackWaitMs := uint64(30_000) + if c.AckWait > 0 { + ackWaitMs = uint64(c.AckWait.Milliseconds()) + } + maxDeliver := c.MaxDeliver + if maxDeliver == 0 { + maxDeliver = 5 + } + + var policy *pb.DeliveryPolicyPb + switch c.DeliverPolicy { + case DeliverNew: + now := time.Now().UnixMilli() + policy = &pb.DeliveryPolicyPb{ + Type: pb.DeliveryPolicyType_DELIVERY_BY_START_TIME, + StartTimeMs: now, + } + case DeliverLast: + policy = &pb.DeliveryPolicyPb{Type: pb.DeliveryPolicyType_DELIVERY_LAST} + case DeliverByStartSeq: + policy = &pb.DeliveryPolicyPb{ + Type: pb.DeliveryPolicyType_DELIVERY_BY_START_SEQ, + StartSeq: c.StartSeq, + } + case DeliverByStartTime: + policy = &pb.DeliveryPolicyPb{ + Type: pb.DeliveryPolicyType_DELIVERY_BY_START_TIME, + StartTimeMs: c.StartTimeMs, + } + default: // DeliverAll + policy = &pb.DeliveryPolicyPb{Type: pb.DeliveryPolicyType_DELIVERY_ALL} + } + + return &pb.ConsumerConfigPb{ + Name: c.DurableName, + FilterSubject: c.FilterSubject, + DeliveryPolicy: policy, + AckWaitMs: ackWaitMs, + MaxDeliver: maxDeliver, + DeliverGroup: c.DeliverGroup, + DeadLetterSubject: c.DeadLetterSubject, + } +} + +// Consumer is a consumer handle. Cheap to copy. +type Consumer struct { + client *Client + StreamName string + Name string +} + +func newConsumer(c *Client, stream, name string) *Consumer { + return &Consumer{client: c, StreamName: stream, Name: name} +} + +// --- Message --- + +// Message is a delivered message. Carries enough context to Ack/Nak/Term/ +// InProgress through the parent consumer. +type Message struct { + Subject string + Payload []byte + Headers [][2]string + Sequence uint64 + TsMs int64 + DeliverCount uint32 + + client *Client + stream string + consumer string +} + +func msgFromPB(c *Client, stream, consumer string, m *pb.MessagePb) *Message { + hdrs := make([][2]string, len(m.GetHeaders())) + for i, h := range m.GetHeaders() { + hdrs[i] = [2]string{h.GetKey(), h.GetValue()} + } + return &Message{ + Subject: m.GetSubject(), + Payload: m.GetPayload(), + Headers: hdrs, + Sequence: m.GetSeq(), + TsMs: m.GetTsMs(), + DeliverCount: m.GetDeliverCount(), + client: c, + stream: stream, + consumer: consumer, + } +} + +// Ack positively acknowledges the message. +func (m *Message) Ack(ctx context.Context) error { + c := m.client.streamsClient() + r, err := c.Ack(ctx, &pb.AckRequest{Stream: m.stream, Consumer: m.consumer, Seq: m.Sequence}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Nak negatively acknowledges — request immediate redelivery. +func (m *Message) Nak(ctx context.Context) error { + return m.NakWithDelay(ctx, 0) +} + +// NakWithDelay negatively acknowledges with a redelivery delay. +func (m *Message) NakWithDelay(ctx context.Context, delay time.Duration) error { + c := m.client.streamsClient() + r, err := c.Nak(ctx, &pb.NakRequest{ + Stream: m.stream, + Consumer: m.consumer, + Seq: m.Sequence, + DelayMs: uint64(delay.Milliseconds()), + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// Term terminates delivery permanently regardless of max_deliver. +func (m *Message) Term(ctx context.Context) error { + c := m.client.streamsClient() + r, err := c.Term(ctx, &pb.TermRequest{Stream: m.stream, Consumer: m.consumer, Seq: m.Sequence}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// InProgress extends the ack_wait window without acking. +func (m *Message) InProgress(ctx context.Context) error { + c := m.client.streamsClient() + r, err := c.InProgress(ctx, &pb.InProgressRequest{Stream: m.stream, Consumer: m.consumer, Seq: m.Sequence}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// --- Consumer methods --- + +// Messages opens a push-mode subscription. Returns a *Messages iterator. +func (con *Consumer) Messages(ctx context.Context) (*Messages, error) { + return con.MessagesWithBatchSize(ctx, 0) +} + +// MessagesWithBatchSize opens a subscription with a custom server-side batch +// hint. 0 = server default. +func (con *Consumer) MessagesWithBatchSize(ctx context.Context, batchSize uint32) (*Messages, error) { + c := con.client.streamsClient() + stream, err := c.Subscribe(ctx, &pb.SubscribeRequest{ + Stream: con.StreamName, + Consumer: con.Name, + BatchSize: batchSize, + StopWhenEmpty: false, + }) + if err != nil { + return nil, rpcErr(err) + } + return &Messages{ + inner: stream, + client: con.client, + stream: con.StreamName, + consumer: con.Name, + }, nil +} + +// Fetch pull-style: fetches up to batchSize messages immediately. +func (con *Consumer) Fetch(ctx context.Context, batchSize uint32) ([]*Message, error) { + c := con.client.streamsClient() + r, err := c.Fetch(ctx, &pb.FetchRequest{ + Stream: con.StreamName, + Consumer: con.Name, + BatchSize: batchSize, + }) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + msgs := make([]*Message, len(r.GetMessages())) + for i, m := range r.GetMessages() { + msgs[i] = msgFromPB(con.client, con.StreamName, con.Name, m) + } + return msgs, nil +} + +// --- Messages iterator --- + +// Messages is a push-mode subscription iterator. Call Next to get each +// delivered message. Receiving from Messages is blocking; cancel the ctx +// to stop. +type Messages struct { + inner pb.WaymakerStreamsService_SubscribeClient + client *Client + stream string + consumer string +} + +// Next blocks until the next message arrives or an error occurs. +// Returns (nil, nil) on normal end-of-stream. +func (m *Messages) Next() (*Message, error) { + for { + ev, err := m.inner.Recv() + if err != nil { + if err == io.EOF { + return nil, nil + } + return nil, rpcErr(err) + } + switch e := ev.GetEvent().(type) { + case *pb.SubscribeEvent_Message: + return msgFromPB(m.client, m.stream, m.consumer, e.Message), nil + case *pb.SubscribeEvent_Stopped: + if e.Stopped.GetReason() == "" { + return nil, nil + } + return nil, serverErr("subscribe_stopped", e.Stopped.GetReason()) + } + } +} + +// --- Client entry points for streams --- + +// CreateStream creates a new stream. +func (c *Client) CreateStream(ctx context.Context, config StreamConfig) (*Stream, error) { + sc := c.streamsClient() + r, err := sc.CreateStream(ctx, &pb.CreateStreamRequest{Config: config.toPB()}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newStream(c, config.Name), nil +} + +// GetStream returns a handle to an existing stream. Confirms existence +// via GetStreamInfo. +func (c *Client) GetStream(ctx context.Context, name string) (*Stream, error) { + sc := c.streamsClient() + r, err := sc.GetStreamInfo(ctx, &pb.GetStreamInfoRequest{Name: name}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + return newStream(c, name), nil +} + +// GetOrCreateStream is the idempotent create-or-get. +func (c *Client) GetOrCreateStream(ctx context.Context, config StreamConfig) (*Stream, error) { + s, err := c.GetStream(ctx, config.Name) + if err == nil { + return s, nil + } + if IsServerCode(err, "no_such_stream") { + return c.CreateStream(ctx, config) + } + return nil, err +} + +// UpdateStream applies the mutable subset of a stream's config. +func (c *Client) UpdateStream(ctx context.Context, name string, update StreamUpdate) error { + var maxAgeMs *uint64 + if update.MaxAge != nil { + v := uint64(update.MaxAge.Milliseconds()) + maxAgeMs = &v + } + sc := c.streamsClient() + r, err := sc.UpdateStream(ctx, &pb.UpdateStreamRequest{ + Name: name, + MaxAgeMs: maxAgeMs, + MaxMsgs: update.MaxMessages, + MaxBytes: update.MaxBytes, + MaxMsgBytes: update.MaxMsgBytes, + StrictLimits: update.StrictLimits, + }) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// DeleteStream deletes a stream and all its consumers. +func (c *Client) DeleteStream(ctx context.Context, name string) error { + sc := c.streamsClient() + r, err := sc.DeleteStream(ctx, &pb.DeleteStreamRequest{Name: name}) + if err != nil { + return rpcErr(err) + } + if !r.GetSuccess() { + return serverErr(r.GetResultCode(), r.GetMessage()) + } + return nil +} + +// GetStreamSources enumerates every (sourcing, source) tail running on +// the node serving the request. Multi-node clusters need to query each +// node. +func (c *Client) GetStreamSources(ctx context.Context) ([]SourceStatus, error) { + sc := c.streamsClient() + r, err := sc.GetStreamSources(ctx, &pb.GetStreamSourcesRequest{}) + if err != nil { + return nil, rpcErr(err) + } + if !r.GetSuccess() { + return nil, serverErr(r.GetResultCode(), r.GetMessage()) + } + out := make([]SourceStatus, len(r.GetEntries())) + for i, e := range r.GetEntries() { + out[i] = SourceStatus{ + SourcingStream: e.GetSourcingStream(), + SourceStream: e.GetSourceStream(), + LastSourcedSeq: e.GetLastSourcedSeq(), + PulledTotal: e.GetPulledTotal(), + LastError: e.GetLastError(), + LastErrorTsMs: e.GetLastErrorTsMs(), + } + } + return out, nil +} diff --git a/go/util.go b/go/util.go new file mode 100644 index 0000000..a9c837b --- /dev/null +++ b/go/util.go @@ -0,0 +1,9 @@ +package waymaker + +import "crypto/rand" + +// cryptoRandRead is a thin wrapper so lock.go can call it without importing +// crypto/rand directly (keeps the import set tidy). +func cryptoRandRead(b []byte) (int, error) { + return rand.Read(b) +} diff --git a/proto/cache.proto b/proto/cache.proto new file mode 100644 index 0000000..ae41bc1 --- /dev/null +++ b/proto/cache.proto @@ -0,0 +1,64 @@ +syntax = "proto3"; +package waymaker.cache; + +option go_package = "/apis/waymaker_cache"; + +// ============================================================ +// WaymakerCacheService — generic TTL / eviction layer over any +// bucket-shaped store (KV, Hash, Set). Methods are deliberately +// minimal at this stage; the design will land alongside the +// first concrete eviction policy (LRU, ARC, expiry-driven). +// +// Phase-5 milestone: +// - This proto pins the crate layout + the wire namespace +// (`waymaker.cache`) so clients don't need to migrate when +// real handlers ship. +// - The server registers the service but every RPC returns +// `Unimplemented` until the policy work lands. +// ============================================================ + +service WaymakerCacheService { + // Apply a TTL policy to a bucket. `policy_id` selects from + // server-configured policies (initially: `lru`, `expiry`). + rpc AttachPolicy (AttachPolicyRequest) returns (AttachPolicyResponse); + + // Detach the policy currently bound to `bucket` (no-op if + // none). + rpc DetachPolicy (DetachPolicyRequest) returns (DetachPolicyResponse); + + // Report current cache stats (hit/miss/eviction counters, + // memory footprint) for a bucket. + rpc Stats (StatsRequest) returns (StatsResponse); +} + +message AttachPolicyRequest { + string bucket = 1; + string policy_id = 2; + // Policy-specific knobs (e.g. `max_entries`, `default_ttl_ms`) + // — interpretation is server-side. + map params = 3; +} +message AttachPolicyResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message DetachPolicyRequest { string bucket = 1; } +message DetachPolicyResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message StatsRequest { string bucket = 1; } +message StatsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 hit_count = 4; + uint64 miss_count = 5; + uint64 eviction_count = 6; + uint64 size_bytes = 7; + uint64 entry_count = 8; +} diff --git a/proto/collections.proto b/proto/collections.proto new file mode 100644 index 0000000..4df5832 --- /dev/null +++ b/proto/collections.proto @@ -0,0 +1,288 @@ +syntax = "proto3"; +package waymaker.collections; + +option go_package = "/apis/waymaker_collections"; + +// ============================================================ +// WaymakerCollectionsService — Hash / Set / Queue data +// structures layered on streams. Each store name is the +// underlying stream name; subjects encode the +// (hash_key|set_key) + (field|member) tuple; member-existence +// uses a "1" marker payload (Set) or per-field values (Hash). +// +// Lives in its own proto + crate so the wire surface is +// composable; handlers continue to share `StreamsController` +// state in the server crate. +// ============================================================ + +service WaymakerCollectionsService { + // ----- Hash ------------------------------------------------- + rpc CreateHashStore (CreateHashStoreRequest) returns (CreateHashStoreResponse); + rpc DeleteHashStore (DeleteHashStoreRequest) returns (DeleteHashStoreResponse); + rpc HashSet (HashSetRequest) returns (HashSetResponse); + rpc HashGet (HashGetRequest) returns (HashGetResponse); + rpc HashExists (HashExistsRequest) returns (HashExistsResponse); + rpc HashDelete (HashDeleteRequest) returns (HashDeleteResponse); + rpc HashGetAll (HashGetAllRequest) returns (HashGetAllResponse); + rpc HashFields (HashFieldsRequest) returns (HashFieldsResponse); + rpc HashLen (HashLenRequest) returns (HashLenResponse); + + // ----- Set -------------------------------------------------- + rpc CreateSetStore (CreateSetStoreRequest) returns (CreateSetStoreResponse); + rpc DeleteSetStore (DeleteSetStoreRequest) returns (DeleteSetStoreResponse); + rpc SetAdd (SetAddRequest) returns (SetAddResponse); + rpc SetRemove (SetRemoveRequest) returns (SetRemoveResponse); + rpc SetIsMember (SetIsMemberRequest) returns (SetIsMemberResponse); + rpc SetMembers (SetMembersRequest) returns (SetMembersResponse); + rpc SetLen (SetLenRequest) returns (SetLenResponse); + + // ----- Queue ------------------------------------------------ + rpc CreateQueue (CreateQueueRequest) returns (CreateQueueResponse); + rpc DeleteQueue (DeleteQueueRequest) returns (DeleteQueueResponse); + rpc QueuePush (QueuePushRequest) returns (QueuePushResponse); + rpc QueuePop (QueuePopRequest) returns (QueuePopResponse); + rpc QueueRange (QueueRangeRequest) returns (QueueRangeResponse); + rpc QueueLen (QueueLenRequest) returns (QueueLenResponse); +} + +// ===== Hash ================================================== + +message CreateHashStoreRequest { + string name = 1; + uint64 max_bytes = 2; + bool ephemeral = 3; +} +message CreateHashStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteHashStoreRequest { string name = 1; } +message DeleteHashStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HashSetRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; + bytes value = 4; +} +message HashSetResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 revision = 4; +} + +message HashGetRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashGetResponse { + bool success = 1; + string result_code = 2; + string message = 3; + optional bytes value = 4; + uint64 revision = 5; +} + +message HashExistsRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashExistsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + bool exists = 4; +} + +message HashDeleteRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HashGetAllRequest { + string bucket = 1; + string hash_key = 2; +} +message HashGetAllResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated HashFieldEntry entries = 4; +} +message HashFieldEntry { + string field = 1; + bytes value = 2; + uint64 revision = 3; +} + +message HashFieldsRequest { + string bucket = 1; + string hash_key = 2; +} +message HashFieldsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated string fields = 4; +} + +message HashLenRequest { + string bucket = 1; + string hash_key = 2; +} +message HashLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} + +// ===== Set ==================================================== + +message CreateSetStoreRequest { + string name = 1; + uint64 max_bytes = 2; + bool ephemeral = 3; +} +message CreateSetStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteSetStoreRequest { string name = 1; } +message DeleteSetStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetAddRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetRemoveRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetRemoveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetIsMemberRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetIsMemberResponse { + bool success = 1; + string result_code = 2; + string message = 3; + bool is_member = 4; +} + +message SetMembersRequest { + string bucket = 1; + string set_key = 2; +} +message SetMembersResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated string members = 4; +} + +message SetLenRequest { + string bucket = 1; + string set_key = 2; +} +message SetLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} + +// ===== Queue ================================================= + +message CreateQueueRequest { + string name = 1; + uint64 max_bytes = 2; + uint64 max_messages = 3; + bool ephemeral = 4; +} +message CreateQueueResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteQueueRequest { string name = 1; } +message DeleteQueueResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message QueuePushRequest { + string bucket = 1; + bytes value = 2; +} +message QueuePushResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 sequence = 4; +} + +message QueuePopRequest { + string bucket = 1; +} +message QueuePopResponse { + bool success = 1; + string result_code = 2; + string message = 3; + optional bytes value = 4; +} + +message QueueRangeRequest { + string bucket = 1; + uint64 from_sequence = 2; + uint64 limit = 3; +} +message QueueRangeResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated bytes values = 4; +} + +message QueueLenRequest { string bucket = 1; } +message QueueLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} diff --git a/proto/kv.proto b/proto/kv.proto new file mode 100644 index 0000000..df777de --- /dev/null +++ b/proto/kv.proto @@ -0,0 +1,207 @@ +syntax = "proto3"; +package waymaker.kv; + +option go_package = "/apis/waymaker_kv"; + +// ============================================================ +// WaymakerKvService — distributed key-value store implemented +// as a thin façade over the streams subsystem. Each KV bucket +// is backed by a stream named `kv:`; KV revisions are +// stream sequence numbers; KV deletes are tombstones (per the +// WIRE_SPEC.md tombstone header convention). +// +// The service lives in its own proto so the wire surface is +// composable: an operator could ship a KV-only build, or layer +// KV on top of someone else's streams implementation. +// ============================================================ + +service WaymakerKvService { + // ----- Bucket lifecycle ------------------------------------- + rpc CreateBucket (KvCreateBucketRequest) returns (KvCreateBucketResponse); + rpc DeleteBucket (KvDeleteBucketRequest) returns (KvDeleteBucketResponse); + + // ----- Mutations -------------------------------------------- + rpc Put (KvPutRequest) returns (KvPutResponse); + // CAS create — succeeds only when the key has never been + // written or its current value is a tombstone. + rpc Create (KvCreateRequest) returns (KvPutResponse); + // CAS update — succeeds only when `expected_revision` + // matches the server-side revision. + rpc Update (KvUpdateRequest) returns (KvPutResponse); + rpc Delete (KvDeleteRequest) returns (KvDeleteResponse); + + // ----- Reads ------------------------------------------------ + rpc Get (KvGetRequest) returns (KvGetResponse); + rpc Keys (KvKeysRequest) returns (KvKeysResponse); + rpc History (KvHistoryRequest) returns (KvHistoryResponse); + + // ----- TTL refresh ------------------------------------------ + rpc Touch (KvTouchRequest) returns (KvPutResponse); + + // ----- Watch ------------------------------------------------ + // Server-streamed event flow for a single bucket. When `key` + // is empty, every put/delete in the bucket fans out; when + // `key` is set, only events at that key are emitted. + rpc Watch (KvWatchRequest) returns (stream KvWatchEvent); +} + +message KvCreateBucketRequest { + string bucket = 1; + uint64 max_bytes = 2; // 0 = unbounded + uint64 max_value_size = 3; // 0 = no per-value cap + // Bucket-level TTL (ms). 0 = no time-based eviction. + // Independent of per-key TTL set via Put. + uint64 max_age_ms = 4; + bool ephemeral = 5; + // Per-key revision cap. 0 (default) = unbounded — history depth + // is then bounded only by the bucket's stream-level retention + // (max_age_ms / max_bytes). When N > 0, after each successful + // write to a key, older revisions of *that key* beyond the N + // most recent are dropped via per-message pruning. Useful when + // one bucket hosts many keys with very different write rates — + // a fast-churning key won't crowd out older revisions of a + // slow-changing key. NATS JetStream's "MaxRevisions" semantic. + uint64 max_revisions = 6; +} + +message KvCreateBucketResponse { + bool success = 1; + string result_code = 2; // "ok" | "already_exists" | "invalid_config" | "internal" + string message = 3; +} + +message KvDeleteBucketRequest { string bucket = 1; } +message KvDeleteBucketResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; +} + +message KvPutRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + uint64 ttl_ms = 4; // per-key TTL; 0 = no TTL +} + +message KvCreateRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + uint64 ttl_ms = 4; +} + +message KvUpdateRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + // The revision the caller believes is current. Server returns + // wrong_revision if mismatch. + uint64 expected_revision = 4; + uint64 ttl_ms = 5; +} + +message KvPutResponse { + bool success = 1; + // "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" + string result_code = 2; + string message = 3; + uint64 revision = 4; +} + +message KvGetRequest { + string bucket = 1; + string key = 2; +} + +message KvGetResponse { + bool success = 1; + string result_code = 2; + string message = 3; + optional KvEntry entry = 4; +} + +message KvEntry { + bytes value = 1; + uint64 revision = 2; + int64 ts_ms = 3; +} + +message KvDeleteRequest { + string bucket = 1; + string key = 2; +} + +message KvDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 revision = 4; +} + +message KvKeysRequest { string bucket = 1; } + +message KvKeysResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated KvKeyEntry entries = 4; +} + +message KvKeyEntry { + string key = 1; + uint64 revision = 2; + bool deleted = 3; +} + +message KvHistoryRequest { + string bucket = 1; + string key = 2; + uint64 from_revision = 3; // 0 = from beginning + uint64 limit = 4; // 0 = server default +} + +message KvHistoryResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated KvHistoryEntry entries = 4; +} + +message KvHistoryEntry { + bytes value = 1; + uint64 revision = 2; + int64 ts_ms = 3; + bool deleted = 4; +} + +message KvTouchRequest { + string bucket = 1; + string key = 2; + uint64 ttl_ms = 3; +} + +message KvWatchRequest { + string bucket = 1; + string key = 2; // empty = whole bucket +} + +message KvWatchEvent { + oneof event { + KvPutEvent put = 1; + KvDeleteEvent delete = 2; + } +} + +message KvPutEvent { + string key = 1; + bytes value = 2; + uint64 revision = 3; + int64 ts_ms = 4; +} + +message KvDeleteEvent { + string key = 1; + uint64 revision = 2; + int64 ts_ms = 3; +} diff --git a/proto/sketches.proto b/proto/sketches.proto new file mode 100644 index 0000000..292e11a --- /dev/null +++ b/proto/sketches.proto @@ -0,0 +1,366 @@ +syntax = "proto3"; +package waymaker.sketches; + +option go_package = "/apis/waymaker_sketches"; + +// In-memory probabilistic data structures: Bloom filter, +// HyperLogLog, Count-Min Sketch, Top-K, t-digest. +// +// Storage model: +// - State is opaque binary per filter, owned by the ring's +// hash-owner for the filter's name. +// - Periodic snapshot replication pushes the bytes to N-1 +// secondaries via ReplicateProbState. Adoption sweep promotes +// replicas to primary on ring shifts. +// - Disk persistence: every ~60s, owned filters snapshot to +// /probabilistic//.bin via tempfile + +// rename. Hydrated on controller startup. +// - Ephemeral by default — survives node failover + process +// restart, full-cluster restart without prior snapshot loses +// state. +// +// See specs/WIRE_SPEC.md (top-level) for the serialization byte +// layout per type — cross-language clients implement against that +// document for the replication state-transfer protocol. + +service WaymakerSketchesService { + // ----- Bloom filter ----- + rpc BloomReserve (BloomReserveRequest) returns (BloomReserveResponse); + rpc BloomAdd (BloomAddRequest) returns (BloomAddResponse); + rpc BloomMultiAdd (BloomMultiAddRequest) returns (BloomMultiAddResponse); + rpc BloomExists (BloomExistsRequest) returns (BloomExistsResponse); + rpc BloomMultiExists (BloomMultiExistsRequest) returns (BloomMultiExistsResponse); + rpc BloomInfo (BloomInfoRequest) returns (BloomInfoResponse); + rpc BloomDelete (BloomDeleteRequest) returns (BloomDeleteResponse); + + // ----- HyperLogLog ----- + rpc HllReserve (HllReserveRequest) returns (HllReserveResponse); + rpc HllAdd (HllAddRequest) returns (HllAddResponse); + rpc HllCount (HllCountRequest) returns (HllCountResponse); + rpc HllMerge (HllMergeRequest) returns (HllMergeResponse); + rpc HllDelete (HllDeleteRequest) returns (HllDeleteResponse); + + // ----- Count-Min Sketch ----- + rpc CmsReserve (CmsReserveRequest) returns (CmsReserveResponse); + rpc CmsIncrBy (CmsIncrByRequest) returns (CmsIncrByResponse); + rpc CmsQuery (CmsQueryRequest) returns (CmsQueryResponse); + rpc CmsDelete (CmsDeleteRequest) returns (CmsDeleteResponse); + + // ----- Top-K ----- + rpc TopKReserve (TopKReserveRequest) returns (TopKReserveResponse); + rpc TopKAdd (TopKAddRequest) returns (TopKAddResponse); + rpc TopKQuery (TopKQueryRequest) returns (TopKQueryResponse); + rpc TopKList (TopKListRequest) returns (TopKListResponse); + rpc TopKDelete (TopKDeleteRequest) returns (TopKDeleteResponse); + + // ----- t-digest ----- + rpc TDigestCreate (TDigestCreateRequest) returns (TDigestCreateResponse); + rpc TDigestAdd (TDigestAddRequest) returns (TDigestAddResponse); + rpc TDigestQuantile (TDigestQuantileRequest) returns (TDigestQuantileResponse); + rpc TDigestMinMax (TDigestMinMaxRequest) returns (TDigestMinMaxResponse); + rpc TDigestDelete (TDigestDeleteRequest) returns (TDigestDeleteResponse); + + // Internal: snapshot replication. Primary pushes serialized + // filter state to N-1 secondaries periodically. Version counter + // dedupes out-of-order pushes. + rpc ReplicateProbState (ReplicateProbStateRequest) returns (ReplicateProbStateResponse); +} + +// ===== Bloom filter =========================================== + +message BloomReserveRequest { + string name = 1; + uint64 capacity = 2; + double error_rate = 3; +} +message BloomReserveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message BloomAddRequest { + string name = 1; + bytes item = 2; +} +message BloomAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message BloomMultiAddRequest { + string name = 1; + repeated bytes items = 2; +} +message BloomMultiAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message BloomExistsRequest { + string name = 1; + bytes item = 2; +} +message BloomExistsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + bool exists = 4; +} + +message BloomMultiExistsRequest { + string name = 1; + repeated bytes items = 2; +} +message BloomMultiExistsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated bool exists = 4; +} + +message BloomInfoRequest { string name = 1; } +message BloomInfoResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 capacity = 4; + double error_rate = 5; + uint64 bits_set = 6; + uint64 bit_count = 7; + uint32 hash_count = 8; + uint64 items_added = 9; +} + +message BloomDeleteRequest { string name = 1; } +message BloomDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +// ===== HyperLogLog ============================================ + +message HllReserveRequest { + string name = 1; + uint32 precision = 2; +} +message HllReserveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HllAddRequest { + string name = 1; + repeated bytes items = 2; +} +message HllAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HllCountRequest { string name = 1; } +message HllCountResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 estimate = 4; +} + +message HllMergeRequest { + string destination = 1; + repeated string sources = 2; +} +message HllMergeResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HllDeleteRequest { string name = 1; } +message HllDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +// ===== Count-Min Sketch ======================================= + +message CmsReserveRequest { + string name = 1; + uint64 width = 2; + uint64 depth = 3; +} +message CmsReserveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message CmsIncrByItem { + bytes item = 1; + uint64 count = 2; +} +message CmsIncrByRequest { + string name = 1; + repeated CmsIncrByItem items = 2; +} +message CmsIncrByResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated uint64 counts = 4; +} + +message CmsQueryRequest { + string name = 1; + repeated bytes items = 2; +} +message CmsQueryResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated uint64 counts = 4; +} + +message CmsDeleteRequest { string name = 1; } +message CmsDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +// ===== Top-K ================================================== + +message TopKReserveRequest { + string name = 1; + uint32 k = 2; + uint64 width = 3; + uint64 depth = 4; + double decay = 5; +} +message TopKReserveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message TopKAddRequest { + string name = 1; + repeated bytes items = 2; +} +message TopKAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated bytes evicted = 4; +} + +message TopKQueryRequest { + string name = 1; + repeated bytes items = 2; +} +message TopKQueryResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated bool in_top_k = 4; +} + +message TopKListRequest { string name = 1; } +message TopKListResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated TopKEntry entries = 4; +} +message TopKEntry { + bytes item = 1; + uint64 count = 2; +} + +message TopKDeleteRequest { string name = 1; } +message TopKDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +// ===== t-digest =============================================== + +message TDigestCreateRequest { + string name = 1; + uint32 compression = 2; +} +message TDigestCreateResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message TDigestAddRequest { + string name = 1; + repeated double values = 2; +} +message TDigestAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message TDigestQuantileRequest { + string name = 1; + repeated double quantiles = 2; +} +message TDigestQuantileResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated double values = 4; +} + +message TDigestMinMaxRequest { string name = 1; } +message TDigestMinMaxResponse { + bool success = 1; + string result_code = 2; + string message = 3; + double min = 4; + double max = 5; +} + +message TDigestDeleteRequest { string name = 1; } +message TDigestDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +// ===== Internal: snapshot replication ========================= + +enum ProbType { + PROB_UNSPECIFIED = 0; + PROB_BLOOM = 1; + PROB_HLL = 2; + PROB_CMS = 3; + PROB_TOPK = 4; + PROB_TDIGEST = 5; +} + +message ReplicateProbStateRequest { + ProbType type = 1; + string name = 2; + // Opaque binary snapshot — see specs/WIRE_SPEC.md "Probabilistic + // subsystem" for the per-type byte layout. + bytes snapshot = 3; + uint64 version = 4; +} + +message ReplicateProbStateResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} \ No newline at end of file diff --git a/proto/waymaker_locks.proto b/proto/waymaker_locks.proto new file mode 100644 index 0000000..f5b18c2 --- /dev/null +++ b/proto/waymaker_locks.proto @@ -0,0 +1,276 @@ +syntax = "proto3"; +package waymaker; + +// Specifies the Go package for the generated code. +option go_package = "/apis/waymaker"; + +// VERSION COMPATIBILITY POLICY +// ---------------------------- +// This proto is the wire contract for the WaymakerService gRPC API. +// To preserve backwards compatibility across rolling upgrades: +// +// 1. Existing field numbers MUST NOT be reused. To remove a field, +// add a `reserved ;` line instead. +// 2. Existing field types MUST NOT change. +// 3. New fields MUST be `optional` (proto3 default) and SHOULD have +// sensible zero-value semantics so old clients setting nothing +// and old servers ignoring the field both stay correct. +// 4. New enum values MUST be appended at the end. Never renumber. +// 5. The package name and service name MUST NOT change. +// 6. RPC removal is a major break — bump to a new package +// (e.g. `waymaker.v2`) instead. +// +// Reserved field numbers below are tombstones for fields that were +// considered but not yet shipped; do not reuse them. + +// WaymakerService defines a gRPC service for managing distributed locks. +service WaymakerService { + // Lock attempts to acquire a lock based on the provided LockRequest. + // The response is a stream of LockEvent messages that provide updates + // on the status of the lock acquisition. + rpc Lock (LockRequest) returns (stream LockEvent) {} + + // ReadLock attempts to acquire a read lock, which allows multiple readers + // but no writers to hold the lock simultaneously. The response is a stream + // of LockEvent messages that provide updates on the status of the lock acquisition. + rpc ReadLock (LockRequest) returns (stream LockEvent) {} + + // UnLock releases a previously acquired lock based on the provided UnLockRequest. + // The response is an UnLockResponse indicating the success or failure of the operation. + rpc UnLock (UnLockRequest) returns (UnLockResponse) {} + + // LeaseStatus retrieves the current status of a lock lease based on the provided + // LeaseStatusRequest. The response is a LeaseStatusResponse containing details + // about the lease. + rpc LeaseStatus (LeaseStatusRequest) returns (LeaseStatusResponse) {} + + // ExtendLease extends the lease of an already acquired lock based on the provided + // ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + // or failure of the operation and the updated lease information. + rpc ExtendLease (ExtendLeaseRequest) returns (ExtendLeaseResponse) {} + + // MultiLock acquires N locks atomically — all keys are granted or none are. + // The server sorts keys lexicographically to guarantee deadlock-free + // ordering between any two MultiLock callers (without this, callers asking + // for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + // applies to the whole batch as a single deadline, not per key. On any + // failure the server releases every key it already acquired in this batch + // before returning. Returns a unary response — no streaming. + rpc MultiLock (MultiLockRequest) returns (MultiLockResponse) {} + + // ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + // request (the node that owns each key via the consistent-hash ring). It is a + // read-only operator/introspection surface (waymaker-ctl `locks list`); it does + // NOT include waiters. An optional `key_prefix` filters the result server-side. + // In a multi-node cluster, call it on each node to see the full picture, since + // each node only holds the locks for the keys it owns. + rpc ListAcquiredLocks (ListAcquiredLocksRequest) returns (ListAcquiredLocksResponse) {} +} + +// LockEventType defines the various types of events that can occur during +// the lock acquisition process. +enum LockEventType { + Unknown = 0; // Default value when the event type is not known. + Waiting = 1; // Indicates that the lock request is waiting to be granted. + Acquired = 2; // Indicates that the lock has been successfully acquired. + Failed = 3; // Indicates that the lock request has failed. + Expired = 4; // Indicates that the lock has expired. + Heartbeat = 5; // Periodic event indicating that the lock is still active. +} + +// FenceScope controls ONE thing: how durable the per-key fence_token +// counter (the monotonic uint64) is across failures. Three things it does +// NOT control — do not conflate them with the scope: +// +// * Whether a HELD LOCK survives a node loss / rollout. That is +// cluster.replication-factor plus secondary adoption, and it already +// applies to every non-Ephemeral lock regardless of scope. A stronger +// scope does not make a lock survive; a replicated lease does. +// * Client-side transparency across a primary bounce. The lock client +// transparently re-binds its event stream and re-confirms ownership +// after a disconnect, but that is a client-lib behaviour — no scope +// value changes it. +// * Mutual exclusion. Holding the lock is NOT, by itself, a guarantee +// that no one else acts. The holder MUST validate fence_token at its +// own side effect (the DB write / object PUT) and reject anything +// carrying a fence below the last one it durably committed. Even +// ScopeQuorum does not let you skip that check — an all-at-once +// cluster restart can still drop an in-memory token. See USAGE.md +// "Fence tokens" for the enforcement rule. +// +// Unspecified: server treats as Ephemeral. +// Ephemeral: per-key counter in RAM on the owning node. Resets on +// process restart or hash-ring rebalance. Fast — no I/O. +// Right for rate limiting, cache lockout, advisory locks, +// anywhere fence resets across failure are tolerable. +// Local: per-key counter persisted to disk on the owning node. +// Survives process restart on the same node. Still resets +// on hash-ring rebalance (a different node has its own +// disk). One fsync per acquire (~1-5ms on SSD). +// Quorum: Raft-replicated per-key counter — cluster-wide monotonic, +// survives any single-node failure (the surviving quorum +// keeps the count). One Raft commit per acquire (~5ms). +// Requires the cluster Raft backend to be wired; a +// single-node or test build returns BadInput for this +// scope. Pick this when an external resource fences on the +// token and two holders must never see fences that fail to +// prove an ordering. (Named Quorum, not Global: the +// guarantee is "a Raft quorum agrees on the count", which +// carries its own limit and makes no geographic claim.) +enum FenceScope { + ScopeUnspecified = 0; + ScopeEphemeral = 1; + ScopeLocal = 2; + // Wire value 3 is unchanged from the former ScopeGlobal — old and new + // binaries interoperate mid-rollout; only the symbol name changed. + ScopeQuorum = 3; +} + +// LockRequest defines the parameters for requesting a lock. +message LockRequest { + string key = 1; // The unique key representing the lock. + uint32 max_wait_period = 2; // The maximum time (in milliseconds) to wait for the lock to be granted. + uint32 max_lease_period = 3; // The maximum time (in milliseconds) the lock can be held. + uint32 priority = 4; // The priority level of the lock request. + + string requester_info = 10; // Additional information about the requester. + string requester_application = 11; // The name of the application making the request. + string request_id = 12; // Idempotency key for retries of the same logical acquire request. + FenceScope fence_scope = 13; // Persistence/durability tier for fence_token. Defaults to Ephemeral. +} + +// LockEvent represents an event related to the lock acquisition process. +message LockEvent { + bool success = 1; // Indicates whether the event was successful. + LockEventType event_type = 2; // The type of event that occurred. + string message = 3; // A message providing additional details about the event. + string id = 4; // The unique identifier of the lock. + string key = 5; // The key associated with the lock. + int64 lease_expires_at = 6; // The timestamp (in Unix milliseconds) when the lease expires. + int64 acquired_at = 7; // The timestamp (in Unix milliseconds) when the lock was acquired. + int64 waiting_expires_at = 8; // The timestamp (in Unix milliseconds) when the waiting period expires. + // Monotonic-per-key fence token assigned at acquire. Increments by 1 per + // successful acquisition of `key`. 0 on non-Acquired events. + // + // Held in RAM on the consistent-hash-owning node. Monotonic within that + // node's process lifetime; resets to 0 across node restart, crash, or + // hash-ring rebalance. This is intentional — see README "Known + // limitations" and "When to use waymaker" for the use cases this suits + // vs. when to reach for a different tool (etcd / ZooKeeper / Consul). + uint64 fence_token = 9; +} + +// UnLockRequest defines the parameters for releasing a lock. +message UnLockRequest { + string key = 1; // The unique key representing the lock. + string id = 2; // The unique identifier of the lock to be released. +} + +// UnLockResponse represents the response to an UnLock request. +message UnLockResponse { + bool success = 1; // Indicates whether the unlock operation was successful. + string result_code = 2; // A code indicating the result of the unlock operation. + string message = 3; // A message providing additional details about the unlock operation. +} + +// Lease represents the details of a lock lease. +message Lease { + string id = 1; // The unique identifier of the lock. + string key = 2; // The key associated with the lock. + bool acquired = 3; // Indicates whether the lock has been acquired. + // Field 4 was historically unused; do not reuse. + reserved 4; + + uint32 priority = 5; // The priority level of the lock. + int64 created_at = 6; // The timestamp (in Unix milliseconds) when the lock was created. + int64 lease_expires_at = 7; // The timestamp (in Unix milliseconds) when the lease expires. + int64 waiting_expires_at = 8;// The timestamp (in Unix milliseconds) when the waiting period expires. + // Fence token assigned at acquire. See LockEvent.fence_token caveats. + uint64 fence_token = 9; +} + +// ExtendLeaseRequest defines the parameters for extending the lease of a lock. +message ExtendLeaseRequest { + string key = 1; // The unique key representing the lock. + string id = 2; // The unique identifier of the lock to extend the lease for. + uint32 lease_timeout = 3; // The additional time (in milliseconds) to extend the lease. + // The new lease expiration will be the current time + lease_timeout. +} + +// ExtendLeaseResponse represents the response to an ExtendLease request. +message ExtendLeaseResponse { + bool success = 1; // Indicates whether the lease extension was successful. + string result_code = 2; // A code indicating the result of the lease extension. + string message = 3; // A message providing additional details about the lease extension. + Lease lease = 4; // The updated lease details after the extension. +} + +// LeaseStatusRequest defines the parameters for retrieving the status of a lock lease. +message LeaseStatusRequest { + string key = 1; // The unique key representing the lock. + string id = 2; // The unique identifier of the lock to check the status of. +} + +// LeaseStatusResponse represents the response to a LeaseStatus request. +message LeaseStatusResponse { + bool success = 1; // Indicates whether the lease status retrieval was successful. + string result_code = 2; // A code indicating the result of the lease status retrieval. + string message = 3; // A message providing additional details about the lease status retrieval. + Lease lease = 4; // The current lease details for the lock. +} + +// A single (key, lock-kind) entry inside a MultiLockRequest. +message MultiLockKey { + string key = 1; // The unique key representing the lock. + bool write_lock = 2; // true = exclusive (write), false = shared (read). +} + +// MultiLockRequest defines the parameters for atomically acquiring N locks. +// See MultiLock RPC docs for ordering and rollback semantics. +message MultiLockRequest { + repeated MultiLockKey keys = 1; // 1..N keys to acquire. Re-ordered server-side. + uint32 max_wait_period = 2; // Total batch deadline (ms). Per-key budget is the remainder. + uint32 max_lease_period = 3; // Per-key lease length (ms). + uint32 priority = 4; // Priority applied to every key. + + string requester_info = 10; + string requester_application = 11; + string request_id = 12; // Idempotency key for the batch. + FenceScope fence_scope = 13; // Applies to every key in the batch. +} + +// MultiLockResponse — unary result of a MultiLock attempt. +message MultiLockResponse { + bool success = 1; // true iff all keys were acquired. + string result_code = 2; // "ok" | "timeout" | "no_keys" | "invalid_scope" | "internal" + string message = 3; // Free-form detail; empty on success. + // Populated only on success, in lexicographic key order (the order the + // server acquired them in). On failure this is empty and any locks + // briefly held during the attempt have already been released. + repeated Lease leases = 4; +} + +// ListAcquiredLocksRequest — filter for ListAcquiredLocks. +message ListAcquiredLocksRequest { + string key_prefix = 1; // Optional; empty = every held key on this node. +} + +// AcquiredLock — one lock currently HELD (not waiting) on the serving node. +message AcquiredLock { + string key = 1; // The lock key. + string lock_id = 2; // The holder's unique lock id. + bool write_lock = 3; // true = exclusive (write); false = shared (read). + uint32 priority = 4; // Priority the lock was acquired at. + uint64 fence_token = 5; // Fence token assigned at acquire. + int64 lease_expires_at = 6; // Lease expiry (epoch ms). + int64 acquired_at = 7; // Acquire time (epoch ms). + string request_id = 8; // Idempotency key of the acquire. + string requester_info = 9; // Caller-supplied requester metadata (free-form string). + string requester_application = 10; // Caller-supplied application name. +} + +// ListAcquiredLocksResponse — held locks on the serving node. +message ListAcquiredLocksResponse { + bool success = 1; + repeated AcquiredLock locks = 2; +} diff --git a/proto/waymaker_streams.proto b/proto/waymaker_streams.proto new file mode 100644 index 0000000..8dafd3e --- /dev/null +++ b/proto/waymaker_streams.proto @@ -0,0 +1,1864 @@ +syntax = "proto3"; +package waymaker.streams; + +option go_package = "/apis/waymaker_streams"; + +// VERSION COMPATIBILITY POLICY +// ---------------------------- +// Same rules as waymaker.proto: never reuse field numbers, append-only +// enums, no type changes, RPC removal = new package. See the comment +// at the top of waymaker.proto for the full rationale. +// +// This is the Phase-1 surface for the JetStream-lite streams subsystem. +// The handler set is intentionally narrow — pull-mode delivery only, +// unary RPCs only. Push consumers (server-streaming Subscribe) and +// admin streaming endpoints arrive in Phase 2. + +service WaymakerStreamsService { + // --- Stream lifecycle --- + rpc CreateStream (CreateStreamRequest) returns (CreateStreamResponse); + rpc DeleteStream (DeleteStreamRequest) returns (DeleteStreamResponse); + rpc GetStreamInfo (GetStreamInfoRequest) returns (GetStreamInfoResponse); + rpc ListStreams (ListStreamsRequest) returns (ListStreamsResponse); + // Slice 3 cross-stream sources admin: enumerate every + // (sourcing, source) tail running on this node, with current + // last_sourced_seq + pulled_total + last_error. Useful for + // operators auditing the cluster's source topology without + // ListStreams + GetStreamInfo per stream. + rpc GetStreamSources (GetStreamSourcesRequest) returns (GetStreamSourcesResponse); + // Update the *mutable* subset of a stream's config — the Limits + // retention bounds (max_age_ms / max_msgs / max_bytes), the per- + // message size cap, and the strict-limits toggle. Immutable fields + // (name, subjects_filter, block_size, retention policy type) are + // not touched. Lowering a bound triggers an immediate prune to + // bring stats under the new limit; the primary fans the resulting + // truncation out via `ReplicateTruncate` so secondaries mirror. + // Partial-update semantics: only fields explicitly set in the + // request are applied; unset fields leave the on-disk value + // unchanged. + rpc UpdateStream (UpdateStreamRequest) returns (UpdateStreamResponse); + + // --- Messages --- + rpc Publish (PublishRequest) returns (PublishResponse); + rpc Fetch (FetchRequest) returns (FetchResponse); + rpc Ack (AckRequest) returns (AckResponse); + + // KV RPCs moved to `WaymakerKvService` in + // `crates/kv/proto/kv.proto`. The underlying message types + // (KvPutRequest etc.) still live in this file because the + // server-internal helper `kv_publish_internal` still returns + // them; the KV service trait converts at the boundary. + + // Hash / Set / Queue collection RPCs moved to + // `WaymakerCollectionsService` in + // `crates/collections/proto/collections.proto`. Message types + // (HashSetRequest, etc.) still live in this proto file + // because some streams-internal helpers reference them; the + // collections service trait converts at the boundary. + + // Probabilistic data structures moved to their own service in + // `WaymakerSketchesService` (see crates/sketches/proto/sketches.proto). + + // Negative-acknowledge: server resets the pending entry's + // delivered_at_ms so the next fetch redelivers. `delay_ms` defers + // eligibility by that wall-clock window (0 = immediate). The + // message's `deliver_count` keeps climbing toward `max_deliver`. + rpc Nak (NakRequest) returns (NakResponse); + // Terminal-acknowledge: drop the pending entry permanently + // without redelivery, regardless of `max_deliver`. Does NOT + // trigger WorkQueue delete — other consumers can still observe + // the message. + rpc Term (TermRequest) returns (TermResponse); + // Heartbeat-acknowledge: bump delivered_at_ms = now to extend + // the ack_wait window. `deliver_count` is unchanged. + rpc InProgress (InProgressRequest) returns (InProgressResponse); + // Push-mode delivery: the server fetches in a loop and streams + // each delivered message back to the client as it arrives. The + // client acks via the unary Ack RPC just like pull-mode. The + // stream stays open until the client disconnects, the server + // returns an error, or the consumer is deleted. Wakes + // immediately on new appends via the storage layer's subscribe + // primitive — no polling for empty streams. + rpc Subscribe (SubscribeRequest) returns (stream SubscribeEvent); + + // --- Consumers --- + rpc CreateConsumer (CreateConsumerRequest) returns (CreateConsumerResponse); + rpc DeleteConsumer (DeleteConsumerRequest) returns (DeleteConsumerResponse); + rpc ListConsumers (ListConsumersRequest) returns (ListConsumersResponse); + rpc GetConsumerInfo (GetConsumerInfoRequest) returns (GetConsumerInfoResponse); + + // --- Rebalancing (Phase 1: operator-driven only) --- + // + // The current owner of a stream serves its raw redb bytes to a peer + // that's pulling the stream over. The handler atomically removes the + // stream from its local registry first, refusing the call if any + // outside reference is still live (operator must drain writers). On + // RPC success the source deletes the local file. See + // STREAMS_SPEC.md §11 for the model and limitations (no automatic + // ring-change sweep yet; the operator is responsible for triggering + // a migrate when membership moves a stream's authority). + rpc TransferStream (TransferStreamRequest) + returns (stream TransferStreamChunk); + + // Admin trigger on the receiving side: pull stream `name` from + // `source_node_id`'s `TransferStream` and own it locally. + rpc MigrateStream (MigrateStreamRequest) returns (MigrateStreamResponse); + + // Cluster-wide stream inventory + skew report. The receiving node + // queries every cluster member's local `StreamsRegistry` (via the + // existing proxy channel pool) and aggregates the result. Used by + // operators to identify hash-skew imbalance before triggering + // `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + rpc GetClusterStreamStats (GetClusterStreamStatsRequest) + returns (GetClusterStreamStatsResponse); + + // Server-streamed admin watch — emits a WatchEvent each time the + // local node's state mutates (stream / consumer create / delete / + // update). Useful for live dashboards or service-discovery + // clients that want to react to topology changes without + // polling. Local-only for now: each watcher sees events generated + // on the node it connected to. Cluster-wide watch can be built + // on top via a fan-out client; the server doesn't fan out + // automatically because the events would arrive out of any + // single-source ordering anyway under proxy hops. + rpc WatchStreams (WatchStreamsRequest) returns (stream WatchEvent); + + // Read the latest message at a given subject within a stream. + // The foundation for KV-style "last-value wins" lookups on top + // of a stream — KV put = Publish to `.`; KV get = + // this RPC against the same subject. Returns the full + // MessagePb (including headers) so callers can detect KV + // tombstones (`wmkv.tombstone` header). + // + // Returns `success: true` with `message` unset when no message + // has ever been published at this subject (or all have been + // pruned). Routes via `try_route!` like every other per-stream + // RPC. + rpc ReadLatestAtSubject (ReadLatestAtSubjectRequest) + returns (ReadLatestAtSubjectResponse); + + // List every distinct subject in `stream` whose name starts + // with `prefix`. Cost is O(matching subjects); independent of + // message count. The foundation for `streams-cli kv-keys` and + // service-discovery-style "everything under this namespace" + // lookups. Returns subjects whose latest message is a + // tombstone too — clients that want live-keys-only filter + // tombstones via a follow-up `ReadLatestAtSubject`. + rpc ListSubjectsByPrefix (ListSubjectsByPrefixRequest) + returns (ListSubjectsByPrefixResponse); + + // Scan all messages published at an exact subject within + // `stream`, in seq order, starting at `from_seq` (0 = from the + // beginning), bounded by `limit`. The foundation for + // `streams-cli kv-history` — operators want to inspect every + // value ever published under a KV key (including tombstones) + // for debugging/audit. Cost is O(matching messages); independent + // of total stream size. Routes via `try_route!` like every + // other per-stream RPC. + rpc ScanExactAtSubject (ScanExactAtSubjectRequest) + returns (ScanExactAtSubjectResponse); + + // Remove a Phase 3 per-stream authority override. Routing + // reverts to the ring's hash owner. Idempotent: clearing a + // stream with no override succeeds silently. Operators use this + // to retire a stale override (e.g. after a ring shift made the + // override redundant). Commits via a Raft entry so the clear + // applies on every node before the response returns. + rpc ClearStreamAuthority (ClearStreamAuthorityRequest) + returns (ClearStreamAuthorityResponse); + + // List every Phase 3 stream_authority override active on the + // responding node. The map is Raft-replicated, so any node's + // response reflects the cluster-wide view (modulo apply lag). + // Useful for ops triage when an unexpected number of overrides + // shows up on /metrics. No fan-out — single-node RPC; the + // returned set is the canonical truth. + rpc ListStreamAuthorityOverrides (ListStreamAuthorityOverridesRequest) + returns (ListStreamAuthorityOverridesResponse); + + // Toggle pinned state for `stream`. Pinned streams are exempt + // from the auto-GC sweep that retires redundant overrides — use + // when you want a stream to stay on its current authority node + // even if the ring shifts to make the override redundant. + // Idempotent. Independent of the override itself (pinning a + // stream with no override is benign; the marker sits dormant). + rpc SetStreamPinned (SetStreamPinnedRequest) + returns (SetStreamPinnedResponse); + + // ---- Phase 4 — Object Store ---- + // + // Convention layer over streams: one stream per bucket, named + // `obj:`. Two subject shapes: + // - `objm.` — JSON-encoded metadata (size, chunk_count, + // sha256, etc.). Latest-revision-wins KV semantics. + // - `objc..` — raw chunk bytes. + // + // Atomicity model: chunks published first, metadata last. A + // crash between steps leaves orphan chunks but no live object + // (readers can't see the object because metadata is missing). + // Orphan-chunk GC sweep handles cleanup. See + // waymaker-streams/OBJECT_STORE_DESIGN.md §"Atomicity model". + // + // v0 surface: unary RPCs only (max object size ~16 MiB — the + // default gRPC message cap). Streaming variants for large + // objects come in a follow-up slice. + + rpc PutObject (PutObjectRequest) returns (PutObjectResponse); + rpc GetObject (GetObjectRequest) returns (GetObjectResponse); + rpc DeleteObject (DeleteObjectRequest) returns (DeleteObjectResponse); + rpc GetObjectInfo (GetObjectInfoRequest) returns (GetObjectInfoResponse); + rpc ListObjects (ListObjectsRequest) returns (ListObjectsResponse); + + // Client-streamed PutObject for arbitrary-size objects. First + // frame MUST set `start { bucket, name, chunk_size, headers, + // sha256 }`. Subsequent frames carry `data` only — each frame's + // `data` is ONE chunk message at `objc..`. The server + // accumulates a running SHA-256 and total-byte count, publishes + // chunks as they arrive (replication fires async), and on the + // last frame (`finish=true`) publishes the metadata. A client + // disconnect before `finish=true` leaves orphan chunks; the GC + // sweep cleans them up. + rpc PutObjectStream (stream PutObjectStreamFrame) + returns (PutObjectResponse); + + // Server-streamed GetObject. First frame carries `info`; + // subsequent frames carry `data` only — one per chunk. Last + // frame sets `done=true`. The client reassembles; the response + // is sent over the wire in chunk-sized pieces so memory usage + // stays bounded on both sides. + rpc GetObjectStream (GetObjectRequest) + returns (stream GetObjectStreamFrame); + + // Every revision of `name`'s metadata in seq order — covers + // overwrites + tombstones. Returns one entry per metadata + // message at `objm.`. Chunks are not enumerated; this RPC + // is for object versioning / audit, not for binary diffing. + rpc ListObjectRevisions (ListObjectRevisionsRequest) + returns (ListObjectRevisionsResponse); + + // Read a byte range `[offset, offset + len)` from an object's + // assembled payload. Only the chunks that intersect the range + // are loaded server-side — useful for resumable downloads of + // large objects. + // - `offset + len > total_bytes` → returns whatever bytes exist + // in the range (success, possibly empty). + // - `offset > total_bytes` → returns empty payload (success). + // - `len == 0` → returns empty payload (success). + rpc GetObjectRange (GetObjectRangeRequest) returns (GetObjectRangeResponse); + + // Operator-driven rebalance. Takes an explicit plan — a list of + // (stream, target_node) — and executes each step by issuing a + // `MigrateStream` to the target. The plan is *not* auto-generated; + // the operator (or a future automatic planner) is responsible for + // building it from a `GetClusterStreamStats` snapshot. Steps run + // sequentially with a per-step timeout; the response carries + // per-step outcomes so partial success is visible. + rpc RebalanceStreams (RebalanceStreamsRequest) + returns (RebalanceStreamsResponse); + + // --- Consumer-state replication (Phase 2 §G) --- + // + // The primary for a stream pushes its consumers' full state to the + // stream's `replication_factor - 1` secondaries after every + // state-mutating consumer operation (create_consumer, fetch, ack, + // delete_consumer). The push is fire-and-forget on the primary's + // side — the client RPC has already returned to the caller; the + // replication runs in a background task. Secondaries hold the + // snapshot in memory; adoption-on-failover is a future slice. + rpc ReplicateConsumerState (ReplicateConsumerStateRequest) + returns (ReplicateConsumerStateResponse); + + // --- Cross-stream sources state replication (slice 2E) --- + // + // The primary for a sourcing stream pushes the current per-source + // tail watermark to each secondary after every successful batch + // (i.e. once per ~128 source messages). Secondaries persist the + // snapshot via their own SourceTailStore so that on adoption (ring + // shift → secondary becomes primary), `spawn_source_tail_tasks` + // reads the replicated state and resumes from `last_sourced_seq + 1` + // instead of re-pulling from `start_seq` (which would emit + // duplicates with already-replicated provenance headers). + rpc ReplicateSourceTailState (ReplicateSourceTailStateRequest) + returns (ReplicateSourceTailStateResponse); + + // --- Stream-data replication (Phase 3, chunk 1) --- + // + // The primary for a stream pushes: + // 1. ReplicateStreamCreate once at create time, so secondaries + // know what stream to open in their replica registry with + // what config (block_size, retention, max_msg_bytes, etc.). + // 2. ReplicateMessage on every successful Publish, with the + // seq the primary assigned, so the secondary's replica + // mirrors the message log by seq exactly. + // + // Replica streams live in a per-node "replica registry" rooted at + // `/replicas/.redb`, distinct from the + // primary-owned namespace. The streams handler never serves + // client requests from the replica — it's purely catastrophe + // recovery state until the (future) adoption-on-failover slice + // promotes a replica to primary. + rpc ReplicateStreamCreate (ReplicateStreamCreateRequest) + returns (ReplicateStreamCreateResponse); + rpc ReplicateMessage (ReplicateMessageRequest) + returns (ReplicateMessageResponse); + // Tear down the replica when the primary deletes the stream. + // Idempotent — missing replica is success. + rpc ReplicateStreamDelete (ReplicateStreamDeleteRequest) + returns (ReplicateStreamDeleteResponse); + // The primary's retention sweep removed messages below + // `first_seq`; the secondary mirrors the same truncation so its + // replica's first_seq advances in lockstep. Idempotent. + rpc ReplicateTruncate (ReplicateTruncateRequest) + returns (ReplicateTruncateResponse); + // The primary applied an UpdateStream; secondaries mirror the + // mutable subset of the config so a future failover lands on a + // replica whose retention matches the primary's. Carries the same + // narrow shape as UpdateStreamRequest — only the mutable fields, + // with partial-update semantics. + rpc ReplicateStreamUpdate (ReplicateStreamUpdateRequest) + returns (ReplicateStreamUpdateResponse); + + // Under `RetentionPolicy::WorkQueue` the primary deletes a message + // on ack (delete-on-first-ack). Without this fan-out, secondaries' + // replica files would still hold the acked message — and after a + // failover, a fresh consumer on the new primary would see it and + // re-deliver, breaking the "each message belongs to exactly one + // consumer at a time" invariant. Idempotent: missing seq on + // secondary is success. + rpc ReplicateWorkQueueAck (ReplicateWorkQueueAckRequest) + returns (ReplicateWorkQueueAckResponse); +} + +// --------------------------------------------------------------------- +// Shared types +// --------------------------------------------------------------------- + +// `Limits` retention with three optional bounds. Any bound that's +// unset (`*` field omitted) means "no limit on that dimension". +message LimitsRetention { + optional uint64 max_age_ms = 1; + optional uint64 max_msgs = 2; + optional uint64 max_bytes = 3; + // `false` = block-aligned approximate pruning (default). `true` = + // per-message exact pruning. See STREAMS_SPEC.md §6. + bool strict_limits = 4; +} + +message WorkQueueRetention {} + +// `Interest` retention: drop a block once every consumer's +// `ack_floor` has advanced past its `last_seq`. With zero +// consumers, every block is eligible. Block-aligned (not +// per-message) so retention sweeps stay cheap. +message InterestRetention {} + +message Retention { + oneof policy { + LimitsRetention limits = 1; + WorkQueueRetention work_queue = 2; + InterestRetention interest = 3; + } +} + +message StreamConfigPb { + string name = 1; + // Subject patterns this stream accepts. Empty Vec = no filter. + repeated string subjects_filter = 2; + Retention retention = 3; + // Messages per block; 0 = server default (currently 100_000). + uint64 block_size = 4; + // Optional per-message size cap; 0 = no cap. + uint64 max_msg_bytes = 5; + // If true, the stream is stored entirely in memory — no redb + // file is created. State survives node failover via the + // existing replication path but a full-cluster restart loses + // it. Matches the NATS JetStream `memory` storage mode. + // Immutable after create. + bool ephemeral = 6; + // Cross-stream sources — this stream pulls messages from each + // listed source stream as a tail subscriber and appends them + // locally with provenance headers (`waymaker-source-stream`, + // `waymaker-source-seq`). See `SOURCES_DESIGN.md`. Slice 1 + // accepts at most one entry; the wire is `repeated` for forward + // compatibility with slice 2 (multi-source fan-in). + repeated StreamSourceConfigPb sources = 7; + // Per-subject revision cap. `0` (default) = unbounded — history + // bounded only by stream-level retention. When N > 0, after a + // successful publish, older messages at that subject beyond the + // N most recent are dropped via per-message pruning. Mirrors + // NATS JetStream's MaxMsgsPerSubject. Backs KV's max_revisions. + uint64 max_msgs_per_subject = 8; +} + +// One source feeding a sourcing stream. Slice 1 honours only +// `source_stream`; the remaining fields land in slice 2/3. +message StreamSourceConfigPb { + string source_stream = 1; + // Optional NATS-style filter; empty = pull every subject. + // Honoured since slice 2B. + string filter_subject = 2; + // Start position. 0/0 = pull from beginning (slice 1 default). + // start_seq honoured since 2C. start_time_ms reserved (rejected). + uint64 start_seq = 3; + int64 start_time_ms = 4; + // Optional subject rewrite. Slice 3. + SubjectTransformPb subject_transform = 5; + // Slice 2F: cap on the initial backfill window. When > 0 AND + // there's no persisted state for this (sourcing, source), the + // tail seeds its watermark at max(0, source.last_seq - + // max_initial_backfill) instead of pulling from seq 1. Once + // there's persisted state (i.e. after the first batch), this + // knob is ignored — the tail resumes from the persisted seq. + // Use 0 (default) for "unbounded" (slice 1 behaviour). + uint64 max_initial_backfill = 6; + // Slice 3: behaviour when the source's retention sweep drops + // messages past our last_sourced_seq (we've fallen behind and + // the source no longer has the messages we'd next pull). + // * ON_DROP_HALT (default, 0): tail surfaces a persistent + // error and stops advancing — operator must intervene. + // * ON_DROP_SKIP_TO_FIRST_AVAILABLE (1): tail jumps its + // watermark to source.first_seq - 1 and resumes, with + // a warn event surfaced via last_error for one cycle so + // operators can alert on it. + OnDropPolicy on_drop = 7; + // Slice 3: optional dead-letter stream. When the tail records + // an error (subject_transform mismatch, append_failed, + // on_drop=halt firing), publish a JSON record describing the + // event to this stream so operators can triage without + // scraping logs. Empty (default) = no DLQ. + string dlq_stream = 8; +} + +enum OnDropPolicy { + ON_DROP_HALT = 0; + ON_DROP_SKIP_TO_FIRST_AVAILABLE = 1; +} + +message SubjectTransformPb { + // NATS-style: e.g. "events.>" with destination "audit.{{wildcard(1)}}". + string source_pattern = 1; + string destination = 2; +} + +message StreamStatsPb { + uint64 last_seq = 1; + uint64 msg_count = 2; + uint64 bytes = 3; + uint64 block_count = 4; + // 0 if there are no blocks (empty stream). + uint64 first_block = 5; +} + +message MessageHeader { + string key = 1; + string value = 2; +} + +message MessagePb { + uint64 seq = 1; + string subject = 2; + int64 ts_ms = 3; + repeated MessageHeader headers = 4; + bytes payload = 5; + // Delivery attempt count assigned by the consumer at fetch time. + // Populated only for Fetch responses; 0 otherwise. + uint32 deliver_count = 6; +} + +enum DeliveryPolicyType { + DELIVERY_ALL = 0; + DELIVERY_LAST = 1; + DELIVERY_BY_START_SEQ = 2; + DELIVERY_BY_START_TIME = 3; +} + +message DeliveryPolicyPb { + DeliveryPolicyType type = 1; + // Used only when type == DELIVERY_BY_START_SEQ. + uint64 start_seq = 2; + // Used only when type == DELIVERY_BY_START_TIME. Wall-clock ms. + int64 start_time_ms = 3; +} + +message ConsumerConfigPb { + string name = 1; + // Empty = no filter. + string filter_subject = 2; + DeliveryPolicyPb delivery_policy = 3; + // 0 = server default (30s). + uint64 ack_wait_ms = 4; + // 0 = server default (5). + uint32 max_deliver = 5; + // Empty = no queue group. + string deliver_group = 6; + // Phase 2 dead-letter routing. When non-empty, every message + // this consumer drops after `max_deliver` attempts is republished + // into the same stream under this subject. Original metadata is + // preserved as `x-waymaker-dlq-*` headers. Empty = silent drop. + // The stream's `subjects_filter` must accept this subject — + // operators typically reserve a pattern like `dlq.>` and include + // it in the stream's filter. + string dead_letter_subject = 7; +} + +message ConsumerStatePb { + ConsumerConfigPb config = 1; + uint64 ack_floor = 2; + uint64 last_delivered = 3; + int64 created_at_ms = 4; + uint64 redelivered_dropped = 5; +} + +// --------------------------------------------------------------------- +// Stream lifecycle +// --------------------------------------------------------------------- + +message CreateStreamRequest { + StreamConfigPb config = 1; +} + +message CreateStreamResponse { + bool success = 1; + string result_code = 2; // "ok" | "already_exists" | "invalid_config" | "internal" + string message = 3; +} + +message DeleteStreamRequest { + string name = 1; +} + +message DeleteStreamResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; +} + +message GetStreamInfoRequest { + string name = 1; +} + +message GetStreamInfoResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" + string message = 3; + StreamConfigPb config = 4; + StreamStatsPb stats = 5; + // Phase 3 — if a `stream_authority` override is active for this + // stream, the routing claimant + the fence epoch at which it was + // committed. Unset when the stream routes via the ring's hash + // owner. Useful for operators auditing "why is this stream on + // node N when the ring says M?". + optional StreamAuthorityOverride authority_override = 6; + // The ring's hash owner for this stream (ignoring any override). + // When `authority_override` is set and `claimant_node_id != + // ring_owner_node_id`, the override is actively redirecting + // routing. 0 = the response node couldn't compute the ring owner + // (e.g. mid-membership-transition). + uint64 ring_owner_node_id = 7; + // Phase 3 — `true` when an operator has pinned this stream + // (auto-GC will not retire its override even when redundant). + bool pinned = 8; + // Per-source tail state. Populated when this stream has + // `sources` set in its config and the request lands on the + // sourcing primary. Empty otherwise. + repeated SourceStatusPb sources_status = 9; +} + +message SourceStatusPb { + string source_stream = 1; + // Last seq successfully appended to the sourcing stream. + uint64 last_sourced_seq = 2; + // Total messages pulled since the tail task started. + uint64 pulled_total = 3; + // Most recent error message; empty when healthy. + string last_error = 4; + int64 last_error_ts_ms = 5; +} + +message StreamAuthorityOverride { + uint64 claimant_node_id = 1; + uint64 fence_epoch = 2; +} + +message ClearStreamAuthorityRequest { + string stream = 1; +} + +message ClearStreamAuthorityResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_leader" | "internal" + string message = 3; +} + +message ListStreamAuthorityOverridesRequest {} + +message ListStreamAuthorityOverridesResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated AuthorityOverrideEntry entries = 4; +} + +message AuthorityOverrideEntry { + string stream = 1; + uint64 claimant_node_id = 2; + uint64 fence_epoch = 3; +} + +message SetStreamPinnedRequest { + string stream = 1; + bool pinned = 2; +} + +message SetStreamPinnedResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_leader" | "internal" + string message = 3; +} + +message ListStreamsRequest {} + +message ListStreamsResponse { + repeated string names = 1; +} + +message GetStreamSourcesRequest {} + +message GetStreamSourcesResponse { + bool success = 1; + string result_code = 2; // "ok" + string message = 3; + repeated GetStreamSourcesEntry entries = 4; +} + +message GetStreamSourcesEntry { + string sourcing_stream = 1; + string source_stream = 2; + uint64 last_sourced_seq = 3; + uint64 pulled_total = 4; + string last_error = 5; + int64 last_error_ts_ms = 6; +} + +// Partial-update of the mutable subset of a stream's config. Fields +// that are present are applied; absent fields leave the existing +// on-disk value unchanged. Setting a Limits bound's optional to 0 is +// a valid way to *clear* that bound (equivalent to "no limit"); to +// leave it unchanged, omit the field. Immutable fields (name, +// subjects_filter, block_size, retention policy type) are not in +// this message — changing them requires a delete + recreate. +message UpdateStreamRequest { + string name = 1; + optional uint64 max_age_ms = 2; + optional uint64 max_msgs = 3; + optional uint64 max_bytes = 4; + optional uint64 max_msg_bytes = 5; + optional bool strict_limits = 6; +} + +message UpdateStreamResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "invalid_config" | "immutable_field" | "internal" + string message = 3; + // Effective config after the update — what the next GetStreamInfo + // would return. Useful for clients that want to confirm what + // landed without a follow-up round trip. + StreamConfigPb config = 4; + // Number of messages the primary pruned to bring stats under the + // new bounds. 0 = no prune (raise-only update, or already under). + // For drift monitoring. + uint64 pruned = 5; +} + +// --------------------------------------------------------------------- +// Messages +// --------------------------------------------------------------------- + +message PublishRequest { + string stream = 1; + string subject = 2; + bytes payload = 3; + repeated MessageHeader headers = 4; + // 0 = server uses wall clock. + int64 ts_ms = 5; + // Optimistic-concurrency hint. When set, the server only + // commits the publish if the latest seq at `subject` matches + // `expected_last_seq` (use 0 to require "subject has never been + // published to"). On mismatch the response carries + // `result_code="wrong_revision"` and `seq` = the current actual + // last seq at the subject. Absent / unset = no check. + optional uint64 expected_last_seq = 6; +} + +message PublishResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "subject_rejected" | "oversize" | "wrong_revision" | "internal" + string message = 3; + uint64 seq = 4; +} + +message FetchRequest { + string stream = 1; + string consumer = 2; + uint32 batch_size = 3; +} + +message FetchResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + string message = 3; + repeated MessagePb messages = 4; +} + +message AckRequest { + string stream = 1; + string consumer = 2; + uint64 seq = 3; +} + +message AckResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + string message = 3; +} + +message NakRequest { + string stream = 1; + string consumer = 2; + uint64 seq = 3; + // Wall-clock ms to defer redelivery. 0 = eligible immediately. + uint64 delay_ms = 4; +} + +message NakResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message TermRequest { + string stream = 1; + string consumer = 2; + uint64 seq = 3; +} + +message TermResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message InProgressRequest { + string stream = 1; + string consumer = 2; + uint64 seq = 3; +} + +message InProgressResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SubscribeRequest { + string stream = 1; + string consumer = 2; + // How many messages per server-side fetch. Smaller batches + // trade throughput for finer-grained per-message latency. 0 + // means use the server default (16). + uint32 batch_size = 3; + // If true, the server tears down the subscription after the + // first fetch returns 0 messages (after the initial backlog + // drains). Useful for one-shot replays. Default false — keep + // the stream open indefinitely and re-fetch on new appends. + bool stop_when_empty = 4; +} + +// Server-streamed events on a Subscribe stream. Currently one +// variant — a delivered message — with a tail end-of-stream +// signal if the client requested `stop_when_empty`. +message SubscribeEvent { + oneof event { + MessagePb message = 1; + SubscribeStopped stopped = 2; + } +} + +message SubscribeStopped { + string reason = 1; +} + +// --------------------------------------------------------------------- +// Consumers +// --------------------------------------------------------------------- + +message CreateConsumerRequest { + string stream = 1; + ConsumerConfigPb config = 2; +} + +message CreateConsumerResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "already_exists" | "invalid_config" | "internal" + string message = 3; +} + +message DeleteConsumerRequest { + string stream = 1; + string consumer = 2; +} + +message DeleteConsumerResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "no_such_consumer" | "internal" + string message = 3; +} + +message ListConsumersRequest { + string stream = 1; +} + +message ListConsumersResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" + string message = 3; + repeated ConsumerStatePb consumers = 4; +} + +message GetConsumerInfoRequest { + string stream = 1; + string consumer = 2; +} + +message GetConsumerInfoResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "no_such_consumer" + string message = 3; + ConsumerStatePb consumer = 4; +} + +// --------------------------------------------------------------------- +// Rebalancing +// --------------------------------------------------------------------- + +message TransferStreamRequest { + string name = 1; +} + +// One chunk of redb bytes plus end-of-stream signalling. The body is +// either `data` (a chunk of raw bytes — order-preserving via gRPC's +// stream ordering) or `summary` (the final marker carrying totals so +// the receiver can sanity-check what it got). Implementations should +// stream multiple `data` chunks followed by exactly one `summary`. +message TransferStreamChunk { + oneof body { + bytes data = 1; + TransferStreamSummary summary = 2; + } +} + +message TransferStreamSummary { + uint64 total_bytes = 1; + // Last seq seen by the source at the moment of transfer — the + // receiver re-opens the file and verifies its stats match, surfacing + // any transfer corruption as a load failure. + uint64 stream_last_seq = 2; +} + +message MigrateStreamRequest { + // Stream to acquire. + string name = 1; + // Node ID currently holding the data. The receiver opens a + // `TransferStream` against this node via the existing proxy channel + // pool. Must be a current cluster member. + uint64 source_node_id = 2; +} + +message MigrateStreamResponse { + bool success = 1; + string result_code = 2; // "ok" | "source_busy" | "source_unreachable" | "already_exists" | "transfer_corrupted" | "internal" + string message = 3; + uint64 total_bytes = 4; + uint64 stream_last_seq = 5; +} + +// --- Cluster-wide rebalance — Phase 2 --- + +message GetClusterStreamStatsRequest { + // When set, also include per-stream stats (msg_count, bytes, + // last_seq) for every stream on every node. Without this the + // response carries only per-node aggregates — much smaller, and + // sufficient for skew-based planning. + bool include_per_stream = 1; + // Internal flag set on the fan-out sub-calls. When `true`, the + // receiving node skips fanning out to peers and reports only its + // own local registry. The orchestrator's outermost call leaves + // this `false` so a single round-trip from an operator pulls the + // whole cluster's view. Mirrors the lock proxy's `iteration` cap. + bool local_only = 2; +} + +// One stream's stats as seen by its primary node. +message PerStreamStats { + string name = 1; + uint64 owner_node_id = 2; + uint64 msg_count = 3; + uint64 bytes = 4; + uint64 last_seq = 5; +} + +// Per-node summary. Bytes/msg counts are summed across the node's +// local streams. +message PerNodeSummary { + uint64 node_id = 1; + uint64 stream_count = 2; + uint64 total_msg_count = 3; + uint64 total_bytes = 4; + // "ok" if the node responded; "unreachable" / "node_standby" / + // "internal" otherwise. The aggregator still emits a row per + // member node so the operator can see which nodes failed to report. + string status = 5; +} + +message GetClusterStreamStatsResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_leader" | "internal" + string message = 3; + repeated PerNodeSummary nodes = 4; + // Populated when the request set `include_per_stream`. + repeated PerStreamStats streams = 5; + // Cluster-wide totals + skew. `skew_count` = max stream_count - + // min stream_count across responding nodes. `skew_bytes` is the + // same in bytes. Both are 0 for a perfectly-balanced cluster. + uint64 total_stream_count = 6; + uint64 total_msg_count = 7; + uint64 total_bytes = 8; + uint64 skew_count = 9; + uint64 skew_bytes = 10; +} + +message RebalancePlanEntry { + string name = 1; + uint64 target_node_id = 2; +} + +message RebalanceStreamsRequest { + repeated RebalancePlanEntry plan = 1; + // Per-step `MigrateStream` timeout, in milliseconds. 0 = server + // default (currently 30s). + uint64 per_step_timeout_ms = 2; +} + +message RebalanceStepOutcome { + string name = 1; + uint64 target_node_id = 2; + bool success = 3; + string result_code = 4; // mirrors MigrateStream codes + "skipped_same_node" / "no_source" + string message = 5; +} + +message RebalanceStreamsResponse { + bool success = 1; // true iff every step succeeded + string result_code = 2; // "ok" | "partial" | "no_plan" | "internal" + string message = 3; + repeated RebalanceStepOutcome steps = 4; +} + +// --- Admin watch — Phase 2 --- + +message WatchStreamsRequest { + // Currently no filters. A future slice can add subject / name + // patterns; today every watcher sees every event the node emits. +} + +// Identifies which kind of state change happened. The full +// WatchEvent carries one detail oneof matching this type. +enum WatchEventType { + WATCH_UNKNOWN = 0; + WATCH_STREAM_CREATED = 1; + WATCH_STREAM_DELETED = 2; + WATCH_STREAM_UPDATED = 3; + WATCH_CONSUMER_CREATED = 4; + WATCH_CONSUMER_DELETED = 5; + // Phase 3 — emitted on every apply of StreamAuthorityClaim or + // ClearStreamAuthority. `claimant_node_id == 0` in the detail + // distinguishes a clear from a set (since 0 isn't a valid node + // id). + WATCH_STREAM_AUTHORITY_CHANGED = 6; +} + +message StreamWatchDetail { + string name = 1; +} + +message ConsumerWatchDetail { + string stream = 1; + string consumer = 2; +} + +// Detail carried on WATCH_STREAM_AUTHORITY_CHANGED events. +// `claimant_node_id == 0` + `fence_epoch == 0` means the override +// was cleared (routing reverts to the ring's hash owner); +// otherwise the override is now `(claimant, fence_epoch)`. +message AuthorityWatchDetail { + string stream = 1; + uint64 claimant_node_id = 2; + uint64 fence_epoch = 3; +} + +// --- KV / subject-state lookups — Phase 3 --- + +message ReadLatestAtSubjectRequest { + string stream = 1; + string subject = 2; +} + +message ReadLatestAtSubjectResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; + // Unset when no message has ever been published at this + // subject. Use the presence of `latest` to distinguish + // "subject is empty" from "no such stream" (the latter is in + // result_code). + optional MessagePb latest = 4; +} + +message ListSubjectsByPrefixRequest { + string stream = 1; + // Empty prefix matches every subject in the stream. + string prefix = 2; +} + +message ListSubjectsByPrefixResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; + repeated string subjects = 4; +} + +message ScanExactAtSubjectRequest { + string stream = 1; + string subject = 2; + // Start scanning at seq >= `from_seq`. 0 = scan from the + // beginning of the stream. + uint64 from_seq = 3; + // Cap on returned messages. 0 = server default (1000). + uint64 limit = 4; +} + +message ScanExactAtSubjectResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; + // Messages at the subject, in seq order. Empty if the subject + // has never been published to, or if the limit returned no + // results in the requested range. + repeated MessagePb messages = 4; +} + +message WatchEvent { + WatchEventType type = 1; + // Server wall-clock at emit time (ms since epoch). Useful for + // ordering across nodes when a client multiplexes watchers. + int64 ts_ms = 2; + // The watching node's id. For cluster-wide watch built on top of + // per-node streams, the client can deduplicate by (node_id, ts_ms, + // type, detail). + uint64 node_id = 3; + oneof detail { + StreamWatchDetail stream = 4; + ConsumerWatchDetail consumer = 5; + AuthorityWatchDetail authority = 7; + } + // Set when this watcher fell behind the server's broadcast buffer + // and missed events. The receiver should treat this as an + // explicit "you missed N events" signal — typically by re-listing + // the cluster to catch back up. After this event, the stream + // continues with fresh events; client need not reconnect. + uint64 lagged_count = 6; +} + +// One pending-delivery entry shipped with a replication snapshot. +message PendingDeliveryPb { + uint64 seq = 1; + int64 delivered_at_ms = 2; + uint32 deliver_count = 3; +} + +// Full snapshot of one consumer's state at the moment the primary +// committed a fetch/ack/create. Includes the immutable config (so a +// secondary that has never seen this consumer can reconstruct it +// from this message alone), the floor/last_delivered counters, the +// active pending set, the create-time wall-clock, and the running +// `redelivered_dropped` total. +message ConsumerStateSnapshot { + string stream = 1; + ConsumerConfigPb config = 2; + uint64 ack_floor = 3; + uint64 last_delivered = 4; + int64 created_at_ms = 5; + uint64 redelivered_dropped = 6; + repeated PendingDeliveryPb pending = 7; + // Whether this snapshot represents a deleted consumer — secondaries + // remove the (stream, consumer) entry from their replica store + // rather than overwriting it. + bool tombstone = 8; +} + +message ReplicateConsumerStateRequest { + ConsumerStateSnapshot snapshot = 1; +} + +message ReplicateConsumerStateResponse { + bool success = 1; + string result_code = 2; // "ok" | "internal" + string message = 3; +} + +// One snapshot of a source-tail's persisted progress, pushed from +// the primary to each secondary after each successful batch. +// `tombstone=true` signals "remove this entry" — sent when the +// sourcing stream is deleted so secondaries don't keep stale rows +// they might adopt later. +message SourceTailStateSnapshot { + string sourcing_stream = 1; + string source_stream = 2; + uint64 last_sourced_seq = 3; + uint64 pulled_total = 4; + int64 updated_ts_ms = 5; + bool tombstone = 6; +} + +message ReplicateSourceTailStateRequest { + SourceTailStateSnapshot snapshot = 1; +} + +message ReplicateSourceTailStateResponse { + bool success = 1; + string result_code = 2; // "ok" | "internal" + string message = 3; +} + +message ReplicateStreamCreateRequest { + // Same shape as CreateStreamRequest's config — the secondary + // opens an identical stream in its replica registry so subsequent + // ReplicateMessage calls land in a config-matched file. + StreamConfigPb config = 1; +} + +message ReplicateStreamCreateResponse { + bool success = 1; + string result_code = 2; // "ok" | "already_exists" | "invalid_config" | "internal" + string message = 3; +} + +message ReplicateMessageRequest { + string stream = 1; + // The seq the primary assigned. The secondary applies the message + // at this exact seq via `apply_replicated_append` (idempotent on + // replay, errors on out-of-order or divergence). + uint64 seq = 2; + string subject = 3; + bytes payload = 4; + repeated MessageHeader headers = 5; + int64 ts_ms = 6; +} + +message ReplicateMessageResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "out_of_order" | "divergence" | "internal" + string message = 3; + // Receiver's last_seq AFTER applying — primary uses this to detect + // when a secondary has fallen behind and needs a `MigrateStream` + // re-seed. + uint64 receiver_last_seq = 4; +} + +message ReplicateStreamDeleteRequest { + string name = 1; +} + +message ReplicateStreamDeleteResponse { + bool success = 1; + string result_code = 2; // "ok" | "internal" + string message = 3; +} + +message ReplicateTruncateRequest { + string stream = 1; + // Drop every message with seq < first_seq. Also raises the + // receiver's `last_seq` to at least `first_seq - 1` so a lagging + // secondary aligns with the primary's expected-next-seq for + // subsequent replication pushes. + uint64 first_seq = 2; +} + +message ReplicateTruncateResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; + // Number of messages the secondary actually dropped (0 on a no-op + // / idempotent re-call). For drift monitoring. + uint64 dropped = 4; +} + +// Mirror of UpdateStreamRequest sent from the primary to each +// secondary after a successful UpdateStream. Same partial-update +// semantics: absent fields leave the secondary's on-disk value +// unchanged. The accompanying prune (if any) is replicated via the +// existing ReplicateTruncate path — this message carries only the +// config change. +message ReplicateStreamUpdateRequest { + string name = 1; + optional uint64 max_age_ms = 2; + optional uint64 max_msgs = 3; + optional uint64 max_bytes = 4; + optional uint64 max_msg_bytes = 5; + optional bool strict_limits = 6; +} + +message ReplicateStreamUpdateResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; +} + +message ReplicateWorkQueueAckRequest { + string stream = 1; + uint64 seq = 2; +} + +message ReplicateWorkQueueAckResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_stream" | "internal" + string message = 3; + // Whether the secondary's replica had the seq present before the + // delete (the operation is idempotent, so `false` here is normal + // for a retry / late-arriving call). + bool was_present = 4; +} + +// ---- Phase 4 — Object Store messages ---- + +// Metadata about a stored object. Sent back on Get/Info/List; the +// server reconstructs this from the `objm.` message body +// (JSON-encoded) plus the message seq. Treat this message as a +// blob description, not a payload — payload is fetched via +// GetObject. +message ObjectInfo { + // Object name (the part after the bucket prefix). + string name = 1; + // Total payload bytes across all chunks (after assembly). + uint64 total_bytes = 2; + // Bytes per chunk (last chunk may be smaller). 0 for empty + // objects. + uint64 chunk_size = 3; + // Number of `objc..` messages required to reconstitute + // the payload. 0 for empty objects. + uint64 chunk_count = 4; + // SHA-256 of the assembled payload, hex-encoded. Set by the + // server; verified by Get. + string sha256 = 5; + // Server wall-clock at metadata-publish time (ms since epoch). + int64 ts_ms = 6; + // Opaque headers the client attached at Put time. Preserved + // verbatim on Get. + repeated MessageHeader headers = 7; + // The metadata message's seq number — doubles as the object + // revision id. A second Put with the same name bumps it. + uint64 metadata_seq = 8; + // Phase 5 — `true` when the object was Put with `dedupe=true`. + // Chunks are stored at `obj_chunk.` (shared across + // objects in the bucket); `false` for legacy `objc..`. + bool deduped = 9; +} + +message PutObjectRequest { + string bucket = 1; + string name = 2; + bytes payload = 3; + // Bytes per chunk. 0 = server default (1 MiB). + uint64 chunk_size = 4; + // Optional headers — preserved verbatim in the metadata blob. + repeated MessageHeader headers = 5; + // Optional pre-computed SHA-256 hex; the server verifies after + // chunking + before publishing metadata. Empty = the server + // computes its own hash from the payload. + string sha256 = 6; + // Phase 5 cross-object dedupe. When set, each chunk is hashed + // and stored at the content-addressed subject `obj_chunk.`; + // identical content across objects shares storage. Metadata + // records the chunk hashes in order so Get can re-assemble. + // See `waymaker-streams/DEDUPE_DESIGN.md`. + bool dedupe = 7; +} + +message PutObjectResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" | "sha_mismatch" + string message = 3; + ObjectInfo info = 4; +} + +// Streaming Put — first frame sets `start`; subsequent frames +// carry `data`. Each non-empty `data` becomes one chunk message +// in seq order. Last frame sets `finish=true` so the server +// commits metadata; closing the stream without `finish=true` +// leaves the upload aborted (orphan chunks). +message PutObjectStreamFrame { + optional PutObjectStart start = 1; + bytes data = 2; + bool finish = 3; +} + +message PutObjectStart { + string bucket = 1; + string name = 2; + // Bytes per chunk. 0 = server default. Note: with streaming Put + // the client controls chunk boundaries by frame size — this + // field is purely metadata-recorded, not used to re-chunk. + uint64 chunk_size = 3; + repeated MessageHeader headers = 4; + // Optional SHA-256 hex. Server verifies against the running + // hash before committing metadata; mismatch aborts the Put + // (chunks already published become orphan; GC reclaims them). + string sha256 = 5; + // Phase 5 cross-object dedupe. When set, each chunk is hashed + // and stored at the content-addressed subject `obj_chunk.`; + // identical content across objects shares storage. See + // `waymaker-streams/DEDUPE_DESIGN.md`. + bool dedupe = 6; +} + +message GetObjectRequest { + string bucket = 1; + string name = 2; +} + +message GetObjectResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" | "sha_mismatch" + string message = 3; + ObjectInfo info = 4; + bytes payload = 5; +} + +// Streaming Get — first frame carries `info` (metadata only, no +// data); subsequent frames carry `data` (one per chunk). +// Final frame sets `done=true`. The server stops streaming on +// the first error; in particular `sha_mismatch` is sent as a +// gRPC Status (Aborted), not as a result_code in a frame. +message GetObjectStreamFrame { + optional ObjectInfo info = 1; + bytes data = 2; + bool done = 3; +} + +message DeleteObjectRequest { + string bucket = 1; + string name = 2; +} + +message DeleteObjectResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; + // Tombstone metadata seq, useful for client confirmations. + uint64 tombstone_seq = 4; +} + +message GetObjectInfoRequest { + string bucket = 1; + string name = 2; +} + +message GetObjectInfoResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "no_such_object" | "internal" + string message = 3; + // Unset when the object name has no live metadata (never put, + // or tombstoned). + optional ObjectInfo info = 4; + // True if the latest metadata is a tombstone (logical delete). + bool deleted = 5; +} + +message ListObjectsRequest { + string bucket = 1; + // Optional name prefix filter (no leading `objm.` — pass just + // the object-name prefix). + string name_prefix = 2; + // Include tombstoned entries? Default false. + bool include_deleted = 3; +} + +message ListObjectsResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; + repeated ObjectListEntry entries = 4; +} + +message ObjectListEntry { + string name = 1; + uint64 total_bytes = 2; + bool deleted = 3; +} + +message ListObjectRevisionsRequest { + string bucket = 1; + string name = 2; + // Start scanning at metadata seq >= `from_seq`. 0 = beginning. + uint64 from_seq = 3; + // Cap on returned revisions. 0 = server default (100). + uint64 limit = 4; +} + +message ListObjectRevisionsResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; + repeated ObjectRevisionEntry revisions = 4; +} + +message GetObjectRangeRequest { + string bucket = 1; + string name = 2; + uint64 offset = 3; + // Bytes to return. 0 = whole tail (`total_bytes - offset`). + uint64 len = 4; +} + +message GetObjectRangeResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" + string message = 3; + // The full object's info (size, hash, etc.). Useful for the + // client to know the total size when paginating. + ObjectInfo info = 4; + // Bytes [offset, offset + actual_len). `actual_len` may be less + // than the requested `len` when the range extends past the + // object's end. + uint64 actual_offset = 5; + bytes payload = 6; +} + +message ObjectRevisionEntry { + // Metadata message seq — doubles as the revision id. + uint64 metadata_seq = 1; + // Always present, including for tombstones (where `deleted=true` + // and the other fields fall back to 0/empty). + bool deleted = 2; + uint64 total_bytes = 3; + uint64 chunk_count = 4; + string sha256 = 5; + int64 ts_ms = 6; +} + +// ===== KV ===================================================== + +message KvCreateBucketRequest { + string bucket = 1; + uint64 max_bytes = 2; // 0 = unbounded + uint64 max_value_size = 3; // 0 = no per-value cap + // Bucket-level TTL (ms). 0 = no time-based eviction. + // Bucket-level TTL is independent of per-key TTL set via KvPut. + uint64 max_age_ms = 4; + bool ephemeral = 5; +} + +message KvCreateBucketResponse { + bool success = 1; + string result_code = 2; // "ok" | "already_exists" | "invalid_config" | "internal" + string message = 3; +} + +message KvDeleteBucketRequest { string bucket = 1; } +message KvDeleteBucketResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; +} + +message KvPutRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + // Per-key TTL in milliseconds. 0 = no TTL. + uint64 ttl_ms = 4; +} + +message KvCreateRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + uint64 ttl_ms = 4; +} + +message KvUpdateRequest { + string bucket = 1; + string key = 2; + bytes value = 3; + // The revision the caller believes is current. Server returns + // wrong_revision if mismatch. + uint64 expected_revision = 4; + uint64 ttl_ms = 5; +} + +message KvPutResponse { + bool success = 1; + // "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" + string result_code = 2; + string message = 3; + // Assigned revision (stream sequence) of the newly-written + // value. On wrong_revision, this is the *current* server-side + // revision the caller can retry against. + uint64 revision = 4; +} + +message KvGetRequest { + string bucket = 1; + string key = 2; +} + +message KvGetResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; + // Unset when the key has no value or is tombstoned. + optional KvEntry entry = 4; +} + +message KvEntry { + bytes value = 1; + uint64 revision = 2; + int64 ts_ms = 3; +} + +message KvDeleteRequest { + string bucket = 1; + string key = 2; +} + +message KvDeleteResponse { + bool success = 1; + string result_code = 2; // "ok" | "no_such_bucket" | "internal" + string message = 3; + uint64 revision = 4; +} + +message KvKeysRequest { string bucket = 1; } + +message KvKeysResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated KvKeyEntry entries = 4; +} + +message KvKeyEntry { + string key = 1; + uint64 revision = 2; + // True if the latest message at this key is a tombstone. + bool deleted = 3; +} + +message KvHistoryRequest { + string bucket = 1; + string key = 2; + uint64 from_revision = 3; // 0 = from beginning + uint64 limit = 4; // 0 = server default +} + +message KvHistoryResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated KvHistoryEntry entries = 4; +} + +message KvHistoryEntry { + bytes value = 1; + uint64 revision = 2; + int64 ts_ms = 3; + bool deleted = 4; +} + +message KvTouchRequest { + string bucket = 1; + string key = 2; + uint64 ttl_ms = 3; +} + +message KvWatchRequest { + string bucket = 1; + // Empty = watch every key in the bucket. Non-empty = watch only + // this key. + string key = 2; +} + +message KvWatchEvent { + oneof event { + KvPutEvent put = 1; + KvDeleteEvent delete = 2; + } +} + +message KvPutEvent { + string key = 1; + bytes value = 2; + uint64 revision = 3; + int64 ts_ms = 4; +} + +message KvDeleteEvent { + string key = 1; + uint64 revision = 2; + int64 ts_ms = 3; +} + +// ===== Cache::Hash ============================================ + +message CreateHashStoreRequest { + string name = 1; + uint64 max_bytes = 2; + bool ephemeral = 3; +} +message CreateHashStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteHashStoreRequest { string name = 1; } +message DeleteHashStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HashSetRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; + bytes value = 4; +} +message HashSetResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 revision = 4; +} + +message HashGetRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashGetResponse { + bool success = 1; + string result_code = 2; + string message = 3; + // Unset when the field has no value or is tombstoned. + optional bytes value = 4; + uint64 revision = 5; +} + +message HashExistsRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashExistsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + bool exists = 4; +} + +message HashDeleteRequest { + string bucket = 1; + string hash_key = 2; + string field = 3; +} +message HashDeleteResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message HashGetAllRequest { + string bucket = 1; + string hash_key = 2; +} +message HashGetAllResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated HashFieldEntry entries = 4; +} +message HashFieldEntry { + string field = 1; + bytes value = 2; + uint64 revision = 3; +} + +message HashFieldsRequest { + string bucket = 1; + string hash_key = 2; +} +message HashFieldsResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated string fields = 4; +} + +message HashLenRequest { + string bucket = 1; + string hash_key = 2; +} +message HashLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} + +// ===== Cache::Set ============================================= + +message CreateSetStoreRequest { + string name = 1; + uint64 max_bytes = 2; + bool ephemeral = 3; +} +message CreateSetStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteSetStoreRequest { string name = 1; } +message DeleteSetStoreResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetAddRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetAddResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetRemoveRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetRemoveResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message SetIsMemberRequest { + string bucket = 1; + string set_key = 2; + string member = 3; +} +message SetIsMemberResponse { + bool success = 1; + string result_code = 2; + string message = 3; + bool is_member = 4; +} + +message SetMembersRequest { + string bucket = 1; + string set_key = 2; +} +message SetMembersResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated string members = 4; +} + +message SetLenRequest { + string bucket = 1; + string set_key = 2; +} +message SetLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} + +// ===== Cache::Queue =========================================== + +message CreateQueueRequest { + string name = 1; + uint64 max_bytes = 2; + uint64 max_messages = 3; + bool ephemeral = 4; +} +message CreateQueueResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} +message DeleteQueueRequest { string name = 1; } +message DeleteQueueResponse { + bool success = 1; + string result_code = 2; + string message = 3; +} + +message QueuePushRequest { + string bucket = 1; + bytes value = 2; +} +message QueuePushResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 sequence = 4; +} + +message QueuePopRequest { + string bucket = 1; +} +message QueuePopResponse { + bool success = 1; + string result_code = 2; + string message = 3; + // Unset when the queue is empty. + optional bytes value = 4; +} + +message QueueRangeRequest { + string bucket = 1; + uint64 from_sequence = 2; + uint64 limit = 3; +} +message QueueRangeResponse { + bool success = 1; + string result_code = 2; + string message = 3; + repeated bytes values = 4; +} + +message QueueLenRequest { string bucket = 1; } +message QueueLenResponse { + bool success = 1; + string result_code = 2; + string message = 3; + uint64 count = 4; +} + diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..7eb4542 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "waymaker-client" +version = "0.1.27" +edition = "2021" +description = "Official Rust client for waymaker — locks, streams, KV, collections, sketches, cache, object store" +repository = "https://git.awesomike.com/pub/waymaker-client" +license = "MIT OR Apache-2.0" + +[lib] +path = "src/lib.rs" + +[dependencies] +# Async runtime. `sync` for watch/Notify in the Lock hold loop; no `signal` +# (that was for the operator CLI, which stays in the waymaker repo). +tokio = { version = "1", default-features = false, features = [ + "rt-multi-thread", "macros", "net", "time", "sync" +] } +tokio-stream = { version = "0.1", default-features = false } +futures = "0.3" +thiserror = "2" +bytes = "1" + +# gRPC client. tls-ring lets the client talk to a TLS-protected waymaker +# without dragging in any server-side TLS termination code. +tonic = { version = "0.14", features = ["codegen", "tls-ring"] } +tonic-prost = "0.14" +prost = "0.14" + +# request_id idempotency keys. +uuid = { version = "1", features = ["v4", "v7", "fast-rng"] } + +[build-dependencies] +# Compiles the vendored protos in ../proto into client stubs at build time. +tonic-prost-build = "0.14" diff --git a/rust/README.md b/rust/README.md new file mode 100644 index 0000000..ac41f1a --- /dev/null +++ b/rust/README.md @@ -0,0 +1,52 @@ +# waymaker-client (Rust) + +Official Rust client for [waymaker](https://git.awesomike.com/dev/waymaker). + +```toml +[dependencies] +waymaker-client = { git = "https://git.awesomike.com/pub/waymaker-client", tag = "v0.1.27" } +# (the crate lives in the rust/ subdir; cargo resolves it automatically) +``` + +Proto stubs are generated from `../proto` at build time via `build.rs` — no +dependency on the waymaker server workspace. + +## Surfaces + +- `lock` — read/write locks, leader election, TTL leases. The `Lock` handle + keeps a background task that **transparently re-binds** its event stream + across a primary bounce (reusing the `request_id`) and exposes live state: + `lock.fence_token()`, `lock.watch()` (a `watch::Receiver`), + `lock.is_lost()`. Re-read the fence before every fenced side effect. +- `stream` — JetStream-lite publish + pull/push consumers. +- `kv` — Put/Get/Create/Update(CAS)/Delete/Keys/History/Watch. +- `cache` — Redis-shape Hash / Set / Queue (collections). +- `probabilistic` — Bloom / HLL / CMS / TopK / t-digest. +- `object` — chunked object Put/Get. + +Raw generated stubs are available under `server` / `streams_server` / +`kv_server` / `collections_server` / `sketches_server` / `cache_server`. + +## Leader election + +```rust +use std::time::Duration; +use waymaker_client::{Client, lock}; + +let client = Client::connect("http://127.0.0.1:8818").await?; +let lock = client.acquire_lock("leader:reports", lock::Config { + max_wait: Duration::ZERO, // try-acquire + lease_ttl: Duration::from_secs(30), + scope: lock::Scope::Quorum, // Raft-replicated fence + ..Default::default() +}).await?; +let _renewal = lock.spawn_renewal(Duration::from_secs(15)); + +// Re-read the fence before each fenced write; stop if leadership is lost. +let mut state = lock.watch(); +loop { + if lock.is_lost() { break; } + do_fenced_write(lock.fence_token()).await?; + state.changed().await.ok(); +} +``` diff --git a/rust/build.rs b/rust/build.rs new file mode 100644 index 0000000..65beb98 --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,19 @@ +// Compile the vendored protos (../proto, synced from the waymaker server repo) +// into client stubs. Client-only: no server traits are generated. +fn main() { + let protos = [ + "../proto/waymaker_locks.proto", + "../proto/waymaker_streams.proto", + "../proto/kv.proto", + "../proto/collections.proto", + "../proto/sketches.proto", + "../proto/cache.proto", + ]; + tonic_prost_build::configure() + .build_server(false) + .compile_protos(&protos, &["../proto"]) + .expect("failed to compile waymaker protos"); + for p in protos { + println!("cargo:rerun-if-changed={p}"); + } +} diff --git a/rust/src/cache/hash.rs b/rust/src/cache/hash.rs new file mode 100644 index 0000000..101e11b --- /dev/null +++ b/rust/src/cache/hash.rs @@ -0,0 +1,210 @@ +//! Redis-shape Hash. Thin RPC binding over server's `Hash*` RPCs. +//! All conventions (subject patterns, tombstone marker) live +//! server-side in `waymaker_streams::wire_conventions`. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::collections_server::{ + CreateHashStoreRequest, DeleteHashStoreRequest, HashDeleteRequest, HashExistsRequest, + HashFieldsRequest, HashGetAllRequest, HashGetRequest, HashLenRequest, HashSetRequest, +}; +use std::collections::HashMap; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct HashStoreConfig { + pub name: String, + pub max_bytes: Option, + pub ephemeral: bool, +} + +#[derive(Clone)] +pub struct HashStore { + client: Client, + name: String, +} + +impl HashStore { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { + &self.name + } + pub fn hash(&self, hash_key: impl Into) -> Hash { + Hash { + client: self.client.clone(), + bucket: self.name.clone(), + hash_key: hash_key.into(), + } + } +} + +#[derive(Clone)] +pub struct Hash { + client: Client, + bucket: String, + hash_key: String, +} + +impl Hash { + pub async fn set( + &self, + field: impl AsRef, + value: impl Into>, + ) -> Result { + let mut c = self.client.collections_client(); + let r = c + .hash_set(Request::new(HashSetRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + field: field.as_ref().into(), + value: value.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + pub async fn get(&self, field: impl AsRef) -> Result>> { + let mut c = self.client.collections_client(); + let r = c + .hash_get(Request::new(HashGetRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + field: field.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.value) + } + + pub async fn exists(&self, field: impl AsRef) -> Result { + let mut c = self.client.collections_client(); + let r = c + .hash_exists(Request::new(HashExistsRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + field: field.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.exists) + } + + pub async fn delete_field(&self, field: impl AsRef) -> Result<()> { + let mut c = self.client.collections_client(); + let r = c + .hash_delete(Request::new(HashDeleteRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + field: field.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + pub async fn fields(&self) -> Result> { + let mut c = self.client.collections_client(); + let r = c + .hash_fields(Request::new(HashFieldsRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.fields) + } + + pub async fn len(&self) -> Result { + let mut c = self.client.collections_client(); + let r = c + .hash_len(Request::new(HashLenRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.count as usize) + } + + pub async fn get_all(&self) -> Result>> { + let mut c = self.client.collections_client(); + let r = c + .hash_get_all(Request::new(HashGetAllRequest { + bucket: self.bucket.clone(), + hash_key: self.hash_key.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries.into_iter().map(|e| (e.field, e.value)).collect()) + } +} + +impl Client { + pub async fn create_hash_store(&self, config: HashStoreConfig) -> Result { + let mut c = self.collections_client(); + let r = c + .create_hash_store(Request::new(CreateHashStoreRequest { + name: config.name.clone(), + max_bytes: config.max_bytes.unwrap_or(0), + ephemeral: config.ephemeral, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(HashStore::new(self.clone(), config.name)) + } + + pub async fn get_or_create_hash_store(&self, config: HashStoreConfig) -> Result { + match self.create_hash_store(config.clone()).await { + Ok(s) => Ok(s), + Err(Error::Server { code, .. }) if code == "already_exists" => { + Ok(HashStore::new(self.clone(), config.name)) + } + Err(e) => Err(e), + } + } + + pub fn hash_store(&self, name: impl Into) -> HashStore { + HashStore::new(self.clone(), name.into()) + } + + pub async fn delete_hash_store(&self, name: impl Into) -> Result<()> { + let mut c = self.collections_client(); + let r = c + .delete_hash_store(Request::new(DeleteHashStoreRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/cache/mod.rs b/rust/src/cache/mod.rs new file mode 100644 index 0000000..56bded0 --- /dev/null +++ b/rust/src/cache/mod.rs @@ -0,0 +1,21 @@ +//! Redis-shape typed structures backed by waymaker server RPCs. +//! +//! Every operation is a single typed RPC: no client-side knowledge +//! of subject patterns, header names, or marker bytes is needed. +//! The conventions live server-side in +//! `waymaker_streams::wire_conventions` — every language client +//! stays in sync because there's only one place where the wire +//! contract lives. +//! +//! Three Redis-flavored types: +//! - [`Hash`] — HSET/HGET/HDEL/HGETALL. +//! - [`Set`] — SADD/SREM/SMEMBERS/SISMEMBER. +//! - [`Queue`] — RPUSH/LPOP/LRANGE/LLEN (queue-style). + +pub mod hash; +pub mod queue; +pub mod set; + +pub use hash::{Hash, HashStore, HashStoreConfig}; +pub use queue::{Queue, QueueConfig}; +pub use set::{Set, SetStore, SetStoreConfig}; diff --git a/rust/src/cache/queue.rs b/rust/src/cache/queue.rs new file mode 100644 index 0000000..3cf24d2 --- /dev/null +++ b/rust/src/cache/queue.rs @@ -0,0 +1,138 @@ +//! Redis-shape Queue. Thin RPC binding. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::collections_server::{ + CreateQueueRequest, DeleteQueueRequest, QueueLenRequest, QueuePopRequest, QueuePushRequest, + QueueRangeRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct QueueConfig { + pub name: String, + pub max_bytes: Option, + pub max_messages: Option, + pub ephemeral: bool, +} + +#[derive(Clone)] +pub struct Queue { + client: Client, + name: String, +} + +impl Queue { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { + &self.name + } + + pub async fn push(&self, value: impl Into>) -> Result { + let mut c = self.client.collections_client(); + let r = c + .queue_push(Request::new(QueuePushRequest { + bucket: self.name.clone(), + value: value.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.sequence) + } + + pub async fn pop(&self) -> Result>> { + let mut c = self.client.collections_client(); + let r = c + .queue_pop(Request::new(QueuePopRequest { + bucket: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.value) + } + + pub async fn range(&self, from: u64, limit: u64) -> Result>> { + let mut c = self.client.collections_client(); + let r = c + .queue_range(Request::new(QueueRangeRequest { + bucket: self.name.clone(), + from_sequence: from, + limit, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.values) + } + + pub async fn len(&self) -> Result { + let mut c = self.client.collections_client(); + let r = c + .queue_len(Request::new(QueueLenRequest { + bucket: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.count) + } +} + +impl Client { + pub async fn create_queue(&self, config: QueueConfig) -> Result { + let mut c = self.collections_client(); + let r = c + .create_queue(Request::new(CreateQueueRequest { + name: config.name.clone(), + max_bytes: config.max_bytes.unwrap_or(0), + max_messages: config.max_messages.unwrap_or(0), + ephemeral: config.ephemeral, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Queue::new(self.clone(), config.name)) + } + + pub async fn get_or_create_queue(&self, config: QueueConfig) -> Result { + match self.create_queue(config.clone()).await { + Ok(q) => Ok(q), + Err(Error::Server { code, .. }) if code == "already_exists" => { + Ok(Queue::new(self.clone(), config.name)) + } + Err(e) => Err(e), + } + } + + pub fn queue(&self, name: impl Into) -> Queue { + Queue::new(self.clone(), name.into()) + } + + pub async fn delete_queue(&self, name: impl Into) -> Result<()> { + let mut c = self.collections_client(); + let r = c + .delete_queue(Request::new(DeleteQueueRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/cache/set.rs b/rust/src/cache/set.rs new file mode 100644 index 0000000..a8d8ce1 --- /dev/null +++ b/rust/src/cache/set.rs @@ -0,0 +1,171 @@ +//! Redis-shape Set. Thin RPC binding. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::collections_server::{ + CreateSetStoreRequest, DeleteSetStoreRequest, SetAddRequest, SetIsMemberRequest, + SetLenRequest, SetMembersRequest, SetRemoveRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct SetStoreConfig { + pub name: String, + pub max_bytes: Option, + pub ephemeral: bool, +} + +#[derive(Clone)] +pub struct SetStore { + client: Client, + name: String, +} + +impl SetStore { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { + &self.name + } + pub fn set(&self, set_key: impl Into) -> Set { + Set { + client: self.client.clone(), + bucket: self.name.clone(), + set_key: set_key.into(), + } + } +} + +#[derive(Clone)] +pub struct Set { + client: Client, + bucket: String, + set_key: String, +} + +impl Set { + pub async fn add(&self, member: impl AsRef) -> Result<()> { + let mut c = self.client.collections_client(); + let r = c + .set_add(Request::new(SetAddRequest { + bucket: self.bucket.clone(), + set_key: self.set_key.clone(), + member: member.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + pub async fn remove(&self, member: impl AsRef) -> Result<()> { + let mut c = self.client.collections_client(); + let r = c + .set_remove(Request::new(SetRemoveRequest { + bucket: self.bucket.clone(), + set_key: self.set_key.clone(), + member: member.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + pub async fn is_member(&self, member: impl AsRef) -> Result { + let mut c = self.client.collections_client(); + let r = c + .set_is_member(Request::new(SetIsMemberRequest { + bucket: self.bucket.clone(), + set_key: self.set_key.clone(), + member: member.as_ref().into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.is_member) + } + + pub async fn members(&self) -> Result> { + let mut c = self.client.collections_client(); + let r = c + .set_members(Request::new(SetMembersRequest { + bucket: self.bucket.clone(), + set_key: self.set_key.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.members) + } + + pub async fn len(&self) -> Result { + let mut c = self.client.collections_client(); + let r = c + .set_len(Request::new(SetLenRequest { + bucket: self.bucket.clone(), + set_key: self.set_key.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.count as usize) + } +} + +impl Client { + pub async fn create_set_store(&self, config: SetStoreConfig) -> Result { + let mut c = self.collections_client(); + let r = c + .create_set_store(Request::new(CreateSetStoreRequest { + name: config.name.clone(), + max_bytes: config.max_bytes.unwrap_or(0), + ephemeral: config.ephemeral, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(SetStore::new(self.clone(), config.name)) + } + + pub async fn get_or_create_set_store(&self, config: SetStoreConfig) -> Result { + match self.create_set_store(config.clone()).await { + Ok(s) => Ok(s), + Err(Error::Server { code, .. }) if code == "already_exists" => { + Ok(SetStore::new(self.clone(), config.name)) + } + Err(e) => Err(e), + } + } + + pub fn set_store(&self, name: impl Into) -> SetStore { + SetStore::new(self.clone(), name.into()) + } + + pub async fn delete_set_store(&self, name: impl Into) -> Result<()> { + let mut c = self.collections_client(); + let r = c + .delete_set_store(Request::new(DeleteSetStoreRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/client.rs b/rust/src/client.rs new file mode 100644 index 0000000..b358e30 --- /dev/null +++ b/rust/src/client.rs @@ -0,0 +1,243 @@ +//! Core connection handle. +//! +//! Owns the gRPC channel and exposes top-level entry points for +//! every subsystem (streams, locks, KV, object store). Per-subsystem +//! operations live on the handle returned by those entry points +//! (e.g. `Stream::publish`, `Lock::extend`). +//! +//! `Client` is cheap to clone — the underlying tonic `Channel` is +//! Arc-based, so passing a `Client` to spawned tasks does not +//! duplicate the connection. +//! +//! ## HA / multi-host +//! +//! `Client::connect` accepts a single URL; `Client::connect_multi` +//! accepts a list. With multiple endpoints, tonic's +//! `Channel::balance_list` round-robins requests across them and +//! automatically reroutes when one endpoint goes down. This is +//! the right shape for a clustered waymaker deployment where any +//! node can serve any RPC (with internal proxy hops when the local +//! node is not the primary for a given key). + +use crate::error::{Error, Result}; +use crate::stream::{Stream, StreamConfig, StreamUpdate}; +use crate::streams_server::waymaker_streams_service_client::WaymakerStreamsServiceClient; +use crate::streams_server::{ + CreateStreamRequest, DeleteStreamRequest, GetStreamInfoRequest, UpdateStreamRequest, +}; +use crate::server::waymaker_service_client::WaymakerServiceClient; +use tonic::transport::{Channel, Endpoint}; + +/// A connected waymaker client. Holds a tonic `Channel` and exposes +/// both gRPC service clients (locks + streams) lazily. +#[derive(Clone)] +pub struct Client { + pub(crate) channel: Channel, +} + +impl Client { + /// Connect to a single waymaker server. Accepts the same + /// `http://host:port` (or `https://...`) URL shape as + /// `tonic::transport::Channel::from_static`. + pub async fn connect(url: impl Into) -> Result { + let url: String = url.into(); + let endpoint = Channel::from_shared(url) + .map_err(|e| Error::Invalid(format!("invalid url: {e}")))?; + let channel = endpoint.connect().await?; + Ok(Self { channel }) + } + + /// Connect to multiple waymaker servers with load-balanced + /// failover. The returned `Client` round-robins requests across + /// endpoints and automatically reroutes when one is down — the + /// right shape for a clustered deployment. + /// + /// Requires at least one URL; errors if the list is empty or any + /// URL fails to parse. + pub fn connect_multi(urls: I) -> Result + where + I: IntoIterator, + S: Into, + { + let endpoints: Vec = urls + .into_iter() + .map(|u| { + let u = u.into(); + Channel::from_shared(u.clone()) + .map_err(|e| Error::Invalid(format!("invalid url {u:?}: {e}"))) + }) + .collect::>()?; + if endpoints.is_empty() { + return Err(Error::Invalid("connect_multi requires at least one URL".into())); + } + // `balance_list` returns a Channel that connects lazily and + // load-balances across all endpoints; it does not need an + // initial successful handshake. + let channel = Channel::balance_list(endpoints.into_iter()); + Ok(Self { channel }) + } + + /// Streams gRPC client over this connection. Constructed + /// per-call so each RPC sees the channel's current routing + /// state (round-robin / failover decisions). + pub fn streams_client(&self) -> WaymakerStreamsServiceClient { + WaymakerStreamsServiceClient::new(self.channel.clone()) + } + + /// Locks gRPC client over this connection. + pub fn locks_client(&self) -> WaymakerServiceClient { + WaymakerServiceClient::new(self.channel.clone()) + } + + /// Sketches gRPC client over this connection. The sketches + /// service is its own surface (`WaymakerSketchesService`); + /// per-call construction matches the streams pattern. + pub(crate) fn sketches_client( + &self, + ) -> crate::sketches_server::waymaker_sketches_service_client::WaymakerSketchesServiceClient< + Channel, + > { + crate::sketches_server::waymaker_sketches_service_client::WaymakerSketchesServiceClient::new( + self.channel.clone(), + ) + } + + /// KV gRPC client over this connection. The KV service + /// (`WaymakerKvService`) is its own surface; per-call + /// construction matches the streams pattern. + pub(crate) fn kv_client( + &self, + ) -> crate::kv_server::waymaker_kv_service_client::WaymakerKvServiceClient { + crate::kv_server::waymaker_kv_service_client::WaymakerKvServiceClient::new( + self.channel.clone(), + ) + } + + /// Collections (Hash / Set / Queue) gRPC client. + pub(crate) fn collections_client( + &self, + ) -> crate::collections_server::waymaker_collections_service_client::WaymakerCollectionsServiceClient + { + crate::collections_server::waymaker_collections_service_client::WaymakerCollectionsServiceClient::new( + self.channel.clone(), + ) + } + + /// Cache (TTL / eviction policy) gRPC client. + pub fn cache_client( + &self, + ) -> crate::cache_server::waymaker_cache_service_client::WaymakerCacheServiceClient + { + crate::cache_server::waymaker_cache_service_client::WaymakerCacheServiceClient::new( + self.channel.clone(), + ) + } + + // ----- Streams subsystem entry points ----- + + /// Create a new stream. Errors if the stream already exists. + pub async fn create_stream(&self, config: StreamConfig) -> Result { + let name = config.name.clone(); + let mut c = self.streams_client(); + let r = c + .create_stream(tonic::Request::new(CreateStreamRequest { + config: Some(config.into_pb()), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Stream::new(self.clone(), name)) + } + + /// Return a handle to an existing stream. Confirms the stream + /// exists via `GetStreamInfo`. + pub async fn get_stream(&self, name: impl Into) -> Result { + let name: String = name.into(); + let mut c = self.streams_client(); + let r = c + .get_stream_info(tonic::Request::new(GetStreamInfoRequest { name: name.clone() })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Stream::new(self.clone(), name)) + } + + /// Create the stream if it doesn't exist; otherwise return a + /// handle to the existing one. + pub async fn get_or_create_stream(&self, config: StreamConfig) -> Result { + match self.get_stream(config.name.clone()).await { + Ok(s) => Ok(s), + Err(Error::Server { code, .. }) if code == "no_such_stream" => { + self.create_stream(config).await + } + Err(e) => Err(e), + } + } + + /// Apply the mutable subset of a stream's config. + pub async fn update_stream( + &self, + name: impl Into, + update: StreamUpdate, + ) -> Result<()> { + let mut c = self.streams_client(); + let r = c + .update_stream(tonic::Request::new(UpdateStreamRequest { + name: name.into(), + max_age_ms: update.max_age_ms.map(|d| d.as_millis() as u64), + max_msgs: update.max_msgs, + max_bytes: update.max_bytes, + max_msg_bytes: update.max_msg_bytes, + strict_limits: update.strict_limits, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Delete a stream and all its consumers. + pub async fn delete_stream(&self, name: impl Into) -> Result<()> { + let mut c = self.streams_client(); + let r = c + .delete_stream(tonic::Request::new(DeleteStreamRequest { name: name.into() })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Slice 3 admin: enumerate every (sourcing, source) tail + /// running on the node serving the request. Multi-node clusters + /// need to query each node — this RPC is local-scope by design. + pub async fn get_stream_sources(&self) -> Result> { + use crate::streams_server::GetStreamSourcesRequest; + let mut c = self.streams_client(); + let r = c + .get_stream_sources(tonic::Request::new(GetStreamSourcesRequest {})) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries + .into_iter() + .map(|e| crate::stream::SourceStatus { + sourcing_stream: e.sourcing_stream, + source_stream: e.source_stream, + last_sourced_seq: e.last_sourced_seq, + pulled_total: e.pulled_total, + last_error: e.last_error, + last_error_ts_ms: e.last_error_ts_ms, + }) + .collect()) + } +} diff --git a/rust/src/error.rs b/rust/src/error.rs new file mode 100644 index 0000000..9dc878b --- /dev/null +++ b/rust/src/error.rs @@ -0,0 +1,39 @@ +//! Typed error surface for the high-level wrapper. +//! +//! Mirrors the shape of `async_nats::Error` — most callers in the +//! awesomike codebase treat errors as `Box` so a simple +//! enum wrapping the underlying causes is enough. + +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum Error { + #[error("connect: {0}")] + Connect(#[from] tonic::transport::Error), + + /// RPC-layer transport failure (typically network). + #[error("rpc: {0}")] + Rpc(#[from] tonic::Status), + + /// Server returned `success=false`. The string is the + /// `result_code` from the response (`no_such_stream`, + /// `no_such_consumer`, `internal`, etc). + #[error("server returned {code}: {message}")] + Server { code: String, message: String }, + + /// The caller passed a value the wrapper couldn't translate to + /// a wire field (e.g. an unknown retention policy). + #[error("invalid argument: {0}")] + Invalid(String), +} + +impl Error { + pub(crate) fn server(code: impl Into, message: impl Into) -> Self { + Self::Server { + code: code.into(), + message: message.into(), + } + } +} + +pub type Result = std::result::Result; diff --git a/rust/src/kv/mod.rs b/rust/src/kv/mod.rs new file mode 100644 index 0000000..c3607c7 --- /dev/null +++ b/rust/src/kv/mod.rs @@ -0,0 +1,371 @@ +//! KV subsystem — thin RPC binding over the server's `Kv*` RPCs. +//! +//! All conventions (subject patterns, tombstone marker, TTL +//! header) live **server-side** in +//! `waymaker_streams::wire_conventions`. The client just calls +//! the typed RPCs — every language client stays in sync without +//! having to mirror the wire details. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::kv_server::{ + self as pb, KvCreateBucketRequest, KvCreateRequest, KvDeleteBucketRequest, KvDeleteRequest, + KvGetRequest, KvHistoryRequest, KvKeysRequest, KvPutRequest, KvTouchRequest, + KvUpdateRequest, KvWatchRequest, +}; +use std::pin::Pin; +use std::task::{Context, Poll}; +use std::time::Duration; +use tonic::Request; + +/// Bucket creation config. +#[derive(Debug, Clone, Default)] +pub struct Config { + pub name: String, + /// Cap on total bucket bytes. `None` = unbounded. + pub max_bytes: Option, + /// Cap on per-value bytes. `None` = no cap. + pub max_value_size: Option, + /// Bucket-level TTL (independent of per-key TTL). + pub max_age: Option, + /// Memory-only. + pub ephemeral: bool, + /// Per-key revision cap. `0` (default) = unbounded — history + /// is bounded only by the bucket's stream-level retention + /// (`max_bytes`/`max_age`). When N > 0, after each write the + /// older revisions of *that key* beyond the N most recent are + /// dropped. NATS JetStream's `MaxRevisions` semantic. Useful + /// when one bucket hosts many keys with very different write + /// rates — a fast-churning key won't crowd out a slow one. + pub max_revisions: u64, +} + +/// A reference to a bucket. Cheap to clone. +#[derive(Clone)] +pub struct Bucket { + client: Client, + name: String, +} + +impl Bucket { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + + pub fn name(&self) -> &str { + &self.name + } + + /// Put `value` under `key`. Latest-write-wins. Returns the + /// new revision. + pub async fn put(&self, key: impl AsRef, value: impl Into>) -> Result { + let mut c = self.client.kv_client(); + let r = c + .put(Request::new(KvPutRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + value: value.into(), + ttl_ms: 0, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + /// Put with per-key TTL. Server auto-expires the value after + /// `ttl` elapses (best-effort, on the next sweep tick). + pub async fn put_with_ttl( + &self, + key: impl AsRef, + value: impl Into>, + ttl: Duration, + ) -> Result { + let mut c = self.client.kv_client(); + let r = c + .put(Request::new(KvPutRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + value: value.into(), + ttl_ms: ttl.as_millis() as u64, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + /// Atomic create — fails with `Error::Server { code: + /// "wrong_revision", .. }` if the key already has any value. + pub async fn create(&self, key: impl AsRef, value: impl Into>) -> Result { + let mut c = self.client.kv_client(); + let r = c + .create(Request::new(KvCreateRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + value: value.into(), + ttl_ms: 0, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + /// CAS update — succeeds only if current revision matches + /// `expected_revision`. + pub async fn update( + &self, + key: impl AsRef, + value: impl Into>, + expected_revision: u64, + ) -> Result { + let mut c = self.client.kv_client(); + let r = c + .update(Request::new(KvUpdateRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + value: value.into(), + expected_revision, + ttl_ms: 0, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + /// Get the latest value. `None` when absent or tombstoned. + pub async fn get(&self, key: impl AsRef) -> Result>> { + Ok(self.get_with_revision(key).await?.map(|(v, _)| v)) + } + + /// Get value + revision (for chaining CAS). + pub async fn get_with_revision( + &self, + key: impl AsRef, + ) -> Result, u64)>> { + let mut c = self.client.kv_client(); + let r = c + .get(Request::new(KvGetRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entry.map(|e| (e.value, e.revision))) + } + + /// Tombstone `key`. + pub async fn delete(&self, key: impl AsRef) -> Result<()> { + let mut c = self.client.kv_client(); + let r = c + .delete(Request::new(KvDeleteRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Extend TTL on `key` without changing its value. + pub async fn touch(&self, key: impl AsRef, ttl: Duration) -> Result { + let mut c = self.client.kv_client(); + let r = c + .touch(Request::new(KvTouchRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + ttl_ms: ttl.as_millis() as u64, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revision) + } + + /// List every key in the bucket. Tombstoned entries are + /// excluded by default. + pub async fn keys(&self) -> Result> { + let mut c = self.client.kv_client(); + let r = c + .keys(Request::new(KvKeysRequest { + bucket: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries + .into_iter() + .filter(|e| !e.deleted) + .map(|e| e.key) + .collect()) + } + + /// Historical values at `key` in publish order. + pub async fn history(&self, key: impl AsRef) -> Result> { + let mut c = self.client.kv_client(); + let r = c + .history(Request::new(KvHistoryRequest { + bucket: self.name.clone(), + key: key.as_ref().to_string(), + from_revision: 0, + limit: 0, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries + .into_iter() + .map(|e| HistoryEntry { + value: e.value, + revision: e.revision, + ts_ms: e.ts_ms, + tombstone: e.deleted, + }) + .collect()) + } + + /// Watch live changes at `key`. + pub async fn watch(&self, key: impl AsRef) -> Result { + self.watch_inner(Some(key.as_ref().to_string())).await + } + + /// Watch every key in the bucket. + pub async fn watch_all(&self) -> Result { + self.watch_inner(None).await + } + + async fn watch_inner(&self, key: Option) -> Result { + let mut c = self.client.kv_client(); + let stream = c + .watch(Request::new(KvWatchRequest { + bucket: self.name.clone(), + key: key.unwrap_or_default(), + })) + .await? + .into_inner(); + Ok(Watch { inner: stream }) + } +} + +#[derive(Debug, Clone)] +pub struct HistoryEntry { + pub value: Vec, + pub revision: u64, + pub ts_ms: i64, + pub tombstone: bool, +} + +#[derive(Debug, Clone)] +pub enum Event { + Put { key: String, value: Vec, revision: u64 }, + Delete { key: String, revision: u64 }, +} + +pub struct Watch { + inner: tonic::Streaming, +} + +impl tokio_stream::Stream for Watch { + type Item = Result; + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + use pb::kv_watch_event::Event as Ev; + loop { + match Pin::new(&mut self.inner).poll_next(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(None) => return Poll::Ready(None), + Poll::Ready(Some(Err(s))) => return Poll::Ready(Some(Err(Error::Rpc(s)))), + Poll::Ready(Some(Ok(ev))) => match ev.event { + Some(Ev::Put(p)) => { + return Poll::Ready(Some(Ok(Event::Put { + key: p.key, + value: p.value, + revision: p.revision, + }))); + } + Some(Ev::Delete(d)) => { + return Poll::Ready(Some(Ok(Event::Delete { + key: d.key, + revision: d.revision, + }))); + } + None => continue, + }, + } + } + } +} + +impl Client { + /// Create a new KV bucket. + pub async fn create_kv(&self, config: Config) -> Result { + let mut c = self.kv_client(); + let r = c + .create_bucket(Request::new(KvCreateBucketRequest { + bucket: config.name.clone(), + max_bytes: config.max_bytes.unwrap_or(0), + max_value_size: config.max_value_size.unwrap_or(0), + max_age_ms: config.max_age.map(|d| d.as_millis() as u64).unwrap_or(0), + ephemeral: config.ephemeral, + max_revisions: config.max_revisions, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Bucket::new(self.clone(), config.name)) + } + + /// Idempotent create-or-get. + pub async fn get_or_create_kv(&self, config: Config) -> Result { + match self.create_kv(config.clone()).await { + Ok(b) => Ok(b), + Err(Error::Server { code, .. }) if code == "already_exists" => { + Ok(Bucket::new(self.clone(), config.name)) + } + Err(e) => Err(e), + } + } + + /// Return a handle without verifying existence. + pub fn kv(&self, name: impl Into) -> Bucket { + Bucket::new(self.clone(), name.into()) + } + + /// Delete the bucket. + pub async fn delete_kv(&self, name: impl Into) -> Result<()> { + let mut c = self.kv_client(); + let r = c + .delete_bucket(Request::new(KvDeleteBucketRequest { + bucket: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..81cb610 --- /dev/null +++ b/rust/src/lib.rs @@ -0,0 +1,72 @@ +//! Official Rust client for waymaker. +//! +//! The proto stubs are generated at build time from the vendored +//! `.proto` files in this repo's `proto/` directory (the waymaker +//! server repo is the source of truth — see `scripts/sync-protos.sh`). +//! Each subsystem's stubs live under a `_server` module so a +//! consumer can reach the raw wire types when needed; the ergonomic +//! wrappers (`lock`, `stream`, `kv`, …) are layered on top. +//! +//! Module names are kept as `server` / `streams_server` / … for +//! source compatibility with the pre-extraction crate, where these +//! were re-exports of the per-subsystem `proto` modules. + +/// Lock proto stubs (`WaymakerService` — the external client surface). +/// Generated from `proto/waymaker_locks.proto` (package `waymaker`). +/// The server-internal `ProxyService` (node-to-node proxy + lease +/// replication) is deliberately NOT vendored here — it is a server +/// concern, not part of the client. +pub mod server { + tonic::include_proto!("waymaker"); +} + +/// Streams proto stubs (`WaymakerStreamsService` + internal +/// replication RPCs). Generated from `proto/waymaker_streams.proto`. +pub mod streams_server { + tonic::include_proto!("waymaker.streams"); +} + +/// Sketches proto stubs (`WaymakerSketchesService`). Generated from +/// `proto/sketches.proto`. +pub mod sketches_server { + tonic::include_proto!("waymaker.sketches"); +} + +/// KV proto stubs (`WaymakerKvService`). Generated from +/// `proto/kv.proto`. +pub mod kv_server { + tonic::include_proto!("waymaker.kv"); +} + +/// Collections proto stubs (`WaymakerCollectionsService` — +/// Hash / Set / Queue). Generated from `proto/collections.proto`. +pub mod collections_server { + tonic::include_proto!("waymaker.collections"); +} + +/// Cache proto stubs (`WaymakerCacheService`). Generated from +/// `proto/cache.proto`. +pub mod cache_server { + tonic::include_proto!("waymaker.cache"); +} + +// High-level wrapper. The proto-generated types in `server` / +// `streams_server` stay available for callers that need the raw +// wire surface; the per-subsystem modules below are the +// ergonomic ones. + +pub mod cache; +pub mod client; +pub mod error; +pub mod kv; +pub mod lock; +pub mod object; +pub mod probabilistic; +pub mod stream; + +pub use client::Client; +pub use error::{Error, Result}; + +// Re-exported so callers can call `.next()` on `consumer.messages()` +// without a separate `use tokio_stream::StreamExt`. +pub use tokio_stream::StreamExt; diff --git a/rust/src/lock/mod.rs b/rust/src/lock/mod.rs new file mode 100644 index 0000000..b96fca7 --- /dev/null +++ b/rust/src/lock/mod.rs @@ -0,0 +1,836 @@ +//! Locks subsystem — wraps the rwlock RPCs (Lock / ReadLock / +//! UnLock / LeaseStatus / ExtendLease / MultiLock). +//! +//! Entry points live on `Client`: +//! - `client.acquire_lock("key", lock::Config { ... })` — write lock +//! - `client.acquire_read_lock("key", lock::Config { ... })` — read lock +//! - `client.lease_status(&lock_id)` +//! - `client.multi_lock(...)` +//! +//! The returned [`Lock`] keeps a background task that holds the +//! server event stream open and, if that stream drops (e.g. the +//! key's primary bounces), transparently re-binds it and re-confirms +//! ownership — reusing the original `request_id` so a still-held +//! lease is recovered rather than re-contended. The lock's live +//! state (fence token, lease expiry, and a `lost` flag) is published +//! through [`Lock::watch`]; re-read [`Lock::fence_token`] before every +//! fenced side effect, because a lost-then-re-won lock carries a new, +//! higher token. +//! +//! ## Leader-election pattern +//! +//! Match the operator workflow used in graylin etc.: +//! +//! ```ignore +//! let lock = client.acquire_lock("leader:foo", lock::Config { +//! max_wait: Duration::ZERO, // try-and-fail +//! lease_ttl: Duration::from_secs(60), +//! scope: lock::Scope::Local, +//! ..Default::default() +//! }).await?; +//! let _renewal = lock.spawn_renewal(Duration::from_secs(30)); +//! // ... do work; drop _renewal + drop lock when done. +//! ``` + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::server::{ + waymaker_service_client::WaymakerServiceClient, ExtendLeaseRequest, LeaseStatusRequest, + LockEvent, LockEventType, LockRequest, MultiLockKey, MultiLockRequest, UnLockRequest, +}; +use std::sync::Arc; +use std::time::Duration; +use tokio::sync::{watch, Notify}; +use tonic::transport::Channel; +use tonic::Request; +use uuid::Uuid; + +/// Fence-scope tier — controls **one thing only**: how durable the +/// per-key fence-token counter (the monotonic `u64`) is across +/// failures. Mirrors the proto `FenceScope`. +/// +/// What the scope does **not** control: +/// - **Whether a held lock survives a node loss / rollout.** That is +/// `cluster.replication-factor` plus secondary adoption, which +/// already applies to every non-`Ephemeral` lock regardless of +/// scope. A stronger scope does not make a lock survive; a +/// replicated lease does. +/// - **Client-side transparency.** [`Lock`] transparently re-binds +/// its event stream after a disconnect, but that is a client-lib +/// behaviour — no scope value changes it. +/// - **Mutual exclusion.** Holding the lock is not, by itself, a +/// guarantee that no one else acts. You MUST validate +/// [`Lock::fence_token`] at your side effect (the DB write / object +/// PUT) and reject anything carrying a fence below the last you +/// durably committed. Even [`Scope::Quorum`] does not let you skip +/// that check — an all-at-once cluster restart can still drop an +/// in-memory token. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Scope { + /// Counter in RAM on the owning node; resets on that node's + /// restart or a hash-ring rebalance. Fastest (no I/O). Right for + /// advisory locks / rate limiting where a fence reset across + /// failure is tolerable. + Ephemeral, + /// Counter persisted to disk on the owning node. Survives a + /// process restart on the same node; still resets if the ring + /// rebalances the key to a different node. One fsync per acquire. + Local, + /// Raft-replicated per-key counter — cluster-wide monotonic, + /// survives any single-node failure (the surviving quorum keeps + /// the count). One Raft commit per acquire. Requires the cluster + /// backend to be wired; a single-node / test build returns + /// `BadInput` for this scope. Pick this when an external resource + /// fences on the token and two holders must never see fences that + /// fail to prove an ordering. + /// + /// Named `Quorum` (not `Global`): the guarantee is "a Raft quorum + /// agrees on the count", which carries its own limit in the word + /// and makes no geographic claim. The wire value is unchanged, so + /// old and new binaries interoperate mid-rollout. + Quorum, +} + +impl Default for Scope { + fn default() -> Self { + Self::Ephemeral + } +} + +impl Scope { + fn to_pb(self) -> i32 { + use crate::server::FenceScope as F; + let s = match self { + Self::Ephemeral => F::ScopeEphemeral, + Self::Local => F::ScopeLocal, + Self::Quorum => F::ScopeQuorum, + }; + s as i32 + } +} + +/// Lock acquisition config. `Default` is `max_wait=infinite, +/// lease_ttl=30s, priority=0, scope=Ephemeral`. Callers typically +/// override `max_wait` (to `ZERO` for try-acquire) and `lease_ttl` +/// (to whatever the renewal cadence supports). +#[derive(Debug, Clone)] +pub struct Config { + /// How long the server will block waiting for the lock to + /// become available. `Duration::ZERO` = try-acquire (fail + /// immediately if contended). `Duration::MAX` = block + /// indefinitely. + pub max_wait: Duration, + /// How long the lease lives once acquired (before + /// auto-expiration). Renewal extends this. + pub lease_ttl: Duration, + /// Priority class — higher priorities jump the wait queue. + /// Default 0. + pub priority: u32, + /// Fence-token persistence tier. + pub scope: Scope, + /// Free-form requester metadata for server-side audit. Empty + /// strings ok. + pub requester_info: String, + /// Application name (sent verbatim — useful for operator + /// dashboards). Default `"waymaker-client"`. + pub requester_application: String, + /// Idempotency key for retries of the same logical acquire. + /// Auto-filled with a UUID if left empty. + pub request_id: String, +} + +impl Default for Config { + fn default() -> Self { + Self { + max_wait: Duration::from_secs(60 * 60), + lease_ttl: Duration::from_secs(30), + priority: 0, + scope: Scope::Ephemeral, + requester_info: String::new(), + requester_application: "waymaker-client".into(), + request_id: String::new(), + } + } +} + +impl Config { + fn into_request(self, key: String) -> LockRequest { + let request_id = if self.request_id.is_empty() { + Uuid::now_v7().to_string() + } else { + self.request_id + }; + let clamp_ms = |d: Duration| -> u32 { + if d == Duration::MAX { + u32::MAX + } else { + d.as_millis().min(u32::MAX as u128) as u32 + } + }; + LockRequest { + key, + max_wait_period: clamp_ms(self.max_wait), + max_lease_period: clamp_ms(self.lease_ttl), + priority: self.priority, + requester_info: self.requester_info, + requester_application: self.requester_application, + request_id, + fence_scope: self.scope.to_pb(), + } + } +} + +/// Lease details returned with `Acquired` / `Heartbeat` / status +/// queries. +#[derive(Debug, Clone)] +pub struct Lease { + pub id: String, + pub key: String, + pub acquired_at_ms: i64, + pub lease_expires_at_ms: i64, + pub fence_token: u64, + pub priority: u32, +} + +/// A live snapshot of a held lock's state, delivered through +/// [`Lock::watch`]. `fence_token` / `id` change only if the lock was +/// lost and transparently re-won after a primary failure; `lost` +/// flips to `true` once the client gives up re-establishing it. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct LockState { + /// Current lease id. Stable across a transparent re-bind; changes + /// only if the lock was lost and freshly re-acquired. + pub id: String, + /// Current fence token. Re-read before every fenced side effect — + /// a lost-then-re-won lock carries a higher token, and acting on a + /// stale copy defeats fencing. + pub fence_token: u64, + /// Lease expiry (epoch ms), refreshed from heartbeats / re-acquire. + pub lease_expires_at_ms: i64, + /// `true` once the client could no longer prove it holds the lock + /// (the lease was taken by someone else, or expired and could not + /// be re-won). A `lost` holder MUST stop acting as the holder. + pub lost: bool, +} + +/// An acquired lock. Dropping the handle **does not** auto-release +/// the lock — call [`Lock::unlock`] explicitly (or let the lease +/// expire). This matches the underlying RPC semantics; auto-release +/// on drop would silently swallow errors and surprise callers +/// who expect the server-side state to outlive the local handle. +/// +/// A background task keeps the server event stream open. If that +/// stream drops — typically because the key's primary bounced — the +/// task transparently re-binds it, reusing the original `request_id` +/// so a still-held lease is recovered rather than re-contended. The +/// lease itself is kept alive by the server's TTL plus +/// [`Lock::spawn_renewal`], independent of the stream: dropping the +/// stream loses event visibility, not the lock. Live state is exposed +/// through the accessors below and [`Lock::watch`]. +pub struct Lock { + client: Client, + pub key: String, + /// Live lock state. `borrow()` yields the current snapshot. + state: watch::Receiver, + /// Signals the background hold task to stop. Set by `unlock` and + /// `Drop` so the task never re-acquires a deliberately-released + /// lock. + stop: Arc, + _hold: tokio::task::JoinHandle<()>, +} + +impl Lock { + /// Current lease id (live). + pub fn id(&self) -> String { + self.state.borrow().id.clone() + } + + /// Current fence token (live). Re-read this before every fenced + /// side effect — see [`LockState::fence_token`]. + pub fn fence_token(&self) -> u64 { + self.state.borrow().fence_token + } + + /// Current lease expiry, epoch ms (live). + pub fn lease_expires_at_ms(&self) -> i64 { + self.state.borrow().lease_expires_at_ms + } + + /// `true` once the client has lost the lock and could not re-win + /// it. A lost holder must stop acting as the holder. + pub fn is_lost(&self) -> bool { + self.state.borrow().lost + } + + /// Subscribe to live state changes. Await `.changed()`, then + /// re-read [`Lock::fence_token`] / [`Lock::is_lost`] before your + /// next side effect. Multiple receivers are fine. + pub fn watch(&self) -> watch::Receiver { + self.state.clone() + } + + /// Extend the lease by `additional`. + pub async fn extend(&self, additional: Duration) -> Result { + let mut c: WaymakerServiceClient = self.client.locks_client(); + let r = c + .extend_lease(Request::new(ExtendLeaseRequest { + key: self.key.clone(), + id: self.id(), + lease_timeout: additional.as_millis().min(u32::MAX as u128) as u32, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + let lease = r.lease.ok_or_else(|| Error::server("internal", "missing lease in response"))?; + Ok(Lease { + id: lease.id, + key: lease.key, + acquired_at_ms: lease.created_at, + lease_expires_at_ms: lease.lease_expires_at, + fence_token: lease.fence_token, + priority: lease.priority, + }) + } + + /// Release the lock. After this returns, the server-side state + /// is gone and subsequent operations on this `Lock` will fail. + pub async fn unlock(self) -> Result<()> { + // Stop the hold task FIRST so it cannot re-acquire the lock we + // are about to release — a re-acquire racing the UnLock would + // resurrect a lock the caller believes is gone. + self.stop.notify_one(); + let id = self.id(); + let mut c = self.client.locks_client(); + let r = c + .un_lock(Request::new(UnLockRequest { + key: self.key.clone(), + id, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Spawn a background task that periodically extends the + /// lease. Returns a `RenewalHandle` — drop it (or call + /// `.stop()`) to halt renewal. Matches the leader-election + /// pattern: the renewal runs independently of the work loop so + /// the work can legitimately outlive any single lease window. + pub fn spawn_renewal(&self, every: Duration) -> RenewalHandle { + let client = self.client.clone(); + let key = self.key.clone(); + // Clone the live-state receiver so each tick renews the *current* + // lease id — a transparent re-acquire after a primary failure can + // mint a new id, and renewing the stale one would silently let the + // real lease expire. + let state = self.state.clone(); + let ttl_ms = (every.as_millis() * 2).min(u32::MAX as u128) as u32; + let stop = Arc::new(Notify::new()); + let stop_task = stop.clone(); + let handle = tokio::spawn(async move { + let mut ticker = tokio::time::interval(every); + // Skip the immediate first tick — interval fires + // straight away by default and the caller has the + // freshly-acquired lease. + ticker.tick().await; + loop { + tokio::select! { + // `biased`: honor stop FIRST, even mid-interval, so a + // completed (or dropped) holder can't leave a renewal + // task quietly extending the lease — the bug that wedged + // a held lock until the holding session ended. The old + // code only checked the stop flag AFTER the next tick, + // so stop lagged a full interval and a stray extend could + // still fire after stop was requested. + biased; + _ = stop_task.notified() => break, + _ = ticker.tick() => { + // Read the live id; skip if the lock is already + // lost (extending a dead lease just errors). + let (id, lost) = { + let s = state.borrow(); + (s.id.clone(), s.lost) + }; + if lost { + continue; + } + let mut c = client.locks_client(); + // Bound the RPC so a hung/wedged server can't freeze + // the renewal task (and therefore `stop().await`) + // forever — without this the holder could never + // release and every other waiter would skip until a + // process restart. + let _ = tokio::time::timeout( + every, + c.extend_lease(Request::new(ExtendLeaseRequest { + key: key.clone(), + id, + lease_timeout: ttl_ms, + })), + ) + .await; + } + } + } + }); + RenewalHandle { stop, handle: Some(handle) } + } +} + +impl Drop for Lock { + fn drop(&mut self) { + // Stop the background hold task so a dropped (but not explicitly + // unlocked) handle does not keep re-acquiring in the background. + // `notify_one` leaves a permit if the task is mid-RPC; `abort` + // is the backstop. + self.stop.notify_one(); + self._hold.abort(); + } +} + +// ---- Background hold / re-bind / loss-detection loop ----------------- +// +// The lease lives on the server's TTL + renewal, NOT on this event +// stream (granting a lock sets its `sender_stream` to None). So a +// dropped stream means "lost event visibility", not "lost lock". This +// task re-binds the stream when it can, and only declares the lock +// `lost` when it can no longer prove ownership via lease_status. + +/// Outcome of draining the current event stream. +enum Drained { + /// `unlock` / drop asked us to stop. + Stopped, + /// The stream ended or the server reported the lease gone; try to + /// re-establish ownership. + Disconnected, +} + +/// Outcome of one idempotent re-acquire attempt. +enum Rebound { + /// Got a live stream back (transparent re-bind, or a clean re-win + /// after a real loss). Carries the fresh `(stream, id, fence, exp)`. + Bound(tonic::Streaming, String, u64, i64), + /// The acquire did not grant (key held — possibly by our own + /// still-adopted lease on a new primary, possibly by someone else) + /// or the RPC failed. Disambiguate via lease_status. + NotBound, +} + +/// Whether we still demonstrably own the lease. +enum Ownership { + Held(i64), + Lost, + Unknown, +} + +const HOLD_BASE_BACKOFF: Duration = Duration::from_millis(200); +const HOLD_MAX_BACKOFF: Duration = Duration::from_secs(10); +const HOLD_RPC_TIMEOUT: Duration = Duration::from_secs(10); + +/// Publish `next` if it differs from the local mirror `cur`, notifying +/// watchers only on a real change. +fn publish(tx: &watch::Sender, cur: &mut LockState, next: LockState) { + if *cur != next { + *cur = next.clone(); + let _ = tx.send_replace(next); + } +} + +/// Background task body: hold the event stream, re-bind it on drop, and +/// surface fence-token changes / loss through `state_tx`. +async fn hold_loop( + client: Client, + key: String, + read: bool, + reacquire_req: LockRequest, + mut stream: tonic::Streaming, + state_tx: watch::Sender, + init: LockState, + stop: Arc, +) { + // Local mirror of the published state — lets us read the current id + // and publish only on change without depending on `Sender::borrow`. + let mut cur = init; + loop { + match drain_stream(&mut stream, &state_tx, &mut cur, &stop).await { + Drained::Stopped => return, + Drained::Disconnected => {} + } + + // Re-establish: re-bind the stream; if we cannot, decide whether + // we still own the lease or have truly lost it. + let mut backoff = HOLD_BASE_BACKOFF; + loop { + // Race every step against `stop` so unlock/drop halts us + // promptly — and, crucially, before any re-acquire could + // resurrect a released lock. + let rebound = match race_stop(reacquire(&client, read, &reacquire_req), &stop).await { + Some(r) => r, + None => return, + }; + + match rebound { + Rebound::Bound(s, id, fence, exp) => { + publish( + &state_tx, + &mut cur, + LockState { id, fence_token: fence, lease_expires_at_ms: exp, lost: false }, + ); + stream = s; + break; // resume draining the fresh stream + } + Rebound::NotBound => { + let cur_id = cur.id.clone(); + let owned = + match race_stop(confirm_ownership(&client, &key, &cur_id), &stop).await { + Some(o) => o, + None => return, + }; + match owned { + Ownership::Held(exp) => { + // Still ours (renewal keeps the lease alive); + // we just could not get an event stream — keep + // monitoring with backoff. + let next = LockState { lease_expires_at_ms: exp, ..cur.clone() }; + publish(&state_tx, &mut cur, next); + } + Ownership::Unknown => { /* transient — back off, retry */ } + Ownership::Lost => { + let next = LockState { lost: true, ..cur.clone() }; + publish(&state_tx, &mut cur, next); + return; + } + } + if race_stop(tokio::time::sleep(backoff), &stop).await.is_none() { + return; + } + backoff = (backoff * 2).min(HOLD_MAX_BACKOFF); + } + } + } + } +} + +/// Drain events from the current stream until it ends, the lease is +/// reported gone, or `stop` fires. Heartbeat / Acquired updates flow +/// into `state_tx`. +async fn drain_stream( + stream: &mut tonic::Streaming, + state_tx: &watch::Sender, + cur: &mut LockState, + stop: &Notify, +) -> Drained { + loop { + tokio::select! { + biased; + _ = stop.notified() => return Drained::Stopped, + msg = stream.message() => match msg { + Ok(Some(ev)) => { + let et = ev.event_type; + if et == LockEventType::Heartbeat as i32 { + let next = LockState { lease_expires_at_ms: ev.lease_expires_at, ..cur.clone() }; + publish(state_tx, cur, next); + } else if et == LockEventType::Acquired as i32 { + // Re-emitted after an idempotent re-bind. + let next = LockState { + id: ev.id, + fence_token: ev.fence_token, + lease_expires_at_ms: ev.lease_expires_at, + lost: false, + }; + publish(state_tx, cur, next); + } else if et == LockEventType::Expired as i32 + || et == LockEventType::Failed as i32 + { + // Server says the lease ended — try to recover. + return Drained::Disconnected; + } + // Waiting / Unknown: ignore, keep reading. + } + Ok(None) | Err(_) => return Drained::Disconnected, + }, + } + } +} + +/// One idempotent re-acquire attempt (reusing the original +/// `request_id`, `max_wait = 0`). On the original primary with the +/// lease still held this re-binds the stream and re-emits the held +/// entry; if the lease was lost and the key is free it re-wins with a +/// fresh, higher token. +async fn reacquire(client: &Client, read: bool, req: &LockRequest) -> Rebound { + let req = req.clone(); + let mut c = client.locks_client(); + let attempt = async move { + let mut stream = if read { + c.read_lock(Request::new(req)).await?.into_inner() + } else { + c.lock(Request::new(req)).await?.into_inner() + }; + loop { + match stream.message().await? { + Some(ev) if ev.event_type == LockEventType::Acquired as i32 => { + return Ok::< + Option<(tonic::Streaming, String, u64, i64)>, + tonic::Status, + >(Some(( + stream, + ev.id, + ev.fence_token, + ev.lease_expires_at, + ))); + } + Some(ev) + if ev.event_type == LockEventType::Failed as i32 + || ev.event_type == LockEventType::Expired as i32 => + { + return Ok(None); // not granted (contended) + } + Some(_) => continue, // Waiting / Heartbeat + None => return Ok(None), // closed before grant + } + } + }; + match tokio::time::timeout(HOLD_RPC_TIMEOUT, attempt).await { + Ok(Ok(Some((s, id, fence, exp)))) => Rebound::Bound(s, id, fence, exp), + Ok(Ok(None)) => Rebound::NotBound, + Ok(Err(_)) | Err(_) => Rebound::NotBound, + } +} + +/// Query whether `id` still holds `key`. `success = false` (or a +/// missing lease) means we lost it; a transport / timeout error is +/// inconclusive (`Unknown`) so we never falsely declare loss. +async fn confirm_ownership(client: &Client, key: &str, id: &str) -> Ownership { + let mut c = client.locks_client(); + let call = c.lease_status(Request::new(LeaseStatusRequest { + key: key.to_string(), + id: id.to_string(), + })); + match tokio::time::timeout(HOLD_RPC_TIMEOUT, call).await { + Ok(Ok(resp)) => { + let r = resp.into_inner(); + match (r.success, r.lease) { + (true, Some(lease)) => Ownership::Held(lease.lease_expires_at), + _ => Ownership::Lost, + } + } + Ok(Err(_)) | Err(_) => Ownership::Unknown, + } +} + +/// Run `fut`, returning `None` if `stop` fires first. +async fn race_stop(fut: F, stop: &Notify) -> Option { + tokio::select! { + biased; + _ = stop.notified() => None, + v = fut => Some(v), + } +} + +/// Handle that keeps a background renewal task alive. Drop or +/// `.stop()` to halt renewal cleanly. +pub struct RenewalHandle { + stop: Arc, + handle: Option>, +} + +impl RenewalHandle { + /// Halt the renewal task. After this returns, no further + /// `ExtendLease` RPCs will be sent. The task selects on this + /// `Notify` so it stops promptly (within one bounded `extend_lease` + /// at worst), rather than lagging a full renewal interval. + pub async fn stop(mut self) { + self.stop.notify_one(); + if let Some(h) = self.handle.take() { + let _ = h.await; + } + } +} + +impl Drop for RenewalHandle { + fn drop(&mut self) { + self.stop.notify_one(); + if let Some(h) = self.handle.take() { + h.abort(); + } + } +} + +impl Client { + /// Acquire an exclusive (write) lock. Blocks for at most + /// `config.max_wait`; if the lock isn't granted in time the server emits a + /// `LockEventType::Expired` (the contended wait-TTL elapsed) which this client + /// surfaces as `Error::Server { code: "expired", .. }`. (There is no + /// `"timeout"` code — callers that loop-until-granted must match `"expired"`.) + pub async fn acquire_lock( + &self, + key: impl Into, + config: Config, + ) -> Result { + self.acquire_lock_inner(key.into(), config, /* read = */ false).await + } + + /// Acquire a shared (read) lock. + pub async fn acquire_read_lock( + &self, + key: impl Into, + config: Config, + ) -> Result { + self.acquire_lock_inner(key.into(), config, /* read = */ true).await + } + + async fn acquire_lock_inner(&self, key: String, config: Config, read: bool) -> Result { + let req = config.into_request(key.clone()); + // Template for transparent re-acquire after a stream drop: same + // request_id (so a still-held lease is recovered idempotently + // rather than re-contended) but never block. + let mut reacquire_req = req.clone(); + reacquire_req.max_wait_period = 0; + + let mut c = self.locks_client(); + let mut stream = if read { + c.read_lock(Request::new(req)).await?.into_inner() + } else { + c.lock(Request::new(req)).await?.into_inner() + }; + + // Consume events until we see Acquired / Failed / Expired. The + // stream stays open after Acquired — the hold task keeps it bound + // (and re-binds it across primary bounces). + loop { + let event = stream.message().await?; + let event = match event { + Some(e) => e, + None => { + return Err(Error::server( + "stream_closed", + "lock stream closed before acquire", + )); + } + }; + match event.event_type { + t if t == LockEventType::Acquired as i32 => { + let init = LockState { + id: event.id, + fence_token: event.fence_token, + lease_expires_at_ms: event.lease_expires_at, + lost: false, + }; + let (state_tx, state_rx) = watch::channel(init.clone()); + let stop = Arc::new(Notify::new()); + // Hand the open stream to the hold task, which parks + // it, re-binds on drop, and publishes fence/loss via + // `state_tx`. + let hold = tokio::spawn(hold_loop( + self.clone(), + key.clone(), + read, + reacquire_req, + stream, + state_tx, + init, + stop.clone(), + )); + return Ok(Lock { + client: self.clone(), + key, + state: state_rx, + stop, + _hold: hold, + }); + } + t if t == LockEventType::Failed as i32 => { + return Err(Error::server("failed", event.message)); + } + t if t == LockEventType::Expired as i32 => { + return Err(Error::server("expired", event.message)); + } + _ => continue, // Waiting / Heartbeat / Unknown — keep reading. + } + } + } + + /// Query the current state of a lock by id. + pub async fn lease_status( + &self, + key: impl Into, + id: impl Into, + ) -> Result { + let mut c = self.locks_client(); + let r = c + .lease_status(Request::new(LeaseStatusRequest { + key: key.into(), + id: id.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + let lease = r.lease.ok_or_else(|| Error::server("internal", "missing lease in response"))?; + Ok(Lease { + id: lease.id, + key: lease.key, + acquired_at_ms: lease.created_at, + lease_expires_at_ms: lease.lease_expires_at, + fence_token: lease.fence_token, + priority: lease.priority, + }) + } + + /// Acquire N locks atomically. Server sorts keys to guarantee + /// deadlock-free ordering. On any failure, every partial lock + /// is released before the call returns. + /// + /// Returns the leases in the server's acquisition order + /// (lexicographic by key). + pub async fn multi_lock( + &self, + keys: impl IntoIterator, + config: Config, + ) -> Result> { + let request_id = if config.request_id.is_empty() { + Uuid::now_v7().to_string() + } else { + config.request_id.clone() + }; + let keys: Vec = keys + .into_iter() + .map(|(key, write_lock)| MultiLockKey { key, write_lock }) + .collect(); + let mut c = self.locks_client(); + let r = c + .multi_lock(Request::new(MultiLockRequest { + keys, + max_wait_period: config.max_wait.as_millis().min(u32::MAX as u128) as u32, + max_lease_period: config.lease_ttl.as_millis().min(u32::MAX as u128) as u32, + priority: config.priority, + requester_info: config.requester_info, + requester_application: config.requester_application, + request_id, + fence_scope: config.scope.to_pb(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.leases + .into_iter() + .map(|lease| Lease { + id: lease.id, + key: lease.key, + acquired_at_ms: lease.created_at, + lease_expires_at_ms: lease.lease_expires_at, + fence_token: lease.fence_token, + priority: lease.priority, + }) + .collect()) + } +} diff --git a/rust/src/object/mod.rs b/rust/src/object/mod.rs new file mode 100644 index 0000000..ea2f704 --- /dev/null +++ b/rust/src/object/mod.rs @@ -0,0 +1,368 @@ +//! Object store subsystem — wraps the PutObject / GetObject / +//! DeleteObject / GetObjectInfo / ListObjects / GetObjectRange / +//! ListObjectRevisions RPCs. +//! +//! An object-store bucket maps to a stream with subject filter +//! `objm.>` + `objc.>` (metadata vs chunks). The wrapper hides +//! that wire convention behind a per-bucket [`Store`] handle. +//! +//! Entry points on `Client`: +//! - `client.create_object_store(object::Config { ... })` +//! - `client.get_or_create_object_store(cfg)` — idempotent +//! - `client.object_store("name")` — handle without creation +//! +//! v1 covers the unary RPCs. The streaming PutObject / +//! GetObject variants for very large objects can drop in +//! alongside without breaking the surface. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::streams_server::{ + self as pb, CreateStreamRequest, DeleteObjectRequest, GetObjectInfoRequest, + GetObjectRangeRequest, GetObjectRequest, ListObjectRevisionsRequest, ListObjectsRequest, + MessageHeader, PutObjectRequest, +}; +use crate::stream::{RetentionPolicy, StreamConfig}; +use tonic::Request; + +const META_SUBJECT_FILTER: &str = "objm.>"; +const CHUNK_SUBJECT_FILTER: &str = "objc.>"; +/// Server-side default chunk size — 1 MiB. Surfaced here so +/// callers can pre-allocate buffers; passing 0 to `Store::put` +/// uses this implicitly. +pub const DEFAULT_CHUNK_SIZE: u64 = 1024 * 1024; + +/// Object-store bucket creation config. +#[derive(Debug, Clone, Default)] +pub struct Config { + pub name: String, + /// Cap on total bucket bytes. `None` = unbounded. + pub max_bytes: Option, + /// Memory-only bucket (underlying stream is ephemeral). + pub ephemeral: bool, +} + +impl Config { + fn into_stream_config(self) -> StreamConfig { + StreamConfig { + name: self.name, + subjects: vec![META_SUBJECT_FILTER.into(), CHUNK_SUBJECT_FILTER.into()], + retention: RetentionPolicy::Limits, + max_bytes: self.max_bytes, + ephemeral: self.ephemeral, + max_msgs_per_subject: 0, + ..Default::default() + } + } +} + +/// Object metadata. Mirrors the proto `ObjectInfo`. +#[derive(Debug, Clone)] +pub struct ObjectInfo { + pub name: String, + pub total_bytes: u64, + pub chunk_count: u64, + pub chunk_size: u64, + pub sha256: String, + pub ts_ms: i64, + pub headers: Vec<(String, String)>, + pub revision: u64, + pub deduped: bool, +} + +impl From for ObjectInfo { + fn from(i: pb::ObjectInfo) -> Self { + Self { + name: i.name, + total_bytes: i.total_bytes, + chunk_count: i.chunk_count, + chunk_size: i.chunk_size, + sha256: i.sha256, + ts_ms: i.ts_ms, + headers: i + .headers + .into_iter() + .map(|MessageHeader { key, value }| (key, value)) + .collect(), + revision: i.metadata_seq, + deduped: i.deduped, + } + } +} + +/// One entry returned by [`Store::list`]. +#[derive(Debug, Clone)] +pub struct ObjectEntry { + pub name: String, + pub total_bytes: u64, + pub deleted: bool, +} + +/// Options for [`Store::put_with`]. +#[derive(Debug, Clone, Default)] +pub struct PutOptions { + /// Bytes per chunk. 0 = server default (`DEFAULT_CHUNK_SIZE`). + pub chunk_size: u64, + /// Optional headers to attach to the object's metadata. + pub headers: Vec<(String, String)>, + /// Optional pre-computed SHA-256 hex. The server verifies + /// against the running hash. Empty = server computes its own. + pub sha256: String, + /// Cross-object dedupe: chunks are content-addressed and + /// shared across objects with identical content. + pub dedupe: bool, +} + +/// A reference to an object-store bucket. Cheap to clone. +#[derive(Clone)] +pub struct Store { + client: Client, + name: String, +} + +impl Store { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + + /// The bucket name (also the underlying stream name). + pub fn name(&self) -> &str { + &self.name + } + + /// Put a small-to-medium object. The whole payload is sent in + /// one RPC; the server chunks server-side. For very large + /// objects use the streaming Put variant (not yet wired into + /// the wrapper — drop down to `streams_server::*`). + pub async fn put( + &self, + name: impl Into, + payload: impl Into>, + ) -> Result { + self.put_with(name, payload, PutOptions::default()).await + } + + /// Put with explicit options (chunk size, headers, sha256, + /// dedupe). + pub async fn put_with( + &self, + name: impl Into, + payload: impl Into>, + options: PutOptions, + ) -> Result { + let mut c = self.client.streams_client(); + let r = c + .put_object(Request::new(PutObjectRequest { + bucket: self.name.clone(), + name: name.into(), + payload: payload.into(), + chunk_size: options.chunk_size, + headers: options + .headers + .into_iter() + .map(|(k, v)| MessageHeader { key: k, value: v }) + .collect(), + sha256: options.sha256, + dedupe: options.dedupe, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + let info = r + .info + .ok_or_else(|| Error::server("internal", "missing info in PutObject response"))?; + Ok(info.into()) + } + + /// Get an object's whole payload + metadata. + pub async fn get(&self, name: impl Into) -> Result<(ObjectInfo, Vec)> { + let mut c = self.client.streams_client(); + let r = c + .get_object(Request::new(GetObjectRequest { + bucket: self.name.clone(), + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + let info = r + .info + .ok_or_else(|| Error::server("internal", "missing info in GetObject response"))?; + Ok((info.into(), r.payload)) + } + + /// Read a byte range of an object's payload. `len = 0` reads + /// the whole tail from `offset`. + pub async fn get_range( + &self, + name: impl Into, + offset: u64, + len: u64, + ) -> Result<(ObjectInfo, u64, Vec)> { + let mut c = self.client.streams_client(); + let r = c + .get_object_range(Request::new(GetObjectRangeRequest { + bucket: self.name.clone(), + name: name.into(), + offset, + len, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + let info = r + .info + .ok_or_else(|| Error::server("internal", "missing info in GetObjectRange response"))?; + Ok((info.into(), r.actual_offset, r.payload)) + } + + /// Get metadata without the payload bytes. Returns `None` if + /// the object has been tombstoned (deleted). + pub async fn info(&self, name: impl Into) -> Result> { + let mut c = self.client.streams_client(); + let r = c + .get_object_info(Request::new(GetObjectInfoRequest { + bucket: self.name.clone(), + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + if r.deleted { + return Ok(None); + } + Ok(r.info.map(Into::into)) + } + + /// Tombstone an object. + pub async fn delete(&self, name: impl Into) -> Result { + let mut c = self.client.streams_client(); + let r = c + .delete_object(Request::new(DeleteObjectRequest { + bucket: self.name.clone(), + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.tombstone_seq) + } + + /// List objects in the bucket. Tombstoned entries excluded by + /// default — set `include_deleted` to include them. + pub async fn list(&self, name_prefix: impl Into) -> Result> { + self.list_inner(name_prefix.into(), /* include_deleted = */ false).await + } + + /// Like [`Self::list`] but includes tombstoned entries. + pub async fn list_with_deleted( + &self, + name_prefix: impl Into, + ) -> Result> { + self.list_inner(name_prefix.into(), true).await + } + + async fn list_inner(&self, name_prefix: String, include_deleted: bool) -> Result> { + let mut c = self.client.streams_client(); + let r = c + .list_objects(Request::new(ListObjectsRequest { + bucket: self.name.clone(), + name_prefix, + include_deleted, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries + .into_iter() + .map(|e| ObjectEntry { + name: e.name, + total_bytes: e.total_bytes, + deleted: e.deleted, + }) + .collect()) + } + + /// List every metadata revision of `name` in seq order. + /// Useful for audit / debugging. + pub async fn revisions(&self, name: impl Into) -> Result> { + let mut c = self.client.streams_client(); + let r = c + .list_object_revisions(Request::new(ListObjectRevisionsRequest { + bucket: self.name.clone(), + name: name.into(), + from_seq: 0, + limit: 0, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.revisions + .into_iter() + .map(|rev| ObjectRevision { + metadata_seq: rev.metadata_seq, + total_bytes: rev.total_bytes, + sha256: rev.sha256, + ts_ms: rev.ts_ms, + deleted: rev.deleted, + }) + .collect()) + } +} + +/// One revision of an object's metadata. +#[derive(Debug, Clone)] +pub struct ObjectRevision { + pub metadata_seq: u64, + pub total_bytes: u64, + pub sha256: String, + pub ts_ms: i64, + pub deleted: bool, +} + +impl Client { + /// Create a new object-store bucket. Errors if the underlying + /// stream already exists. + pub async fn create_object_store(&self, config: Config) -> Result { + let name = config.name.clone(); + let mut c = self.streams_client(); + let r = c + .create_stream(Request::new(CreateStreamRequest { + config: Some(config.into_stream_config().into_pb()), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Store::new(self.clone(), name)) + } + + /// Idempotent — create the bucket if it doesn't exist, + /// otherwise return a handle to the existing one. + pub async fn get_or_create_object_store(&self, config: Config) -> Result { + let name = config.name.clone(); + self.get_or_create_stream(config.into_stream_config()).await?; + Ok(Store::new(self.clone(), name)) + } + + /// Return a handle to an existing object-store bucket without + /// verifying it exists server-side. + pub fn object_store(&self, name: impl Into) -> Store { + Store::new(self.clone(), name.into()) + } +} diff --git a/rust/src/probabilistic/bloom.rs b/rust/src/probabilistic/bloom.rs new file mode 100644 index 0000000..ff9538c --- /dev/null +++ b/rust/src/probabilistic/bloom.rs @@ -0,0 +1,175 @@ +//! Bloom filter — thin RPC binding. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::sketches_server::{ + BloomAddRequest, BloomDeleteRequest, BloomExistsRequest, BloomInfoRequest, + BloomMultiAddRequest, BloomMultiExistsRequest, BloomReserveRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct BloomConfig { + pub name: String, + pub capacity: u64, + /// Target false-positive rate (e.g. 0.01 for 1%). 0.0 = server + /// default (0.01). + pub error_rate: f64, +} + +#[derive(Debug, Clone)] +pub struct BloomInfo { + pub capacity: u64, + pub error_rate: f64, + pub bits_set: u64, + pub bit_count: u64, + pub hash_count: u32, + pub items_added: u64, +} + +#[derive(Clone)] +pub struct Bloom { + client: Client, + name: String, +} + +impl Bloom { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { + &self.name + } + + pub async fn add(&self, item: impl Into>) -> Result<()> { + let mut c = self.client.sketches_client(); + let r = c + .bloom_add(Request::new(BloomAddRequest { + name: self.name.clone(), + item: item.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + pub async fn add_many(&self, items: I) -> Result<()> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .bloom_multi_add(Request::new(BloomMultiAddRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Probabilistic membership test. `true` = probably present + /// (may be a false positive); `false` = definitely absent. + pub async fn exists(&self, item: impl Into>) -> Result { + let mut c = self.client.sketches_client(); + let r = c + .bloom_exists(Request::new(BloomExistsRequest { + name: self.name.clone(), + item: item.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.exists) + } + + pub async fn exists_many(&self, items: I) -> Result> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .bloom_multi_exists(Request::new(BloomMultiExistsRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.exists) + } + + pub async fn info(&self) -> Result { + let mut c = self.client.sketches_client(); + let r = c + .bloom_info(Request::new(BloomInfoRequest { + name: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(BloomInfo { + capacity: r.capacity, + error_rate: r.error_rate, + bits_set: r.bits_set, + bit_count: r.bit_count, + hash_count: r.hash_count, + items_added: r.items_added, + }) + } +} + +impl Client { + /// Reserve a new Bloom filter. + pub async fn create_bloom(&self, config: BloomConfig) -> Result { + let mut c = self.sketches_client(); + let r = c + .bloom_reserve(Request::new(BloomReserveRequest { + name: config.name.clone(), + capacity: config.capacity, + error_rate: config.error_rate, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Bloom::new(self.clone(), config.name)) + } + + /// Return a handle to an existing Bloom filter without + /// verifying. First operation on a missing filter fails with + /// `no_such_filter`. + pub fn bloom(&self, name: impl Into) -> Bloom { + Bloom::new(self.clone(), name.into()) + } + + /// Delete a Bloom filter and free its memory. + pub async fn delete_bloom(&self, name: impl Into) -> Result<()> { + let mut c = self.sketches_client(); + let r = c + .bloom_delete(Request::new(BloomDeleteRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/probabilistic/cms.rs b/rust/src/probabilistic/cms.rs new file mode 100644 index 0000000..cb2c3ad --- /dev/null +++ b/rust/src/probabilistic/cms.rs @@ -0,0 +1,109 @@ +//! Count-Min Sketch — typed bindings. +//! +//! Server-side implementation is a follow-up slice; every call +//! currently surfaces `Error::Server { code: "unimplemented", .. }`. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::sketches_server::{ + CmsDeleteRequest, CmsIncrByItem, CmsIncrByRequest, CmsQueryRequest, CmsReserveRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct CmsConfig { + pub name: String, + /// Sketch width (columns). 0 = server default. + pub width: u64, + /// Sketch depth (rows / hash functions). 0 = server default. + pub depth: u64, +} + +#[derive(Clone)] +pub struct Cms { + client: Client, + name: String, +} + +impl Cms { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { &self.name } + + pub async fn incr(&self, items: I) -> Result> + where + I: IntoIterator, u64)>, + { + let mut c = self.client.sketches_client(); + let r = c + .cms_incr_by(Request::new(CmsIncrByRequest { + name: self.name.clone(), + items: items + .into_iter() + .map(|(item, count)| CmsIncrByItem { item, count }) + .collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.counts) + } + + pub async fn query(&self, items: I) -> Result> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .cms_query(Request::new(CmsQueryRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.counts) + } +} + +impl Client { + pub async fn create_cms(&self, config: CmsConfig) -> Result { + let mut c = self.sketches_client(); + let r = c + .cms_reserve(Request::new(CmsReserveRequest { + name: config.name.clone(), + width: config.width, + depth: config.depth, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Cms::new(self.clone(), config.name)) + } + + pub fn cms(&self, name: impl Into) -> Cms { + Cms::new(self.clone(), name.into()) + } + + pub async fn delete_cms(&self, name: impl Into) -> Result<()> { + let mut c = self.sketches_client(); + let r = c + .cms_delete(Request::new(CmsDeleteRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/probabilistic/hll.rs b/rust/src/probabilistic/hll.rs new file mode 100644 index 0000000..c4b2866 --- /dev/null +++ b/rust/src/probabilistic/hll.rs @@ -0,0 +1,120 @@ +//! HyperLogLog cardinality estimator — thin RPC binding. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::sketches_server::{ + HllAddRequest, HllCountRequest, HllDeleteRequest, HllMergeRequest, HllReserveRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct HllConfig { + pub name: String, + /// 2^precision = register count. Valid range 4..=18. 0 = + /// server default (14, ~16 KB, ~1% error). + pub precision: u32, +} + +#[derive(Clone)] +pub struct Hll { + client: Client, + name: String, +} + +impl Hll { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { + &self.name + } + + pub async fn add(&self, items: I) -> Result<()> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .hll_add(Request::new(HllAddRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Estimated cardinality. + pub async fn count(&self) -> Result { + let mut c = self.client.sketches_client(); + let r = c + .hll_count(Request::new(HllCountRequest { + name: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.estimate) + } + + /// Merge `sources` into this HLL (union of their registers). + pub async fn merge_from(&self, sources: I) -> Result<()> + where + I: IntoIterator, + S: Into, + { + let mut c = self.client.sketches_client(); + let r = c + .hll_merge(Request::new(HllMergeRequest { + destination: self.name.clone(), + sources: sources.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} + +impl Client { + pub async fn create_hll(&self, config: HllConfig) -> Result { + let mut c = self.sketches_client(); + let r = c + .hll_reserve(Request::new(HllReserveRequest { + name: config.name.clone(), + precision: config.precision, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Hll::new(self.clone(), config.name)) + } + + pub fn hll(&self, name: impl Into) -> Hll { + Hll::new(self.clone(), name.into()) + } + + pub async fn delete_hll(&self, name: impl Into) -> Result<()> { + let mut c = self.sketches_client(); + let r = c + .hll_delete(Request::new(HllDeleteRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/probabilistic/mod.rs b/rust/src/probabilistic/mod.rs new file mode 100644 index 0000000..0fa63c7 --- /dev/null +++ b/rust/src/probabilistic/mod.rs @@ -0,0 +1,22 @@ +//! Probabilistic data structures — thin RPC bindings. +//! +//! - [`bloom`] — Bloom filter (functional) +//! - [`hll`] — HyperLogLog cardinality estimator (functional) +//! - [`cms`] — Count-Min Sketch (proto+API present; server returns +//! `unimplemented` — implementation is a follow-up slice) +//! - [`topk`] — Top-K (proto+API present; server returns +//! `unimplemented`) +//! - [`tdigest`] — t-digest quantile sketch (proto+API present; +//! server returns `unimplemented`) + +pub mod bloom; +pub mod cms; +pub mod hll; +pub mod tdigest; +pub mod topk; + +pub use bloom::{Bloom, BloomConfig, BloomInfo}; +pub use cms::{Cms, CmsConfig}; +pub use hll::{Hll, HllConfig}; +pub use tdigest::{TDigest, TDigestConfig}; +pub use topk::{TopK, TopKConfig, TopKListEntry}; diff --git a/rust/src/probabilistic/tdigest.rs b/rust/src/probabilistic/tdigest.rs new file mode 100644 index 0000000..87a06e5 --- /dev/null +++ b/rust/src/probabilistic/tdigest.rs @@ -0,0 +1,116 @@ +//! t-digest quantile sketch — typed bindings. Server-side +//! implementation deferred. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::sketches_server::{ + TDigestAddRequest, TDigestCreateRequest, TDigestDeleteRequest, TDigestMinMaxRequest, + TDigestQuantileRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct TDigestConfig { + pub name: String, + /// Compression. Higher = better tail accuracy at cost of + /// memory. 0 = server default. + pub compression: u32, +} + +#[derive(Clone)] +pub struct TDigest { + client: Client, + name: String, +} + +impl TDigest { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { &self.name } + + pub async fn add(&self, values: I) -> Result<()> + where + I: IntoIterator, + { + let mut c = self.client.sketches_client(); + let r = c + .t_digest_add(Request::new(TDigestAddRequest { + name: self.name.clone(), + values: values.into_iter().collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + pub async fn quantile(&self, quantiles: I) -> Result> + where + I: IntoIterator, + { + let mut c = self.client.sketches_client(); + let r = c + .t_digest_quantile(Request::new(TDigestQuantileRequest { + name: self.name.clone(), + quantiles: quantiles.into_iter().collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.values) + } + + pub async fn min_max(&self) -> Result<(f64, f64)> { + let mut c = self.client.sketches_client(); + let r = c + .t_digest_min_max(Request::new(TDigestMinMaxRequest { + name: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok((r.min, r.max)) + } +} + +impl Client { + pub async fn create_tdigest(&self, config: TDigestConfig) -> Result { + let mut c = self.sketches_client(); + let r = c + .t_digest_create(Request::new(TDigestCreateRequest { + name: config.name.clone(), + compression: config.compression, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(TDigest::new(self.clone(), config.name)) + } + + pub fn tdigest(&self, name: impl Into) -> TDigest { + TDigest::new(self.clone(), name.into()) + } + + pub async fn delete_tdigest(&self, name: impl Into) -> Result<()> { + let mut c = self.sketches_client(); + let r = c + .t_digest_delete(Request::new(TDigestDeleteRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/probabilistic/topk.rs b/rust/src/probabilistic/topk.rs new file mode 100644 index 0000000..042703a --- /dev/null +++ b/rust/src/probabilistic/topk.rs @@ -0,0 +1,134 @@ +//! Top-K — typed bindings. Server-side implementation deferred. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::sketches_server::{ + TopKAddRequest, TopKDeleteRequest, TopKListRequest, TopKQueryRequest, TopKReserveRequest, +}; +use tonic::Request; + +#[derive(Debug, Clone, Default)] +pub struct TopKConfig { + pub name: String, + pub k: u32, + /// Underlying sketch width. 0 = server default. + pub width: u64, + /// Underlying sketch depth. 0 = server default. + pub depth: u64, + /// Probability-decay factor (0.0..=1.0). 0 = server default. + pub decay: f64, +} + +#[derive(Debug, Clone)] +pub struct TopKListEntry { + pub item: Vec, + pub count: u64, +} + +#[derive(Clone)] +pub struct TopK { + client: Client, + name: String, +} + +impl TopK { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + pub fn name(&self) -> &str { &self.name } + + /// Add items. Returns one entry per request item: + /// the evicted item (if any) for that slot, or empty bytes. + pub async fn add(&self, items: I) -> Result>> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .top_k_add(Request::new(TopKAddRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.evicted) + } + + pub async fn query(&self, items: I) -> Result> + where + I: IntoIterator, + T: Into>, + { + let mut c = self.client.sketches_client(); + let r = c + .top_k_query(Request::new(TopKQueryRequest { + name: self.name.clone(), + items: items.into_iter().map(Into::into).collect(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.in_top_k) + } + + pub async fn list(&self) -> Result> { + let mut c = self.client.sketches_client(); + let r = c + .top_k_list(Request::new(TopKListRequest { + name: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.entries + .into_iter() + .map(|e| TopKListEntry { item: e.item, count: e.count }) + .collect()) + } +} + +impl Client { + pub async fn create_topk(&self, config: TopKConfig) -> Result { + let mut c = self.sketches_client(); + let r = c + .top_k_reserve(Request::new(TopKReserveRequest { + name: config.name.clone(), + k: config.k, + width: config.width, + depth: config.depth, + decay: config.decay, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(TopK::new(self.clone(), config.name)) + } + + pub fn topk(&self, name: impl Into) -> TopK { + TopK::new(self.clone(), name.into()) + } + + pub async fn delete_topk(&self, name: impl Into) -> Result<()> { + let mut c = self.sketches_client(); + let r = c + .top_k_delete(Request::new(TopKDeleteRequest { + name: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} diff --git a/rust/src/stream/consumer.rs b/rust/src/stream/consumer.rs new file mode 100644 index 0000000..3b16192 --- /dev/null +++ b/rust/src/stream/consumer.rs @@ -0,0 +1,371 @@ +//! Consumer handle + delivered messages. +//! +//! - `Consumer::messages()` returns a `Stream>` +//! that yields delivered messages one at a time, via the server's +//! `Subscribe` server-streaming RPC. +//! - `Consumer::fetch(batch)` returns a one-shot batch via the +//! `Fetch` unary RPC — for pull-style polling consumers. +//! - Each `Message` carries a back-reference to the client so +//! `message.ack()` / `nak()` / `term()` / `in_progress()` can +//! round-trip to the server. + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::streams_server::{ + AckRequest, FetchRequest, InProgressRequest, MessageHeader, NakRequest, SubscribeRequest, + TermRequest, +}; +use std::pin::Pin; +use std::task::{Context as TaskContext, Poll}; +use tonic::Request; + +/// A consumer handle. Returned by `Stream::create_consumer` / +/// `get_consumer`. +#[derive(Clone)] +pub struct Consumer { + pub(crate) client: Client, + pub(crate) stream: String, + pub(crate) name: String, +} + +impl Consumer { + pub(crate) fn new(client: Client, stream: String, name: String) -> Self { + Self { client, stream, name } + } + + /// The consumer's durable name. + pub fn name(&self) -> &str { + &self.name + } + + /// The parent stream's name. + pub fn stream(&self) -> &str { + &self.stream + } + + /// Open a push-mode subscription. Returns a `Stream` of + /// delivered messages — equivalent to async-nats's + /// `consumer.messages().await?`. + /// + /// The server holds the subscription open until the client + /// drops the returned stream, the consumer is deleted, or an + /// RPC error occurs. + pub async fn messages(&self) -> Result { + self.messages_with_batch_size(0).await + } + + /// Like `messages()` but with a custom server-side batch + /// hint. 0 = server default (currently 16). + pub async fn messages_with_batch_size(&self, batch_size: u32) -> Result { + let mut c = self.client.streams_client(); + let stream = c + .subscribe(Request::new(SubscribeRequest { + stream: self.stream.clone(), + consumer: self.name.clone(), + batch_size, + stop_when_empty: false, + })) + .await? + .into_inner(); + Ok(Messages { + inner: stream, + client: self.client.clone(), + stream_name: self.stream.clone(), + consumer_name: self.name.clone(), + }) + } + + /// Pull-style: fetch up to `batch_size` messages right now. + /// Returns the batch immediately (possibly empty) without + /// blocking for new arrivals. + pub async fn fetch(&self, batch_size: u32) -> Result> { + let mut c = self.client.streams_client(); + let r = c + .fetch(Request::new(FetchRequest { + stream: self.stream.clone(), + consumer: self.name.clone(), + batch_size, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.messages + .into_iter() + .map(|m| Message::from_pb(self.client.clone(), self.stream.clone(), self.name.clone(), m)) + .collect()) + } +} + +/// A delivered message. Carries enough context to ack/nak/term/ +/// in-progress through the parent consumer. +pub struct Message { + pub subject: String, + pub payload: Vec, + pub headers: Vec<(String, String)>, + pub sequence: u64, + pub ts_ms: i64, + /// How many times this seq has been delivered to this consumer + /// (1 on first delivery; climbs on redelivery). + pub deliver_count: u32, + client: Client, + stream: String, + consumer: String, +} + +impl Message { + fn from_pb( + client: Client, + stream: String, + consumer: String, + m: crate::streams_server::MessagePb, + ) -> Self { + Self { + subject: m.subject, + payload: m.payload, + headers: m + .headers + .into_iter() + .map(|MessageHeader { key, value }| (key, value)) + .collect(), + sequence: m.seq, + ts_ms: m.ts_ms, + deliver_count: m.deliver_count, + client, + stream, + consumer, + } + } + + /// Positive acknowledgment — the message is consumed. + pub async fn ack(&self) -> Result<()> { + let mut c = self.client.streams_client(); + let r = c + .ack(Request::new(AckRequest { + stream: self.stream.clone(), + consumer: self.consumer.clone(), + seq: self.sequence, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Negative acknowledgment — request immediate redelivery. + /// `deliver_count` keeps climbing toward `max_deliver`. + pub async fn nak(&self) -> Result<()> { + self.nak_with_delay(std::time::Duration::ZERO).await + } + + /// Negative acknowledgment with delay — server defers + /// redelivery by `delay`. + pub async fn nak_with_delay(&self, delay: std::time::Duration) -> Result<()> { + let mut c = self.client.streams_client(); + let r = c + .nak(Request::new(NakRequest { + stream: self.stream.clone(), + consumer: self.consumer.clone(), + seq: self.sequence, + delay_ms: delay.as_millis() as u64, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Terminal acknowledgment — drop the message permanently, + /// regardless of `max_deliver`. The message is NOT removed + /// from WorkQueue retention (other consumers can still + /// observe it). + pub async fn term(&self) -> Result<()> { + let mut c = self.client.streams_client(); + let r = c + .term(Request::new(TermRequest { + stream: self.stream.clone(), + consumer: self.consumer.clone(), + seq: self.sequence, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } + + /// Heartbeat — extend the `ack_wait` window without acking. + /// `deliver_count` is unchanged. + pub async fn in_progress(&self) -> Result<()> { + let mut c = self.client.streams_client(); + let r = c + .in_progress(Request::new(InProgressRequest { + stream: self.stream.clone(), + consumer: self.consumer.clone(), + seq: self.sequence, + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} + +/// A `Stream>` returned by +/// `Consumer::messages()`. Yields delivered messages until the +/// underlying server-streaming RPC terminates (server-side close, +/// network error, or client drop). +/// +/// Implementations of the `futures::Stream` trait are provided via +/// `tokio_stream::Stream` (re-exported below) so callers can use +/// `while let Some(msg) = stream.next().await { … }` as they do +/// with async-nats. +pub struct Messages { + inner: tonic::Streaming, + client: Client, + stream_name: String, + consumer_name: String, +} + +impl tokio_stream::Stream for Messages { + type Item = Result; + + fn poll_next(mut self: Pin<&mut Self>, cx: &mut TaskContext<'_>) -> Poll> { + // Loop past stream-event frames that don't carry a message + // payload (control frames: subscribe-stopped, etc). + loop { + match Pin::new(&mut self.inner).poll_next(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(None) => return Poll::Ready(None), + Poll::Ready(Some(Err(s))) => return Poll::Ready(Some(Err(Error::Rpc(s)))), + Poll::Ready(Some(Ok(event))) => { + use crate::streams_server::subscribe_event::Event as Ev; + match event.event { + Some(Ev::Message(m)) => { + let msg = Message::from_pb( + self.client.clone(), + self.stream_name.clone(), + self.consumer_name.clone(), + m, + ); + return Poll::Ready(Some(Ok(msg))); + } + Some(Ev::Stopped(stopped)) => { + // Server-side close. Carry the reason + // out via Err so callers can distinguish + // a normal EOS (None) from "server told + // us to stop because the consumer was + // deleted" etc. + if stopped.reason.is_empty() { + return Poll::Ready(None); + } + return Poll::Ready(Some(Err(Error::server( + "subscribe_stopped", + stopped.reason, + )))); + } + None => continue, + } + } + } + } + } +} + +/// Consumer delivery start policy. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum DeliverPolicy { + /// Start from the first message in the stream. + All, + /// Start from messages published after subscription (emulated + /// via `ByStartTime(now)` at consumer creation since waymaker + /// has no native `deliver-new`). + New, + /// Start at the last message published. + Last, + /// Start at the given sequence. + ByStartSequence(u64), + /// Start at messages published at or after `start_time_ms`. + ByStartTime(i64), +} + +impl Default for DeliverPolicy { + fn default() -> Self { + Self::All + } +} + +impl DeliverPolicy { + fn into_pb(self) -> crate::streams_server::DeliveryPolicyPb { + use crate::streams_server::DeliveryPolicyType as T; + let (ty, seq, t_ms) = match self { + DeliverPolicy::All => (T::DeliveryAll, 0, 0), + DeliverPolicy::New => { + let now_ms = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_millis() as i64) + .unwrap_or(0); + (T::DeliveryByStartTime, 0, now_ms) + } + DeliverPolicy::Last => (T::DeliveryLast, 0, 0), + DeliverPolicy::ByStartSequence(s) => (T::DeliveryByStartSeq, s, 0), + DeliverPolicy::ByStartTime(t) => (T::DeliveryByStartTime, 0, t), + }; + crate::streams_server::DeliveryPolicyPb { + r#type: ty as i32, + start_seq: seq, + start_time_ms: t_ms, + } + } +} + +/// Consumer configuration. +/// +/// Waymaker is `ack_policy=Explicit` + `replay_policy=Instant` only, +/// so those async-nats fields aren't exposed. +#[derive(Debug, Clone, Default)] +pub struct ConsumerConfig { + pub durable_name: Option, + pub filter_subject: Option, + pub deliver_policy: DeliverPolicy, + /// How long the server waits for an Ack before considering a + /// delivery redeliverable. Defaults to 30s. + pub ack_wait: std::time::Duration, + /// Cap on delivery attempts. Defaults to 5. + pub max_deliver: u32, + /// Queue-group label. Multiple workers in the same group share + /// the message stream round-robin. + pub deliver_group: Option, + /// Optional dead-letter subject. Messages dropped past + /// `max_deliver` are re-published here within the same stream. + pub dead_letter_subject: Option, +} + +impl ConsumerConfig { + pub(crate) fn into_pb(self, fallback_name: &str) -> crate::streams_server::ConsumerConfigPb { + let name = self.durable_name.unwrap_or_else(|| fallback_name.into()); + let ack_wait_ms = if self.ack_wait.is_zero() { + 30_000 + } else { + self.ack_wait.as_millis() as u64 + }; + let max_deliver = if self.max_deliver == 0 { 5 } else { self.max_deliver }; + crate::streams_server::ConsumerConfigPb { + name, + filter_subject: self.filter_subject.unwrap_or_default(), + delivery_policy: Some(self.deliver_policy.into_pb()), + ack_wait_ms, + max_deliver, + deliver_group: self.deliver_group.unwrap_or_default(), + dead_letter_subject: self.dead_letter_subject.unwrap_or_default(), + } + } +} diff --git a/rust/src/stream/mod.rs b/rust/src/stream/mod.rs new file mode 100644 index 0000000..6a62dc1 --- /dev/null +++ b/rust/src/stream/mod.rs @@ -0,0 +1,363 @@ +//! Streams subsystem. Owns the stream handle and all stream- +//! specific types (configs, retention, consumer types). +//! +//! Entry points live on `Client`: +//! - `client.create_stream(stream::StreamConfig { ... })` +//! - `client.get_stream("name")` +//! - `client.get_or_create_stream(cfg)` +//! +//! Returned `Stream` carries the per-stream operations: +//! - `stream.publish(subject, payload)` +//! - `stream.create_consumer(stream::ConsumerConfig { ... })` + +pub mod consumer; + +pub use consumer::{Consumer, ConsumerConfig, DeliverPolicy, Message, Messages}; + +use crate::client::Client; +use crate::error::{Error, Result}; +use crate::streams_server::{ + self as pb, CreateConsumerRequest, DeleteConsumerRequest, GetConsumerInfoRequest, + GetStreamInfoRequest, PublishRequest, +}; +use std::time::Duration; +use tonic::Request; + +/// One row of per-(sourcing, source) status returned by +/// `Stream::sources_status` and `Client::get_stream_sources`. +#[derive(Debug, Clone)] +pub struct SourceStatus { + pub sourcing_stream: String, + pub source_stream: String, + pub last_sourced_seq: u64, + pub pulled_total: u64, + pub last_error: String, + pub last_error_ts_ms: i64, +} + +/// A reference to a stream on the server. Cheap to clone. +#[derive(Clone)] +pub struct Stream { + pub(crate) client: Client, + pub(crate) name: String, +} + +impl Stream { + pub(crate) fn new(client: Client, name: String) -> Self { + Self { client, name } + } + + /// The stream's name. + pub fn name(&self) -> &str { + &self.name + } + + /// Publish a message into this stream. + pub async fn publish( + &self, + subject: impl Into, + payload: impl Into>, + ) -> Result { + self.publish_with_headers(subject, std::iter::empty::<(String, String)>(), payload) + .await + } + + /// Publish with explicit headers. + pub async fn publish_with_headers( + &self, + subject: impl Into, + headers: impl IntoIterator, + payload: impl Into>, + ) -> Result { + let mut c = self.client.streams_client(); + let req = PublishRequest { + stream: self.name.clone(), + subject: subject.into(), + payload: payload.into(), + headers: headers + .into_iter() + .map(|(k, v)| pb::MessageHeader { key: k, value: v }) + .collect(), + ts_ms: 0, + expected_last_seq: None, + }; + let r = c.publish(Request::new(req)).await?.into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(PublishAck { sequence: r.seq }) + } + + /// Slice 3: per-source tail status for this stream. Returns + /// one entry per source feeding this stream. Empty when the + /// stream has no sources OR the tail tasks are running on a + /// different node (this RPC returns the local primary's view). + pub async fn sources_status(&self) -> Result> { + let mut c = self.client.streams_client(); + let r = c + .get_stream_info(Request::new(GetStreamInfoRequest { + name: self.name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(r.sources_status + .into_iter() + .map(|s| SourceStatus { + sourcing_stream: self.name.clone(), + source_stream: s.source_stream, + last_sourced_seq: s.last_sourced_seq, + pulled_total: s.pulled_total, + last_error: s.last_error, + last_error_ts_ms: s.last_error_ts_ms, + }) + .collect()) + } + + /// Create a new consumer on this stream. Errors if a consumer + /// with the same `durable_name` already exists. + pub async fn create_consumer(&self, config: ConsumerConfig) -> Result { + let name = config + .durable_name + .clone() + .ok_or_else(|| Error::Invalid("ConsumerConfig.durable_name is required".into()))?; + let cfg_pb = config.into_pb(&name); + let mut c = self.client.streams_client(); + let r = c + .create_consumer(Request::new(CreateConsumerRequest { + stream: self.name.clone(), + config: Some(cfg_pb), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Consumer::new(self.client.clone(), self.name.clone(), name)) + } + + /// Idempotent variant — returns an existing consumer if one + /// with the same `durable_name` already exists, otherwise + /// creates it. + pub async fn get_or_create_consumer(&self, config: ConsumerConfig) -> Result { + let name = config + .durable_name + .clone() + .ok_or_else(|| Error::Invalid("ConsumerConfig.durable_name is required".into()))?; + match self.get_consumer(&name).await { + Ok(c) => Ok(c), + Err(Error::Server { code, .. }) if code == "no_such_consumer" => { + self.create_consumer(config).await + } + Err(e) => Err(e), + } + } + + /// Return a handle to an existing consumer. + pub async fn get_consumer(&self, name: impl Into) -> Result { + let name: String = name.into(); + let mut c = self.client.streams_client(); + let r = c + .get_consumer_info(Request::new(GetConsumerInfoRequest { + stream: self.name.clone(), + consumer: name.clone(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(Consumer::new(self.client.clone(), self.name.clone(), name)) + } + + /// Delete a consumer by name. + pub async fn delete_consumer(&self, name: impl Into) -> Result<()> { + let mut c = self.client.streams_client(); + let r = c + .delete_consumer(Request::new(DeleteConsumerRequest { + stream: self.name.clone(), + consumer: name.into(), + })) + .await? + .into_inner(); + if !r.success { + return Err(Error::server(r.result_code, r.message)); + } + Ok(()) + } +} + +/// Returned by `Stream::publish` — just the assigned stream +/// sequence; new fields can be added without breaking callers. +#[derive(Debug, Clone, Copy)] +pub struct PublishAck { + pub sequence: u64, +} + +/// Retention policy. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum RetentionPolicy { + Limits, + WorkQueue, + Interest, +} + +impl Default for RetentionPolicy { + fn default() -> Self { + Self::Limits + } +} + +/// Stream configuration. `Default` produces an unbounded Limits +/// stream with no subject filter, suitable for +/// `StreamConfig { name: ..., ..Default::default() }`. +#[derive(Debug, Clone, Default)] +pub struct StreamConfig { + pub name: String, + pub subjects: Vec, + pub retention: RetentionPolicy, + /// Maximum age before messages are pruned. `None` = unbounded. + pub max_age: Option, + /// Maximum number of messages. `None` = unbounded. + pub max_messages: Option, + /// Maximum total stored bytes. `None` = unbounded. + pub max_bytes: Option, + /// Max bytes per individual message. `None` = no cap. + pub max_message_size: Option, + /// Block size override. 0 = server default (100_000). + pub block_size: u64, + /// Reject publishes that would push over `max_bytes` / + /// `max_messages` instead of silently dropping the oldest. + pub strict_limits: bool, + /// Memory-only stream. Survives node failover via replication + /// but a full-cluster restart loses it. + pub ephemeral: bool, + /// Per-subject revision cap. `0` (default) = unbounded. + /// When N > 0, after each publish, older messages at that + /// subject beyond the N most recent are dropped. Mirrors + /// NATS JetStream's `MaxMsgsPerSubject` (and backs KV's + /// `max_revisions` knob). + pub max_msgs_per_subject: u64, + /// Cross-stream sources. Slice 1: at most one entry, name-only. + /// See `crates/streams/specs/SOURCES_DESIGN.md`. + pub sources: Vec, +} + +/// Identifies a stream to tail from. +#[derive(Debug, Clone, Default)] +pub struct StreamSource { + pub source_stream: String, + /// Optional NATS pattern. Only source messages whose subject + /// matches are pulled. Empty = pull all. + pub filter_subject: String, + /// First source-seq to pull. `0` (default) = pull from + /// beginning of source (subject to `max_initial_backfill`). + /// Mutually exclusive with `start_time_ms`. + pub start_seq: u64, + /// Slice 3: start position by wall-clock timestamp (ms since + /// epoch). When set, the tail resolves to the first message + /// with `ts_ms >= start_time_ms` and seeds there. Future-of- + /// stream resolves to "seed at current end". Mutually exclusive + /// with `start_seq`. + pub start_time_ms: i64, + /// Slice 2F: cap on the initial backfill window. `0` = no cap. + /// When set, the tail seeds at `max(0, source.last_seq - + /// max_initial_backfill)`. Ignored once durable state exists. + pub max_initial_backfill: u64, + /// Slice 3: NATS-style subject rewrite. When set, the source's + /// subject is matched against `subject_transform.source_pattern` + /// and the captured wildcards substituted into + /// `subject_transform.destination` (1-indexed `{{wildcard(N)}}` + /// placeholders). The sourcing stream sees the rewritten + /// subject; the original is preserved on the + /// `waymaker-source-subject` header. + pub subject_transform: Option, + /// Slice 3: what to do when source retention drops messages + /// past our last_sourced_seq. Default = Halt. + pub on_drop: OnDropPolicy, + /// Slice 3: dead-letter stream name. When non-empty, tail + /// errors (transform mismatch, halt-on-drop firing, etc.) are + /// published as JSON records to this stream so operators can + /// triage without scraping logs. + pub dlq_stream: String, +} + +#[derive(Debug, Clone, Default)] +pub struct SubjectTransform { + pub source_pattern: String, + pub destination: String, +} + +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +pub enum OnDropPolicy { + /// Tail records a persistent error + stops advancing. + #[default] + Halt, + /// Tail jumps watermark to source's first available seq. + SkipToFirstAvailable, +} + +impl StreamConfig { + pub(crate) fn into_pb(self) -> pb::StreamConfigPb { + let retention = match self.retention { + RetentionPolicy::Limits => pb::Retention { + policy: Some(pb::retention::Policy::Limits(pb::LimitsRetention { + max_age_ms: self.max_age.map(|d| d.as_millis() as u64), + max_msgs: self.max_messages, + max_bytes: self.max_bytes, + strict_limits: self.strict_limits, + })), + }, + RetentionPolicy::WorkQueue => pb::Retention { + policy: Some(pb::retention::Policy::WorkQueue(pb::WorkQueueRetention {})), + }, + RetentionPolicy::Interest => pb::Retention { + policy: Some(pb::retention::Policy::Interest(pb::InterestRetention {})), + }, + }; + pb::StreamConfigPb { + name: self.name, + subjects_filter: self.subjects, + retention: Some(retention), + block_size: self.block_size, + max_msg_bytes: self.max_message_size.unwrap_or(0), + ephemeral: self.ephemeral, + max_msgs_per_subject: self.max_msgs_per_subject, + sources: self + .sources + .into_iter() + .map(|s| pb::StreamSourceConfigPb { + source_stream: s.source_stream, + filter_subject: s.filter_subject, + start_seq: s.start_seq, + start_time_ms: s.start_time_ms, + subject_transform: s.subject_transform.map(|t| { + pb::SubjectTransformPb { + source_pattern: t.source_pattern, + destination: t.destination, + } + }), + max_initial_backfill: s.max_initial_backfill, + on_drop: match s.on_drop { + OnDropPolicy::Halt => 0, + OnDropPolicy::SkipToFirstAvailable => 1, + }, + dlq_stream: s.dlq_stream, + }) + .collect(), + } + } +} + +/// Partial-update payload for `Client::update_stream`. Any field +/// left at `None` is not touched server-side. +#[derive(Debug, Clone, Default)] +pub struct StreamUpdate { + pub max_age_ms: Option, + pub max_msgs: Option, + pub max_bytes: Option, + pub max_msg_bytes: Option, + pub strict_limits: Option, +} diff --git a/scripts/gen-go.sh b/scripts/gen-go.sh new file mode 100755 index 0000000..72759b7 --- /dev/null +++ b/scripts/gen-go.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Generate Go gRPC stubs from the vendored protos into go/genpb/. +# The protos carry no `option go_package`, so each is mapped explicitly here. +# internal_proxy.proto is server-internal and intentionally skipped. +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$here/go" +export PATH="$(go env GOPATH)/bin:$PATH" +MOD=git.awesomike.com/pub/waymaker-client/go + +# proto filename (relative to ../proto) -> Go package dir under the module +protos=( + waymaker_locks.proto:genpb/locks + waymaker_streams.proto:genpb/streams + kv.proto:genpb/kv + collections.proto:genpb/collections + sketches.proto:genpb/sketches + cache.proto:genpb/cache +) + +files=() +mflags=() +for entry in "${protos[@]}"; do + f="${entry%%:*}"; pkg="${entry##*:}" + files+=("$f") + mflags+=("--go_opt=M$f=$MOD/$pkg" "--go-grpc_opt=M$f=$MOD/$pkg") +done + +rm -rf genpb +protoc -I ../proto \ + --go_out=. --go_opt=module="$MOD" \ + --go-grpc_out=. --go-grpc_opt=module="$MOD" \ + "${mflags[@]}" \ + "${files[@]}" + +echo "Generated Go stubs under go/genpb/" diff --git a/scripts/gen-ts.sh b/scripts/gen-ts.sh new file mode 100755 index 0000000..9584ab4 --- /dev/null +++ b/scripts/gen-ts.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Generate TypeScript gRPC stubs from the vendored protos into ts/src/genpb, +# using ts-proto with @grpc/grpc-js service output. internal_proxy.proto is +# server-internal and intentionally skipped. +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$here/ts" + +plugin="node_modules/.bin/protoc-gen-ts_proto" +if [[ ! -x "$plugin" ]]; then + echo "ts-proto not installed; run 'npm install' in ts/ first" >&2 + exit 1 +fi + +out="src/genpb" +rm -rf "$out"; mkdir -p "$out" + +protoc -I ../proto \ + --plugin=protoc-gen-ts_proto="$plugin" \ + --ts_proto_out="$out" \ + --ts_proto_opt=outputServices=grpc-js,esModuleInterop=true,env=node,useExactTypes=false,unrecognizedEnum=false \ + waymaker_locks.proto \ + waymaker_streams.proto \ + kv.proto \ + collections.proto \ + sketches.proto \ + cache.proto + +echo "Generated TypeScript stubs under ts/src/genpb/" diff --git a/scripts/sync-protos.sh b/scripts/sync-protos.sh new file mode 100755 index 0000000..9868563 --- /dev/null +++ b/scripts/sync-protos.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# +# Sync the canonical .proto files from the waymaker server repo into this +# client repo's proto/ directory. +# +# The waymaker server repo is the SOURCE OF TRUTH for the wire contract. +# This repo vendors copies so the Go / TS / Rust clients can each generate +# stubs without depending on the server's Cargo workspace. Run this whenever +# the server's protos change, then re-run codegen and tag at the SAME version +# as the waymaker release (see VERSION). +# +# Usage: +# WAYMAKER_REPO=/path/to/waymaker ./scripts/sync-protos.sh +# Defaults to ../waymaker relative to this repo. + +set -euo pipefail + +here="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +WAYMAKER_REPO="${WAYMAKER_REPO:-$here/../waymaker}" + +if [[ ! -d "$WAYMAKER_REPO/crates" ]]; then + echo "ERROR: waymaker repo not found at '$WAYMAKER_REPO'." >&2 + echo " Set WAYMAKER_REPO=/path/to/waymaker and re-run." >&2 + exit 1 +fi + +# canonical path in waymaker -> filename in proto/ +# NOTE: crates/locks/proto/internal_proxy.proto (the server-internal +# node-to-node ProxyService + lease replication) is intentionally NOT +# vendored — it is a server concern, not part of any client. +protos=( + "crates/locks/proto/waymaker_locks.proto" + "crates/streams/proto/waymaker_streams.proto" + "crates/kv/proto/kv.proto" + "crates/collections/proto/collections.proto" + "crates/sketches/proto/sketches.proto" + "crates/cache/proto/cache.proto" +) + +dest="$here/proto" +mkdir -p "$dest" +for rel in "${protos[@]}"; do + src="$WAYMAKER_REPO/$rel" + [[ -f "$src" ]] || { echo "ERROR: missing $src" >&2; exit 1; } + cp "$src" "$dest/$(basename "$rel")" + echo "synced $(basename "$rel")" +done + +# Keep VERSION in lockstep with the waymaker workspace version. +wm_version="$(grep -m1 '^version' "$WAYMAKER_REPO/Cargo.toml" | sed -E 's/.*"([^"]+)".*/\1/')" +if [[ -n "$wm_version" ]]; then + echo "$wm_version" > "$here/VERSION" + echo "VERSION -> $wm_version (matched waymaker workspace)" +fi + +echo "Done. Re-run codegen (scripts/gen-*.sh) and tag at v$(cat "$here/VERSION")." diff --git a/ts/README.md b/ts/README.md new file mode 100644 index 0000000..806b8fc --- /dev/null +++ b/ts/README.md @@ -0,0 +1,261 @@ +# @waymaker/client — TypeScript + +Official TypeScript client for [waymaker](https://git.awesomike.com/dev/waymaker). +Full-parity with the Rust client across all subsystems. + +## Installation + +``` +npm install @waymaker/client +``` + +Requires Node 18+ (for `crypto.randomUUID`, `Buffer`, async iterators). + +## Quick start + +```ts +import { WaymakerClient } from "@waymaker/client"; + +const client = WaymakerClient.connect("localhost:8818"); + +// ---- locks ---- +import { Scope } from "@waymaker/client"; + +const lock = await client.acquireLock("leader:myjob", { + maxWaitMs: 0, // fail immediately if contended + leaseTtlMs: 60_000, + scope: Scope.Local, +}); + +const renewal = lock.spawnRenewal(30_000); +lock.on("change", (state) => { + if (state.lost) console.error("lock lost — fence token was", state.fenceToken); +}); + +try { + // Work can outlive a single lease window; renewal keeps it alive. + await doWork(lock.fenceToken()); +} finally { + renewal.stop(); + await lock.unlock(); +} + +client.close(); +``` + +## Multi-node (cluster) + +```ts +const client = WaymakerClient.connectMulti([ + "node1:8818", + "node2:8828", + "node3:8838", +]); +``` + +grpc-js round-robins requests across the list and reroutes automatically +when an endpoint is unreachable. + +## Subsystems + +### Locks + +```ts +import { Scope } from "@waymaker/client"; + +// Exclusive lock +const lock = await client.acquireLock("my-resource"); +await lock.unlock(); + +// Shared lock +const rlock = await client.acquireReadLock("my-resource"); +await rlock.unlock(); + +// Atomic multi-lock (deadlock-free: server sorts keys) +const leases = await client.multiLock([ + { key: "a", writeLock: true }, + { key: "b", writeLock: false }, +]); + +// Operator introspection +const held = await client.listAcquiredLocks("leader:"); +``` + +**Leader-election pattern** (mirrors the waymaker-ctl renew loop): + +```ts +const lock = await client.acquireLock("leader:batch", { + maxWaitMs: 0, + leaseTtlMs: 60_000, + scope: Scope.Local, +}); + +// Renewal runs independently of the work loop. +const renewal = lock.spawnRenewal(20_000); + +lock.on("change", (s) => { + if (s.lost) process.exit(1); // give up leadership +}); + +try { + await runBatch(); +} finally { + renewal.stop(); + await lock.unlock(); +} +``` + +### Streams + +```ts +import { RetentionPolicy, DeliverPolicy } from "@waymaker/client"; + +const stream = await client.getOrCreateStream({ + name: "events", + subjects: ["events.>"], + retention: { policy: RetentionPolicy.Limits, maxAgeMs: 7 * 86_400_000 }, + replicationFactor: 3, +}); + +// Publish +const seq = await stream.publish("events.user.123", Buffer.from("hello")); + +// Pull consumer +const consumer = await stream.getOrCreateConsumer({ + name: "processor", + deliverPolicy: DeliverPolicy.All, + ackPolicy: "explicit", +}); +const msgs = await consumer.fetch(10); +for (const msg of msgs) { + console.log(msg.subject, msg.data.toString()); + await msg.ack(); +} + +// Push consumer (async iterator) +for await (const msg of consumer.messages()) { + await msg.ack(); +} +``` + +### KV + +```ts +const bucket = await client.getOrCreateKv({ name: "config", maxRevisions: 5 }); + +await bucket.put("db.host", "localhost"); +const val = await bucket.get("db.host"); + +// CAS +const rev = await bucket.create("lock", Buffer.from("1")); +await bucket.update("lock", Buffer.from("2"), rev); + +// Watch +for await (const ev of await bucket.watch("db.host")) { + if (ev.kind === "put") console.log("new value:", ev.value.toString()); +} +``` + +### Collections + +```ts +// Hash +const hs = await client.createHashStore({ name: "users" }); +const h = hs.hash("user:42"); +await h.set("email", "alice@example.com"); +console.log(await h.get("email")); + +// Set +const ss = await client.createSetStore({ name: "tags" }); +const s = ss.set("article:1"); +await s.add(Buffer.from("typescript")); +console.log(await s.members()); + +// Queue +const q = await client.createQueue({ name: "jobs" }); +await q.push(Buffer.from(JSON.stringify({ type: "email" }))); +const item = await q.pop(); +``` + +### Sketches + +```ts +// Bloom filter +const bloom = await client.bloomReserve("seen-ids", 1_000_000, 0.001); +await bloom.add(Buffer.from("msg-123")); +console.log(await bloom.exists(Buffer.from("msg-123"))); // true + +// HyperLogLog +const hll = await client.hllReserve("unique-visitors"); +await hll.add(Buffer.from("user-abc")); +console.log(await hll.count()); // approx cardinality + +// Count-Min Sketch +const cms = await client.cmsReserve("event-counts", 0.001, 0.999); +await cms.add(Buffer.from("click"), 5); +console.log(await cms.count(Buffer.from("click"))); + +// Top-K +const topk = await client.topKReserve("hot-keys", 10); +await topk.add(Buffer.from("key-1"), 100); +console.log(await topk.list()); + +// t-digest +const td = await client.tdigestCreate("latency-p99", 200); +await td.add(42.5); +console.log(await td.quantile(0.99)); +``` + +### Object store + +```ts +const store = await client.getOrCreateObjectStore({ + name: "artifacts", + maxBytes: 10 * 1024 * 1024 * 1024, // 10 GiB +}); + +const info = await store.put("report.pdf", pdfBytes); +console.log(info.sha256, info.totalBytes); + +const { payload } = await store.get("report.pdf"); +const entries = await store.list(); +``` + +### Cache (stub) + +The cache subsystem is wired but returns `unimplemented` until the +first eviction policy ships server-side. The client surface is +complete so callers can compile against it today: + +```ts +await client.cacheAttachPolicy("my-bucket", "lru", { max_entries: "1000" }); +await client.cacheDetachPolicy("my-bucket"); +``` + +## TypeScript notes + +- All `bytes` proto fields are typed as `Buffer`. +- `uint64` / `int64` proto fields are typed as `number`. Values beyond + `Number.MAX_SAFE_INTEGER` require `BigInt` — use `Long` from the + `long` package if you need exact 64-bit arithmetic. +- Streaming RPCs (`watch`, push consumers) return async iterables; + iterate with `for await`. +- The `Lock` class extends `EventEmitter`; subscribe with + `lock.on("change", handler)`. +- Strict TypeScript (`noImplicitAny`, `strictNullChecks`). No `any` leaks + through the public API surface. + +## Regenerating proto stubs + +The generated files in `src/genpb/` must not be hand-edited. Regenerate via: + +``` +bash ../scripts/gen-ts.sh +``` + +## Building from source + +``` +npm install +npm run build # emits to dist/ +``` diff --git a/ts/package-lock.json b/ts/package-lock.json new file mode 100644 index 0000000..2f5ee83 --- /dev/null +++ b/ts/package-lock.json @@ -0,0 +1,447 @@ +{ + "name": "@waymaker/client", + "version": "0.1.27", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@waymaker/client", + "version": "0.1.27", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "long": "^5.2.3" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "ts-proto": "^2.6.0", + "typescript": "^5.6.0" + } + }, + "node_modules/@bufbuild/protobuf": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.12.0.tgz", + "integrity": "sha512-B/XlCaFIP8LOwzo+bz5uFzATYokcwCKQcghqnlfwSmM5eX/qTkvDBnDPs+gXtX/RyjxJ4DRikECcPJbyALA8FA==", + "dev": true, + "license": "(Apache-2.0 AND BSD-3-Clause)" + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.4.tgz", + "integrity": "sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.1.tgz", + "integrity": "sha512-wtF6h+DY6M3YaDBPAmvuuA6jV8Sif9MjtOI5euKFWRgCDl5PeDpPsHR9u2l6St5ceY8AZgoNDww5+HvEsXFsGg==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.5.tgz", + "integrity": "sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.1.tgz", + "integrity": "sha512-vW1GmwMZNnL+gMRaovlh9yZX74kc+TTU3FObkkurpMaRtBfLP3ldjS9KQWlwZgraRE0+dheEEoAxdzcJQ8eXZg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.1.tgz", + "integrity": "sha512-GpptLrs57adMSuHi3VNj0mAF8dwh36LMaYF6XyJ6JMWlVsc+t42tm1HSEDmOs3A8fC9yyeisgLhsTVQokOZ0zw==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.2.tgz", + "integrity": "sha512-pa0vFRuws4wkvaXKK1uXZMAwAX4/t8ANaJo45iw/oQHNQ9q5xUzwgFmVJGXiga2BeN+zpX7Vf9vmsiIa2J+MUw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.1.tgz", + "integrity": "sha512-oOAWABowe8EAbMyWKM0tYDKi8Yaox52D+HWZhAIJqQXbqe0xI/GV7FhLWqlEKreMkfDjshR5FKgi3mnle0h6Eg==", + "license": "BSD-3-Clause" + }, + "node_modules/@types/node": { + "version": "22.19.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.20.tgz", + "integrity": "sha512-6tELRwSDYWW9EdZhbeZmYGZ1/7Djkt+Ah3/ScEYT9cDord7UJzasR/4D3VONg9tQI5CDp+/CZC1AXj2pCFOvpw==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^1.0.3" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/protobufjs": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.6.2.tgz", + "integrity": "sha512-N9EiLovGEQOJSPF26Ij7qUGvahfEnq0eeYZ02aigIedkmz1qZSwjnP9SBITHJuF/6MYbIW4HDN8zdYjsjqJKXQ==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.5", + "@protobufjs/eventemitter": "^1.1.1", + "@protobufjs/fetch": "^1.1.1", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.2", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.1", + "@types/node": ">=13.7.0", + "long": "^5.3.2" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-poet": { + "version": "6.12.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.12.0.tgz", + "integrity": "sha512-xo+iRNMWqyvXpFTaOAvLPA5QAWO6TZrSUs5s4Odaya3epqofBu/fMLHEWl8jPmjhA0s9sgj9sNvF1BmaQlmQkA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.11.8.tgz", + "integrity": "sha512-+5hzECnyVB33jxjG1BIdzAHcRBm7hjnm8womdJVp2A7xJWihP0drHHVsXYTr9i/LpWNGfh80I+AVVNzFM5AwJw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.10.2", + "case-anything": "^2.1.13", + "ts-poet": "^6.12.0", + "ts-proto-descriptors": "2.1.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.1.0.tgz", + "integrity": "sha512-S5EZYEQ6L9KLFfjSRpZWDIXDV/W7tAj8uW7pLsihIxyr62EAVSiKuVPwE8iWnr849Bqa53enex1jhDUcpgquzA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + } + } +} diff --git a/ts/package.json b/ts/package.json new file mode 100644 index 0000000..3859200 --- /dev/null +++ b/ts/package.json @@ -0,0 +1,25 @@ +{ + "name": "@waymaker/client", + "version": "0.1.27", + "description": "Official TypeScript client for waymaker — locks, streams, KV, collections, sketches, cache, object store", + "repository": "https://git.awesomike.com/pub/waymaker-client", + "license": "MIT OR Apache-2.0", + "type": "commonjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": ["dist", "src"], + "scripts": { + "gen": "../scripts/gen-ts.sh", + "build": "tsc -p tsconfig.json", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "@grpc/grpc-js": "^1.12.0", + "long": "^5.2.3" + }, + "devDependencies": { + "ts-proto": "^2.6.0", + "typescript": "^5.6.0", + "@types/node": "^22.0.0" + } +} diff --git a/ts/src/cache.ts b/ts/src/cache.ts new file mode 100644 index 0000000..f9f723c --- /dev/null +++ b/ts/src/cache.ts @@ -0,0 +1,72 @@ +/** + * Cache subsystem — TTL/eviction policy service. + * + * The server-side implementation is a stub; all calls return + * `unimplemented`. The client surface is complete so callers can + * import and compile against it and get real responses once the + * server ships the implementation. + * + * Entry points on `WaymakerClient`: + * - `client.cacheAttachPolicy(streamName, policyType, params)` + * - `client.cacheDetachPolicy(streamName)` + */ + +import { WaymakerClient, callUnary } from "./client"; +import { serverError } from "./error"; + +declare module "./client" { + interface WaymakerClient { + /** + * Attach a TTL/eviction policy to a bucket. + * Server returns `unimplemented` until the first concrete policy lands. + * `policyId` is the policy kind (e.g. `"lru"`); `params` are + * policy-specific knobs (e.g. `{ max_entries: "1000" }`). + */ + cacheAttachPolicy( + bucket: string, + policyId: string, + params?: Record + ): Promise; + + /** + * Detach a TTL/eviction policy from a bucket. + * Server returns `unimplemented` until the first concrete policy lands. + */ + cacheDetachPolicy(bucket: string): Promise; + } +} + +WaymakerClient.prototype.cacheAttachPolicy = async function ( + this: WaymakerClient, + bucket: string, + policyId: string, + params: Record = {} +): Promise { + const c = this._cacheClient(); + try { + const res = await callUnary(c, (req, cb) => c.attachPolicy(req, cb), { + bucket, + policyId, + params, + }); + // res may be unknown if server is unimplemented — cast defensively. + const r = res as { success?: boolean; resultCode?: string; message?: string }; + if (r.success === false) throw serverError(r.resultCode ?? "error", r.message ?? ""); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.cacheDetachPolicy = async function ( + this: WaymakerClient, + bucket: string +): Promise { + const c = this._cacheClient(); + try { + const res = await callUnary(c, (req, cb) => c.detachPolicy(req, cb), { bucket }); + const r = res as { success?: boolean; resultCode?: string; message?: string }; + if (r.success === false) throw serverError(r.resultCode ?? "error", r.message ?? ""); + } finally { + c.close(); + } +}; diff --git a/ts/src/client.ts b/ts/src/client.ts new file mode 100644 index 0000000..1283dc8 --- /dev/null +++ b/ts/src/client.ts @@ -0,0 +1,226 @@ +/** + * Core connection handle. + * + * `WaymakerClient` holds the gRPC channel and exposes per-subsystem + * service clients. It is safe to share across async tasks — the + * underlying grpc-js `Channel` is reference-counted. + * + * ## Single-host + * ```ts + * const client = await WaymakerClient.connect("localhost:8818"); + * ``` + * + * ## Multi-host (HA, round-robin) + * ```ts + * const client = WaymakerClient.connectMulti([ + * "localhost:8818", + * "localhost:8828", + * "localhost:8838", + * ]); + * ``` + */ + +import * as grpc from "@grpc/grpc-js"; +import { WaymakerServiceClient } from "./genpb/waymaker_locks"; +import { WaymakerStreamsServiceClient } from "./genpb/waymaker_streams"; +import { WaymakerKvServiceClient } from "./genpb/kv"; +import { WaymakerCollectionsServiceClient } from "./genpb/collections"; +import { WaymakerSketchesServiceClient } from "./genpb/sketches"; +import { WaymakerCacheServiceClient } from "./genpb/cache"; +import { invalidError, rpcError, serverError } from "./error"; + +export type { WaymakerError } from "./error"; +export { isServerError, isWaymakerError } from "./error"; + +/** Options for `WaymakerClient.connect`. */ +export interface ConnectOptions { + /** Channel credentials. Defaults to `grpc.credentials.createInsecure()`. */ + credentials?: grpc.ChannelCredentials; + /** Extra gRPC channel options. */ + channelOptions?: grpc.ChannelOptions; +} + +/** + * A connected waymaker client. Cheap to pass around — the underlying + * channel is shared, not copied. + */ +export class WaymakerClient { + readonly channel: grpc.Channel; + + private constructor(channel: grpc.Channel) { + this.channel = channel; + } + + /** + * Connect to a single waymaker server. + * + * `address` must be `"host:port"` (no scheme). + * Returns immediately; the channel connects lazily on the first RPC. + */ + static connect(address: string, opts: ConnectOptions = {}): WaymakerClient { + const creds = opts.credentials ?? grpc.credentials.createInsecure(); + const ch = new grpc.Channel(address, creds, opts.channelOptions ?? {}); + return new WaymakerClient(ch); + } + + /** + * Connect to multiple waymaker servers. grpc-js round-robins + * requests across the list and automatically reroutes when one + * endpoint is unreachable — the right shape for a clustered + * deployment. + * + * Each entry in `addresses` must be `"host:port"`. + */ + static connectMulti(addresses: string[], opts: ConnectOptions = {}): WaymakerClient { + if (addresses.length === 0) { + throw invalidError("connectMulti requires at least one address"); + } + const creds = opts.credentials ?? grpc.credentials.createInsecure(); + // grpc-js supports a comma-joined list in a single Channel address + // string with the round_robin load-balancing policy. + const joined = addresses.map((a) => (a.startsWith("dns://") ? a : `dns:///${a}`)).join(","); + const ch = new grpc.Channel(joined, creds, { + "grpc.lb_policy_name": "round_robin", + ...(opts.channelOptions ?? {}), + }); + return new WaymakerClient(ch); + } + + /** Close the underlying channel and free resources. */ + close(): void { + this.channel.close(); + } + + // ------------------------------------------------------------------ + // Per-subsystem gRPC client constructors. Each is constructed + // per-call so individual RPCs pick up the channel's current routing + // state (equivalent to the Rust "lazy per-call client" pattern). + // ------------------------------------------------------------------ + + /** @internal */ + _locksClient(): WaymakerServiceClient { + return new WaymakerServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } + + /** @internal */ + _streamsClient(): WaymakerStreamsServiceClient { + return new WaymakerStreamsServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } + + /** @internal */ + _kvClient(): WaymakerKvServiceClient { + return new WaymakerKvServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } + + /** @internal */ + _collectionsClient(): WaymakerCollectionsServiceClient { + return new WaymakerCollectionsServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } + + /** @internal */ + _sketchesClient(): WaymakerSketchesServiceClient { + return new WaymakerSketchesServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } + + /** @internal */ + _cacheClient(): WaymakerCacheServiceClient { + return new WaymakerCacheServiceClient("", grpc.credentials.createInsecure(), { + channelOverride: this.channel, + }); + } +} + +// ------------------------------------------------------------------ +// Helpers used throughout the client codebase. +// ------------------------------------------------------------------ + +/** + * Wrap a grpc-js unary callback-style call in a Promise. + * + * Pass the method as a bound arrow so that grpc-js receives `this` + * correctly: + * `callUnary(c, (req, cb) => c.someRpc(req, cb), { ...requestFields })` + * + * The generic `Res` parameter is used to type the resolved value. + * Because grpc-js stubs define every RPC with three overloads (no meta / + * with meta / with meta+options), TypeScript cannot infer `Res` from + * contextual typing of the method lambda. Callers must therefore supply + * the response type explicitly: + * `callUnary(c, (req, cb) => c.hashSet(req, cb), req)` + * + * To avoid that boilerplate everywhere, prefer the `callRpc` helper which + * binds the method and infers the response type automatically. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function callUnary( + _client: grpc.Client, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + method: (req: any, cb: (err: grpc.ServiceError | null, res: Res) => void) => grpc.ClientUnaryCall, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + req: any +): Promise { + return new Promise((resolve, reject) => { + method(req, (err, res) => { + if (err) { + reject(rpcError(err)); + } else { + resolve(res as Res); + } + }); + }); +} + +/** + * Read all events from a grpc-js `ClientReadableStream` into an + * async generator. Each `yield` fires as soon as a message arrives; + * the generator ends when the stream closes (or rejects on error). + */ +export async function* streamToAsyncIter( + stream: grpc.ClientReadableStream +): AsyncGenerator { + const queue: T[] = []; + let ended = false; + let error: Error | null = null; + let resolve: (() => void) | null = null; + + stream.on("data", (msg: T) => { + queue.push(msg); + resolve?.(); + resolve = null; + }); + stream.on("end", () => { + ended = true; + resolve?.(); + resolve = null; + }); + stream.on("error", (err: Error) => { + error = err; + resolve?.(); + resolve = null; + }); + + while (true) { + while (queue.length > 0) { + yield queue.shift() as T; + } + if (error) throw rpcError(error as { message: string; code?: number }); + if (ended) return; + await new Promise((res) => { + resolve = res; + }); + } +} + +// Re-export error helpers so callers can import them from the main +// package without reaching into the error module. +export { serverError, rpcError, invalidError }; diff --git a/ts/src/collections.ts b/ts/src/collections.ts new file mode 100644 index 0000000..53a38bb --- /dev/null +++ b/ts/src/collections.ts @@ -0,0 +1,542 @@ +/** + * Collections subsystem — Redis-shape Hash / Set / Queue types. + * + * Entry points on `WaymakerClient`: + * - `client.createHashStore(config)` / `getOrCreateHashStore` / `deleteHashStore` + * - `client.createSetStore(config)` / `getOrCreateSetStore` / `deleteSetStore` + * - `client.createQueue(config)` / `getOrCreateQueue` / `deleteQueue` + * - `client.hashStore(name)` / `setStore(name)` / `queue(name)` — handles without creation + */ + +import { WaymakerClient, callUnary } from "./client"; +import { serverError } from "./error"; + +// ------------------------------------------------------------------ +// Hash +// ------------------------------------------------------------------ + +export interface HashStoreConfig { + name: string; + maxBytes?: number; + ephemeral?: boolean; +} + +export class HashStore { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Return a `Hash` handle for `hashKey` within this store. */ + hash(hashKey: string): Hash { + return new Hash(this._client, this.name, hashKey); + } +} + +export class Hash { + /** @internal */ + constructor( + private readonly _client: WaymakerClient, + private readonly _bucket: string, + readonly hashKey: string + ) {} + + /** Set `field` = `value`. Returns the new revision. */ + async set(field: string, value: Uint8Array | Buffer | string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashSet(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + field, + value: toBuffer(value), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.revision; + } finally { + c.close(); + } + } + + /** Get value for `field`. `null` when absent. */ + async get(field: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashGet(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + field, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.value ?? null; + } finally { + c.close(); + } + } + + /** Check if `field` exists. */ + async exists(field: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashExists(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + field, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.exists; + } finally { + c.close(); + } + } + + /** Delete `field`. */ + async deleteField(field: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashDelete(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + field, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** List all field names. */ + async fields(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashFields(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.fields; + } finally { + c.close(); + } + } + + /** Number of fields. */ + async len(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashLen(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.count; + } finally { + c.close(); + } + } + + /** Get all field→value pairs. */ + async getAll(): Promise> { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.hashGetAll(req, cb), { + bucket: this._bucket, + hashKey: this.hashKey, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + const map = new Map(); + for (const e of res.entries) map.set(e.field, e.value); + return map; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Set +// ------------------------------------------------------------------ + +export interface SetStoreConfig { + name: string; + maxBytes?: number; + ephemeral?: boolean; +} + +export class SetStore { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Return a `Set` handle for `setKey` within this store. */ + set(setKey: string): SetHandle { + return new SetHandle(this._client, this.name, setKey); + } +} + +export class SetHandle { + /** @internal */ + constructor( + private readonly _client: WaymakerClient, + private readonly _bucket: string, + readonly setKey: string + ) {} + + /** Add `member`. */ + async add(member: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.setAdd(req, cb), { + bucket: this._bucket, + setKey: this.setKey, + member, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Remove `member`. */ + async remove(member: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.setRemove(req, cb), { + bucket: this._bucket, + setKey: this.setKey, + member, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Test membership. */ + async isMember(member: string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.setIsMember(req, cb), { + bucket: this._bucket, + setKey: this.setKey, + member, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.isMember; + } finally { + c.close(); + } + } + + /** List all members. */ + async members(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.setMembers(req, cb), { + bucket: this._bucket, + setKey: this.setKey, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.members; + } finally { + c.close(); + } + } + + /** Cardinality. */ + async len(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.setLen(req, cb), { + bucket: this._bucket, + setKey: this.setKey, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.count; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Queue +// ------------------------------------------------------------------ + +export interface QueueConfig { + name: string; + maxBytes?: number; + maxMessages?: number; + ephemeral?: boolean; +} + +export class Queue { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Push `value` to the tail. Returns the new sequence. */ + async push(value: Uint8Array | Buffer | string): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.queuePush(req, cb), { + bucket: this.name, + value: toBuffer(value), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.sequence; + } finally { + c.close(); + } + } + + /** Pop from the head. Returns `null` when empty. */ + async pop(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.queuePop(req, cb), { + bucket: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.value ?? null; + } finally { + c.close(); + } + } + + /** Read a range without consuming. */ + async range(from: number, limit: number): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.queueRange(req, cb), { + bucket: this.name, + fromSequence: from, + limit, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.values; + } finally { + c.close(); + } + } + + /** Queue depth. */ + async len(): Promise { + const c = this._client._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.queueLen(req, cb), { + bucket: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.count; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Client extension methods +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + createHashStore(config: HashStoreConfig): Promise; + getOrCreateHashStore(config: HashStoreConfig): Promise; + hashStore(name: string): HashStore; + deleteHashStore(name: string): Promise; + + createSetStore(config: SetStoreConfig): Promise; + getOrCreateSetStore(config: SetStoreConfig): Promise; + setStore(name: string): SetStore; + deleteSetStore(name: string): Promise; + + createQueue(config: QueueConfig): Promise; + getOrCreateQueue(config: QueueConfig): Promise; + queue(name: string): Queue; + deleteQueue(name: string): Promise; + } +} + +// Hash store +WaymakerClient.prototype.createHashStore = async function ( + this: WaymakerClient, + config: HashStoreConfig +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.createHashStore(req, cb), { + name: config.name, + maxBytes: config.maxBytes ?? 0, + ephemeral: config.ephemeral ?? false, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new HashStore(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateHashStore = async function ( + this: WaymakerClient, + config: HashStoreConfig +): Promise { + try { + return await (this as WaymakerClient).createHashStore(config); + } catch (e) { + if (isServerErrorCode(e, "already_exists")) return new HashStore(this, config.name); + throw e; + } +}; + +WaymakerClient.prototype.hashStore = function ( + this: WaymakerClient, + name: string +): HashStore { + return new HashStore(this, name); +}; + +WaymakerClient.prototype.deleteHashStore = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteHashStore(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// Set store +WaymakerClient.prototype.createSetStore = async function ( + this: WaymakerClient, + config: SetStoreConfig +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.createSetStore(req, cb), { + name: config.name, + maxBytes: config.maxBytes ?? 0, + ephemeral: config.ephemeral ?? false, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new SetStore(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateSetStore = async function ( + this: WaymakerClient, + config: SetStoreConfig +): Promise { + try { + return await (this as WaymakerClient).createSetStore(config); + } catch (e) { + if (isServerErrorCode(e, "already_exists")) return new SetStore(this, config.name); + throw e; + } +}; + +WaymakerClient.prototype.setStore = function ( + this: WaymakerClient, + name: string +): SetStore { + return new SetStore(this, name); +}; + +WaymakerClient.prototype.deleteSetStore = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteSetStore(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// Queue +WaymakerClient.prototype.createQueue = async function ( + this: WaymakerClient, + config: QueueConfig +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.createQueue(req, cb), { + name: config.name, + maxBytes: config.maxBytes ?? 0, + maxMessages: config.maxMessages ?? 0, + ephemeral: config.ephemeral ?? false, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Queue(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateQueue = async function ( + this: WaymakerClient, + config: QueueConfig +): Promise { + try { + return await (this as WaymakerClient).createQueue(config); + } catch (e) { + if (isServerErrorCode(e, "already_exists")) return new Queue(this, config.name); + throw e; + } +}; + +WaymakerClient.prototype.queue = function ( + this: WaymakerClient, + name: string +): Queue { + return new Queue(this, name); +}; + +WaymakerClient.prototype.deleteQueue = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._collectionsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteQueue(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// ------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------ + +function toBuffer(v: Uint8Array | Buffer | string): Buffer { + if (typeof v === "string") return Buffer.from(v); + if (Buffer.isBuffer(v)) return v; + return Buffer.from(v); +} + +function isServerErrorCode(err: unknown, code: string): boolean { + return ( + typeof err === "object" && + err !== null && + "kind" in err && + (err as { kind: string }).kind === "server" && + "code" in err && + (err as { code: string }).code === code + ); +} diff --git a/ts/src/error.ts b/ts/src/error.ts new file mode 100644 index 0000000..f1ba1e0 --- /dev/null +++ b/ts/src/error.ts @@ -0,0 +1,47 @@ +/** + * Waymaker client error types. + * + * `WaymakerError` is the single error type the client surfaces. + * The `kind` discriminant lets callers match specific cases: + * + * - `server` — the server returned success=false. `code` matches the + * server's result_code string (e.g. "expired", "wrong_revision"). + * - `rpc` — a gRPC transport error (network, auth, etc.). + * - `invalid` — bad call-site argument (no RPC was sent). + */ + +export type WaymakerError = + | { kind: "server"; code: string; message: string } + | { kind: "rpc"; message: string; status?: number } + | { kind: "invalid"; message: string }; + +/** Create a server-logic error (success=false response). */ +export function serverError(code: string, message: string): WaymakerError { + return { kind: "server", code, message }; +} + +/** Wrap a gRPC ServiceError. */ +export function rpcError(err: { message: string; code?: number }): WaymakerError { + return { kind: "rpc", message: err.message, status: err.code }; +} + +/** Create an invalid-argument error. */ +export function invalidError(message: string): WaymakerError { + return { kind: "invalid", message }; +} + +/** Type guard: is this a server-logic error with the given code? */ +export function isServerError(err: unknown, code?: string): err is { kind: "server"; code: string; message: string } { + if (!isWaymakerError(err) || err.kind !== "server") return false; + if (code !== undefined) return err.code === code; + return true; +} + +export function isWaymakerError(err: unknown): err is WaymakerError { + return ( + typeof err === "object" && + err !== null && + "kind" in err && + (err as WaymakerError).kind !== undefined + ); +} diff --git a/ts/src/genpb/cache.ts b/ts/src/genpb/cache.ts new file mode 100644 index 0000000..55a84ac --- /dev/null +++ b/ts/src/genpb/cache.ts @@ -0,0 +1,946 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: cache.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientUnaryCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker.cache"; + +export interface AttachPolicyRequest { + bucket: string; + policyId: string; + /** + * Policy-specific knobs (e.g. `max_entries`, `default_ttl_ms`) + * — interpretation is server-side. + */ + params: { [key: string]: string }; +} + +export interface AttachPolicyRequest_ParamsEntry { + key: string; + value: string; +} + +export interface AttachPolicyResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DetachPolicyRequest { + bucket: string; +} + +export interface DetachPolicyResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface StatsRequest { + bucket: string; +} + +export interface StatsResponse { + success: boolean; + resultCode: string; + message: string; + hitCount: number; + missCount: number; + evictionCount: number; + sizeBytes: number; + entryCount: number; +} + +function createBaseAttachPolicyRequest(): AttachPolicyRequest { + return { bucket: "", policyId: "", params: {} }; +} + +export const AttachPolicyRequest: MessageFns = { + encode(message: AttachPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.policyId !== "") { + writer.uint32(18).string(message.policyId); + } + globalThis.Object.entries(message.params).forEach(([key, value]: [string, string]) => { + AttachPolicyRequest_ParamsEntry.encode({ key: key as any, value }, writer.uint32(26).fork()).join(); + }); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttachPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttachPolicyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.policyId = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + const entry3 = AttachPolicyRequest_ParamsEntry.decode(reader, reader.uint32()); + if (entry3.value !== undefined) { + message.params[entry3.key] = entry3.value; + } + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AttachPolicyRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + policyId: isSet(object.policyId) + ? globalThis.String(object.policyId) + : isSet(object.policy_id) + ? globalThis.String(object.policy_id) + : "", + params: isObject(object.params) + ? (globalThis.Object.entries(object.params) as [string, any][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, any]) => { + acc[key] = globalThis.String(value); + return acc; + }, + {}, + ) + : {}, + }; + }, + + toJSON(message: AttachPolicyRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.policyId !== "") { + obj.policyId = message.policyId; + } + if (message.params) { + const entries = globalThis.Object.entries(message.params) as [string, string][]; + if (entries.length > 0) { + obj.params = {}; + entries.forEach(([k, v]) => { + obj.params[k] = v; + }); + } + } + return obj; + }, + + create(base?: DeepPartial): AttachPolicyRequest { + return AttachPolicyRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AttachPolicyRequest { + const message = createBaseAttachPolicyRequest(); + message.bucket = object.bucket ?? ""; + message.policyId = object.policyId ?? ""; + message.params = (globalThis.Object.entries(object.params ?? {}) as [string, string][]).reduce( + (acc: { [key: string]: string }, [key, value]: [string, string]) => { + if (value !== undefined) { + acc[key] = globalThis.String(value); + } + return acc; + }, + {}, + ); + return message; + }, +}; + +function createBaseAttachPolicyRequest_ParamsEntry(): AttachPolicyRequest_ParamsEntry { + return { key: "", value: "" }; +} + +export const AttachPolicyRequest_ParamsEntry: MessageFns = { + encode(message: AttachPolicyRequest_ParamsEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttachPolicyRequest_ParamsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttachPolicyRequest_ParamsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AttachPolicyRequest_ParamsEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: AttachPolicyRequest_ParamsEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create(base?: DeepPartial): AttachPolicyRequest_ParamsEntry { + return AttachPolicyRequest_ParamsEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AttachPolicyRequest_ParamsEntry { + const message = createBaseAttachPolicyRequest_ParamsEntry(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseAttachPolicyResponse(): AttachPolicyResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const AttachPolicyResponse: MessageFns = { + encode(message: AttachPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AttachPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttachPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AttachPolicyResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: AttachPolicyResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): AttachPolicyResponse { + return AttachPolicyResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AttachPolicyResponse { + const message = createBaseAttachPolicyResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDetachPolicyRequest(): DetachPolicyRequest { + return { bucket: "" }; +} + +export const DetachPolicyRequest: MessageFns = { + encode(message: DetachPolicyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DetachPolicyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDetachPolicyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DetachPolicyRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: DetachPolicyRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): DetachPolicyRequest { + return DetachPolicyRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DetachPolicyRequest { + const message = createBaseDetachPolicyRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseDetachPolicyResponse(): DetachPolicyResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DetachPolicyResponse: MessageFns = { + encode(message: DetachPolicyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DetachPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDetachPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DetachPolicyResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DetachPolicyResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DetachPolicyResponse { + return DetachPolicyResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DetachPolicyResponse { + const message = createBaseDetachPolicyResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseStatsRequest(): StatsRequest { + return { bucket: "" }; +} + +export const StatsRequest: MessageFns = { + encode(message: StatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatsRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: StatsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): StatsRequest { + return StatsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StatsRequest { + const message = createBaseStatsRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseStatsResponse(): StatsResponse { + return { + success: false, + resultCode: "", + message: "", + hitCount: 0, + missCount: 0, + evictionCount: 0, + sizeBytes: 0, + entryCount: 0, + }; +} + +export const StatsResponse: MessageFns = { + encode(message: StatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.hitCount !== 0) { + writer.uint32(32).uint64(message.hitCount); + } + if (message.missCount !== 0) { + writer.uint32(40).uint64(message.missCount); + } + if (message.evictionCount !== 0) { + writer.uint32(48).uint64(message.evictionCount); + } + if (message.sizeBytes !== 0) { + writer.uint32(56).uint64(message.sizeBytes); + } + if (message.entryCount !== 0) { + writer.uint32(64).uint64(message.entryCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StatsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStatsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.hitCount = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.missCount = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.evictionCount = longToNumber(reader.uint64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.sizeBytes = longToNumber(reader.uint64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.entryCount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StatsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + hitCount: isSet(object.hitCount) + ? globalThis.Number(object.hitCount) + : isSet(object.hit_count) + ? globalThis.Number(object.hit_count) + : 0, + missCount: isSet(object.missCount) + ? globalThis.Number(object.missCount) + : isSet(object.miss_count) + ? globalThis.Number(object.miss_count) + : 0, + evictionCount: isSet(object.evictionCount) + ? globalThis.Number(object.evictionCount) + : isSet(object.eviction_count) + ? globalThis.Number(object.eviction_count) + : 0, + sizeBytes: isSet(object.sizeBytes) + ? globalThis.Number(object.sizeBytes) + : isSet(object.size_bytes) + ? globalThis.Number(object.size_bytes) + : 0, + entryCount: isSet(object.entryCount) + ? globalThis.Number(object.entryCount) + : isSet(object.entry_count) + ? globalThis.Number(object.entry_count) + : 0, + }; + }, + + toJSON(message: StatsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.hitCount !== 0) { + obj.hitCount = Math.round(message.hitCount); + } + if (message.missCount !== 0) { + obj.missCount = Math.round(message.missCount); + } + if (message.evictionCount !== 0) { + obj.evictionCount = Math.round(message.evictionCount); + } + if (message.sizeBytes !== 0) { + obj.sizeBytes = Math.round(message.sizeBytes); + } + if (message.entryCount !== 0) { + obj.entryCount = Math.round(message.entryCount); + } + return obj; + }, + + create(base?: DeepPartial): StatsResponse { + return StatsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StatsResponse { + const message = createBaseStatsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.hitCount = object.hitCount ?? 0; + message.missCount = object.missCount ?? 0; + message.evictionCount = object.evictionCount ?? 0; + message.sizeBytes = object.sizeBytes ?? 0; + message.entryCount = object.entryCount ?? 0; + return message; + }, +}; + +export type WaymakerCacheServiceService = typeof WaymakerCacheServiceService; +export const WaymakerCacheServiceService = { + /** + * Apply a TTL policy to a bucket. `policy_id` selects from + * server-configured policies (initially: `lru`, `expiry`). + */ + attachPolicy: { + path: "/waymaker.cache.WaymakerCacheService/AttachPolicy" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: AttachPolicyRequest): Buffer => Buffer.from(AttachPolicyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): AttachPolicyRequest => AttachPolicyRequest.decode(value), + responseSerialize: (value: AttachPolicyResponse): Buffer => + Buffer.from(AttachPolicyResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AttachPolicyResponse => AttachPolicyResponse.decode(value), + }, + /** + * Detach the policy currently bound to `bucket` (no-op if + * none). + */ + detachPolicy: { + path: "/waymaker.cache.WaymakerCacheService/DetachPolicy" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DetachPolicyRequest): Buffer => Buffer.from(DetachPolicyRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DetachPolicyRequest => DetachPolicyRequest.decode(value), + responseSerialize: (value: DetachPolicyResponse): Buffer => + Buffer.from(DetachPolicyResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DetachPolicyResponse => DetachPolicyResponse.decode(value), + }, + /** + * Report current cache stats (hit/miss/eviction counters, + * memory footprint) for a bucket. + */ + stats: { + path: "/waymaker.cache.WaymakerCacheService/Stats" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: StatsRequest): Buffer => Buffer.from(StatsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): StatsRequest => StatsRequest.decode(value), + responseSerialize: (value: StatsResponse): Buffer => Buffer.from(StatsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): StatsResponse => StatsResponse.decode(value), + }, +} as const; + +export interface WaymakerCacheServiceServer extends UntypedServiceImplementation { + /** + * Apply a TTL policy to a bucket. `policy_id` selects from + * server-configured policies (initially: `lru`, `expiry`). + */ + attachPolicy: handleUnaryCall; + /** + * Detach the policy currently bound to `bucket` (no-op if + * none). + */ + detachPolicy: handleUnaryCall; + /** + * Report current cache stats (hit/miss/eviction counters, + * memory footprint) for a bucket. + */ + stats: handleUnaryCall; +} + +export interface WaymakerCacheServiceClient extends Client { + /** + * Apply a TTL policy to a bucket. `policy_id` selects from + * server-configured policies (initially: `lru`, `expiry`). + */ + attachPolicy( + request: AttachPolicyRequest, + callback: (error: ServiceError | null, response: AttachPolicyResponse) => void, + ): ClientUnaryCall; + attachPolicy( + request: AttachPolicyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AttachPolicyResponse) => void, + ): ClientUnaryCall; + attachPolicy( + request: AttachPolicyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AttachPolicyResponse) => void, + ): ClientUnaryCall; + /** + * Detach the policy currently bound to `bucket` (no-op if + * none). + */ + detachPolicy( + request: DetachPolicyRequest, + callback: (error: ServiceError | null, response: DetachPolicyResponse) => void, + ): ClientUnaryCall; + detachPolicy( + request: DetachPolicyRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DetachPolicyResponse) => void, + ): ClientUnaryCall; + detachPolicy( + request: DetachPolicyRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DetachPolicyResponse) => void, + ): ClientUnaryCall; + /** + * Report current cache stats (hit/miss/eviction counters, + * memory footprint) for a bucket. + */ + stats( + request: StatsRequest, + callback: (error: ServiceError | null, response: StatsResponse) => void, + ): ClientUnaryCall; + stats( + request: StatsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: StatsResponse) => void, + ): ClientUnaryCall; + stats( + request: StatsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: StatsResponse) => void, + ): ClientUnaryCall; +} + +export const WaymakerCacheServiceClient = makeGenericClientConstructor( + WaymakerCacheServiceService, + "waymaker.cache.WaymakerCacheService", +) as unknown as { + new (address: string, credentials: ChannelCredentials, options?: Partial): WaymakerCacheServiceClient; + service: typeof WaymakerCacheServiceService; + serviceName: string; +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isObject(value: any): boolean { + return typeof value === "object" && value !== null; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/collections.ts b/ts/src/genpb/collections.ts new file mode 100644 index 0000000..5c49f7f --- /dev/null +++ b/ts/src/genpb/collections.ts @@ -0,0 +1,5216 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: collections.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientUnaryCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker.collections"; + +export interface CreateHashStoreRequest { + name: string; + maxBytes: number; + ephemeral: boolean; +} + +export interface CreateHashStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteHashStoreRequest { + name: string; +} + +export interface DeleteHashStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HashSetRequest { + bucket: string; + hashKey: string; + field: string; + value: Buffer; +} + +export interface HashSetResponse { + success: boolean; + resultCode: string; + message: string; + revision: number; +} + +export interface HashGetRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashGetResponse { + success: boolean; + resultCode: string; + message: string; + value?: Buffer | undefined; + revision: number; +} + +export interface HashExistsRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashExistsResponse { + success: boolean; + resultCode: string; + message: string; + exists: boolean; +} + +export interface HashDeleteRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HashGetAllRequest { + bucket: string; + hashKey: string; +} + +export interface HashGetAllResponse { + success: boolean; + resultCode: string; + message: string; + entries: HashFieldEntry[]; +} + +export interface HashFieldEntry { + field: string; + value: Buffer; + revision: number; +} + +export interface HashFieldsRequest { + bucket: string; + hashKey: string; +} + +export interface HashFieldsResponse { + success: boolean; + resultCode: string; + message: string; + fields: string[]; +} + +export interface HashLenRequest { + bucket: string; + hashKey: string; +} + +export interface HashLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +export interface CreateSetStoreRequest { + name: string; + maxBytes: number; + ephemeral: boolean; +} + +export interface CreateSetStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteSetStoreRequest { + name: string; +} + +export interface DeleteSetStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetAddRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetRemoveRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetRemoveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetIsMemberRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetIsMemberResponse { + success: boolean; + resultCode: string; + message: string; + isMember: boolean; +} + +export interface SetMembersRequest { + bucket: string; + setKey: string; +} + +export interface SetMembersResponse { + success: boolean; + resultCode: string; + message: string; + members: string[]; +} + +export interface SetLenRequest { + bucket: string; + setKey: string; +} + +export interface SetLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +export interface CreateQueueRequest { + name: string; + maxBytes: number; + maxMessages: number; + ephemeral: boolean; +} + +export interface CreateQueueResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteQueueRequest { + name: string; +} + +export interface DeleteQueueResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface QueuePushRequest { + bucket: string; + value: Buffer; +} + +export interface QueuePushResponse { + success: boolean; + resultCode: string; + message: string; + sequence: number; +} + +export interface QueuePopRequest { + bucket: string; +} + +export interface QueuePopResponse { + success: boolean; + resultCode: string; + message: string; + value?: Buffer | undefined; +} + +export interface QueueRangeRequest { + bucket: string; + fromSequence: number; + limit: number; +} + +export interface QueueRangeResponse { + success: boolean; + resultCode: string; + message: string; + values: Buffer[]; +} + +export interface QueueLenRequest { + bucket: string; +} + +export interface QueueLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +function createBaseCreateHashStoreRequest(): CreateHashStoreRequest { + return { name: "", maxBytes: 0, ephemeral: false }; +} + +export const CreateHashStoreRequest: MessageFns = { + encode(message: CreateHashStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.ephemeral !== false) { + writer.uint32(24).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateHashStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateHashStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateHashStoreRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateHashStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateHashStoreRequest { + return CreateHashStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateHashStoreRequest { + const message = createBaseCreateHashStoreRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateHashStoreResponse(): CreateHashStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateHashStoreResponse: MessageFns = { + encode(message: CreateHashStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateHashStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateHashStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateHashStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateHashStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateHashStoreResponse { + return CreateHashStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateHashStoreResponse { + const message = createBaseCreateHashStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteHashStoreRequest(): DeleteHashStoreRequest { + return { name: "" }; +} + +export const DeleteHashStoreRequest: MessageFns = { + encode(message: DeleteHashStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteHashStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteHashStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteHashStoreRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteHashStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteHashStoreRequest { + return DeleteHashStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteHashStoreRequest { + const message = createBaseDeleteHashStoreRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteHashStoreResponse(): DeleteHashStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteHashStoreResponse: MessageFns = { + encode(message: DeleteHashStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteHashStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteHashStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteHashStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteHashStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteHashStoreResponse { + return DeleteHashStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteHashStoreResponse { + const message = createBaseDeleteHashStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHashSetRequest(): HashSetRequest { + return { bucket: "", hashKey: "", field: "", value: Buffer.alloc(0) }; +} + +export const HashSetRequest: MessageFns = { + encode(message: HashSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashSetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + + toJSON(message: HashSetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): HashSetRequest { + return HashSetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashSetRequest { + const message = createBaseHashSetRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + message.value = object.value ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseHashSetResponse(): HashSetResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const HashSetResponse: MessageFns = { + encode(message: HashSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashSetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashSetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashSetResponse { + return HashSetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashSetResponse { + const message = createBaseHashSetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashGetRequest(): HashGetRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashGetRequest: MessageFns = { + encode(message: HashGetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashGetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashGetRequest { + return HashGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetRequest { + const message = createBaseHashGetRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashGetResponse(): HashGetResponse { + return { success: false, resultCode: "", message: "", value: undefined, revision: 0 }; +} + +export const HashGetResponse: MessageFns = { + encode(message: HashGetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.value !== undefined) { + writer.uint32(34).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(40).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : undefined, + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashGetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.value !== undefined) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashGetResponse { + return HashGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetResponse { + const message = createBaseHashGetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.value = object.value ?? undefined; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashExistsRequest(): HashExistsRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashExistsRequest: MessageFns = { + encode(message: HashExistsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashExistsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashExistsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashExistsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashExistsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashExistsRequest { + return HashExistsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashExistsRequest { + const message = createBaseHashExistsRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashExistsResponse(): HashExistsResponse { + return { success: false, resultCode: "", message: "", exists: false }; +} + +export const HashExistsResponse: MessageFns = { + encode(message: HashExistsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.exists !== false) { + writer.uint32(32).bool(message.exists); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashExistsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashExistsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashExistsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, + }; + }, + + toJSON(message: HashExistsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + + create(base?: DeepPartial): HashExistsResponse { + return HashExistsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashExistsResponse { + const message = createBaseHashExistsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.exists = object.exists ?? false; + return message; + }, +}; + +function createBaseHashDeleteRequest(): HashDeleteRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashDeleteRequest: MessageFns = { + encode(message: HashDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashDeleteRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashDeleteRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashDeleteRequest { + return HashDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashDeleteRequest { + const message = createBaseHashDeleteRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashDeleteResponse(): HashDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HashDeleteResponse: MessageFns = { + encode(message: HashDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HashDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HashDeleteResponse { + return HashDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashDeleteResponse { + const message = createBaseHashDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHashGetAllRequest(): HashGetAllRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashGetAllRequest: MessageFns = { + encode(message: HashGetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetAllRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashGetAllRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashGetAllRequest { + return HashGetAllRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetAllRequest { + const message = createBaseHashGetAllRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashGetAllResponse(): HashGetAllResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const HashGetAllResponse: MessageFns = { + encode(message: HashGetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + HashFieldEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(HashFieldEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetAllResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => HashFieldEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HashGetAllResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => HashFieldEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): HashGetAllResponse { + return HashGetAllResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetAllResponse { + const message = createBaseHashGetAllResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => HashFieldEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHashFieldEntry(): HashFieldEntry { + return { field: "", value: Buffer.alloc(0), revision: 0 }; +} + +export const HashFieldEntry: MessageFns = { + encode(message: HashFieldEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field !== "") { + writer.uint32(10).string(message.field); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(24).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.field = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldEntry { + return { + field: isSet(object.field) ? globalThis.String(object.field) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashFieldEntry): unknown { + const obj: any = {}; + if (message.field !== "") { + obj.field = message.field; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashFieldEntry { + return HashFieldEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldEntry { + const message = createBaseHashFieldEntry(); + message.field = object.field ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashFieldsRequest(): HashFieldsRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashFieldsRequest: MessageFns = { + encode(message: HashFieldsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashFieldsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashFieldsRequest { + return HashFieldsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldsRequest { + const message = createBaseHashFieldsRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashFieldsResponse(): HashFieldsResponse { + return { success: false, resultCode: "", message: "", fields: [] }; +} + +export const HashFieldsResponse: MessageFns = { + encode(message: HashFieldsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.fields) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fields.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + fields: globalThis.Array.isArray(object?.fields) ? object.fields.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: HashFieldsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.fields?.length) { + obj.fields = message.fields; + } + return obj; + }, + + create(base?: DeepPartial): HashFieldsResponse { + return HashFieldsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldsResponse { + const message = createBaseHashFieldsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.fields = object.fields?.map((e) => e) || []; + return message; + }, +}; + +function createBaseHashLenRequest(): HashLenRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashLenRequest: MessageFns = { + encode(message: HashLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashLenRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashLenRequest { + return HashLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashLenRequest { + const message = createBaseHashLenRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashLenResponse(): HashLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const HashLenResponse: MessageFns = { + encode(message: HashLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: HashLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): HashLenResponse { + return HashLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashLenResponse { + const message = createBaseHashLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseCreateSetStoreRequest(): CreateSetStoreRequest { + return { name: "", maxBytes: 0, ephemeral: false }; +} + +export const CreateSetStoreRequest: MessageFns = { + encode(message: CreateSetStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.ephemeral !== false) { + writer.uint32(24).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateSetStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateSetStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateSetStoreRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateSetStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateSetStoreRequest { + return CreateSetStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateSetStoreRequest { + const message = createBaseCreateSetStoreRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateSetStoreResponse(): CreateSetStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateSetStoreResponse: MessageFns = { + encode(message: CreateSetStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateSetStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateSetStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateSetStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateSetStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateSetStoreResponse { + return CreateSetStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateSetStoreResponse { + const message = createBaseCreateSetStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteSetStoreRequest(): DeleteSetStoreRequest { + return { name: "" }; +} + +export const DeleteSetStoreRequest: MessageFns = { + encode(message: DeleteSetStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteSetStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteSetStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteSetStoreRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteSetStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteSetStoreRequest { + return DeleteSetStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteSetStoreRequest { + const message = createBaseDeleteSetStoreRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteSetStoreResponse(): DeleteSetStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteSetStoreResponse: MessageFns = { + encode(message: DeleteSetStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteSetStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteSetStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteSetStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteSetStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteSetStoreResponse { + return DeleteSetStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteSetStoreResponse { + const message = createBaseDeleteSetStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetAddRequest(): SetAddRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetAddRequest: MessageFns = { + encode(message: SetAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetAddRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetAddRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetAddRequest { + return SetAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetAddRequest { + const message = createBaseSetAddRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetAddResponse(): SetAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const SetAddResponse: MessageFns = { + encode(message: SetAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: SetAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): SetAddResponse { + return SetAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetAddResponse { + const message = createBaseSetAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetRemoveRequest(): SetRemoveRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetRemoveRequest: MessageFns = { + encode(message: SetRemoveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetRemoveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetRemoveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetRemoveRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetRemoveRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetRemoveRequest { + return SetRemoveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetRemoveRequest { + const message = createBaseSetRemoveRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetRemoveResponse(): SetRemoveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const SetRemoveResponse: MessageFns = { + encode(message: SetRemoveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetRemoveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetRemoveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetRemoveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: SetRemoveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): SetRemoveResponse { + return SetRemoveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetRemoveResponse { + const message = createBaseSetRemoveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetIsMemberRequest(): SetIsMemberRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetIsMemberRequest: MessageFns = { + encode(message: SetIsMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetIsMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetIsMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetIsMemberRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetIsMemberRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetIsMemberRequest { + return SetIsMemberRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetIsMemberRequest { + const message = createBaseSetIsMemberRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetIsMemberResponse(): SetIsMemberResponse { + return { success: false, resultCode: "", message: "", isMember: false }; +} + +export const SetIsMemberResponse: MessageFns = { + encode(message: SetIsMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.isMember !== false) { + writer.uint32(32).bool(message.isMember); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetIsMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetIsMemberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.isMember = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetIsMemberResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + isMember: isSet(object.isMember) + ? globalThis.Boolean(object.isMember) + : isSet(object.is_member) + ? globalThis.Boolean(object.is_member) + : false, + }; + }, + + toJSON(message: SetIsMemberResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.isMember !== false) { + obj.isMember = message.isMember; + } + return obj; + }, + + create(base?: DeepPartial): SetIsMemberResponse { + return SetIsMemberResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetIsMemberResponse { + const message = createBaseSetIsMemberResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.isMember = object.isMember ?? false; + return message; + }, +}; + +function createBaseSetMembersRequest(): SetMembersRequest { + return { bucket: "", setKey: "" }; +} + +export const SetMembersRequest: MessageFns = { + encode(message: SetMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMembersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetMembersRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + }; + }, + + toJSON(message: SetMembersRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + return obj; + }, + + create(base?: DeepPartial): SetMembersRequest { + return SetMembersRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMembersRequest { + const message = createBaseSetMembersRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + return message; + }, +}; + +function createBaseSetMembersResponse(): SetMembersResponse { + return { success: false, resultCode: "", message: "", members: [] }; +} + +export const SetMembersResponse: MessageFns = { + encode(message: SetMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.members) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.members.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetMembersResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + members: globalThis.Array.isArray(object?.members) ? object.members.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: SetMembersResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.members?.length) { + obj.members = message.members; + } + return obj; + }, + + create(base?: DeepPartial): SetMembersResponse { + return SetMembersResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMembersResponse { + const message = createBaseSetMembersResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.members = object.members?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSetLenRequest(): SetLenRequest { + return { bucket: "", setKey: "" }; +} + +export const SetLenRequest: MessageFns = { + encode(message: SetLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetLenRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + }; + }, + + toJSON(message: SetLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + return obj; + }, + + create(base?: DeepPartial): SetLenRequest { + return SetLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetLenRequest { + const message = createBaseSetLenRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + return message; + }, +}; + +function createBaseSetLenResponse(): SetLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const SetLenResponse: MessageFns = { + encode(message: SetLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: SetLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): SetLenResponse { + return SetLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetLenResponse { + const message = createBaseSetLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseCreateQueueRequest(): CreateQueueRequest { + return { name: "", maxBytes: 0, maxMessages: 0, ephemeral: false }; +} + +export const CreateQueueRequest: MessageFns = { + encode(message: CreateQueueRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.maxMessages !== 0) { + writer.uint32(24).uint64(message.maxMessages); + } + if (message.ephemeral !== false) { + writer.uint32(32).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateQueueRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateQueueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxMessages = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateQueueRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + maxMessages: isSet(object.maxMessages) + ? globalThis.Number(object.maxMessages) + : isSet(object.max_messages) + ? globalThis.Number(object.max_messages) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateQueueRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxMessages !== 0) { + obj.maxMessages = Math.round(message.maxMessages); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateQueueRequest { + return CreateQueueRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateQueueRequest { + const message = createBaseCreateQueueRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.maxMessages = object.maxMessages ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateQueueResponse(): CreateQueueResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateQueueResponse: MessageFns = { + encode(message: CreateQueueResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateQueueResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateQueueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateQueueResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateQueueResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateQueueResponse { + return CreateQueueResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateQueueResponse { + const message = createBaseCreateQueueResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteQueueRequest(): DeleteQueueRequest { + return { name: "" }; +} + +export const DeleteQueueRequest: MessageFns = { + encode(message: DeleteQueueRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteQueueRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteQueueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteQueueRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteQueueRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteQueueRequest { + return DeleteQueueRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteQueueRequest { + const message = createBaseDeleteQueueRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteQueueResponse(): DeleteQueueResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteQueueResponse: MessageFns = { + encode(message: DeleteQueueResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteQueueResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteQueueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteQueueResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteQueueResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteQueueResponse { + return DeleteQueueResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteQueueResponse { + const message = createBaseDeleteQueueResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseQueuePushRequest(): QueuePushRequest { + return { bucket: "", value: Buffer.alloc(0) }; +} + +export const QueuePushRequest: MessageFns = { + encode(message: QueuePushRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePushRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePushRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePushRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + + toJSON(message: QueuePushRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): QueuePushRequest { + return QueuePushRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePushRequest { + const message = createBaseQueuePushRequest(); + message.bucket = object.bucket ?? ""; + message.value = object.value ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseQueuePushResponse(): QueuePushResponse { + return { success: false, resultCode: "", message: "", sequence: 0 }; +} + +export const QueuePushResponse: MessageFns = { + encode(message: QueuePushResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePushResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePushResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePushResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: QueuePushResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create(base?: DeepPartial): QueuePushResponse { + return QueuePushResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePushResponse { + const message = createBaseQueuePushResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseQueuePopRequest(): QueuePopRequest { + return { bucket: "" }; +} + +export const QueuePopRequest: MessageFns = { + encode(message: QueuePopRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePopRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePopRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: QueuePopRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): QueuePopRequest { + return QueuePopRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePopRequest { + const message = createBaseQueuePopRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseQueuePopResponse(): QueuePopResponse { + return { success: false, resultCode: "", message: "", value: undefined }; +} + +export const QueuePopResponse: MessageFns = { + encode(message: QueuePopResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.value !== undefined) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePopResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePopResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : undefined, + }; + }, + + toJSON(message: QueuePopResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.value !== undefined) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): QueuePopResponse { + return QueuePopResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePopResponse { + const message = createBaseQueuePopResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseQueueRangeRequest(): QueueRangeRequest { + return { bucket: "", fromSequence: 0, limit: 0 }; +} + +export const QueueRangeRequest: MessageFns = { + encode(message: QueueRangeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.fromSequence !== 0) { + writer.uint32(16).uint64(message.fromSequence); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueRangeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueRangeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fromSequence = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueRangeRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + fromSequence: isSet(object.fromSequence) + ? globalThis.Number(object.fromSequence) + : isSet(object.from_sequence) + ? globalThis.Number(object.from_sequence) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: QueueRangeRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.fromSequence !== 0) { + obj.fromSequence = Math.round(message.fromSequence); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): QueueRangeRequest { + return QueueRangeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueRangeRequest { + const message = createBaseQueueRangeRequest(); + message.bucket = object.bucket ?? ""; + message.fromSequence = object.fromSequence ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseQueueRangeResponse(): QueueRangeResponse { + return { success: false, resultCode: "", message: "", values: [] }; +} + +export const QueueRangeResponse: MessageFns = { + encode(message: QueueRangeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.values) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueRangeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueRangeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.values.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueRangeResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: QueueRangeResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): QueueRangeResponse { + return QueueRangeResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueRangeResponse { + const message = createBaseQueueRangeResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueueLenRequest(): QueueLenRequest { + return { bucket: "" }; +} + +export const QueueLenRequest: MessageFns = { + encode(message: QueueLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueLenRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: QueueLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): QueueLenRequest { + return QueueLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueLenRequest { + const message = createBaseQueueLenRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseQueueLenResponse(): QueueLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const QueueLenResponse: MessageFns = { + encode(message: QueueLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: QueueLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): QueueLenResponse { + return QueueLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueLenResponse { + const message = createBaseQueueLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +export type WaymakerCollectionsServiceService = typeof WaymakerCollectionsServiceService; +export const WaymakerCollectionsServiceService = { + /** ----- Hash ------------------------------------------------- */ + createHashStore: { + path: "/waymaker.collections.WaymakerCollectionsService/CreateHashStore" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateHashStoreRequest): Buffer => + Buffer.from(CreateHashStoreRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateHashStoreRequest => CreateHashStoreRequest.decode(value), + responseSerialize: (value: CreateHashStoreResponse): Buffer => + Buffer.from(CreateHashStoreResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateHashStoreResponse => CreateHashStoreResponse.decode(value), + }, + deleteHashStore: { + path: "/waymaker.collections.WaymakerCollectionsService/DeleteHashStore" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteHashStoreRequest): Buffer => + Buffer.from(DeleteHashStoreRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteHashStoreRequest => DeleteHashStoreRequest.decode(value), + responseSerialize: (value: DeleteHashStoreResponse): Buffer => + Buffer.from(DeleteHashStoreResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteHashStoreResponse => DeleteHashStoreResponse.decode(value), + }, + hashSet: { + path: "/waymaker.collections.WaymakerCollectionsService/HashSet" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashSetRequest): Buffer => Buffer.from(HashSetRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashSetRequest => HashSetRequest.decode(value), + responseSerialize: (value: HashSetResponse): Buffer => Buffer.from(HashSetResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashSetResponse => HashSetResponse.decode(value), + }, + hashGet: { + path: "/waymaker.collections.WaymakerCollectionsService/HashGet" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashGetRequest): Buffer => Buffer.from(HashGetRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashGetRequest => HashGetRequest.decode(value), + responseSerialize: (value: HashGetResponse): Buffer => Buffer.from(HashGetResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashGetResponse => HashGetResponse.decode(value), + }, + hashExists: { + path: "/waymaker.collections.WaymakerCollectionsService/HashExists" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashExistsRequest): Buffer => Buffer.from(HashExistsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashExistsRequest => HashExistsRequest.decode(value), + responseSerialize: (value: HashExistsResponse): Buffer => Buffer.from(HashExistsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashExistsResponse => HashExistsResponse.decode(value), + }, + hashDelete: { + path: "/waymaker.collections.WaymakerCollectionsService/HashDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashDeleteRequest): Buffer => Buffer.from(HashDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashDeleteRequest => HashDeleteRequest.decode(value), + responseSerialize: (value: HashDeleteResponse): Buffer => Buffer.from(HashDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashDeleteResponse => HashDeleteResponse.decode(value), + }, + hashGetAll: { + path: "/waymaker.collections.WaymakerCollectionsService/HashGetAll" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashGetAllRequest): Buffer => Buffer.from(HashGetAllRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashGetAllRequest => HashGetAllRequest.decode(value), + responseSerialize: (value: HashGetAllResponse): Buffer => Buffer.from(HashGetAllResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashGetAllResponse => HashGetAllResponse.decode(value), + }, + hashFields: { + path: "/waymaker.collections.WaymakerCollectionsService/HashFields" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashFieldsRequest): Buffer => Buffer.from(HashFieldsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashFieldsRequest => HashFieldsRequest.decode(value), + responseSerialize: (value: HashFieldsResponse): Buffer => Buffer.from(HashFieldsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashFieldsResponse => HashFieldsResponse.decode(value), + }, + hashLen: { + path: "/waymaker.collections.WaymakerCollectionsService/HashLen" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HashLenRequest): Buffer => Buffer.from(HashLenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HashLenRequest => HashLenRequest.decode(value), + responseSerialize: (value: HashLenResponse): Buffer => Buffer.from(HashLenResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HashLenResponse => HashLenResponse.decode(value), + }, + /** ----- Set -------------------------------------------------- */ + createSetStore: { + path: "/waymaker.collections.WaymakerCollectionsService/CreateSetStore" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateSetStoreRequest): Buffer => + Buffer.from(CreateSetStoreRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateSetStoreRequest => CreateSetStoreRequest.decode(value), + responseSerialize: (value: CreateSetStoreResponse): Buffer => + Buffer.from(CreateSetStoreResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateSetStoreResponse => CreateSetStoreResponse.decode(value), + }, + deleteSetStore: { + path: "/waymaker.collections.WaymakerCollectionsService/DeleteSetStore" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteSetStoreRequest): Buffer => + Buffer.from(DeleteSetStoreRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteSetStoreRequest => DeleteSetStoreRequest.decode(value), + responseSerialize: (value: DeleteSetStoreResponse): Buffer => + Buffer.from(DeleteSetStoreResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteSetStoreResponse => DeleteSetStoreResponse.decode(value), + }, + setAdd: { + path: "/waymaker.collections.WaymakerCollectionsService/SetAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetAddRequest): Buffer => Buffer.from(SetAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetAddRequest => SetAddRequest.decode(value), + responseSerialize: (value: SetAddResponse): Buffer => Buffer.from(SetAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetAddResponse => SetAddResponse.decode(value), + }, + setRemove: { + path: "/waymaker.collections.WaymakerCollectionsService/SetRemove" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetRemoveRequest): Buffer => Buffer.from(SetRemoveRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetRemoveRequest => SetRemoveRequest.decode(value), + responseSerialize: (value: SetRemoveResponse): Buffer => Buffer.from(SetRemoveResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetRemoveResponse => SetRemoveResponse.decode(value), + }, + setIsMember: { + path: "/waymaker.collections.WaymakerCollectionsService/SetIsMember" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetIsMemberRequest): Buffer => Buffer.from(SetIsMemberRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetIsMemberRequest => SetIsMemberRequest.decode(value), + responseSerialize: (value: SetIsMemberResponse): Buffer => Buffer.from(SetIsMemberResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetIsMemberResponse => SetIsMemberResponse.decode(value), + }, + setMembers: { + path: "/waymaker.collections.WaymakerCollectionsService/SetMembers" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetMembersRequest): Buffer => Buffer.from(SetMembersRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetMembersRequest => SetMembersRequest.decode(value), + responseSerialize: (value: SetMembersResponse): Buffer => Buffer.from(SetMembersResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetMembersResponse => SetMembersResponse.decode(value), + }, + setLen: { + path: "/waymaker.collections.WaymakerCollectionsService/SetLen" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetLenRequest): Buffer => Buffer.from(SetLenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetLenRequest => SetLenRequest.decode(value), + responseSerialize: (value: SetLenResponse): Buffer => Buffer.from(SetLenResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetLenResponse => SetLenResponse.decode(value), + }, + /** ----- Queue ------------------------------------------------ */ + createQueue: { + path: "/waymaker.collections.WaymakerCollectionsService/CreateQueue" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateQueueRequest): Buffer => Buffer.from(CreateQueueRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateQueueRequest => CreateQueueRequest.decode(value), + responseSerialize: (value: CreateQueueResponse): Buffer => Buffer.from(CreateQueueResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateQueueResponse => CreateQueueResponse.decode(value), + }, + deleteQueue: { + path: "/waymaker.collections.WaymakerCollectionsService/DeleteQueue" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteQueueRequest): Buffer => Buffer.from(DeleteQueueRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteQueueRequest => DeleteQueueRequest.decode(value), + responseSerialize: (value: DeleteQueueResponse): Buffer => Buffer.from(DeleteQueueResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteQueueResponse => DeleteQueueResponse.decode(value), + }, + queuePush: { + path: "/waymaker.collections.WaymakerCollectionsService/QueuePush" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: QueuePushRequest): Buffer => Buffer.from(QueuePushRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): QueuePushRequest => QueuePushRequest.decode(value), + responseSerialize: (value: QueuePushResponse): Buffer => Buffer.from(QueuePushResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): QueuePushResponse => QueuePushResponse.decode(value), + }, + queuePop: { + path: "/waymaker.collections.WaymakerCollectionsService/QueuePop" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: QueuePopRequest): Buffer => Buffer.from(QueuePopRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): QueuePopRequest => QueuePopRequest.decode(value), + responseSerialize: (value: QueuePopResponse): Buffer => Buffer.from(QueuePopResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): QueuePopResponse => QueuePopResponse.decode(value), + }, + queueRange: { + path: "/waymaker.collections.WaymakerCollectionsService/QueueRange" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: QueueRangeRequest): Buffer => Buffer.from(QueueRangeRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): QueueRangeRequest => QueueRangeRequest.decode(value), + responseSerialize: (value: QueueRangeResponse): Buffer => Buffer.from(QueueRangeResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): QueueRangeResponse => QueueRangeResponse.decode(value), + }, + queueLen: { + path: "/waymaker.collections.WaymakerCollectionsService/QueueLen" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: QueueLenRequest): Buffer => Buffer.from(QueueLenRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): QueueLenRequest => QueueLenRequest.decode(value), + responseSerialize: (value: QueueLenResponse): Buffer => Buffer.from(QueueLenResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): QueueLenResponse => QueueLenResponse.decode(value), + }, +} as const; + +export interface WaymakerCollectionsServiceServer extends UntypedServiceImplementation { + /** ----- Hash ------------------------------------------------- */ + createHashStore: handleUnaryCall; + deleteHashStore: handleUnaryCall; + hashSet: handleUnaryCall; + hashGet: handleUnaryCall; + hashExists: handleUnaryCall; + hashDelete: handleUnaryCall; + hashGetAll: handleUnaryCall; + hashFields: handleUnaryCall; + hashLen: handleUnaryCall; + /** ----- Set -------------------------------------------------- */ + createSetStore: handleUnaryCall; + deleteSetStore: handleUnaryCall; + setAdd: handleUnaryCall; + setRemove: handleUnaryCall; + setIsMember: handleUnaryCall; + setMembers: handleUnaryCall; + setLen: handleUnaryCall; + /** ----- Queue ------------------------------------------------ */ + createQueue: handleUnaryCall; + deleteQueue: handleUnaryCall; + queuePush: handleUnaryCall; + queuePop: handleUnaryCall; + queueRange: handleUnaryCall; + queueLen: handleUnaryCall; +} + +export interface WaymakerCollectionsServiceClient extends Client { + /** ----- Hash ------------------------------------------------- */ + createHashStore( + request: CreateHashStoreRequest, + callback: (error: ServiceError | null, response: CreateHashStoreResponse) => void, + ): ClientUnaryCall; + createHashStore( + request: CreateHashStoreRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateHashStoreResponse) => void, + ): ClientUnaryCall; + createHashStore( + request: CreateHashStoreRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateHashStoreResponse) => void, + ): ClientUnaryCall; + deleteHashStore( + request: DeleteHashStoreRequest, + callback: (error: ServiceError | null, response: DeleteHashStoreResponse) => void, + ): ClientUnaryCall; + deleteHashStore( + request: DeleteHashStoreRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteHashStoreResponse) => void, + ): ClientUnaryCall; + deleteHashStore( + request: DeleteHashStoreRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteHashStoreResponse) => void, + ): ClientUnaryCall; + hashSet( + request: HashSetRequest, + callback: (error: ServiceError | null, response: HashSetResponse) => void, + ): ClientUnaryCall; + hashSet( + request: HashSetRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashSetResponse) => void, + ): ClientUnaryCall; + hashSet( + request: HashSetRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashSetResponse) => void, + ): ClientUnaryCall; + hashGet( + request: HashGetRequest, + callback: (error: ServiceError | null, response: HashGetResponse) => void, + ): ClientUnaryCall; + hashGet( + request: HashGetRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashGetResponse) => void, + ): ClientUnaryCall; + hashGet( + request: HashGetRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashGetResponse) => void, + ): ClientUnaryCall; + hashExists( + request: HashExistsRequest, + callback: (error: ServiceError | null, response: HashExistsResponse) => void, + ): ClientUnaryCall; + hashExists( + request: HashExistsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashExistsResponse) => void, + ): ClientUnaryCall; + hashExists( + request: HashExistsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashExistsResponse) => void, + ): ClientUnaryCall; + hashDelete( + request: HashDeleteRequest, + callback: (error: ServiceError | null, response: HashDeleteResponse) => void, + ): ClientUnaryCall; + hashDelete( + request: HashDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashDeleteResponse) => void, + ): ClientUnaryCall; + hashDelete( + request: HashDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashDeleteResponse) => void, + ): ClientUnaryCall; + hashGetAll( + request: HashGetAllRequest, + callback: (error: ServiceError | null, response: HashGetAllResponse) => void, + ): ClientUnaryCall; + hashGetAll( + request: HashGetAllRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashGetAllResponse) => void, + ): ClientUnaryCall; + hashGetAll( + request: HashGetAllRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashGetAllResponse) => void, + ): ClientUnaryCall; + hashFields( + request: HashFieldsRequest, + callback: (error: ServiceError | null, response: HashFieldsResponse) => void, + ): ClientUnaryCall; + hashFields( + request: HashFieldsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashFieldsResponse) => void, + ): ClientUnaryCall; + hashFields( + request: HashFieldsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashFieldsResponse) => void, + ): ClientUnaryCall; + hashLen( + request: HashLenRequest, + callback: (error: ServiceError | null, response: HashLenResponse) => void, + ): ClientUnaryCall; + hashLen( + request: HashLenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HashLenResponse) => void, + ): ClientUnaryCall; + hashLen( + request: HashLenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HashLenResponse) => void, + ): ClientUnaryCall; + /** ----- Set -------------------------------------------------- */ + createSetStore( + request: CreateSetStoreRequest, + callback: (error: ServiceError | null, response: CreateSetStoreResponse) => void, + ): ClientUnaryCall; + createSetStore( + request: CreateSetStoreRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateSetStoreResponse) => void, + ): ClientUnaryCall; + createSetStore( + request: CreateSetStoreRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateSetStoreResponse) => void, + ): ClientUnaryCall; + deleteSetStore( + request: DeleteSetStoreRequest, + callback: (error: ServiceError | null, response: DeleteSetStoreResponse) => void, + ): ClientUnaryCall; + deleteSetStore( + request: DeleteSetStoreRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteSetStoreResponse) => void, + ): ClientUnaryCall; + deleteSetStore( + request: DeleteSetStoreRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteSetStoreResponse) => void, + ): ClientUnaryCall; + setAdd( + request: SetAddRequest, + callback: (error: ServiceError | null, response: SetAddResponse) => void, + ): ClientUnaryCall; + setAdd( + request: SetAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetAddResponse) => void, + ): ClientUnaryCall; + setAdd( + request: SetAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetAddResponse) => void, + ): ClientUnaryCall; + setRemove( + request: SetRemoveRequest, + callback: (error: ServiceError | null, response: SetRemoveResponse) => void, + ): ClientUnaryCall; + setRemove( + request: SetRemoveRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetRemoveResponse) => void, + ): ClientUnaryCall; + setRemove( + request: SetRemoveRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetRemoveResponse) => void, + ): ClientUnaryCall; + setIsMember( + request: SetIsMemberRequest, + callback: (error: ServiceError | null, response: SetIsMemberResponse) => void, + ): ClientUnaryCall; + setIsMember( + request: SetIsMemberRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetIsMemberResponse) => void, + ): ClientUnaryCall; + setIsMember( + request: SetIsMemberRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetIsMemberResponse) => void, + ): ClientUnaryCall; + setMembers( + request: SetMembersRequest, + callback: (error: ServiceError | null, response: SetMembersResponse) => void, + ): ClientUnaryCall; + setMembers( + request: SetMembersRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetMembersResponse) => void, + ): ClientUnaryCall; + setMembers( + request: SetMembersRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetMembersResponse) => void, + ): ClientUnaryCall; + setLen( + request: SetLenRequest, + callback: (error: ServiceError | null, response: SetLenResponse) => void, + ): ClientUnaryCall; + setLen( + request: SetLenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetLenResponse) => void, + ): ClientUnaryCall; + setLen( + request: SetLenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetLenResponse) => void, + ): ClientUnaryCall; + /** ----- Queue ------------------------------------------------ */ + createQueue( + request: CreateQueueRequest, + callback: (error: ServiceError | null, response: CreateQueueResponse) => void, + ): ClientUnaryCall; + createQueue( + request: CreateQueueRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateQueueResponse) => void, + ): ClientUnaryCall; + createQueue( + request: CreateQueueRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateQueueResponse) => void, + ): ClientUnaryCall; + deleteQueue( + request: DeleteQueueRequest, + callback: (error: ServiceError | null, response: DeleteQueueResponse) => void, + ): ClientUnaryCall; + deleteQueue( + request: DeleteQueueRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteQueueResponse) => void, + ): ClientUnaryCall; + deleteQueue( + request: DeleteQueueRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteQueueResponse) => void, + ): ClientUnaryCall; + queuePush( + request: QueuePushRequest, + callback: (error: ServiceError | null, response: QueuePushResponse) => void, + ): ClientUnaryCall; + queuePush( + request: QueuePushRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: QueuePushResponse) => void, + ): ClientUnaryCall; + queuePush( + request: QueuePushRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: QueuePushResponse) => void, + ): ClientUnaryCall; + queuePop( + request: QueuePopRequest, + callback: (error: ServiceError | null, response: QueuePopResponse) => void, + ): ClientUnaryCall; + queuePop( + request: QueuePopRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: QueuePopResponse) => void, + ): ClientUnaryCall; + queuePop( + request: QueuePopRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: QueuePopResponse) => void, + ): ClientUnaryCall; + queueRange( + request: QueueRangeRequest, + callback: (error: ServiceError | null, response: QueueRangeResponse) => void, + ): ClientUnaryCall; + queueRange( + request: QueueRangeRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: QueueRangeResponse) => void, + ): ClientUnaryCall; + queueRange( + request: QueueRangeRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: QueueRangeResponse) => void, + ): ClientUnaryCall; + queueLen( + request: QueueLenRequest, + callback: (error: ServiceError | null, response: QueueLenResponse) => void, + ): ClientUnaryCall; + queueLen( + request: QueueLenRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: QueueLenResponse) => void, + ): ClientUnaryCall; + queueLen( + request: QueueLenRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: QueueLenResponse) => void, + ): ClientUnaryCall; +} + +export const WaymakerCollectionsServiceClient = makeGenericClientConstructor( + WaymakerCollectionsServiceService, + "waymaker.collections.WaymakerCollectionsService", +) as unknown as { + new ( + address: string, + credentials: ChannelCredentials, + options?: Partial, + ): WaymakerCollectionsServiceClient; + service: typeof WaymakerCollectionsServiceService; + serviceName: string; +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/kv.ts b/ts/src/genpb/kv.ts new file mode 100644 index 0000000..3e46124 --- /dev/null +++ b/ts/src/genpb/kv.ts @@ -0,0 +1,2985 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: kv.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientReadableStream, + type ClientUnaryCall, + type handleServerStreamingCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker.kv"; + +export interface KvCreateBucketRequest { + bucket: string; + /** 0 = unbounded */ + maxBytes: number; + /** 0 = no per-value cap */ + maxValueSize: number; + /** + * Bucket-level TTL (ms). 0 = no time-based eviction. + * Independent of per-key TTL set via Put. + */ + maxAgeMs: number; + ephemeral: boolean; + /** + * Per-key revision cap. 0 (default) = unbounded — history depth + * is then bounded only by the bucket's stream-level retention + * (max_age_ms / max_bytes). When N > 0, after each successful + * write to a key, older revisions of *that key* beyond the N + * most recent are dropped via per-message pruning. Useful when + * one bucket hosts many keys with very different write rates — + * a fast-churning key won't crowd out older revisions of a + * slow-changing key. NATS JetStream's "MaxRevisions" semantic. + */ + maxRevisions: number; +} + +export interface KvCreateBucketResponse { + success: boolean; + /** "ok" | "already_exists" | "invalid_config" | "internal" */ + resultCode: string; + message: string; +} + +export interface KvDeleteBucketRequest { + bucket: string; +} + +export interface KvDeleteBucketResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; +} + +export interface KvPutRequest { + bucket: string; + key: string; + value: Buffer; + /** per-key TTL; 0 = no TTL */ + ttlMs: number; +} + +export interface KvCreateRequest { + bucket: string; + key: string; + value: Buffer; + ttlMs: number; +} + +export interface KvUpdateRequest { + bucket: string; + key: string; + value: Buffer; + /** + * The revision the caller believes is current. Server returns + * wrong_revision if mismatch. + */ + expectedRevision: number; + ttlMs: number; +} + +export interface KvPutResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" */ + resultCode: string; + message: string; + revision: number; +} + +export interface KvGetRequest { + bucket: string; + key: string; +} + +export interface KvGetResponse { + success: boolean; + resultCode: string; + message: string; + entry?: KvEntry | undefined; +} + +export interface KvEntry { + value: Buffer; + revision: number; + tsMs: number; +} + +export interface KvDeleteRequest { + bucket: string; + key: string; +} + +export interface KvDeleteResponse { + success: boolean; + resultCode: string; + message: string; + revision: number; +} + +export interface KvKeysRequest { + bucket: string; +} + +export interface KvKeysResponse { + success: boolean; + resultCode: string; + message: string; + entries: KvKeyEntry[]; +} + +export interface KvKeyEntry { + key: string; + revision: number; + deleted: boolean; +} + +export interface KvHistoryRequest { + bucket: string; + key: string; + /** 0 = from beginning */ + fromRevision: number; + /** 0 = server default */ + limit: number; +} + +export interface KvHistoryResponse { + success: boolean; + resultCode: string; + message: string; + entries: KvHistoryEntry[]; +} + +export interface KvHistoryEntry { + value: Buffer; + revision: number; + tsMs: number; + deleted: boolean; +} + +export interface KvTouchRequest { + bucket: string; + key: string; + ttlMs: number; +} + +export interface KvWatchRequest { + bucket: string; + /** empty = whole bucket */ + key: string; +} + +export interface KvWatchEvent { + put?: KvPutEvent | undefined; + delete?: KvDeleteEvent | undefined; +} + +export interface KvPutEvent { + key: string; + value: Buffer; + revision: number; + tsMs: number; +} + +export interface KvDeleteEvent { + key: string; + revision: number; + tsMs: number; +} + +function createBaseKvCreateBucketRequest(): KvCreateBucketRequest { + return { bucket: "", maxBytes: 0, maxValueSize: 0, maxAgeMs: 0, ephemeral: false, maxRevisions: 0 }; +} + +export const KvCreateBucketRequest: MessageFns = { + encode(message: KvCreateBucketRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.maxValueSize !== 0) { + writer.uint32(24).uint64(message.maxValueSize); + } + if (message.maxAgeMs !== 0) { + writer.uint32(32).uint64(message.maxAgeMs); + } + if (message.ephemeral !== false) { + writer.uint32(40).bool(message.ephemeral); + } + if (message.maxRevisions !== 0) { + writer.uint32(48).uint64(message.maxRevisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateBucketRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateBucketRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxValueSize = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.maxAgeMs = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.maxRevisions = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateBucketRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + maxValueSize: isSet(object.maxValueSize) + ? globalThis.Number(object.maxValueSize) + : isSet(object.max_value_size) + ? globalThis.Number(object.max_value_size) + : 0, + maxAgeMs: isSet(object.maxAgeMs) + ? globalThis.Number(object.maxAgeMs) + : isSet(object.max_age_ms) + ? globalThis.Number(object.max_age_ms) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + maxRevisions: isSet(object.maxRevisions) + ? globalThis.Number(object.maxRevisions) + : isSet(object.max_revisions) + ? globalThis.Number(object.max_revisions) + : 0, + }; + }, + + toJSON(message: KvCreateBucketRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxValueSize !== 0) { + obj.maxValueSize = Math.round(message.maxValueSize); + } + if (message.maxAgeMs !== 0) { + obj.maxAgeMs = Math.round(message.maxAgeMs); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + if (message.maxRevisions !== 0) { + obj.maxRevisions = Math.round(message.maxRevisions); + } + return obj; + }, + + create(base?: DeepPartial): KvCreateBucketRequest { + return KvCreateBucketRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateBucketRequest { + const message = createBaseKvCreateBucketRequest(); + message.bucket = object.bucket ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.maxValueSize = object.maxValueSize ?? 0; + message.maxAgeMs = object.maxAgeMs ?? 0; + message.ephemeral = object.ephemeral ?? false; + message.maxRevisions = object.maxRevisions ?? 0; + return message; + }, +}; + +function createBaseKvCreateBucketResponse(): KvCreateBucketResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const KvCreateBucketResponse: MessageFns = { + encode(message: KvCreateBucketResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateBucketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateBucketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateBucketResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: KvCreateBucketResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): KvCreateBucketResponse { + return KvCreateBucketResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateBucketResponse { + const message = createBaseKvCreateBucketResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseKvDeleteBucketRequest(): KvDeleteBucketRequest { + return { bucket: "" }; +} + +export const KvDeleteBucketRequest: MessageFns = { + encode(message: KvDeleteBucketRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteBucketRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteBucketRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteBucketRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: KvDeleteBucketRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteBucketRequest { + return KvDeleteBucketRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteBucketRequest { + const message = createBaseKvDeleteBucketRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseKvDeleteBucketResponse(): KvDeleteBucketResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const KvDeleteBucketResponse: MessageFns = { + encode(message: KvDeleteBucketResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteBucketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteBucketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteBucketResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: KvDeleteBucketResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteBucketResponse { + return KvDeleteBucketResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteBucketResponse { + const message = createBaseKvDeleteBucketResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseKvPutRequest(): KvPutRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), ttlMs: 0 }; +} + +export const KvPutRequest: MessageFns = { + encode(message: KvPutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.ttlMs !== 0) { + writer.uint32(32).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvPutRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvPutRequest { + return KvPutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutRequest { + const message = createBaseKvPutRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvCreateRequest(): KvCreateRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), ttlMs: 0 }; +} + +export const KvCreateRequest: MessageFns = { + encode(message: KvCreateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.ttlMs !== 0) { + writer.uint32(32).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvCreateRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvCreateRequest { + return KvCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateRequest { + const message = createBaseKvCreateRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvUpdateRequest(): KvUpdateRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), expectedRevision: 0, ttlMs: 0 }; +} + +export const KvUpdateRequest: MessageFns = { + encode(message: KvUpdateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.expectedRevision !== 0) { + writer.uint32(32).uint64(message.expectedRevision); + } + if (message.ttlMs !== 0) { + writer.uint32(40).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.expectedRevision = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvUpdateRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + expectedRevision: isSet(object.expectedRevision) + ? globalThis.Number(object.expectedRevision) + : isSet(object.expected_revision) + ? globalThis.Number(object.expected_revision) + : 0, + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvUpdateRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.expectedRevision !== 0) { + obj.expectedRevision = Math.round(message.expectedRevision); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvUpdateRequest { + return KvUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvUpdateRequest { + const message = createBaseKvUpdateRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.expectedRevision = object.expectedRevision ?? 0; + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvPutResponse(): KvPutResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const KvPutResponse: MessageFns = { + encode(message: KvPutResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: KvPutResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): KvPutResponse { + return KvPutResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutResponse { + const message = createBaseKvPutResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseKvGetRequest(): KvGetRequest { + return { bucket: "", key: "" }; +} + +export const KvGetRequest: MessageFns = { + encode(message: KvGetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvGetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvGetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvGetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvGetRequest { + return KvGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvGetRequest { + const message = createBaseKvGetRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvGetResponse(): KvGetResponse { + return { success: false, resultCode: "", message: "", entry: undefined }; +} + +export const KvGetResponse: MessageFns = { + encode(message: KvGetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.entry !== undefined) { + KvEntry.encode(message.entry, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvGetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entry = KvEntry.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvGetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entry: isSet(object.entry) ? KvEntry.fromJSON(object.entry) : undefined, + }; + }, + + toJSON(message: KvGetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entry !== undefined) { + obj.entry = KvEntry.toJSON(message.entry); + } + return obj; + }, + + create(base?: DeepPartial): KvGetResponse { + return KvGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvGetResponse { + const message = createBaseKvGetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entry = (object.entry !== undefined && object.entry !== null) + ? KvEntry.fromPartial(object.entry) + : undefined; + return message; + }, +}; + +function createBaseKvEntry(): KvEntry { + return { value: Buffer.alloc(0), revision: 0, tsMs: 0 }; +} + +export const KvEntry: MessageFns = { + encode(message: KvEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvEntry { + return { + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvEntry): unknown { + const obj: any = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvEntry { + return KvEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvEntry { + const message = createBaseKvEntry(); + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseKvDeleteRequest(): KvDeleteRequest { + return { bucket: "", key: "" }; +} + +export const KvDeleteRequest: MessageFns = { + encode(message: KvDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvDeleteRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteRequest { + return KvDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteRequest { + const message = createBaseKvDeleteRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvDeleteResponse(): KvDeleteResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const KvDeleteResponse: MessageFns = { + encode(message: KvDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: KvDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteResponse { + return KvDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteResponse { + const message = createBaseKvDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseKvKeysRequest(): KvKeysRequest { + return { bucket: "" }; +} + +export const KvKeysRequest: MessageFns = { + encode(message: KvKeysRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeysRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeysRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeysRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: KvKeysRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): KvKeysRequest { + return KvKeysRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeysRequest { + const message = createBaseKvKeysRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseKvKeysResponse(): KvKeysResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const KvKeysResponse: MessageFns = { + encode(message: KvKeysResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + KvKeyEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeysResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeysResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(KvKeyEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeysResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => KvKeyEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: KvKeysResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => KvKeyEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): KvKeysResponse { + return KvKeysResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeysResponse { + const message = createBaseKvKeysResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => KvKeyEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseKvKeyEntry(): KvKeyEntry { + return { key: "", revision: 0, deleted: false }; +} + +export const KvKeyEntry: MessageFns = { + encode(message: KvKeyEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.deleted !== false) { + writer.uint32(24).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeyEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeyEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeyEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: KvKeyEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): KvKeyEntry { + return KvKeyEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeyEntry { + const message = createBaseKvKeyEntry(); + message.key = object.key ?? ""; + message.revision = object.revision ?? 0; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseKvHistoryRequest(): KvHistoryRequest { + return { bucket: "", key: "", fromRevision: 0, limit: 0 }; +} + +export const KvHistoryRequest: MessageFns = { + encode(message: KvHistoryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.fromRevision !== 0) { + writer.uint32(24).uint64(message.fromRevision); + } + if (message.limit !== 0) { + writer.uint32(32).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fromRevision = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + fromRevision: isSet(object.fromRevision) + ? globalThis.Number(object.fromRevision) + : isSet(object.from_revision) + ? globalThis.Number(object.from_revision) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: KvHistoryRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.fromRevision !== 0) { + obj.fromRevision = Math.round(message.fromRevision); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryRequest { + return KvHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryRequest { + const message = createBaseKvHistoryRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.fromRevision = object.fromRevision ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseKvHistoryResponse(): KvHistoryResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const KvHistoryResponse: MessageFns = { + encode(message: KvHistoryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + KvHistoryEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(KvHistoryEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => KvHistoryEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: KvHistoryResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => KvHistoryEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryResponse { + return KvHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryResponse { + const message = createBaseKvHistoryResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => KvHistoryEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseKvHistoryEntry(): KvHistoryEntry { + return { value: Buffer.alloc(0), revision: 0, tsMs: 0, deleted: false }; +} + +export const KvHistoryEntry: MessageFns = { + encode(message: KvHistoryEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + if (message.deleted !== false) { + writer.uint32(32).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryEntry { + return { + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: KvHistoryEntry): unknown { + const obj: any = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryEntry { + return KvHistoryEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryEntry { + const message = createBaseKvHistoryEntry(); + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseKvTouchRequest(): KvTouchRequest { + return { bucket: "", key: "", ttlMs: 0 }; +} + +export const KvTouchRequest: MessageFns = { + encode(message: KvTouchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.ttlMs !== 0) { + writer.uint32(24).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvTouchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvTouchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvTouchRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvTouchRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvTouchRequest { + return KvTouchRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvTouchRequest { + const message = createBaseKvTouchRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvWatchRequest(): KvWatchRequest { + return { bucket: "", key: "" }; +} + +export const KvWatchRequest: MessageFns = { + encode(message: KvWatchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvWatchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvWatchRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvWatchRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvWatchRequest { + return KvWatchRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvWatchRequest { + const message = createBaseKvWatchRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvWatchEvent(): KvWatchEvent { + return { put: undefined, delete: undefined }; +} + +export const KvWatchEvent: MessageFns = { + encode(message: KvWatchEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.put !== undefined) { + KvPutEvent.encode(message.put, writer.uint32(10).fork()).join(); + } + if (message.delete !== undefined) { + KvDeleteEvent.encode(message.delete, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvWatchEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvWatchEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.put = KvPutEvent.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.delete = KvDeleteEvent.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvWatchEvent { + return { + put: isSet(object.put) ? KvPutEvent.fromJSON(object.put) : undefined, + delete: isSet(object.delete) ? KvDeleteEvent.fromJSON(object.delete) : undefined, + }; + }, + + toJSON(message: KvWatchEvent): unknown { + const obj: any = {}; + if (message.put !== undefined) { + obj.put = KvPutEvent.toJSON(message.put); + } + if (message.delete !== undefined) { + obj.delete = KvDeleteEvent.toJSON(message.delete); + } + return obj; + }, + + create(base?: DeepPartial): KvWatchEvent { + return KvWatchEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvWatchEvent { + const message = createBaseKvWatchEvent(); + message.put = (object.put !== undefined && object.put !== null) ? KvPutEvent.fromPartial(object.put) : undefined; + message.delete = (object.delete !== undefined && object.delete !== null) + ? KvDeleteEvent.fromPartial(object.delete) + : undefined; + return message; + }, +}; + +function createBaseKvPutEvent(): KvPutEvent { + return { key: "", value: Buffer.alloc(0), revision: 0, tsMs: 0 }; +} + +export const KvPutEvent: MessageFns = { + encode(message: KvPutEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(24).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(32).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutEvent { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvPutEvent): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvPutEvent { + return KvPutEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutEvent { + const message = createBaseKvPutEvent(); + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseKvDeleteEvent(): KvDeleteEvent { + return { key: "", revision: 0, tsMs: 0 }; +} + +export const KvDeleteEvent: MessageFns = { + encode(message: KvDeleteEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteEvent { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvDeleteEvent): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteEvent { + return KvDeleteEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteEvent { + const message = createBaseKvDeleteEvent(); + message.key = object.key ?? ""; + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +export type WaymakerKvServiceService = typeof WaymakerKvServiceService; +export const WaymakerKvServiceService = { + /** ----- Bucket lifecycle ------------------------------------- */ + createBucket: { + path: "/waymaker.kv.WaymakerKvService/CreateBucket" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvCreateBucketRequest): Buffer => + Buffer.from(KvCreateBucketRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvCreateBucketRequest => KvCreateBucketRequest.decode(value), + responseSerialize: (value: KvCreateBucketResponse): Buffer => + Buffer.from(KvCreateBucketResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvCreateBucketResponse => KvCreateBucketResponse.decode(value), + }, + deleteBucket: { + path: "/waymaker.kv.WaymakerKvService/DeleteBucket" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvDeleteBucketRequest): Buffer => + Buffer.from(KvDeleteBucketRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvDeleteBucketRequest => KvDeleteBucketRequest.decode(value), + responseSerialize: (value: KvDeleteBucketResponse): Buffer => + Buffer.from(KvDeleteBucketResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvDeleteBucketResponse => KvDeleteBucketResponse.decode(value), + }, + /** ----- Mutations -------------------------------------------- */ + put: { + path: "/waymaker.kv.WaymakerKvService/Put" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvPutRequest): Buffer => Buffer.from(KvPutRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvPutRequest => KvPutRequest.decode(value), + responseSerialize: (value: KvPutResponse): Buffer => Buffer.from(KvPutResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvPutResponse => KvPutResponse.decode(value), + }, + /** + * CAS create — succeeds only when the key has never been + * written or its current value is a tombstone. + */ + create: { + path: "/waymaker.kv.WaymakerKvService/Create" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvCreateRequest): Buffer => Buffer.from(KvCreateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvCreateRequest => KvCreateRequest.decode(value), + responseSerialize: (value: KvPutResponse): Buffer => Buffer.from(KvPutResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvPutResponse => KvPutResponse.decode(value), + }, + /** + * CAS update — succeeds only when `expected_revision` + * matches the server-side revision. + */ + update: { + path: "/waymaker.kv.WaymakerKvService/Update" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvUpdateRequest): Buffer => Buffer.from(KvUpdateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvUpdateRequest => KvUpdateRequest.decode(value), + responseSerialize: (value: KvPutResponse): Buffer => Buffer.from(KvPutResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvPutResponse => KvPutResponse.decode(value), + }, + delete: { + path: "/waymaker.kv.WaymakerKvService/Delete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvDeleteRequest): Buffer => Buffer.from(KvDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvDeleteRequest => KvDeleteRequest.decode(value), + responseSerialize: (value: KvDeleteResponse): Buffer => Buffer.from(KvDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvDeleteResponse => KvDeleteResponse.decode(value), + }, + /** ----- Reads ------------------------------------------------ */ + get: { + path: "/waymaker.kv.WaymakerKvService/Get" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvGetRequest): Buffer => Buffer.from(KvGetRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvGetRequest => KvGetRequest.decode(value), + responseSerialize: (value: KvGetResponse): Buffer => Buffer.from(KvGetResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvGetResponse => KvGetResponse.decode(value), + }, + keys: { + path: "/waymaker.kv.WaymakerKvService/Keys" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvKeysRequest): Buffer => Buffer.from(KvKeysRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvKeysRequest => KvKeysRequest.decode(value), + responseSerialize: (value: KvKeysResponse): Buffer => Buffer.from(KvKeysResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvKeysResponse => KvKeysResponse.decode(value), + }, + history: { + path: "/waymaker.kv.WaymakerKvService/History" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvHistoryRequest): Buffer => Buffer.from(KvHistoryRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvHistoryRequest => KvHistoryRequest.decode(value), + responseSerialize: (value: KvHistoryResponse): Buffer => Buffer.from(KvHistoryResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvHistoryResponse => KvHistoryResponse.decode(value), + }, + /** ----- TTL refresh ------------------------------------------ */ + touch: { + path: "/waymaker.kv.WaymakerKvService/Touch" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: KvTouchRequest): Buffer => Buffer.from(KvTouchRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvTouchRequest => KvTouchRequest.decode(value), + responseSerialize: (value: KvPutResponse): Buffer => Buffer.from(KvPutResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): KvPutResponse => KvPutResponse.decode(value), + }, + /** + * ----- Watch ------------------------------------------------ + * Server-streamed event flow for a single bucket. When `key` + * is empty, every put/delete in the bucket fans out; when + * `key` is set, only events at that key are emitted. + */ + watch: { + path: "/waymaker.kv.WaymakerKvService/Watch" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: KvWatchRequest): Buffer => Buffer.from(KvWatchRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): KvWatchRequest => KvWatchRequest.decode(value), + responseSerialize: (value: KvWatchEvent): Buffer => Buffer.from(KvWatchEvent.encode(value).finish()), + responseDeserialize: (value: Buffer): KvWatchEvent => KvWatchEvent.decode(value), + }, +} as const; + +export interface WaymakerKvServiceServer extends UntypedServiceImplementation { + /** ----- Bucket lifecycle ------------------------------------- */ + createBucket: handleUnaryCall; + deleteBucket: handleUnaryCall; + /** ----- Mutations -------------------------------------------- */ + put: handleUnaryCall; + /** + * CAS create — succeeds only when the key has never been + * written or its current value is a tombstone. + */ + create: handleUnaryCall; + /** + * CAS update — succeeds only when `expected_revision` + * matches the server-side revision. + */ + update: handleUnaryCall; + delete: handleUnaryCall; + /** ----- Reads ------------------------------------------------ */ + get: handleUnaryCall; + keys: handleUnaryCall; + history: handleUnaryCall; + /** ----- TTL refresh ------------------------------------------ */ + touch: handleUnaryCall; + /** + * ----- Watch ------------------------------------------------ + * Server-streamed event flow for a single bucket. When `key` + * is empty, every put/delete in the bucket fans out; when + * `key` is set, only events at that key are emitted. + */ + watch: handleServerStreamingCall; +} + +export interface WaymakerKvServiceClient extends Client { + /** ----- Bucket lifecycle ------------------------------------- */ + createBucket( + request: KvCreateBucketRequest, + callback: (error: ServiceError | null, response: KvCreateBucketResponse) => void, + ): ClientUnaryCall; + createBucket( + request: KvCreateBucketRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvCreateBucketResponse) => void, + ): ClientUnaryCall; + createBucket( + request: KvCreateBucketRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvCreateBucketResponse) => void, + ): ClientUnaryCall; + deleteBucket( + request: KvDeleteBucketRequest, + callback: (error: ServiceError | null, response: KvDeleteBucketResponse) => void, + ): ClientUnaryCall; + deleteBucket( + request: KvDeleteBucketRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvDeleteBucketResponse) => void, + ): ClientUnaryCall; + deleteBucket( + request: KvDeleteBucketRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvDeleteBucketResponse) => void, + ): ClientUnaryCall; + /** ----- Mutations -------------------------------------------- */ + put(request: KvPutRequest, callback: (error: ServiceError | null, response: KvPutResponse) => void): ClientUnaryCall; + put( + request: KvPutRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + put( + request: KvPutRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + /** + * CAS create — succeeds only when the key has never been + * written or its current value is a tombstone. + */ + create( + request: KvCreateRequest, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + create( + request: KvCreateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + create( + request: KvCreateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + /** + * CAS update — succeeds only when `expected_revision` + * matches the server-side revision. + */ + update( + request: KvUpdateRequest, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + update( + request: KvUpdateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + update( + request: KvUpdateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + delete( + request: KvDeleteRequest, + callback: (error: ServiceError | null, response: KvDeleteResponse) => void, + ): ClientUnaryCall; + delete( + request: KvDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvDeleteResponse) => void, + ): ClientUnaryCall; + delete( + request: KvDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvDeleteResponse) => void, + ): ClientUnaryCall; + /** ----- Reads ------------------------------------------------ */ + get(request: KvGetRequest, callback: (error: ServiceError | null, response: KvGetResponse) => void): ClientUnaryCall; + get( + request: KvGetRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvGetResponse) => void, + ): ClientUnaryCall; + get( + request: KvGetRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvGetResponse) => void, + ): ClientUnaryCall; + keys( + request: KvKeysRequest, + callback: (error: ServiceError | null, response: KvKeysResponse) => void, + ): ClientUnaryCall; + keys( + request: KvKeysRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvKeysResponse) => void, + ): ClientUnaryCall; + keys( + request: KvKeysRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvKeysResponse) => void, + ): ClientUnaryCall; + history( + request: KvHistoryRequest, + callback: (error: ServiceError | null, response: KvHistoryResponse) => void, + ): ClientUnaryCall; + history( + request: KvHistoryRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvHistoryResponse) => void, + ): ClientUnaryCall; + history( + request: KvHistoryRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvHistoryResponse) => void, + ): ClientUnaryCall; + /** ----- TTL refresh ------------------------------------------ */ + touch( + request: KvTouchRequest, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + touch( + request: KvTouchRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + touch( + request: KvTouchRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: KvPutResponse) => void, + ): ClientUnaryCall; + /** + * ----- Watch ------------------------------------------------ + * Server-streamed event flow for a single bucket. When `key` + * is empty, every put/delete in the bucket fans out; when + * `key` is set, only events at that key are emitted. + */ + watch(request: KvWatchRequest, options?: Partial): ClientReadableStream; + watch( + request: KvWatchRequest, + metadata?: Metadata, + options?: Partial, + ): ClientReadableStream; +} + +export const WaymakerKvServiceClient = makeGenericClientConstructor( + WaymakerKvServiceService, + "waymaker.kv.WaymakerKvService", +) as unknown as { + new (address: string, credentials: ChannelCredentials, options?: Partial): WaymakerKvServiceClient; + service: typeof WaymakerKvServiceService; + serviceName: string; +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/sketches.ts b/ts/src/genpb/sketches.ts new file mode 100644 index 0000000..9eb8dae --- /dev/null +++ b/ts/src/genpb/sketches.ts @@ -0,0 +1,6336 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: sketches.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientUnaryCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker.sketches"; + +export enum ProbType { + PROB_UNSPECIFIED = 0, + PROB_BLOOM = 1, + PROB_HLL = 2, + PROB_CMS = 3, + PROB_TOPK = 4, + PROB_TDIGEST = 5, +} + +export function probTypeFromJSON(object: any): ProbType { + switch (object) { + case 0: + case "PROB_UNSPECIFIED": + return ProbType.PROB_UNSPECIFIED; + case 1: + case "PROB_BLOOM": + return ProbType.PROB_BLOOM; + case 2: + case "PROB_HLL": + return ProbType.PROB_HLL; + case 3: + case "PROB_CMS": + return ProbType.PROB_CMS; + case 4: + case "PROB_TOPK": + return ProbType.PROB_TOPK; + case 5: + case "PROB_TDIGEST": + return ProbType.PROB_TDIGEST; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ProbType"); + } +} + +export function probTypeToJSON(object: ProbType): string { + switch (object) { + case ProbType.PROB_UNSPECIFIED: + return "PROB_UNSPECIFIED"; + case ProbType.PROB_BLOOM: + return "PROB_BLOOM"; + case ProbType.PROB_HLL: + return "PROB_HLL"; + case ProbType.PROB_CMS: + return "PROB_CMS"; + case ProbType.PROB_TOPK: + return "PROB_TOPK"; + case ProbType.PROB_TDIGEST: + return "PROB_TDIGEST"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum ProbType"); + } +} + +export interface BloomReserveRequest { + name: string; + capacity: number; + errorRate: number; +} + +export interface BloomReserveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface BloomAddRequest { + name: string; + item: Buffer; +} + +export interface BloomAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface BloomMultiAddRequest { + name: string; + items: Buffer[]; +} + +export interface BloomMultiAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface BloomExistsRequest { + name: string; + item: Buffer; +} + +export interface BloomExistsResponse { + success: boolean; + resultCode: string; + message: string; + exists: boolean; +} + +export interface BloomMultiExistsRequest { + name: string; + items: Buffer[]; +} + +export interface BloomMultiExistsResponse { + success: boolean; + resultCode: string; + message: string; + exists: boolean[]; +} + +export interface BloomInfoRequest { + name: string; +} + +export interface BloomInfoResponse { + success: boolean; + resultCode: string; + message: string; + capacity: number; + errorRate: number; + bitsSet: number; + bitCount: number; + hashCount: number; + itemsAdded: number; +} + +export interface BloomDeleteRequest { + name: string; +} + +export interface BloomDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HllReserveRequest { + name: string; + precision: number; +} + +export interface HllReserveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HllAddRequest { + name: string; + items: Buffer[]; +} + +export interface HllAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HllCountRequest { + name: string; +} + +export interface HllCountResponse { + success: boolean; + resultCode: string; + message: string; + estimate: number; +} + +export interface HllMergeRequest { + destination: string; + sources: string[]; +} + +export interface HllMergeResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HllDeleteRequest { + name: string; +} + +export interface HllDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface CmsReserveRequest { + name: string; + width: number; + depth: number; +} + +export interface CmsReserveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface CmsIncrByItem { + item: Buffer; + count: number; +} + +export interface CmsIncrByRequest { + name: string; + items: CmsIncrByItem[]; +} + +export interface CmsIncrByResponse { + success: boolean; + resultCode: string; + message: string; + counts: number[]; +} + +export interface CmsQueryRequest { + name: string; + items: Buffer[]; +} + +export interface CmsQueryResponse { + success: boolean; + resultCode: string; + message: string; + counts: number[]; +} + +export interface CmsDeleteRequest { + name: string; +} + +export interface CmsDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TopKReserveRequest { + name: string; + k: number; + width: number; + depth: number; + decay: number; +} + +export interface TopKReserveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TopKAddRequest { + name: string; + items: Buffer[]; +} + +export interface TopKAddResponse { + success: boolean; + resultCode: string; + message: string; + evicted: Buffer[]; +} + +export interface TopKQueryRequest { + name: string; + items: Buffer[]; +} + +export interface TopKQueryResponse { + success: boolean; + resultCode: string; + message: string; + inTopK: boolean[]; +} + +export interface TopKListRequest { + name: string; +} + +export interface TopKListResponse { + success: boolean; + resultCode: string; + message: string; + entries: TopKEntry[]; +} + +export interface TopKEntry { + item: Buffer; + count: number; +} + +export interface TopKDeleteRequest { + name: string; +} + +export interface TopKDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TDigestCreateRequest { + name: string; + compression: number; +} + +export interface TDigestCreateResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TDigestAddRequest { + name: string; + values: number[]; +} + +export interface TDigestAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TDigestQuantileRequest { + name: string; + quantiles: number[]; +} + +export interface TDigestQuantileResponse { + success: boolean; + resultCode: string; + message: string; + values: number[]; +} + +export interface TDigestMinMaxRequest { + name: string; +} + +export interface TDigestMinMaxResponse { + success: boolean; + resultCode: string; + message: string; + min: number; + max: number; +} + +export interface TDigestDeleteRequest { + name: string; +} + +export interface TDigestDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface ReplicateProbStateRequest { + type: ProbType; + name: string; + /** + * Opaque binary snapshot — see specs/WIRE_SPEC.md "Probabilistic + * subsystem" for the per-type byte layout. + */ + snapshot: Buffer; + version: number; +} + +export interface ReplicateProbStateResponse { + success: boolean; + resultCode: string; + message: string; +} + +function createBaseBloomReserveRequest(): BloomReserveRequest { + return { name: "", capacity: 0, errorRate: 0 }; +} + +export const BloomReserveRequest: MessageFns = { + encode(message: BloomReserveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.capacity !== 0) { + writer.uint32(16).uint64(message.capacity); + } + if (message.errorRate !== 0) { + writer.uint32(25).double(message.errorRate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomReserveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomReserveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.capacity = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 25) { + break; + } + + message.errorRate = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomReserveRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + capacity: isSet(object.capacity) ? globalThis.Number(object.capacity) : 0, + errorRate: isSet(object.errorRate) + ? globalThis.Number(object.errorRate) + : isSet(object.error_rate) + ? globalThis.Number(object.error_rate) + : 0, + }; + }, + + toJSON(message: BloomReserveRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.capacity !== 0) { + obj.capacity = Math.round(message.capacity); + } + if (message.errorRate !== 0) { + obj.errorRate = message.errorRate; + } + return obj; + }, + + create(base?: DeepPartial): BloomReserveRequest { + return BloomReserveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomReserveRequest { + const message = createBaseBloomReserveRequest(); + message.name = object.name ?? ""; + message.capacity = object.capacity ?? 0; + message.errorRate = object.errorRate ?? 0; + return message; + }, +}; + +function createBaseBloomReserveResponse(): BloomReserveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const BloomReserveResponse: MessageFns = { + encode(message: BloomReserveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomReserveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomReserveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomReserveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: BloomReserveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): BloomReserveResponse { + return BloomReserveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomReserveResponse { + const message = createBaseBloomReserveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseBloomAddRequest(): BloomAddRequest { + return { name: "", item: Buffer.alloc(0) }; +} + +export const BloomAddRequest: MessageFns = { + encode(message: BloomAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.item.length !== 0) { + writer.uint32(18).bytes(message.item); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.item = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomAddRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + item: isSet(object.item) ? Buffer.from(bytesFromBase64(object.item)) : Buffer.alloc(0), + }; + }, + + toJSON(message: BloomAddRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.item.length !== 0) { + obj.item = base64FromBytes(message.item); + } + return obj; + }, + + create(base?: DeepPartial): BloomAddRequest { + return BloomAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomAddRequest { + const message = createBaseBloomAddRequest(); + message.name = object.name ?? ""; + message.item = object.item ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseBloomAddResponse(): BloomAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const BloomAddResponse: MessageFns = { + encode(message: BloomAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: BloomAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): BloomAddResponse { + return BloomAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomAddResponse { + const message = createBaseBloomAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseBloomMultiAddRequest(): BloomMultiAddRequest { + return { name: "", items: [] }; +} + +export const BloomMultiAddRequest: MessageFns = { + encode(message: BloomMultiAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomMultiAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomMultiAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomMultiAddRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: BloomMultiAddRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): BloomMultiAddRequest { + return BloomMultiAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomMultiAddRequest { + const message = createBaseBloomMultiAddRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseBloomMultiAddResponse(): BloomMultiAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const BloomMultiAddResponse: MessageFns = { + encode(message: BloomMultiAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomMultiAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomMultiAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomMultiAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: BloomMultiAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): BloomMultiAddResponse { + return BloomMultiAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomMultiAddResponse { + const message = createBaseBloomMultiAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseBloomExistsRequest(): BloomExistsRequest { + return { name: "", item: Buffer.alloc(0) }; +} + +export const BloomExistsRequest: MessageFns = { + encode(message: BloomExistsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.item.length !== 0) { + writer.uint32(18).bytes(message.item); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomExistsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomExistsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.item = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomExistsRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + item: isSet(object.item) ? Buffer.from(bytesFromBase64(object.item)) : Buffer.alloc(0), + }; + }, + + toJSON(message: BloomExistsRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.item.length !== 0) { + obj.item = base64FromBytes(message.item); + } + return obj; + }, + + create(base?: DeepPartial): BloomExistsRequest { + return BloomExistsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomExistsRequest { + const message = createBaseBloomExistsRequest(); + message.name = object.name ?? ""; + message.item = object.item ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseBloomExistsResponse(): BloomExistsResponse { + return { success: false, resultCode: "", message: "", exists: false }; +} + +export const BloomExistsResponse: MessageFns = { + encode(message: BloomExistsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.exists !== false) { + writer.uint32(32).bool(message.exists); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomExistsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomExistsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomExistsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, + }; + }, + + toJSON(message: BloomExistsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + + create(base?: DeepPartial): BloomExistsResponse { + return BloomExistsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomExistsResponse { + const message = createBaseBloomExistsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.exists = object.exists ?? false; + return message; + }, +}; + +function createBaseBloomMultiExistsRequest(): BloomMultiExistsRequest { + return { name: "", items: [] }; +} + +export const BloomMultiExistsRequest: MessageFns = { + encode(message: BloomMultiExistsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomMultiExistsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomMultiExistsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomMultiExistsRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: BloomMultiExistsRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): BloomMultiExistsRequest { + return BloomMultiExistsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomMultiExistsRequest { + const message = createBaseBloomMultiExistsRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseBloomMultiExistsResponse(): BloomMultiExistsResponse { + return { success: false, resultCode: "", message: "", exists: [] }; +} + +export const BloomMultiExistsResponse: MessageFns = { + encode(message: BloomMultiExistsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + writer.uint32(34).fork(); + for (const v of message.exists) { + writer.bool(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomMultiExistsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomMultiExistsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag === 32) { + message.exists.push(reader.bool()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.exists.push(reader.bool()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomMultiExistsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + exists: globalThis.Array.isArray(object?.exists) ? object.exists.map((e: any) => globalThis.Boolean(e)) : [], + }; + }, + + toJSON(message: BloomMultiExistsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.exists?.length) { + obj.exists = message.exists; + } + return obj; + }, + + create(base?: DeepPartial): BloomMultiExistsResponse { + return BloomMultiExistsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomMultiExistsResponse { + const message = createBaseBloomMultiExistsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.exists = object.exists?.map((e) => e) || []; + return message; + }, +}; + +function createBaseBloomInfoRequest(): BloomInfoRequest { + return { name: "" }; +} + +export const BloomInfoRequest: MessageFns = { + encode(message: BloomInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomInfoRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: BloomInfoRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): BloomInfoRequest { + return BloomInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomInfoRequest { + const message = createBaseBloomInfoRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseBloomInfoResponse(): BloomInfoResponse { + return { + success: false, + resultCode: "", + message: "", + capacity: 0, + errorRate: 0, + bitsSet: 0, + bitCount: 0, + hashCount: 0, + itemsAdded: 0, + }; +} + +export const BloomInfoResponse: MessageFns = { + encode(message: BloomInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.capacity !== 0) { + writer.uint32(32).uint64(message.capacity); + } + if (message.errorRate !== 0) { + writer.uint32(41).double(message.errorRate); + } + if (message.bitsSet !== 0) { + writer.uint32(48).uint64(message.bitsSet); + } + if (message.bitCount !== 0) { + writer.uint32(56).uint64(message.bitCount); + } + if (message.hashCount !== 0) { + writer.uint32(64).uint32(message.hashCount); + } + if (message.itemsAdded !== 0) { + writer.uint32(72).uint64(message.itemsAdded); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.capacity = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.errorRate = reader.double(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.bitsSet = longToNumber(reader.uint64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.bitCount = longToNumber(reader.uint64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.hashCount = reader.uint32(); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.itemsAdded = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomInfoResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + capacity: isSet(object.capacity) ? globalThis.Number(object.capacity) : 0, + errorRate: isSet(object.errorRate) + ? globalThis.Number(object.errorRate) + : isSet(object.error_rate) + ? globalThis.Number(object.error_rate) + : 0, + bitsSet: isSet(object.bitsSet) + ? globalThis.Number(object.bitsSet) + : isSet(object.bits_set) + ? globalThis.Number(object.bits_set) + : 0, + bitCount: isSet(object.bitCount) + ? globalThis.Number(object.bitCount) + : isSet(object.bit_count) + ? globalThis.Number(object.bit_count) + : 0, + hashCount: isSet(object.hashCount) + ? globalThis.Number(object.hashCount) + : isSet(object.hash_count) + ? globalThis.Number(object.hash_count) + : 0, + itemsAdded: isSet(object.itemsAdded) + ? globalThis.Number(object.itemsAdded) + : isSet(object.items_added) + ? globalThis.Number(object.items_added) + : 0, + }; + }, + + toJSON(message: BloomInfoResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.capacity !== 0) { + obj.capacity = Math.round(message.capacity); + } + if (message.errorRate !== 0) { + obj.errorRate = message.errorRate; + } + if (message.bitsSet !== 0) { + obj.bitsSet = Math.round(message.bitsSet); + } + if (message.bitCount !== 0) { + obj.bitCount = Math.round(message.bitCount); + } + if (message.hashCount !== 0) { + obj.hashCount = Math.round(message.hashCount); + } + if (message.itemsAdded !== 0) { + obj.itemsAdded = Math.round(message.itemsAdded); + } + return obj; + }, + + create(base?: DeepPartial): BloomInfoResponse { + return BloomInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomInfoResponse { + const message = createBaseBloomInfoResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.capacity = object.capacity ?? 0; + message.errorRate = object.errorRate ?? 0; + message.bitsSet = object.bitsSet ?? 0; + message.bitCount = object.bitCount ?? 0; + message.hashCount = object.hashCount ?? 0; + message.itemsAdded = object.itemsAdded ?? 0; + return message; + }, +}; + +function createBaseBloomDeleteRequest(): BloomDeleteRequest { + return { name: "" }; +} + +export const BloomDeleteRequest: MessageFns = { + encode(message: BloomDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: BloomDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): BloomDeleteRequest { + return BloomDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomDeleteRequest { + const message = createBaseBloomDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseBloomDeleteResponse(): BloomDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const BloomDeleteResponse: MessageFns = { + encode(message: BloomDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BloomDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBloomDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BloomDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: BloomDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): BloomDeleteResponse { + return BloomDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): BloomDeleteResponse { + const message = createBaseBloomDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHllReserveRequest(): HllReserveRequest { + return { name: "", precision: 0 }; +} + +export const HllReserveRequest: MessageFns = { + encode(message: HllReserveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.precision !== 0) { + writer.uint32(16).uint32(message.precision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllReserveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllReserveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.precision = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllReserveRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + precision: isSet(object.precision) ? globalThis.Number(object.precision) : 0, + }; + }, + + toJSON(message: HllReserveRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.precision !== 0) { + obj.precision = Math.round(message.precision); + } + return obj; + }, + + create(base?: DeepPartial): HllReserveRequest { + return HllReserveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllReserveRequest { + const message = createBaseHllReserveRequest(); + message.name = object.name ?? ""; + message.precision = object.precision ?? 0; + return message; + }, +}; + +function createBaseHllReserveResponse(): HllReserveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HllReserveResponse: MessageFns = { + encode(message: HllReserveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllReserveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllReserveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllReserveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HllReserveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HllReserveResponse { + return HllReserveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllReserveResponse { + const message = createBaseHllReserveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHllAddRequest(): HllAddRequest { + return { name: "", items: [] }; +} + +export const HllAddRequest: MessageFns = { + encode(message: HllAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllAddRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: HllAddRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): HllAddRequest { + return HllAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllAddRequest { + const message = createBaseHllAddRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseHllAddResponse(): HllAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HllAddResponse: MessageFns = { + encode(message: HllAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HllAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HllAddResponse { + return HllAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllAddResponse { + const message = createBaseHllAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHllCountRequest(): HllCountRequest { + return { name: "" }; +} + +export const HllCountRequest: MessageFns = { + encode(message: HllCountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllCountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllCountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllCountRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: HllCountRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): HllCountRequest { + return HllCountRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllCountRequest { + const message = createBaseHllCountRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseHllCountResponse(): HllCountResponse { + return { success: false, resultCode: "", message: "", estimate: 0 }; +} + +export const HllCountResponse: MessageFns = { + encode(message: HllCountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.estimate !== 0) { + writer.uint32(32).uint64(message.estimate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllCountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllCountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.estimate = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllCountResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + estimate: isSet(object.estimate) ? globalThis.Number(object.estimate) : 0, + }; + }, + + toJSON(message: HllCountResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.estimate !== 0) { + obj.estimate = Math.round(message.estimate); + } + return obj; + }, + + create(base?: DeepPartial): HllCountResponse { + return HllCountResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllCountResponse { + const message = createBaseHllCountResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.estimate = object.estimate ?? 0; + return message; + }, +}; + +function createBaseHllMergeRequest(): HllMergeRequest { + return { destination: "", sources: [] }; +} + +export const HllMergeRequest: MessageFns = { + encode(message: HllMergeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.destination !== "") { + writer.uint32(10).string(message.destination); + } + for (const v of message.sources) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllMergeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllMergeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.destination = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sources.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllMergeRequest { + return { + destination: isSet(object.destination) ? globalThis.String(object.destination) : "", + sources: globalThis.Array.isArray(object?.sources) ? object.sources.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: HllMergeRequest): unknown { + const obj: any = {}; + if (message.destination !== "") { + obj.destination = message.destination; + } + if (message.sources?.length) { + obj.sources = message.sources; + } + return obj; + }, + + create(base?: DeepPartial): HllMergeRequest { + return HllMergeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllMergeRequest { + const message = createBaseHllMergeRequest(); + message.destination = object.destination ?? ""; + message.sources = object.sources?.map((e) => e) || []; + return message; + }, +}; + +function createBaseHllMergeResponse(): HllMergeResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HllMergeResponse: MessageFns = { + encode(message: HllMergeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllMergeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllMergeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllMergeResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HllMergeResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HllMergeResponse { + return HllMergeResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllMergeResponse { + const message = createBaseHllMergeResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHllDeleteRequest(): HllDeleteRequest { + return { name: "" }; +} + +export const HllDeleteRequest: MessageFns = { + encode(message: HllDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: HllDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): HllDeleteRequest { + return HllDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllDeleteRequest { + const message = createBaseHllDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseHllDeleteResponse(): HllDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HllDeleteResponse: MessageFns = { + encode(message: HllDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HllDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHllDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HllDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HllDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HllDeleteResponse { + return HllDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HllDeleteResponse { + const message = createBaseHllDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseCmsReserveRequest(): CmsReserveRequest { + return { name: "", width: 0, depth: 0 }; +} + +export const CmsReserveRequest: MessageFns = { + encode(message: CmsReserveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.width !== 0) { + writer.uint32(16).uint64(message.width); + } + if (message.depth !== 0) { + writer.uint32(24).uint64(message.depth); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsReserveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsReserveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.width = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.depth = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsReserveRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + width: isSet(object.width) ? globalThis.Number(object.width) : 0, + depth: isSet(object.depth) ? globalThis.Number(object.depth) : 0, + }; + }, + + toJSON(message: CmsReserveRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.width !== 0) { + obj.width = Math.round(message.width); + } + if (message.depth !== 0) { + obj.depth = Math.round(message.depth); + } + return obj; + }, + + create(base?: DeepPartial): CmsReserveRequest { + return CmsReserveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsReserveRequest { + const message = createBaseCmsReserveRequest(); + message.name = object.name ?? ""; + message.width = object.width ?? 0; + message.depth = object.depth ?? 0; + return message; + }, +}; + +function createBaseCmsReserveResponse(): CmsReserveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CmsReserveResponse: MessageFns = { + encode(message: CmsReserveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsReserveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsReserveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsReserveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CmsReserveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CmsReserveResponse { + return CmsReserveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsReserveResponse { + const message = createBaseCmsReserveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseCmsIncrByItem(): CmsIncrByItem { + return { item: Buffer.alloc(0), count: 0 }; +} + +export const CmsIncrByItem: MessageFns = { + encode(message: CmsIncrByItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.item.length !== 0) { + writer.uint32(10).bytes(message.item); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsIncrByItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsIncrByItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.item = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsIncrByItem { + return { + item: isSet(object.item) ? Buffer.from(bytesFromBase64(object.item)) : Buffer.alloc(0), + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: CmsIncrByItem): unknown { + const obj: any = {}; + if (message.item.length !== 0) { + obj.item = base64FromBytes(message.item); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): CmsIncrByItem { + return CmsIncrByItem.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsIncrByItem { + const message = createBaseCmsIncrByItem(); + message.item = object.item ?? Buffer.alloc(0); + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseCmsIncrByRequest(): CmsIncrByRequest { + return { name: "", items: [] }; +} + +export const CmsIncrByRequest: MessageFns = { + encode(message: CmsIncrByRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + CmsIncrByItem.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsIncrByRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsIncrByRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(CmsIncrByItem.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsIncrByRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) ? object.items.map((e: any) => CmsIncrByItem.fromJSON(e)) : [], + }; + }, + + toJSON(message: CmsIncrByRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => CmsIncrByItem.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): CmsIncrByRequest { + return CmsIncrByRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsIncrByRequest { + const message = createBaseCmsIncrByRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => CmsIncrByItem.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCmsIncrByResponse(): CmsIncrByResponse { + return { success: false, resultCode: "", message: "", counts: [] }; +} + +export const CmsIncrByResponse: MessageFns = { + encode(message: CmsIncrByResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + writer.uint32(34).fork(); + for (const v of message.counts) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsIncrByResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsIncrByResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag === 32) { + message.counts.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.counts.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsIncrByResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + counts: globalThis.Array.isArray(object?.counts) ? object.counts.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: CmsIncrByResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.counts?.length) { + obj.counts = message.counts.map((e) => Math.round(e)); + } + return obj; + }, + + create(base?: DeepPartial): CmsIncrByResponse { + return CmsIncrByResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsIncrByResponse { + const message = createBaseCmsIncrByResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.counts = object.counts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCmsQueryRequest(): CmsQueryRequest { + return { name: "", items: [] }; +} + +export const CmsQueryRequest: MessageFns = { + encode(message: CmsQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsQueryRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: CmsQueryRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): CmsQueryRequest { + return CmsQueryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsQueryRequest { + const message = createBaseCmsQueryRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCmsQueryResponse(): CmsQueryResponse { + return { success: false, resultCode: "", message: "", counts: [] }; +} + +export const CmsQueryResponse: MessageFns = { + encode(message: CmsQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + writer.uint32(34).fork(); + for (const v of message.counts) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag === 32) { + message.counts.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.counts.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsQueryResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + counts: globalThis.Array.isArray(object?.counts) ? object.counts.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: CmsQueryResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.counts?.length) { + obj.counts = message.counts.map((e) => Math.round(e)); + } + return obj; + }, + + create(base?: DeepPartial): CmsQueryResponse { + return CmsQueryResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsQueryResponse { + const message = createBaseCmsQueryResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.counts = object.counts?.map((e) => e) || []; + return message; + }, +}; + +function createBaseCmsDeleteRequest(): CmsDeleteRequest { + return { name: "" }; +} + +export const CmsDeleteRequest: MessageFns = { + encode(message: CmsDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: CmsDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): CmsDeleteRequest { + return CmsDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsDeleteRequest { + const message = createBaseCmsDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseCmsDeleteResponse(): CmsDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CmsDeleteResponse: MessageFns = { + encode(message: CmsDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CmsDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCmsDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CmsDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CmsDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CmsDeleteResponse { + return CmsDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CmsDeleteResponse { + const message = createBaseCmsDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTopKReserveRequest(): TopKReserveRequest { + return { name: "", k: 0, width: 0, depth: 0, decay: 0 }; +} + +export const TopKReserveRequest: MessageFns = { + encode(message: TopKReserveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.k !== 0) { + writer.uint32(16).uint32(message.k); + } + if (message.width !== 0) { + writer.uint32(24).uint64(message.width); + } + if (message.depth !== 0) { + writer.uint32(32).uint64(message.depth); + } + if (message.decay !== 0) { + writer.uint32(41).double(message.decay); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKReserveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKReserveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.k = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.width = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.depth = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.decay = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKReserveRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + k: isSet(object.k) ? globalThis.Number(object.k) : 0, + width: isSet(object.width) ? globalThis.Number(object.width) : 0, + depth: isSet(object.depth) ? globalThis.Number(object.depth) : 0, + decay: isSet(object.decay) ? globalThis.Number(object.decay) : 0, + }; + }, + + toJSON(message: TopKReserveRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.k !== 0) { + obj.k = Math.round(message.k); + } + if (message.width !== 0) { + obj.width = Math.round(message.width); + } + if (message.depth !== 0) { + obj.depth = Math.round(message.depth); + } + if (message.decay !== 0) { + obj.decay = message.decay; + } + return obj; + }, + + create(base?: DeepPartial): TopKReserveRequest { + return TopKReserveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKReserveRequest { + const message = createBaseTopKReserveRequest(); + message.name = object.name ?? ""; + message.k = object.k ?? 0; + message.width = object.width ?? 0; + message.depth = object.depth ?? 0; + message.decay = object.decay ?? 0; + return message; + }, +}; + +function createBaseTopKReserveResponse(): TopKReserveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TopKReserveResponse: MessageFns = { + encode(message: TopKReserveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKReserveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKReserveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKReserveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TopKReserveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TopKReserveResponse { + return TopKReserveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKReserveResponse { + const message = createBaseTopKReserveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTopKAddRequest(): TopKAddRequest { + return { name: "", items: [] }; +} + +export const TopKAddRequest: MessageFns = { + encode(message: TopKAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKAddRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: TopKAddRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): TopKAddRequest { + return TopKAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKAddRequest { + const message = createBaseTopKAddRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTopKAddResponse(): TopKAddResponse { + return { success: false, resultCode: "", message: "", evicted: [] }; +} + +export const TopKAddResponse: MessageFns = { + encode(message: TopKAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.evicted) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.evicted.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + evicted: globalThis.Array.isArray(object?.evicted) + ? object.evicted.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: TopKAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.evicted?.length) { + obj.evicted = message.evicted.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): TopKAddResponse { + return TopKAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKAddResponse { + const message = createBaseTopKAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.evicted = object.evicted?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTopKQueryRequest(): TopKQueryRequest { + return { name: "", items: [] }; +} + +export const TopKQueryRequest: MessageFns = { + encode(message: TopKQueryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.items) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.items.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKQueryRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + items: globalThis.Array.isArray(object?.items) + ? object.items.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: TopKQueryRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.items?.length) { + obj.items = message.items.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): TopKQueryRequest { + return TopKQueryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKQueryRequest { + const message = createBaseTopKQueryRequest(); + message.name = object.name ?? ""; + message.items = object.items?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTopKQueryResponse(): TopKQueryResponse { + return { success: false, resultCode: "", message: "", inTopK: [] }; +} + +export const TopKQueryResponse: MessageFns = { + encode(message: TopKQueryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + writer.uint32(34).fork(); + for (const v of message.inTopK) { + writer.bool(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag === 32) { + message.inTopK.push(reader.bool()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.inTopK.push(reader.bool()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKQueryResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + inTopK: globalThis.Array.isArray(object?.inTopK) + ? object.inTopK.map((e: any) => globalThis.Boolean(e)) + : globalThis.Array.isArray(object?.in_top_k) + ? object.in_top_k.map((e: any) => globalThis.Boolean(e)) + : [], + }; + }, + + toJSON(message: TopKQueryResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.inTopK?.length) { + obj.inTopK = message.inTopK; + } + return obj; + }, + + create(base?: DeepPartial): TopKQueryResponse { + return TopKQueryResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKQueryResponse { + const message = createBaseTopKQueryResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.inTopK = object.inTopK?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTopKListRequest(): TopKListRequest { + return { name: "" }; +} + +export const TopKListRequest: MessageFns = { + encode(message: TopKListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKListRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: TopKListRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): TopKListRequest { + return TopKListRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKListRequest { + const message = createBaseTopKListRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseTopKListResponse(): TopKListResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const TopKListResponse: MessageFns = { + encode(message: TopKListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + TopKEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(TopKEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKListResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => TopKEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: TopKListResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => TopKEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): TopKListResponse { + return TopKListResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKListResponse { + const message = createBaseTopKListResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => TopKEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTopKEntry(): TopKEntry { + return { item: Buffer.alloc(0), count: 0 }; +} + +export const TopKEntry: MessageFns = { + encode(message: TopKEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.item.length !== 0) { + writer.uint32(10).bytes(message.item); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.item = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKEntry { + return { + item: isSet(object.item) ? Buffer.from(bytesFromBase64(object.item)) : Buffer.alloc(0), + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: TopKEntry): unknown { + const obj: any = {}; + if (message.item.length !== 0) { + obj.item = base64FromBytes(message.item); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): TopKEntry { + return TopKEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKEntry { + const message = createBaseTopKEntry(); + message.item = object.item ?? Buffer.alloc(0); + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseTopKDeleteRequest(): TopKDeleteRequest { + return { name: "" }; +} + +export const TopKDeleteRequest: MessageFns = { + encode(message: TopKDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: TopKDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): TopKDeleteRequest { + return TopKDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKDeleteRequest { + const message = createBaseTopKDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseTopKDeleteResponse(): TopKDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TopKDeleteResponse: MessageFns = { + encode(message: TopKDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TopKDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTopKDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TopKDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TopKDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TopKDeleteResponse { + return TopKDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TopKDeleteResponse { + const message = createBaseTopKDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTDigestCreateRequest(): TDigestCreateRequest { + return { name: "", compression: 0 }; +} + +export const TDigestCreateRequest: MessageFns = { + encode(message: TDigestCreateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.compression !== 0) { + writer.uint32(16).uint32(message.compression); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestCreateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.compression = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestCreateRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + compression: isSet(object.compression) ? globalThis.Number(object.compression) : 0, + }; + }, + + toJSON(message: TDigestCreateRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.compression !== 0) { + obj.compression = Math.round(message.compression); + } + return obj; + }, + + create(base?: DeepPartial): TDigestCreateRequest { + return TDigestCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestCreateRequest { + const message = createBaseTDigestCreateRequest(); + message.name = object.name ?? ""; + message.compression = object.compression ?? 0; + return message; + }, +}; + +function createBaseTDigestCreateResponse(): TDigestCreateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TDigestCreateResponse: MessageFns = { + encode(message: TDigestCreateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestCreateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestCreateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TDigestCreateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TDigestCreateResponse { + return TDigestCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestCreateResponse { + const message = createBaseTDigestCreateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTDigestAddRequest(): TDigestAddRequest { + return { name: "", values: [] }; +} + +export const TDigestAddRequest: MessageFns = { + encode(message: TDigestAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + writer.uint32(18).fork(); + for (const v of message.values) { + writer.double(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag === 17) { + message.values.push(reader.double()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.values.push(reader.double()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestAddRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: TDigestAddRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create(base?: DeepPartial): TDigestAddRequest { + return TDigestAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestAddRequest { + const message = createBaseTDigestAddRequest(); + message.name = object.name ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTDigestAddResponse(): TDigestAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TDigestAddResponse: MessageFns = { + encode(message: TDigestAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TDigestAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TDigestAddResponse { + return TDigestAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestAddResponse { + const message = createBaseTDigestAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTDigestQuantileRequest(): TDigestQuantileRequest { + return { name: "", quantiles: [] }; +} + +export const TDigestQuantileRequest: MessageFns = { + encode(message: TDigestQuantileRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + writer.uint32(18).fork(); + for (const v of message.quantiles) { + writer.double(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestQuantileRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestQuantileRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag === 17) { + message.quantiles.push(reader.double()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.quantiles.push(reader.double()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestQuantileRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + quantiles: globalThis.Array.isArray(object?.quantiles) + ? object.quantiles.map((e: any) => globalThis.Number(e)) + : [], + }; + }, + + toJSON(message: TDigestQuantileRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.quantiles?.length) { + obj.quantiles = message.quantiles; + } + return obj; + }, + + create(base?: DeepPartial): TDigestQuantileRequest { + return TDigestQuantileRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestQuantileRequest { + const message = createBaseTDigestQuantileRequest(); + message.name = object.name ?? ""; + message.quantiles = object.quantiles?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTDigestQuantileResponse(): TDigestQuantileResponse { + return { success: false, resultCode: "", message: "", values: [] }; +} + +export const TDigestQuantileResponse: MessageFns = { + encode(message: TDigestQuantileResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + writer.uint32(34).fork(); + for (const v of message.values) { + writer.double(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestQuantileResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestQuantileResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag === 33) { + message.values.push(reader.double()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.values.push(reader.double()); + } + + continue; + } + + break; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestQuantileResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + values: globalThis.Array.isArray(object?.values) ? object.values.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: TDigestQuantileResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.values?.length) { + obj.values = message.values; + } + return obj; + }, + + create(base?: DeepPartial): TDigestQuantileResponse { + return TDigestQuantileResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestQuantileResponse { + const message = createBaseTDigestQuantileResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseTDigestMinMaxRequest(): TDigestMinMaxRequest { + return { name: "" }; +} + +export const TDigestMinMaxRequest: MessageFns = { + encode(message: TDigestMinMaxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestMinMaxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestMinMaxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestMinMaxRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: TDigestMinMaxRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): TDigestMinMaxRequest { + return TDigestMinMaxRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestMinMaxRequest { + const message = createBaseTDigestMinMaxRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseTDigestMinMaxResponse(): TDigestMinMaxResponse { + return { success: false, resultCode: "", message: "", min: 0, max: 0 }; +} + +export const TDigestMinMaxResponse: MessageFns = { + encode(message: TDigestMinMaxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.min !== 0) { + writer.uint32(33).double(message.min); + } + if (message.max !== 0) { + writer.uint32(41).double(message.max); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestMinMaxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestMinMaxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 33) { + break; + } + + message.min = reader.double(); + continue; + } + case 5: { + if (tag !== 41) { + break; + } + + message.max = reader.double(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestMinMaxResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + min: isSet(object.min) ? globalThis.Number(object.min) : 0, + max: isSet(object.max) ? globalThis.Number(object.max) : 0, + }; + }, + + toJSON(message: TDigestMinMaxResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.min !== 0) { + obj.min = message.min; + } + if (message.max !== 0) { + obj.max = message.max; + } + return obj; + }, + + create(base?: DeepPartial): TDigestMinMaxResponse { + return TDigestMinMaxResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestMinMaxResponse { + const message = createBaseTDigestMinMaxResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.min = object.min ?? 0; + message.max = object.max ?? 0; + return message; + }, +}; + +function createBaseTDigestDeleteRequest(): TDigestDeleteRequest { + return { name: "" }; +} + +export const TDigestDeleteRequest: MessageFns = { + encode(message: TDigestDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: TDigestDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): TDigestDeleteRequest { + return TDigestDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestDeleteRequest { + const message = createBaseTDigestDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseTDigestDeleteResponse(): TDigestDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TDigestDeleteResponse: MessageFns = { + encode(message: TDigestDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TDigestDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTDigestDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TDigestDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TDigestDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TDigestDeleteResponse { + return TDigestDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TDigestDeleteResponse { + const message = createBaseTDigestDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseReplicateProbStateRequest(): ReplicateProbStateRequest { + return { type: 0, name: "", snapshot: Buffer.alloc(0), version: 0 }; +} + +export const ReplicateProbStateRequest: MessageFns = { + encode(message: ReplicateProbStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.snapshot.length !== 0) { + writer.uint32(26).bytes(message.snapshot); + } + if (message.version !== 0) { + writer.uint32(32).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateProbStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateProbStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.snapshot = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateProbStateRequest { + return { + type: isSet(object.type) ? probTypeFromJSON(object.type) : 0, + name: isSet(object.name) ? globalThis.String(object.name) : "", + snapshot: isSet(object.snapshot) ? Buffer.from(bytesFromBase64(object.snapshot)) : Buffer.alloc(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ReplicateProbStateRequest): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = probTypeToJSON(message.type); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.snapshot.length !== 0) { + obj.snapshot = base64FromBytes(message.snapshot); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateProbStateRequest { + return ReplicateProbStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateProbStateRequest { + const message = createBaseReplicateProbStateRequest(); + message.type = object.type ?? 0; + message.name = object.name ?? ""; + message.snapshot = object.snapshot ?? Buffer.alloc(0); + message.version = object.version ?? 0; + return message; + }, +}; + +function createBaseReplicateProbStateResponse(): ReplicateProbStateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateProbStateResponse: MessageFns = { + encode(message: ReplicateProbStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateProbStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateProbStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateProbStateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateProbStateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateProbStateResponse { + return ReplicateProbStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateProbStateResponse { + const message = createBaseReplicateProbStateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +export type WaymakerSketchesServiceService = typeof WaymakerSketchesServiceService; +export const WaymakerSketchesServiceService = { + /** ----- Bloom filter ----- */ + bloomReserve: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomReserve" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomReserveRequest): Buffer => Buffer.from(BloomReserveRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomReserveRequest => BloomReserveRequest.decode(value), + responseSerialize: (value: BloomReserveResponse): Buffer => + Buffer.from(BloomReserveResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomReserveResponse => BloomReserveResponse.decode(value), + }, + bloomAdd: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomAddRequest): Buffer => Buffer.from(BloomAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomAddRequest => BloomAddRequest.decode(value), + responseSerialize: (value: BloomAddResponse): Buffer => Buffer.from(BloomAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomAddResponse => BloomAddResponse.decode(value), + }, + bloomMultiAdd: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomMultiAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomMultiAddRequest): Buffer => Buffer.from(BloomMultiAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomMultiAddRequest => BloomMultiAddRequest.decode(value), + responseSerialize: (value: BloomMultiAddResponse): Buffer => + Buffer.from(BloomMultiAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomMultiAddResponse => BloomMultiAddResponse.decode(value), + }, + bloomExists: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomExists" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomExistsRequest): Buffer => Buffer.from(BloomExistsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomExistsRequest => BloomExistsRequest.decode(value), + responseSerialize: (value: BloomExistsResponse): Buffer => Buffer.from(BloomExistsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomExistsResponse => BloomExistsResponse.decode(value), + }, + bloomMultiExists: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomMultiExists" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomMultiExistsRequest): Buffer => + Buffer.from(BloomMultiExistsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomMultiExistsRequest => BloomMultiExistsRequest.decode(value), + responseSerialize: (value: BloomMultiExistsResponse): Buffer => + Buffer.from(BloomMultiExistsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomMultiExistsResponse => BloomMultiExistsResponse.decode(value), + }, + bloomInfo: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomInfo" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomInfoRequest): Buffer => Buffer.from(BloomInfoRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomInfoRequest => BloomInfoRequest.decode(value), + responseSerialize: (value: BloomInfoResponse): Buffer => Buffer.from(BloomInfoResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomInfoResponse => BloomInfoResponse.decode(value), + }, + bloomDelete: { + path: "/waymaker.sketches.WaymakerSketchesService/BloomDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: BloomDeleteRequest): Buffer => Buffer.from(BloomDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): BloomDeleteRequest => BloomDeleteRequest.decode(value), + responseSerialize: (value: BloomDeleteResponse): Buffer => Buffer.from(BloomDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): BloomDeleteResponse => BloomDeleteResponse.decode(value), + }, + /** ----- HyperLogLog ----- */ + hllReserve: { + path: "/waymaker.sketches.WaymakerSketchesService/HllReserve" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HllReserveRequest): Buffer => Buffer.from(HllReserveRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HllReserveRequest => HllReserveRequest.decode(value), + responseSerialize: (value: HllReserveResponse): Buffer => Buffer.from(HllReserveResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HllReserveResponse => HllReserveResponse.decode(value), + }, + hllAdd: { + path: "/waymaker.sketches.WaymakerSketchesService/HllAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HllAddRequest): Buffer => Buffer.from(HllAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HllAddRequest => HllAddRequest.decode(value), + responseSerialize: (value: HllAddResponse): Buffer => Buffer.from(HllAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HllAddResponse => HllAddResponse.decode(value), + }, + hllCount: { + path: "/waymaker.sketches.WaymakerSketchesService/HllCount" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HllCountRequest): Buffer => Buffer.from(HllCountRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HllCountRequest => HllCountRequest.decode(value), + responseSerialize: (value: HllCountResponse): Buffer => Buffer.from(HllCountResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HllCountResponse => HllCountResponse.decode(value), + }, + hllMerge: { + path: "/waymaker.sketches.WaymakerSketchesService/HllMerge" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HllMergeRequest): Buffer => Buffer.from(HllMergeRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HllMergeRequest => HllMergeRequest.decode(value), + responseSerialize: (value: HllMergeResponse): Buffer => Buffer.from(HllMergeResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HllMergeResponse => HllMergeResponse.decode(value), + }, + hllDelete: { + path: "/waymaker.sketches.WaymakerSketchesService/HllDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: HllDeleteRequest): Buffer => Buffer.from(HllDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): HllDeleteRequest => HllDeleteRequest.decode(value), + responseSerialize: (value: HllDeleteResponse): Buffer => Buffer.from(HllDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): HllDeleteResponse => HllDeleteResponse.decode(value), + }, + /** ----- Count-Min Sketch ----- */ + cmsReserve: { + path: "/waymaker.sketches.WaymakerSketchesService/CmsReserve" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CmsReserveRequest): Buffer => Buffer.from(CmsReserveRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CmsReserveRequest => CmsReserveRequest.decode(value), + responseSerialize: (value: CmsReserveResponse): Buffer => Buffer.from(CmsReserveResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CmsReserveResponse => CmsReserveResponse.decode(value), + }, + cmsIncrBy: { + path: "/waymaker.sketches.WaymakerSketchesService/CmsIncrBy" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CmsIncrByRequest): Buffer => Buffer.from(CmsIncrByRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CmsIncrByRequest => CmsIncrByRequest.decode(value), + responseSerialize: (value: CmsIncrByResponse): Buffer => Buffer.from(CmsIncrByResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CmsIncrByResponse => CmsIncrByResponse.decode(value), + }, + cmsQuery: { + path: "/waymaker.sketches.WaymakerSketchesService/CmsQuery" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CmsQueryRequest): Buffer => Buffer.from(CmsQueryRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CmsQueryRequest => CmsQueryRequest.decode(value), + responseSerialize: (value: CmsQueryResponse): Buffer => Buffer.from(CmsQueryResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CmsQueryResponse => CmsQueryResponse.decode(value), + }, + cmsDelete: { + path: "/waymaker.sketches.WaymakerSketchesService/CmsDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CmsDeleteRequest): Buffer => Buffer.from(CmsDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CmsDeleteRequest => CmsDeleteRequest.decode(value), + responseSerialize: (value: CmsDeleteResponse): Buffer => Buffer.from(CmsDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CmsDeleteResponse => CmsDeleteResponse.decode(value), + }, + /** ----- Top-K ----- */ + topKReserve: { + path: "/waymaker.sketches.WaymakerSketchesService/TopKReserve" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TopKReserveRequest): Buffer => Buffer.from(TopKReserveRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TopKReserveRequest => TopKReserveRequest.decode(value), + responseSerialize: (value: TopKReserveResponse): Buffer => Buffer.from(TopKReserveResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TopKReserveResponse => TopKReserveResponse.decode(value), + }, + topKAdd: { + path: "/waymaker.sketches.WaymakerSketchesService/TopKAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TopKAddRequest): Buffer => Buffer.from(TopKAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TopKAddRequest => TopKAddRequest.decode(value), + responseSerialize: (value: TopKAddResponse): Buffer => Buffer.from(TopKAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TopKAddResponse => TopKAddResponse.decode(value), + }, + topKQuery: { + path: "/waymaker.sketches.WaymakerSketchesService/TopKQuery" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TopKQueryRequest): Buffer => Buffer.from(TopKQueryRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TopKQueryRequest => TopKQueryRequest.decode(value), + responseSerialize: (value: TopKQueryResponse): Buffer => Buffer.from(TopKQueryResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TopKQueryResponse => TopKQueryResponse.decode(value), + }, + topKList: { + path: "/waymaker.sketches.WaymakerSketchesService/TopKList" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TopKListRequest): Buffer => Buffer.from(TopKListRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TopKListRequest => TopKListRequest.decode(value), + responseSerialize: (value: TopKListResponse): Buffer => Buffer.from(TopKListResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TopKListResponse => TopKListResponse.decode(value), + }, + topKDelete: { + path: "/waymaker.sketches.WaymakerSketchesService/TopKDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TopKDeleteRequest): Buffer => Buffer.from(TopKDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TopKDeleteRequest => TopKDeleteRequest.decode(value), + responseSerialize: (value: TopKDeleteResponse): Buffer => Buffer.from(TopKDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TopKDeleteResponse => TopKDeleteResponse.decode(value), + }, + /** ----- t-digest ----- */ + tDigestCreate: { + path: "/waymaker.sketches.WaymakerSketchesService/TDigestCreate" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TDigestCreateRequest): Buffer => Buffer.from(TDigestCreateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TDigestCreateRequest => TDigestCreateRequest.decode(value), + responseSerialize: (value: TDigestCreateResponse): Buffer => + Buffer.from(TDigestCreateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TDigestCreateResponse => TDigestCreateResponse.decode(value), + }, + tDigestAdd: { + path: "/waymaker.sketches.WaymakerSketchesService/TDigestAdd" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TDigestAddRequest): Buffer => Buffer.from(TDigestAddRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TDigestAddRequest => TDigestAddRequest.decode(value), + responseSerialize: (value: TDigestAddResponse): Buffer => Buffer.from(TDigestAddResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TDigestAddResponse => TDigestAddResponse.decode(value), + }, + tDigestQuantile: { + path: "/waymaker.sketches.WaymakerSketchesService/TDigestQuantile" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TDigestQuantileRequest): Buffer => + Buffer.from(TDigestQuantileRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TDigestQuantileRequest => TDigestQuantileRequest.decode(value), + responseSerialize: (value: TDigestQuantileResponse): Buffer => + Buffer.from(TDigestQuantileResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TDigestQuantileResponse => TDigestQuantileResponse.decode(value), + }, + tDigestMinMax: { + path: "/waymaker.sketches.WaymakerSketchesService/TDigestMinMax" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TDigestMinMaxRequest): Buffer => Buffer.from(TDigestMinMaxRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TDigestMinMaxRequest => TDigestMinMaxRequest.decode(value), + responseSerialize: (value: TDigestMinMaxResponse): Buffer => + Buffer.from(TDigestMinMaxResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TDigestMinMaxResponse => TDigestMinMaxResponse.decode(value), + }, + tDigestDelete: { + path: "/waymaker.sketches.WaymakerSketchesService/TDigestDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TDigestDeleteRequest): Buffer => Buffer.from(TDigestDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TDigestDeleteRequest => TDigestDeleteRequest.decode(value), + responseSerialize: (value: TDigestDeleteResponse): Buffer => + Buffer.from(TDigestDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TDigestDeleteResponse => TDigestDeleteResponse.decode(value), + }, + /** + * Internal: snapshot replication. Primary pushes serialized + * filter state to N-1 secondaries periodically. Version counter + * dedupes out-of-order pushes. + */ + replicateProbState: { + path: "/waymaker.sketches.WaymakerSketchesService/ReplicateProbState" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateProbStateRequest): Buffer => + Buffer.from(ReplicateProbStateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateProbStateRequest => ReplicateProbStateRequest.decode(value), + responseSerialize: (value: ReplicateProbStateResponse): Buffer => + Buffer.from(ReplicateProbStateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateProbStateResponse => ReplicateProbStateResponse.decode(value), + }, +} as const; + +export interface WaymakerSketchesServiceServer extends UntypedServiceImplementation { + /** ----- Bloom filter ----- */ + bloomReserve: handleUnaryCall; + bloomAdd: handleUnaryCall; + bloomMultiAdd: handleUnaryCall; + bloomExists: handleUnaryCall; + bloomMultiExists: handleUnaryCall; + bloomInfo: handleUnaryCall; + bloomDelete: handleUnaryCall; + /** ----- HyperLogLog ----- */ + hllReserve: handleUnaryCall; + hllAdd: handleUnaryCall; + hllCount: handleUnaryCall; + hllMerge: handleUnaryCall; + hllDelete: handleUnaryCall; + /** ----- Count-Min Sketch ----- */ + cmsReserve: handleUnaryCall; + cmsIncrBy: handleUnaryCall; + cmsQuery: handleUnaryCall; + cmsDelete: handleUnaryCall; + /** ----- Top-K ----- */ + topKReserve: handleUnaryCall; + topKAdd: handleUnaryCall; + topKQuery: handleUnaryCall; + topKList: handleUnaryCall; + topKDelete: handleUnaryCall; + /** ----- t-digest ----- */ + tDigestCreate: handleUnaryCall; + tDigestAdd: handleUnaryCall; + tDigestQuantile: handleUnaryCall; + tDigestMinMax: handleUnaryCall; + tDigestDelete: handleUnaryCall; + /** + * Internal: snapshot replication. Primary pushes serialized + * filter state to N-1 secondaries periodically. Version counter + * dedupes out-of-order pushes. + */ + replicateProbState: handleUnaryCall; +} + +export interface WaymakerSketchesServiceClient extends Client { + /** ----- Bloom filter ----- */ + bloomReserve( + request: BloomReserveRequest, + callback: (error: ServiceError | null, response: BloomReserveResponse) => void, + ): ClientUnaryCall; + bloomReserve( + request: BloomReserveRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomReserveResponse) => void, + ): ClientUnaryCall; + bloomReserve( + request: BloomReserveRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomReserveResponse) => void, + ): ClientUnaryCall; + bloomAdd( + request: BloomAddRequest, + callback: (error: ServiceError | null, response: BloomAddResponse) => void, + ): ClientUnaryCall; + bloomAdd( + request: BloomAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomAddResponse) => void, + ): ClientUnaryCall; + bloomAdd( + request: BloomAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomAddResponse) => void, + ): ClientUnaryCall; + bloomMultiAdd( + request: BloomMultiAddRequest, + callback: (error: ServiceError | null, response: BloomMultiAddResponse) => void, + ): ClientUnaryCall; + bloomMultiAdd( + request: BloomMultiAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomMultiAddResponse) => void, + ): ClientUnaryCall; + bloomMultiAdd( + request: BloomMultiAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomMultiAddResponse) => void, + ): ClientUnaryCall; + bloomExists( + request: BloomExistsRequest, + callback: (error: ServiceError | null, response: BloomExistsResponse) => void, + ): ClientUnaryCall; + bloomExists( + request: BloomExistsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomExistsResponse) => void, + ): ClientUnaryCall; + bloomExists( + request: BloomExistsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomExistsResponse) => void, + ): ClientUnaryCall; + bloomMultiExists( + request: BloomMultiExistsRequest, + callback: (error: ServiceError | null, response: BloomMultiExistsResponse) => void, + ): ClientUnaryCall; + bloomMultiExists( + request: BloomMultiExistsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomMultiExistsResponse) => void, + ): ClientUnaryCall; + bloomMultiExists( + request: BloomMultiExistsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomMultiExistsResponse) => void, + ): ClientUnaryCall; + bloomInfo( + request: BloomInfoRequest, + callback: (error: ServiceError | null, response: BloomInfoResponse) => void, + ): ClientUnaryCall; + bloomInfo( + request: BloomInfoRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomInfoResponse) => void, + ): ClientUnaryCall; + bloomInfo( + request: BloomInfoRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomInfoResponse) => void, + ): ClientUnaryCall; + bloomDelete( + request: BloomDeleteRequest, + callback: (error: ServiceError | null, response: BloomDeleteResponse) => void, + ): ClientUnaryCall; + bloomDelete( + request: BloomDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: BloomDeleteResponse) => void, + ): ClientUnaryCall; + bloomDelete( + request: BloomDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: BloomDeleteResponse) => void, + ): ClientUnaryCall; + /** ----- HyperLogLog ----- */ + hllReserve( + request: HllReserveRequest, + callback: (error: ServiceError | null, response: HllReserveResponse) => void, + ): ClientUnaryCall; + hllReserve( + request: HllReserveRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HllReserveResponse) => void, + ): ClientUnaryCall; + hllReserve( + request: HllReserveRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HllReserveResponse) => void, + ): ClientUnaryCall; + hllAdd( + request: HllAddRequest, + callback: (error: ServiceError | null, response: HllAddResponse) => void, + ): ClientUnaryCall; + hllAdd( + request: HllAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HllAddResponse) => void, + ): ClientUnaryCall; + hllAdd( + request: HllAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HllAddResponse) => void, + ): ClientUnaryCall; + hllCount( + request: HllCountRequest, + callback: (error: ServiceError | null, response: HllCountResponse) => void, + ): ClientUnaryCall; + hllCount( + request: HllCountRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HllCountResponse) => void, + ): ClientUnaryCall; + hllCount( + request: HllCountRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HllCountResponse) => void, + ): ClientUnaryCall; + hllMerge( + request: HllMergeRequest, + callback: (error: ServiceError | null, response: HllMergeResponse) => void, + ): ClientUnaryCall; + hllMerge( + request: HllMergeRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HllMergeResponse) => void, + ): ClientUnaryCall; + hllMerge( + request: HllMergeRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HllMergeResponse) => void, + ): ClientUnaryCall; + hllDelete( + request: HllDeleteRequest, + callback: (error: ServiceError | null, response: HllDeleteResponse) => void, + ): ClientUnaryCall; + hllDelete( + request: HllDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: HllDeleteResponse) => void, + ): ClientUnaryCall; + hllDelete( + request: HllDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: HllDeleteResponse) => void, + ): ClientUnaryCall; + /** ----- Count-Min Sketch ----- */ + cmsReserve( + request: CmsReserveRequest, + callback: (error: ServiceError | null, response: CmsReserveResponse) => void, + ): ClientUnaryCall; + cmsReserve( + request: CmsReserveRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CmsReserveResponse) => void, + ): ClientUnaryCall; + cmsReserve( + request: CmsReserveRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CmsReserveResponse) => void, + ): ClientUnaryCall; + cmsIncrBy( + request: CmsIncrByRequest, + callback: (error: ServiceError | null, response: CmsIncrByResponse) => void, + ): ClientUnaryCall; + cmsIncrBy( + request: CmsIncrByRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CmsIncrByResponse) => void, + ): ClientUnaryCall; + cmsIncrBy( + request: CmsIncrByRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CmsIncrByResponse) => void, + ): ClientUnaryCall; + cmsQuery( + request: CmsQueryRequest, + callback: (error: ServiceError | null, response: CmsQueryResponse) => void, + ): ClientUnaryCall; + cmsQuery( + request: CmsQueryRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CmsQueryResponse) => void, + ): ClientUnaryCall; + cmsQuery( + request: CmsQueryRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CmsQueryResponse) => void, + ): ClientUnaryCall; + cmsDelete( + request: CmsDeleteRequest, + callback: (error: ServiceError | null, response: CmsDeleteResponse) => void, + ): ClientUnaryCall; + cmsDelete( + request: CmsDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CmsDeleteResponse) => void, + ): ClientUnaryCall; + cmsDelete( + request: CmsDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CmsDeleteResponse) => void, + ): ClientUnaryCall; + /** ----- Top-K ----- */ + topKReserve( + request: TopKReserveRequest, + callback: (error: ServiceError | null, response: TopKReserveResponse) => void, + ): ClientUnaryCall; + topKReserve( + request: TopKReserveRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TopKReserveResponse) => void, + ): ClientUnaryCall; + topKReserve( + request: TopKReserveRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TopKReserveResponse) => void, + ): ClientUnaryCall; + topKAdd( + request: TopKAddRequest, + callback: (error: ServiceError | null, response: TopKAddResponse) => void, + ): ClientUnaryCall; + topKAdd( + request: TopKAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TopKAddResponse) => void, + ): ClientUnaryCall; + topKAdd( + request: TopKAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TopKAddResponse) => void, + ): ClientUnaryCall; + topKQuery( + request: TopKQueryRequest, + callback: (error: ServiceError | null, response: TopKQueryResponse) => void, + ): ClientUnaryCall; + topKQuery( + request: TopKQueryRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TopKQueryResponse) => void, + ): ClientUnaryCall; + topKQuery( + request: TopKQueryRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TopKQueryResponse) => void, + ): ClientUnaryCall; + topKList( + request: TopKListRequest, + callback: (error: ServiceError | null, response: TopKListResponse) => void, + ): ClientUnaryCall; + topKList( + request: TopKListRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TopKListResponse) => void, + ): ClientUnaryCall; + topKList( + request: TopKListRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TopKListResponse) => void, + ): ClientUnaryCall; + topKDelete( + request: TopKDeleteRequest, + callback: (error: ServiceError | null, response: TopKDeleteResponse) => void, + ): ClientUnaryCall; + topKDelete( + request: TopKDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TopKDeleteResponse) => void, + ): ClientUnaryCall; + topKDelete( + request: TopKDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TopKDeleteResponse) => void, + ): ClientUnaryCall; + /** ----- t-digest ----- */ + tDigestCreate( + request: TDigestCreateRequest, + callback: (error: ServiceError | null, response: TDigestCreateResponse) => void, + ): ClientUnaryCall; + tDigestCreate( + request: TDigestCreateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TDigestCreateResponse) => void, + ): ClientUnaryCall; + tDigestCreate( + request: TDigestCreateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TDigestCreateResponse) => void, + ): ClientUnaryCall; + tDigestAdd( + request: TDigestAddRequest, + callback: (error: ServiceError | null, response: TDigestAddResponse) => void, + ): ClientUnaryCall; + tDigestAdd( + request: TDigestAddRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TDigestAddResponse) => void, + ): ClientUnaryCall; + tDigestAdd( + request: TDigestAddRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TDigestAddResponse) => void, + ): ClientUnaryCall; + tDigestQuantile( + request: TDigestQuantileRequest, + callback: (error: ServiceError | null, response: TDigestQuantileResponse) => void, + ): ClientUnaryCall; + tDigestQuantile( + request: TDigestQuantileRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TDigestQuantileResponse) => void, + ): ClientUnaryCall; + tDigestQuantile( + request: TDigestQuantileRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TDigestQuantileResponse) => void, + ): ClientUnaryCall; + tDigestMinMax( + request: TDigestMinMaxRequest, + callback: (error: ServiceError | null, response: TDigestMinMaxResponse) => void, + ): ClientUnaryCall; + tDigestMinMax( + request: TDigestMinMaxRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TDigestMinMaxResponse) => void, + ): ClientUnaryCall; + tDigestMinMax( + request: TDigestMinMaxRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TDigestMinMaxResponse) => void, + ): ClientUnaryCall; + tDigestDelete( + request: TDigestDeleteRequest, + callback: (error: ServiceError | null, response: TDigestDeleteResponse) => void, + ): ClientUnaryCall; + tDigestDelete( + request: TDigestDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TDigestDeleteResponse) => void, + ): ClientUnaryCall; + tDigestDelete( + request: TDigestDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TDigestDeleteResponse) => void, + ): ClientUnaryCall; + /** + * Internal: snapshot replication. Primary pushes serialized + * filter state to N-1 secondaries periodically. Version counter + * dedupes out-of-order pushes. + */ + replicateProbState( + request: ReplicateProbStateRequest, + callback: (error: ServiceError | null, response: ReplicateProbStateResponse) => void, + ): ClientUnaryCall; + replicateProbState( + request: ReplicateProbStateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateProbStateResponse) => void, + ): ClientUnaryCall; + replicateProbState( + request: ReplicateProbStateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateProbStateResponse) => void, + ): ClientUnaryCall; +} + +export const WaymakerSketchesServiceClient = makeGenericClientConstructor( + WaymakerSketchesServiceService, + "waymaker.sketches.WaymakerSketchesService", +) as unknown as { + new ( + address: string, + credentials: ChannelCredentials, + options?: Partial, + ): WaymakerSketchesServiceClient; + service: typeof WaymakerSketchesServiceService; + serviceName: string; +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/waymaker_locks.ts b/ts/src/genpb/waymaker_locks.ts new file mode 100644 index 0000000..e66b325 --- /dev/null +++ b/ts/src/genpb/waymaker_locks.ts @@ -0,0 +1,2683 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: waymaker_locks.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientReadableStream, + type ClientUnaryCall, + type handleServerStreamingCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker"; + +/** + * LockEventType defines the various types of events that can occur during + * the lock acquisition process. + */ +export enum LockEventType { + /** Unknown - Default value when the event type is not known. */ + Unknown = 0, + /** Waiting - Indicates that the lock request is waiting to be granted. */ + Waiting = 1, + /** Acquired - Indicates that the lock has been successfully acquired. */ + Acquired = 2, + /** Failed - Indicates that the lock request has failed. */ + Failed = 3, + /** Expired - Indicates that the lock has expired. */ + Expired = 4, + /** Heartbeat - Periodic event indicating that the lock is still active. */ + Heartbeat = 5, +} + +export function lockEventTypeFromJSON(object: any): LockEventType { + switch (object) { + case 0: + case "Unknown": + return LockEventType.Unknown; + case 1: + case "Waiting": + return LockEventType.Waiting; + case 2: + case "Acquired": + return LockEventType.Acquired; + case 3: + case "Failed": + return LockEventType.Failed; + case 4: + case "Expired": + return LockEventType.Expired; + case 5: + case "Heartbeat": + return LockEventType.Heartbeat; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum LockEventType"); + } +} + +export function lockEventTypeToJSON(object: LockEventType): string { + switch (object) { + case LockEventType.Unknown: + return "Unknown"; + case LockEventType.Waiting: + return "Waiting"; + case LockEventType.Acquired: + return "Acquired"; + case LockEventType.Failed: + return "Failed"; + case LockEventType.Expired: + return "Expired"; + case LockEventType.Heartbeat: + return "Heartbeat"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum LockEventType"); + } +} + +/** + * FenceScope controls ONE thing: how durable the per-key fence_token + * counter (the monotonic uint64) is across failures. Three things it does + * NOT control — do not conflate them with the scope: + * + * * Whether a HELD LOCK survives a node loss / rollout. That is + * cluster.replication-factor plus secondary adoption, and it already + * applies to every non-Ephemeral lock regardless of scope. A stronger + * scope does not make a lock survive; a replicated lease does. + * * Client-side transparency across a primary bounce. The lock client + * transparently re-binds its event stream and re-confirms ownership + * after a disconnect, but that is a client-lib behaviour — no scope + * value changes it. + * * Mutual exclusion. Holding the lock is NOT, by itself, a guarantee + * that no one else acts. The holder MUST validate fence_token at its + * own side effect (the DB write / object PUT) and reject anything + * carrying a fence below the last one it durably committed. Even + * ScopeQuorum does not let you skip that check — an all-at-once + * cluster restart can still drop an in-memory token. See USAGE.md + * "Fence tokens" for the enforcement rule. + * + * Unspecified: server treats as Ephemeral. + * Ephemeral: per-key counter in RAM on the owning node. Resets on + * process restart or hash-ring rebalance. Fast — no I/O. + * Right for rate limiting, cache lockout, advisory locks, + * anywhere fence resets across failure are tolerable. + * Local: per-key counter persisted to disk on the owning node. + * Survives process restart on the same node. Still resets + * on hash-ring rebalance (a different node has its own + * disk). One fsync per acquire (~1-5ms on SSD). + * Quorum: Raft-replicated per-key counter — cluster-wide monotonic, + * survives any single-node failure (the surviving quorum + * keeps the count). One Raft commit per acquire (~5ms). + * Requires the cluster Raft backend to be wired; a + * single-node or test build returns BadInput for this + * scope. Pick this when an external resource fences on the + * token and two holders must never see fences that fail to + * prove an ordering. (Named Quorum, not Global: the + * guarantee is "a Raft quorum agrees on the count", which + * carries its own limit and makes no geographic claim.) + */ +export enum FenceScope { + ScopeUnspecified = 0, + ScopeEphemeral = 1, + ScopeLocal = 2, + /** + * ScopeQuorum - Wire value 3 is unchanged from the former ScopeGlobal — old and new + * binaries interoperate mid-rollout; only the symbol name changed. + */ + ScopeQuorum = 3, +} + +export function fenceScopeFromJSON(object: any): FenceScope { + switch (object) { + case 0: + case "ScopeUnspecified": + return FenceScope.ScopeUnspecified; + case 1: + case "ScopeEphemeral": + return FenceScope.ScopeEphemeral; + case 2: + case "ScopeLocal": + return FenceScope.ScopeLocal; + case 3: + case "ScopeQuorum": + return FenceScope.ScopeQuorum; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum FenceScope"); + } +} + +export function fenceScopeToJSON(object: FenceScope): string { + switch (object) { + case FenceScope.ScopeUnspecified: + return "ScopeUnspecified"; + case FenceScope.ScopeEphemeral: + return "ScopeEphemeral"; + case FenceScope.ScopeLocal: + return "ScopeLocal"; + case FenceScope.ScopeQuorum: + return "ScopeQuorum"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum FenceScope"); + } +} + +/** LockRequest defines the parameters for requesting a lock. */ +export interface LockRequest { + /** The unique key representing the lock. */ + key: string; + /** The maximum time (in milliseconds) to wait for the lock to be granted. */ + maxWaitPeriod: number; + /** The maximum time (in milliseconds) the lock can be held. */ + maxLeasePeriod: number; + /** The priority level of the lock request. */ + priority: number; + /** Additional information about the requester. */ + requesterInfo: string; + /** The name of the application making the request. */ + requesterApplication: string; + /** Idempotency key for retries of the same logical acquire request. */ + requestId: string; + /** Persistence/durability tier for fence_token. Defaults to Ephemeral. */ + fenceScope: FenceScope; +} + +/** LockEvent represents an event related to the lock acquisition process. */ +export interface LockEvent { + /** Indicates whether the event was successful. */ + success: boolean; + /** The type of event that occurred. */ + eventType: LockEventType; + /** A message providing additional details about the event. */ + message: string; + /** The unique identifier of the lock. */ + id: string; + /** The key associated with the lock. */ + key: string; + /** The timestamp (in Unix milliseconds) when the lease expires. */ + leaseExpiresAt: number; + /** The timestamp (in Unix milliseconds) when the lock was acquired. */ + acquiredAt: number; + /** The timestamp (in Unix milliseconds) when the waiting period expires. */ + waitingExpiresAt: number; + /** + * Monotonic-per-key fence token assigned at acquire. Increments by 1 per + * successful acquisition of `key`. 0 on non-Acquired events. + * + * Held in RAM on the consistent-hash-owning node. Monotonic within that + * node's process lifetime; resets to 0 across node restart, crash, or + * hash-ring rebalance. This is intentional — see README "Known + * limitations" and "When to use waymaker" for the use cases this suits + * vs. when to reach for a different tool (etcd / ZooKeeper / Consul). + */ + fenceToken: number; +} + +/** UnLockRequest defines the parameters for releasing a lock. */ +export interface UnLockRequest { + /** The unique key representing the lock. */ + key: string; + /** The unique identifier of the lock to be released. */ + id: string; +} + +/** UnLockResponse represents the response to an UnLock request. */ +export interface UnLockResponse { + /** Indicates whether the unlock operation was successful. */ + success: boolean; + /** A code indicating the result of the unlock operation. */ + resultCode: string; + /** A message providing additional details about the unlock operation. */ + message: string; +} + +/** Lease represents the details of a lock lease. */ +export interface Lease { + /** The unique identifier of the lock. */ + id: string; + /** The key associated with the lock. */ + key: string; + /** Indicates whether the lock has been acquired. */ + acquired: boolean; + /** The priority level of the lock. */ + priority: number; + /** The timestamp (in Unix milliseconds) when the lock was created. */ + createdAt: number; + /** The timestamp (in Unix milliseconds) when the lease expires. */ + leaseExpiresAt: number; + /** The timestamp (in Unix milliseconds) when the waiting period expires. */ + waitingExpiresAt: number; + /** Fence token assigned at acquire. See LockEvent.fence_token caveats. */ + fenceToken: number; +} + +/** ExtendLeaseRequest defines the parameters for extending the lease of a lock. */ +export interface ExtendLeaseRequest { + /** The unique key representing the lock. */ + key: string; + /** The unique identifier of the lock to extend the lease for. */ + id: string; + /** The additional time (in milliseconds) to extend the lease. */ + leaseTimeout: number; +} + +/** ExtendLeaseResponse represents the response to an ExtendLease request. */ +export interface ExtendLeaseResponse { + /** Indicates whether the lease extension was successful. */ + success: boolean; + /** A code indicating the result of the lease extension. */ + resultCode: string; + /** A message providing additional details about the lease extension. */ + message: string; + /** The updated lease details after the extension. */ + lease: Lease | undefined; +} + +/** LeaseStatusRequest defines the parameters for retrieving the status of a lock lease. */ +export interface LeaseStatusRequest { + /** The unique key representing the lock. */ + key: string; + /** The unique identifier of the lock to check the status of. */ + id: string; +} + +/** LeaseStatusResponse represents the response to a LeaseStatus request. */ +export interface LeaseStatusResponse { + /** Indicates whether the lease status retrieval was successful. */ + success: boolean; + /** A code indicating the result of the lease status retrieval. */ + resultCode: string; + /** A message providing additional details about the lease status retrieval. */ + message: string; + /** The current lease details for the lock. */ + lease: Lease | undefined; +} + +/** A single (key, lock-kind) entry inside a MultiLockRequest. */ +export interface MultiLockKey { + /** The unique key representing the lock. */ + key: string; + /** true = exclusive (write), false = shared (read). */ + writeLock: boolean; +} + +/** + * MultiLockRequest defines the parameters for atomically acquiring N locks. + * See MultiLock RPC docs for ordering and rollback semantics. + */ +export interface MultiLockRequest { + /** 1..N keys to acquire. Re-ordered server-side. */ + keys: MultiLockKey[]; + /** Total batch deadline (ms). Per-key budget is the remainder. */ + maxWaitPeriod: number; + /** Per-key lease length (ms). */ + maxLeasePeriod: number; + /** Priority applied to every key. */ + priority: number; + requesterInfo: string; + requesterApplication: string; + /** Idempotency key for the batch. */ + requestId: string; + /** Applies to every key in the batch. */ + fenceScope: FenceScope; +} + +/** MultiLockResponse — unary result of a MultiLock attempt. */ +export interface MultiLockResponse { + /** true iff all keys were acquired. */ + success: boolean; + /** "ok" | "timeout" | "no_keys" | "invalid_scope" | "internal" */ + resultCode: string; + /** Free-form detail; empty on success. */ + message: string; + /** + * Populated only on success, in lexicographic key order (the order the + * server acquired them in). On failure this is empty and any locks + * briefly held during the attempt have already been released. + */ + leases: Lease[]; +} + +/** ListAcquiredLocksRequest — filter for ListAcquiredLocks. */ +export interface ListAcquiredLocksRequest { + /** Optional; empty = every held key on this node. */ + keyPrefix: string; +} + +/** AcquiredLock — one lock currently HELD (not waiting) on the serving node. */ +export interface AcquiredLock { + /** The lock key. */ + key: string; + /** The holder's unique lock id. */ + lockId: string; + /** true = exclusive (write); false = shared (read). */ + writeLock: boolean; + /** Priority the lock was acquired at. */ + priority: number; + /** Fence token assigned at acquire. */ + fenceToken: number; + /** Lease expiry (epoch ms). */ + leaseExpiresAt: number; + /** Acquire time (epoch ms). */ + acquiredAt: number; + /** Idempotency key of the acquire. */ + requestId: string; + /** Caller-supplied requester metadata (free-form string). */ + requesterInfo: string; + /** Caller-supplied application name. */ + requesterApplication: string; +} + +/** ListAcquiredLocksResponse — held locks on the serving node. */ +export interface ListAcquiredLocksResponse { + success: boolean; + locks: AcquiredLock[]; +} + +function createBaseLockRequest(): LockRequest { + return { + key: "", + maxWaitPeriod: 0, + maxLeasePeriod: 0, + priority: 0, + requesterInfo: "", + requesterApplication: "", + requestId: "", + fenceScope: 0, + }; +} + +export const LockRequest: MessageFns = { + encode(message: LockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.maxWaitPeriod !== 0) { + writer.uint32(16).uint32(message.maxWaitPeriod); + } + if (message.maxLeasePeriod !== 0) { + writer.uint32(24).uint32(message.maxLeasePeriod); + } + if (message.priority !== 0) { + writer.uint32(32).uint32(message.priority); + } + if (message.requesterInfo !== "") { + writer.uint32(82).string(message.requesterInfo); + } + if (message.requesterApplication !== "") { + writer.uint32(90).string(message.requesterApplication); + } + if (message.requestId !== "") { + writer.uint32(98).string(message.requestId); + } + if (message.fenceScope !== 0) { + writer.uint32(104).int32(message.fenceScope); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxWaitPeriod = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxLeasePeriod = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.priority = reader.uint32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.requesterInfo = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.requesterApplication = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.requestId = reader.string(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.fenceScope = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LockRequest { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + maxWaitPeriod: isSet(object.maxWaitPeriod) + ? globalThis.Number(object.maxWaitPeriod) + : isSet(object.max_wait_period) + ? globalThis.Number(object.max_wait_period) + : 0, + maxLeasePeriod: isSet(object.maxLeasePeriod) + ? globalThis.Number(object.maxLeasePeriod) + : isSet(object.max_lease_period) + ? globalThis.Number(object.max_lease_period) + : 0, + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + requesterInfo: isSet(object.requesterInfo) + ? globalThis.String(object.requesterInfo) + : isSet(object.requester_info) + ? globalThis.String(object.requester_info) + : "", + requesterApplication: isSet(object.requesterApplication) + ? globalThis.String(object.requesterApplication) + : isSet(object.requester_application) + ? globalThis.String(object.requester_application) + : "", + requestId: isSet(object.requestId) + ? globalThis.String(object.requestId) + : isSet(object.request_id) + ? globalThis.String(object.request_id) + : "", + fenceScope: isSet(object.fenceScope) + ? fenceScopeFromJSON(object.fenceScope) + : isSet(object.fence_scope) + ? fenceScopeFromJSON(object.fence_scope) + : 0, + }; + }, + + toJSON(message: LockRequest): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.maxWaitPeriod !== 0) { + obj.maxWaitPeriod = Math.round(message.maxWaitPeriod); + } + if (message.maxLeasePeriod !== 0) { + obj.maxLeasePeriod = Math.round(message.maxLeasePeriod); + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.requesterInfo !== "") { + obj.requesterInfo = message.requesterInfo; + } + if (message.requesterApplication !== "") { + obj.requesterApplication = message.requesterApplication; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.fenceScope !== 0) { + obj.fenceScope = fenceScopeToJSON(message.fenceScope); + } + return obj; + }, + + create(base?: DeepPartial): LockRequest { + return LockRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LockRequest { + const message = createBaseLockRequest(); + message.key = object.key ?? ""; + message.maxWaitPeriod = object.maxWaitPeriod ?? 0; + message.maxLeasePeriod = object.maxLeasePeriod ?? 0; + message.priority = object.priority ?? 0; + message.requesterInfo = object.requesterInfo ?? ""; + message.requesterApplication = object.requesterApplication ?? ""; + message.requestId = object.requestId ?? ""; + message.fenceScope = object.fenceScope ?? 0; + return message; + }, +}; + +function createBaseLockEvent(): LockEvent { + return { + success: false, + eventType: 0, + message: "", + id: "", + key: "", + leaseExpiresAt: 0, + acquiredAt: 0, + waitingExpiresAt: 0, + fenceToken: 0, + }; +} + +export const LockEvent: MessageFns = { + encode(message: LockEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.eventType !== 0) { + writer.uint32(16).int32(message.eventType); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.id !== "") { + writer.uint32(34).string(message.id); + } + if (message.key !== "") { + writer.uint32(42).string(message.key); + } + if (message.leaseExpiresAt !== 0) { + writer.uint32(48).int64(message.leaseExpiresAt); + } + if (message.acquiredAt !== 0) { + writer.uint32(56).int64(message.acquiredAt); + } + if (message.waitingExpiresAt !== 0) { + writer.uint32(64).int64(message.waitingExpiresAt); + } + if (message.fenceToken !== 0) { + writer.uint32(72).uint64(message.fenceToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LockEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLockEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.eventType = reader.int32() as any; + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.id = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.key = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.leaseExpiresAt = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.acquiredAt = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.waitingExpiresAt = longToNumber(reader.int64()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.fenceToken = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LockEvent { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + eventType: isSet(object.eventType) + ? lockEventTypeFromJSON(object.eventType) + : isSet(object.event_type) + ? lockEventTypeFromJSON(object.event_type) + : 0, + message: isSet(object.message) ? globalThis.String(object.message) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + leaseExpiresAt: isSet(object.leaseExpiresAt) + ? globalThis.Number(object.leaseExpiresAt) + : isSet(object.lease_expires_at) + ? globalThis.Number(object.lease_expires_at) + : 0, + acquiredAt: isSet(object.acquiredAt) + ? globalThis.Number(object.acquiredAt) + : isSet(object.acquired_at) + ? globalThis.Number(object.acquired_at) + : 0, + waitingExpiresAt: isSet(object.waitingExpiresAt) + ? globalThis.Number(object.waitingExpiresAt) + : isSet(object.waiting_expires_at) + ? globalThis.Number(object.waiting_expires_at) + : 0, + fenceToken: isSet(object.fenceToken) + ? globalThis.Number(object.fenceToken) + : isSet(object.fence_token) + ? globalThis.Number(object.fence_token) + : 0, + }; + }, + + toJSON(message: LockEvent): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.eventType !== 0) { + obj.eventType = lockEventTypeToJSON(message.eventType); + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.leaseExpiresAt !== 0) { + obj.leaseExpiresAt = Math.round(message.leaseExpiresAt); + } + if (message.acquiredAt !== 0) { + obj.acquiredAt = Math.round(message.acquiredAt); + } + if (message.waitingExpiresAt !== 0) { + obj.waitingExpiresAt = Math.round(message.waitingExpiresAt); + } + if (message.fenceToken !== 0) { + obj.fenceToken = Math.round(message.fenceToken); + } + return obj; + }, + + create(base?: DeepPartial): LockEvent { + return LockEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LockEvent { + const message = createBaseLockEvent(); + message.success = object.success ?? false; + message.eventType = object.eventType ?? 0; + message.message = object.message ?? ""; + message.id = object.id ?? ""; + message.key = object.key ?? ""; + message.leaseExpiresAt = object.leaseExpiresAt ?? 0; + message.acquiredAt = object.acquiredAt ?? 0; + message.waitingExpiresAt = object.waitingExpiresAt ?? 0; + message.fenceToken = object.fenceToken ?? 0; + return message; + }, +}; + +function createBaseUnLockRequest(): UnLockRequest { + return { key: "", id: "" }; +} + +export const UnLockRequest: MessageFns = { + encode(message: UnLockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnLockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnLockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnLockRequest { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: UnLockRequest): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create(base?: DeepPartial): UnLockRequest { + return UnLockRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UnLockRequest { + const message = createBaseUnLockRequest(); + message.key = object.key ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseUnLockResponse(): UnLockResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const UnLockResponse: MessageFns = { + encode(message: UnLockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnLockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnLockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnLockResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: UnLockResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): UnLockResponse { + return UnLockResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UnLockResponse { + const message = createBaseUnLockResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseLease(): Lease { + return { + id: "", + key: "", + acquired: false, + priority: 0, + createdAt: 0, + leaseExpiresAt: 0, + waitingExpiresAt: 0, + fenceToken: 0, + }; +} + +export const Lease: MessageFns = { + encode(message: Lease, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.acquired !== false) { + writer.uint32(24).bool(message.acquired); + } + if (message.priority !== 0) { + writer.uint32(40).uint32(message.priority); + } + if (message.createdAt !== 0) { + writer.uint32(48).int64(message.createdAt); + } + if (message.leaseExpiresAt !== 0) { + writer.uint32(56).int64(message.leaseExpiresAt); + } + if (message.waitingExpiresAt !== 0) { + writer.uint32(64).int64(message.waitingExpiresAt); + } + if (message.fenceToken !== 0) { + writer.uint32(72).uint64(message.fenceToken); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Lease { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.acquired = reader.bool(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.priority = reader.uint32(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.createdAt = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.leaseExpiresAt = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.waitingExpiresAt = longToNumber(reader.int64()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.fenceToken = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Lease { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + acquired: isSet(object.acquired) ? globalThis.Boolean(object.acquired) : false, + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + createdAt: isSet(object.createdAt) + ? globalThis.Number(object.createdAt) + : isSet(object.created_at) + ? globalThis.Number(object.created_at) + : 0, + leaseExpiresAt: isSet(object.leaseExpiresAt) + ? globalThis.Number(object.leaseExpiresAt) + : isSet(object.lease_expires_at) + ? globalThis.Number(object.lease_expires_at) + : 0, + waitingExpiresAt: isSet(object.waitingExpiresAt) + ? globalThis.Number(object.waitingExpiresAt) + : isSet(object.waiting_expires_at) + ? globalThis.Number(object.waiting_expires_at) + : 0, + fenceToken: isSet(object.fenceToken) + ? globalThis.Number(object.fenceToken) + : isSet(object.fence_token) + ? globalThis.Number(object.fence_token) + : 0, + }; + }, + + toJSON(message: Lease): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.acquired !== false) { + obj.acquired = message.acquired; + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.createdAt !== 0) { + obj.createdAt = Math.round(message.createdAt); + } + if (message.leaseExpiresAt !== 0) { + obj.leaseExpiresAt = Math.round(message.leaseExpiresAt); + } + if (message.waitingExpiresAt !== 0) { + obj.waitingExpiresAt = Math.round(message.waitingExpiresAt); + } + if (message.fenceToken !== 0) { + obj.fenceToken = Math.round(message.fenceToken); + } + return obj; + }, + + create(base?: DeepPartial): Lease { + return Lease.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Lease { + const message = createBaseLease(); + message.id = object.id ?? ""; + message.key = object.key ?? ""; + message.acquired = object.acquired ?? false; + message.priority = object.priority ?? 0; + message.createdAt = object.createdAt ?? 0; + message.leaseExpiresAt = object.leaseExpiresAt ?? 0; + message.waitingExpiresAt = object.waitingExpiresAt ?? 0; + message.fenceToken = object.fenceToken ?? 0; + return message; + }, +}; + +function createBaseExtendLeaseRequest(): ExtendLeaseRequest { + return { key: "", id: "", leaseTimeout: 0 }; +} + +export const ExtendLeaseRequest: MessageFns = { + encode(message: ExtendLeaseRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + if (message.leaseTimeout !== 0) { + writer.uint32(24).uint32(message.leaseTimeout); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendLeaseRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendLeaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.leaseTimeout = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendLeaseRequest { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + leaseTimeout: isSet(object.leaseTimeout) + ? globalThis.Number(object.leaseTimeout) + : isSet(object.lease_timeout) + ? globalThis.Number(object.lease_timeout) + : 0, + }; + }, + + toJSON(message: ExtendLeaseRequest): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.id !== "") { + obj.id = message.id; + } + if (message.leaseTimeout !== 0) { + obj.leaseTimeout = Math.round(message.leaseTimeout); + } + return obj; + }, + + create(base?: DeepPartial): ExtendLeaseRequest { + return ExtendLeaseRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ExtendLeaseRequest { + const message = createBaseExtendLeaseRequest(); + message.key = object.key ?? ""; + message.id = object.id ?? ""; + message.leaseTimeout = object.leaseTimeout ?? 0; + return message; + }, +}; + +function createBaseExtendLeaseResponse(): ExtendLeaseResponse { + return { success: false, resultCode: "", message: "", lease: undefined }; +} + +export const ExtendLeaseResponse: MessageFns = { + encode(message: ExtendLeaseResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.lease !== undefined) { + Lease.encode(message.lease, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendLeaseResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendLeaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lease = Lease.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendLeaseResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + lease: isSet(object.lease) ? Lease.fromJSON(object.lease) : undefined, + }; + }, + + toJSON(message: ExtendLeaseResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.lease !== undefined) { + obj.lease = Lease.toJSON(message.lease); + } + return obj; + }, + + create(base?: DeepPartial): ExtendLeaseResponse { + return ExtendLeaseResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ExtendLeaseResponse { + const message = createBaseExtendLeaseResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.lease = (object.lease !== undefined && object.lease !== null) ? Lease.fromPartial(object.lease) : undefined; + return message; + }, +}; + +function createBaseLeaseStatusRequest(): LeaseStatusRequest { + return { key: "", id: "" }; +} + +export const LeaseStatusRequest: MessageFns = { + encode(message: LeaseStatusRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.id !== "") { + writer.uint32(18).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LeaseStatusRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseStatusRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.id = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LeaseStatusRequest { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + id: isSet(object.id) ? globalThis.String(object.id) : "", + }; + }, + + toJSON(message: LeaseStatusRequest): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create(base?: DeepPartial): LeaseStatusRequest { + return LeaseStatusRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LeaseStatusRequest { + const message = createBaseLeaseStatusRequest(); + message.key = object.key ?? ""; + message.id = object.id ?? ""; + return message; + }, +}; + +function createBaseLeaseStatusResponse(): LeaseStatusResponse { + return { success: false, resultCode: "", message: "", lease: undefined }; +} + +export const LeaseStatusResponse: MessageFns = { + encode(message: LeaseStatusResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.lease !== undefined) { + Lease.encode(message.lease, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LeaseStatusResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeaseStatusResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lease = Lease.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LeaseStatusResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + lease: isSet(object.lease) ? Lease.fromJSON(object.lease) : undefined, + }; + }, + + toJSON(message: LeaseStatusResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.lease !== undefined) { + obj.lease = Lease.toJSON(message.lease); + } + return obj; + }, + + create(base?: DeepPartial): LeaseStatusResponse { + return LeaseStatusResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LeaseStatusResponse { + const message = createBaseLeaseStatusResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.lease = (object.lease !== undefined && object.lease !== null) ? Lease.fromPartial(object.lease) : undefined; + return message; + }, +}; + +function createBaseMultiLockKey(): MultiLockKey { + return { key: "", writeLock: false }; +} + +export const MultiLockKey: MessageFns = { + encode(message: MultiLockKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.writeLock !== false) { + writer.uint32(16).bool(message.writeLock); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiLockKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiLockKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.writeLock = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiLockKey { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + writeLock: isSet(object.writeLock) + ? globalThis.Boolean(object.writeLock) + : isSet(object.write_lock) + ? globalThis.Boolean(object.write_lock) + : false, + }; + }, + + toJSON(message: MultiLockKey): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.writeLock !== false) { + obj.writeLock = message.writeLock; + } + return obj; + }, + + create(base?: DeepPartial): MultiLockKey { + return MultiLockKey.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MultiLockKey { + const message = createBaseMultiLockKey(); + message.key = object.key ?? ""; + message.writeLock = object.writeLock ?? false; + return message; + }, +}; + +function createBaseMultiLockRequest(): MultiLockRequest { + return { + keys: [], + maxWaitPeriod: 0, + maxLeasePeriod: 0, + priority: 0, + requesterInfo: "", + requesterApplication: "", + requestId: "", + fenceScope: 0, + }; +} + +export const MultiLockRequest: MessageFns = { + encode(message: MultiLockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.keys) { + MultiLockKey.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.maxWaitPeriod !== 0) { + writer.uint32(16).uint32(message.maxWaitPeriod); + } + if (message.maxLeasePeriod !== 0) { + writer.uint32(24).uint32(message.maxLeasePeriod); + } + if (message.priority !== 0) { + writer.uint32(32).uint32(message.priority); + } + if (message.requesterInfo !== "") { + writer.uint32(82).string(message.requesterInfo); + } + if (message.requesterApplication !== "") { + writer.uint32(90).string(message.requesterApplication); + } + if (message.requestId !== "") { + writer.uint32(98).string(message.requestId); + } + if (message.fenceScope !== 0) { + writer.uint32(104).int32(message.fenceScope); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiLockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiLockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.keys.push(MultiLockKey.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxWaitPeriod = reader.uint32(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxLeasePeriod = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.priority = reader.uint32(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.requesterInfo = reader.string(); + continue; + } + case 11: { + if (tag !== 90) { + break; + } + + message.requesterApplication = reader.string(); + continue; + } + case 12: { + if (tag !== 98) { + break; + } + + message.requestId = reader.string(); + continue; + } + case 13: { + if (tag !== 104) { + break; + } + + message.fenceScope = reader.int32() as any; + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiLockRequest { + return { + keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e: any) => MultiLockKey.fromJSON(e)) : [], + maxWaitPeriod: isSet(object.maxWaitPeriod) + ? globalThis.Number(object.maxWaitPeriod) + : isSet(object.max_wait_period) + ? globalThis.Number(object.max_wait_period) + : 0, + maxLeasePeriod: isSet(object.maxLeasePeriod) + ? globalThis.Number(object.maxLeasePeriod) + : isSet(object.max_lease_period) + ? globalThis.Number(object.max_lease_period) + : 0, + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + requesterInfo: isSet(object.requesterInfo) + ? globalThis.String(object.requesterInfo) + : isSet(object.requester_info) + ? globalThis.String(object.requester_info) + : "", + requesterApplication: isSet(object.requesterApplication) + ? globalThis.String(object.requesterApplication) + : isSet(object.requester_application) + ? globalThis.String(object.requester_application) + : "", + requestId: isSet(object.requestId) + ? globalThis.String(object.requestId) + : isSet(object.request_id) + ? globalThis.String(object.request_id) + : "", + fenceScope: isSet(object.fenceScope) + ? fenceScopeFromJSON(object.fenceScope) + : isSet(object.fence_scope) + ? fenceScopeFromJSON(object.fence_scope) + : 0, + }; + }, + + toJSON(message: MultiLockRequest): unknown { + const obj: any = {}; + if (message.keys?.length) { + obj.keys = message.keys.map((e) => MultiLockKey.toJSON(e)); + } + if (message.maxWaitPeriod !== 0) { + obj.maxWaitPeriod = Math.round(message.maxWaitPeriod); + } + if (message.maxLeasePeriod !== 0) { + obj.maxLeasePeriod = Math.round(message.maxLeasePeriod); + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.requesterInfo !== "") { + obj.requesterInfo = message.requesterInfo; + } + if (message.requesterApplication !== "") { + obj.requesterApplication = message.requesterApplication; + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.fenceScope !== 0) { + obj.fenceScope = fenceScopeToJSON(message.fenceScope); + } + return obj; + }, + + create(base?: DeepPartial): MultiLockRequest { + return MultiLockRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MultiLockRequest { + const message = createBaseMultiLockRequest(); + message.keys = object.keys?.map((e) => MultiLockKey.fromPartial(e)) || []; + message.maxWaitPeriod = object.maxWaitPeriod ?? 0; + message.maxLeasePeriod = object.maxLeasePeriod ?? 0; + message.priority = object.priority ?? 0; + message.requesterInfo = object.requesterInfo ?? ""; + message.requesterApplication = object.requesterApplication ?? ""; + message.requestId = object.requestId ?? ""; + message.fenceScope = object.fenceScope ?? 0; + return message; + }, +}; + +function createBaseMultiLockResponse(): MultiLockResponse { + return { success: false, resultCode: "", message: "", leases: [] }; +} + +export const MultiLockResponse: MessageFns = { + encode(message: MultiLockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.leases) { + Lease.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiLockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiLockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.leases.push(Lease.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiLockResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + leases: globalThis.Array.isArray(object?.leases) ? object.leases.map((e: any) => Lease.fromJSON(e)) : [], + }; + }, + + toJSON(message: MultiLockResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.leases?.length) { + obj.leases = message.leases.map((e) => Lease.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): MultiLockResponse { + return MultiLockResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MultiLockResponse { + const message = createBaseMultiLockResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.leases = object.leases?.map((e) => Lease.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseListAcquiredLocksRequest(): ListAcquiredLocksRequest { + return { keyPrefix: "" }; +} + +export const ListAcquiredLocksRequest: MessageFns = { + encode(message: ListAcquiredLocksRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.keyPrefix !== "") { + writer.uint32(10).string(message.keyPrefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAcquiredLocksRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAcquiredLocksRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.keyPrefix = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAcquiredLocksRequest { + return { + keyPrefix: isSet(object.keyPrefix) + ? globalThis.String(object.keyPrefix) + : isSet(object.key_prefix) + ? globalThis.String(object.key_prefix) + : "", + }; + }, + + toJSON(message: ListAcquiredLocksRequest): unknown { + const obj: any = {}; + if (message.keyPrefix !== "") { + obj.keyPrefix = message.keyPrefix; + } + return obj; + }, + + create(base?: DeepPartial): ListAcquiredLocksRequest { + return ListAcquiredLocksRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListAcquiredLocksRequest { + const message = createBaseListAcquiredLocksRequest(); + message.keyPrefix = object.keyPrefix ?? ""; + return message; + }, +}; + +function createBaseAcquiredLock(): AcquiredLock { + return { + key: "", + lockId: "", + writeLock: false, + priority: 0, + fenceToken: 0, + leaseExpiresAt: 0, + acquiredAt: 0, + requestId: "", + requesterInfo: "", + requesterApplication: "", + }; +} + +export const AcquiredLock: MessageFns = { + encode(message: AcquiredLock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.lockId !== "") { + writer.uint32(18).string(message.lockId); + } + if (message.writeLock !== false) { + writer.uint32(24).bool(message.writeLock); + } + if (message.priority !== 0) { + writer.uint32(32).uint32(message.priority); + } + if (message.fenceToken !== 0) { + writer.uint32(40).uint64(message.fenceToken); + } + if (message.leaseExpiresAt !== 0) { + writer.uint32(48).int64(message.leaseExpiresAt); + } + if (message.acquiredAt !== 0) { + writer.uint32(56).int64(message.acquiredAt); + } + if (message.requestId !== "") { + writer.uint32(66).string(message.requestId); + } + if (message.requesterInfo !== "") { + writer.uint32(74).string(message.requesterInfo); + } + if (message.requesterApplication !== "") { + writer.uint32(82).string(message.requesterApplication); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AcquiredLock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcquiredLock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.lockId = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.writeLock = reader.bool(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.priority = reader.uint32(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.fenceToken = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.leaseExpiresAt = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.acquiredAt = longToNumber(reader.int64()); + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.requestId = reader.string(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.requesterInfo = reader.string(); + continue; + } + case 10: { + if (tag !== 82) { + break; + } + + message.requesterApplication = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AcquiredLock { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + lockId: isSet(object.lockId) + ? globalThis.String(object.lockId) + : isSet(object.lock_id) + ? globalThis.String(object.lock_id) + : "", + writeLock: isSet(object.writeLock) + ? globalThis.Boolean(object.writeLock) + : isSet(object.write_lock) + ? globalThis.Boolean(object.write_lock) + : false, + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + fenceToken: isSet(object.fenceToken) + ? globalThis.Number(object.fenceToken) + : isSet(object.fence_token) + ? globalThis.Number(object.fence_token) + : 0, + leaseExpiresAt: isSet(object.leaseExpiresAt) + ? globalThis.Number(object.leaseExpiresAt) + : isSet(object.lease_expires_at) + ? globalThis.Number(object.lease_expires_at) + : 0, + acquiredAt: isSet(object.acquiredAt) + ? globalThis.Number(object.acquiredAt) + : isSet(object.acquired_at) + ? globalThis.Number(object.acquired_at) + : 0, + requestId: isSet(object.requestId) + ? globalThis.String(object.requestId) + : isSet(object.request_id) + ? globalThis.String(object.request_id) + : "", + requesterInfo: isSet(object.requesterInfo) + ? globalThis.String(object.requesterInfo) + : isSet(object.requester_info) + ? globalThis.String(object.requester_info) + : "", + requesterApplication: isSet(object.requesterApplication) + ? globalThis.String(object.requesterApplication) + : isSet(object.requester_application) + ? globalThis.String(object.requester_application) + : "", + }; + }, + + toJSON(message: AcquiredLock): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.lockId !== "") { + obj.lockId = message.lockId; + } + if (message.writeLock !== false) { + obj.writeLock = message.writeLock; + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + if (message.fenceToken !== 0) { + obj.fenceToken = Math.round(message.fenceToken); + } + if (message.leaseExpiresAt !== 0) { + obj.leaseExpiresAt = Math.round(message.leaseExpiresAt); + } + if (message.acquiredAt !== 0) { + obj.acquiredAt = Math.round(message.acquiredAt); + } + if (message.requestId !== "") { + obj.requestId = message.requestId; + } + if (message.requesterInfo !== "") { + obj.requesterInfo = message.requesterInfo; + } + if (message.requesterApplication !== "") { + obj.requesterApplication = message.requesterApplication; + } + return obj; + }, + + create(base?: DeepPartial): AcquiredLock { + return AcquiredLock.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AcquiredLock { + const message = createBaseAcquiredLock(); + message.key = object.key ?? ""; + message.lockId = object.lockId ?? ""; + message.writeLock = object.writeLock ?? false; + message.priority = object.priority ?? 0; + message.fenceToken = object.fenceToken ?? 0; + message.leaseExpiresAt = object.leaseExpiresAt ?? 0; + message.acquiredAt = object.acquiredAt ?? 0; + message.requestId = object.requestId ?? ""; + message.requesterInfo = object.requesterInfo ?? ""; + message.requesterApplication = object.requesterApplication ?? ""; + return message; + }, +}; + +function createBaseListAcquiredLocksResponse(): ListAcquiredLocksResponse { + return { success: false, locks: [] }; +} + +export const ListAcquiredLocksResponse: MessageFns = { + encode(message: ListAcquiredLocksResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + for (const v of message.locks) { + AcquiredLock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAcquiredLocksResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAcquiredLocksResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.locks.push(AcquiredLock.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAcquiredLocksResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + locks: globalThis.Array.isArray(object?.locks) ? object.locks.map((e: any) => AcquiredLock.fromJSON(e)) : [], + }; + }, + + toJSON(message: ListAcquiredLocksResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.locks?.length) { + obj.locks = message.locks.map((e) => AcquiredLock.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListAcquiredLocksResponse { + return ListAcquiredLocksResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListAcquiredLocksResponse { + const message = createBaseListAcquiredLocksResponse(); + message.success = object.success ?? false; + message.locks = object.locks?.map((e) => AcquiredLock.fromPartial(e)) || []; + return message; + }, +}; + +/** WaymakerService defines a gRPC service for managing distributed locks. */ +export type WaymakerServiceService = typeof WaymakerServiceService; +export const WaymakerServiceService = { + /** + * Lock attempts to acquire a lock based on the provided LockRequest. + * The response is a stream of LockEvent messages that provide updates + * on the status of the lock acquisition. + */ + lock: { + path: "/waymaker.WaymakerService/Lock" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: LockRequest): Buffer => Buffer.from(LockRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LockRequest => LockRequest.decode(value), + responseSerialize: (value: LockEvent): Buffer => Buffer.from(LockEvent.encode(value).finish()), + responseDeserialize: (value: Buffer): LockEvent => LockEvent.decode(value), + }, + /** + * ReadLock attempts to acquire a read lock, which allows multiple readers + * but no writers to hold the lock simultaneously. The response is a stream + * of LockEvent messages that provide updates on the status of the lock acquisition. + */ + readLock: { + path: "/waymaker.WaymakerService/ReadLock" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: LockRequest): Buffer => Buffer.from(LockRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LockRequest => LockRequest.decode(value), + responseSerialize: (value: LockEvent): Buffer => Buffer.from(LockEvent.encode(value).finish()), + responseDeserialize: (value: Buffer): LockEvent => LockEvent.decode(value), + }, + /** + * UnLock releases a previously acquired lock based on the provided UnLockRequest. + * The response is an UnLockResponse indicating the success or failure of the operation. + */ + unLock: { + path: "/waymaker.WaymakerService/UnLock" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: UnLockRequest): Buffer => Buffer.from(UnLockRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UnLockRequest => UnLockRequest.decode(value), + responseSerialize: (value: UnLockResponse): Buffer => Buffer.from(UnLockResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UnLockResponse => UnLockResponse.decode(value), + }, + /** + * LeaseStatus retrieves the current status of a lock lease based on the provided + * LeaseStatusRequest. The response is a LeaseStatusResponse containing details + * about the lease. + */ + leaseStatus: { + path: "/waymaker.WaymakerService/LeaseStatus" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: LeaseStatusRequest): Buffer => Buffer.from(LeaseStatusRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): LeaseStatusRequest => LeaseStatusRequest.decode(value), + responseSerialize: (value: LeaseStatusResponse): Buffer => Buffer.from(LeaseStatusResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): LeaseStatusResponse => LeaseStatusResponse.decode(value), + }, + /** + * ExtendLease extends the lease of an already acquired lock based on the provided + * ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + * or failure of the operation and the updated lease information. + */ + extendLease: { + path: "/waymaker.WaymakerService/ExtendLease" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ExtendLeaseRequest): Buffer => Buffer.from(ExtendLeaseRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ExtendLeaseRequest => ExtendLeaseRequest.decode(value), + responseSerialize: (value: ExtendLeaseResponse): Buffer => Buffer.from(ExtendLeaseResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ExtendLeaseResponse => ExtendLeaseResponse.decode(value), + }, + /** + * MultiLock acquires N locks atomically — all keys are granted or none are. + * The server sorts keys lexicographically to guarantee deadlock-free + * ordering between any two MultiLock callers (without this, callers asking + * for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + * applies to the whole batch as a single deadline, not per key. On any + * failure the server releases every key it already acquired in this batch + * before returning. Returns a unary response — no streaming. + */ + multiLock: { + path: "/waymaker.WaymakerService/MultiLock" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: MultiLockRequest): Buffer => Buffer.from(MultiLockRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): MultiLockRequest => MultiLockRequest.decode(value), + responseSerialize: (value: MultiLockResponse): Buffer => Buffer.from(MultiLockResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): MultiLockResponse => MultiLockResponse.decode(value), + }, + /** + * ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + * request (the node that owns each key via the consistent-hash ring). It is a + * read-only operator/introspection surface (waymaker-ctl `locks list`); it does + * NOT include waiters. An optional `key_prefix` filters the result server-side. + * In a multi-node cluster, call it on each node to see the full picture, since + * each node only holds the locks for the keys it owns. + */ + listAcquiredLocks: { + path: "/waymaker.WaymakerService/ListAcquiredLocks" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListAcquiredLocksRequest): Buffer => + Buffer.from(ListAcquiredLocksRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListAcquiredLocksRequest => ListAcquiredLocksRequest.decode(value), + responseSerialize: (value: ListAcquiredLocksResponse): Buffer => + Buffer.from(ListAcquiredLocksResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListAcquiredLocksResponse => ListAcquiredLocksResponse.decode(value), + }, +} as const; + +export interface WaymakerServiceServer extends UntypedServiceImplementation { + /** + * Lock attempts to acquire a lock based on the provided LockRequest. + * The response is a stream of LockEvent messages that provide updates + * on the status of the lock acquisition. + */ + lock: handleServerStreamingCall; + /** + * ReadLock attempts to acquire a read lock, which allows multiple readers + * but no writers to hold the lock simultaneously. The response is a stream + * of LockEvent messages that provide updates on the status of the lock acquisition. + */ + readLock: handleServerStreamingCall; + /** + * UnLock releases a previously acquired lock based on the provided UnLockRequest. + * The response is an UnLockResponse indicating the success or failure of the operation. + */ + unLock: handleUnaryCall; + /** + * LeaseStatus retrieves the current status of a lock lease based on the provided + * LeaseStatusRequest. The response is a LeaseStatusResponse containing details + * about the lease. + */ + leaseStatus: handleUnaryCall; + /** + * ExtendLease extends the lease of an already acquired lock based on the provided + * ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + * or failure of the operation and the updated lease information. + */ + extendLease: handleUnaryCall; + /** + * MultiLock acquires N locks atomically — all keys are granted or none are. + * The server sorts keys lexicographically to guarantee deadlock-free + * ordering between any two MultiLock callers (without this, callers asking + * for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + * applies to the whole batch as a single deadline, not per key. On any + * failure the server releases every key it already acquired in this batch + * before returning. Returns a unary response — no streaming. + */ + multiLock: handleUnaryCall; + /** + * ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + * request (the node that owns each key via the consistent-hash ring). It is a + * read-only operator/introspection surface (waymaker-ctl `locks list`); it does + * NOT include waiters. An optional `key_prefix` filters the result server-side. + * In a multi-node cluster, call it on each node to see the full picture, since + * each node only holds the locks for the keys it owns. + */ + listAcquiredLocks: handleUnaryCall; +} + +export interface WaymakerServiceClient extends Client { + /** + * Lock attempts to acquire a lock based on the provided LockRequest. + * The response is a stream of LockEvent messages that provide updates + * on the status of the lock acquisition. + */ + lock(request: LockRequest, options?: Partial): ClientReadableStream; + lock(request: LockRequest, metadata?: Metadata, options?: Partial): ClientReadableStream; + /** + * ReadLock attempts to acquire a read lock, which allows multiple readers + * but no writers to hold the lock simultaneously. The response is a stream + * of LockEvent messages that provide updates on the status of the lock acquisition. + */ + readLock(request: LockRequest, options?: Partial): ClientReadableStream; + readLock(request: LockRequest, metadata?: Metadata, options?: Partial): ClientReadableStream; + /** + * UnLock releases a previously acquired lock based on the provided UnLockRequest. + * The response is an UnLockResponse indicating the success or failure of the operation. + */ + unLock( + request: UnLockRequest, + callback: (error: ServiceError | null, response: UnLockResponse) => void, + ): ClientUnaryCall; + unLock( + request: UnLockRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UnLockResponse) => void, + ): ClientUnaryCall; + unLock( + request: UnLockRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UnLockResponse) => void, + ): ClientUnaryCall; + /** + * LeaseStatus retrieves the current status of a lock lease based on the provided + * LeaseStatusRequest. The response is a LeaseStatusResponse containing details + * about the lease. + */ + leaseStatus( + request: LeaseStatusRequest, + callback: (error: ServiceError | null, response: LeaseStatusResponse) => void, + ): ClientUnaryCall; + leaseStatus( + request: LeaseStatusRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: LeaseStatusResponse) => void, + ): ClientUnaryCall; + leaseStatus( + request: LeaseStatusRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: LeaseStatusResponse) => void, + ): ClientUnaryCall; + /** + * ExtendLease extends the lease of an already acquired lock based on the provided + * ExtendLeaseRequest. The response is an ExtendLeaseResponse indicating the success + * or failure of the operation and the updated lease information. + */ + extendLease( + request: ExtendLeaseRequest, + callback: (error: ServiceError | null, response: ExtendLeaseResponse) => void, + ): ClientUnaryCall; + extendLease( + request: ExtendLeaseRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ExtendLeaseResponse) => void, + ): ClientUnaryCall; + extendLease( + request: ExtendLeaseRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ExtendLeaseResponse) => void, + ): ClientUnaryCall; + /** + * MultiLock acquires N locks atomically — all keys are granted or none are. + * The server sorts keys lexicographically to guarantee deadlock-free + * ordering between any two MultiLock callers (without this, callers asking + * for (k1,k2) and (k2,k1) could deadlock under contention). `max_wait_period` + * applies to the whole batch as a single deadline, not per key. On any + * failure the server releases every key it already acquired in this batch + * before returning. Returns a unary response — no streaming. + */ + multiLock( + request: MultiLockRequest, + callback: (error: ServiceError | null, response: MultiLockResponse) => void, + ): ClientUnaryCall; + multiLock( + request: MultiLockRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: MultiLockResponse) => void, + ): ClientUnaryCall; + multiLock( + request: MultiLockRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: MultiLockResponse) => void, + ): ClientUnaryCall; + /** + * ListAcquiredLocks returns every lock CURRENTLY HELD on the node serving the + * request (the node that owns each key via the consistent-hash ring). It is a + * read-only operator/introspection surface (waymaker-ctl `locks list`); it does + * NOT include waiters. An optional `key_prefix` filters the result server-side. + * In a multi-node cluster, call it on each node to see the full picture, since + * each node only holds the locks for the keys it owns. + */ + listAcquiredLocks( + request: ListAcquiredLocksRequest, + callback: (error: ServiceError | null, response: ListAcquiredLocksResponse) => void, + ): ClientUnaryCall; + listAcquiredLocks( + request: ListAcquiredLocksRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListAcquiredLocksResponse) => void, + ): ClientUnaryCall; + listAcquiredLocks( + request: ListAcquiredLocksRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListAcquiredLocksResponse) => void, + ): ClientUnaryCall; +} + +export const WaymakerServiceClient = makeGenericClientConstructor( + WaymakerServiceService, + "waymaker.WaymakerService", +) as unknown as { + new (address: string, credentials: ChannelCredentials, options?: Partial): WaymakerServiceClient; + service: typeof WaymakerServiceService; + serviceName: string; +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/genpb/waymaker_streams.ts b/ts/src/genpb/waymaker_streams.ts new file mode 100644 index 0000000..f69c362 --- /dev/null +++ b/ts/src/genpb/waymaker_streams.ts @@ -0,0 +1,23317 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.8 +// protoc v7.34.1 +// source: waymaker_streams.proto + +/* eslint-disable */ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; +import { + type CallOptions, + type ChannelCredentials, + Client, + type ClientOptions, + type ClientReadableStream, + type ClientUnaryCall, + type ClientWritableStream, + type handleClientStreamingCall, + type handleServerStreamingCall, + type handleUnaryCall, + makeGenericClientConstructor, + type Metadata, + type ServiceError, + type UntypedServiceImplementation, +} from "@grpc/grpc-js"; + +export const protobufPackage = "waymaker.streams"; + +export enum OnDropPolicy { + ON_DROP_HALT = 0, + ON_DROP_SKIP_TO_FIRST_AVAILABLE = 1, +} + +export function onDropPolicyFromJSON(object: any): OnDropPolicy { + switch (object) { + case 0: + case "ON_DROP_HALT": + return OnDropPolicy.ON_DROP_HALT; + case 1: + case "ON_DROP_SKIP_TO_FIRST_AVAILABLE": + return OnDropPolicy.ON_DROP_SKIP_TO_FIRST_AVAILABLE; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum OnDropPolicy"); + } +} + +export function onDropPolicyToJSON(object: OnDropPolicy): string { + switch (object) { + case OnDropPolicy.ON_DROP_HALT: + return "ON_DROP_HALT"; + case OnDropPolicy.ON_DROP_SKIP_TO_FIRST_AVAILABLE: + return "ON_DROP_SKIP_TO_FIRST_AVAILABLE"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum OnDropPolicy"); + } +} + +export enum DeliveryPolicyType { + DELIVERY_ALL = 0, + DELIVERY_LAST = 1, + DELIVERY_BY_START_SEQ = 2, + DELIVERY_BY_START_TIME = 3, +} + +export function deliveryPolicyTypeFromJSON(object: any): DeliveryPolicyType { + switch (object) { + case 0: + case "DELIVERY_ALL": + return DeliveryPolicyType.DELIVERY_ALL; + case 1: + case "DELIVERY_LAST": + return DeliveryPolicyType.DELIVERY_LAST; + case 2: + case "DELIVERY_BY_START_SEQ": + return DeliveryPolicyType.DELIVERY_BY_START_SEQ; + case 3: + case "DELIVERY_BY_START_TIME": + return DeliveryPolicyType.DELIVERY_BY_START_TIME; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum DeliveryPolicyType"); + } +} + +export function deliveryPolicyTypeToJSON(object: DeliveryPolicyType): string { + switch (object) { + case DeliveryPolicyType.DELIVERY_ALL: + return "DELIVERY_ALL"; + case DeliveryPolicyType.DELIVERY_LAST: + return "DELIVERY_LAST"; + case DeliveryPolicyType.DELIVERY_BY_START_SEQ: + return "DELIVERY_BY_START_SEQ"; + case DeliveryPolicyType.DELIVERY_BY_START_TIME: + return "DELIVERY_BY_START_TIME"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum DeliveryPolicyType"); + } +} + +/** + * Identifies which kind of state change happened. The full + * WatchEvent carries one detail oneof matching this type. + */ +export enum WatchEventType { + WATCH_UNKNOWN = 0, + WATCH_STREAM_CREATED = 1, + WATCH_STREAM_DELETED = 2, + WATCH_STREAM_UPDATED = 3, + WATCH_CONSUMER_CREATED = 4, + WATCH_CONSUMER_DELETED = 5, + /** + * WATCH_STREAM_AUTHORITY_CHANGED - Phase 3 — emitted on every apply of StreamAuthorityClaim or + * ClearStreamAuthority. `claimant_node_id == 0` in the detail + * distinguishes a clear from a set (since 0 isn't a valid node + * id). + */ + WATCH_STREAM_AUTHORITY_CHANGED = 6, +} + +export function watchEventTypeFromJSON(object: any): WatchEventType { + switch (object) { + case 0: + case "WATCH_UNKNOWN": + return WatchEventType.WATCH_UNKNOWN; + case 1: + case "WATCH_STREAM_CREATED": + return WatchEventType.WATCH_STREAM_CREATED; + case 2: + case "WATCH_STREAM_DELETED": + return WatchEventType.WATCH_STREAM_DELETED; + case 3: + case "WATCH_STREAM_UPDATED": + return WatchEventType.WATCH_STREAM_UPDATED; + case 4: + case "WATCH_CONSUMER_CREATED": + return WatchEventType.WATCH_CONSUMER_CREATED; + case 5: + case "WATCH_CONSUMER_DELETED": + return WatchEventType.WATCH_CONSUMER_DELETED; + case 6: + case "WATCH_STREAM_AUTHORITY_CHANGED": + return WatchEventType.WATCH_STREAM_AUTHORITY_CHANGED; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum WatchEventType"); + } +} + +export function watchEventTypeToJSON(object: WatchEventType): string { + switch (object) { + case WatchEventType.WATCH_UNKNOWN: + return "WATCH_UNKNOWN"; + case WatchEventType.WATCH_STREAM_CREATED: + return "WATCH_STREAM_CREATED"; + case WatchEventType.WATCH_STREAM_DELETED: + return "WATCH_STREAM_DELETED"; + case WatchEventType.WATCH_STREAM_UPDATED: + return "WATCH_STREAM_UPDATED"; + case WatchEventType.WATCH_CONSUMER_CREATED: + return "WATCH_CONSUMER_CREATED"; + case WatchEventType.WATCH_CONSUMER_DELETED: + return "WATCH_CONSUMER_DELETED"; + case WatchEventType.WATCH_STREAM_AUTHORITY_CHANGED: + return "WATCH_STREAM_AUTHORITY_CHANGED"; + default: + throw new globalThis.Error("Unrecognized enum value " + object + " for enum WatchEventType"); + } +} + +/** + * `Limits` retention with three optional bounds. Any bound that's + * unset (`*` field omitted) means "no limit on that dimension". + */ +export interface LimitsRetention { + maxAgeMs?: number | undefined; + maxMsgs?: number | undefined; + maxBytes?: + | number + | undefined; + /** + * `false` = block-aligned approximate pruning (default). `true` = + * per-message exact pruning. See STREAMS_SPEC.md §6. + */ + strictLimits: boolean; +} + +export interface WorkQueueRetention { +} + +/** + * `Interest` retention: drop a block once every consumer's + * `ack_floor` has advanced past its `last_seq`. With zero + * consumers, every block is eligible. Block-aligned (not + * per-message) so retention sweeps stay cheap. + */ +export interface InterestRetention { +} + +export interface Retention { + limits?: LimitsRetention | undefined; + workQueue?: WorkQueueRetention | undefined; + interest?: InterestRetention | undefined; +} + +export interface StreamConfigPb { + name: string; + /** Subject patterns this stream accepts. Empty Vec = no filter. */ + subjectsFilter: string[]; + retention: + | Retention + | undefined; + /** Messages per block; 0 = server default (currently 100_000). */ + blockSize: number; + /** Optional per-message size cap; 0 = no cap. */ + maxMsgBytes: number; + /** + * If true, the stream is stored entirely in memory — no redb + * file is created. State survives node failover via the + * existing replication path but a full-cluster restart loses + * it. Matches the NATS JetStream `memory` storage mode. + * Immutable after create. + */ + ephemeral: boolean; + /** + * Cross-stream sources — this stream pulls messages from each + * listed source stream as a tail subscriber and appends them + * locally with provenance headers (`waymaker-source-stream`, + * `waymaker-source-seq`). See `SOURCES_DESIGN.md`. Slice 1 + * accepts at most one entry; the wire is `repeated` for forward + * compatibility with slice 2 (multi-source fan-in). + */ + sources: StreamSourceConfigPb[]; + /** + * Per-subject revision cap. `0` (default) = unbounded — history + * bounded only by stream-level retention. When N > 0, after a + * successful publish, older messages at that subject beyond the + * N most recent are dropped via per-message pruning. Mirrors + * NATS JetStream's MaxMsgsPerSubject. Backs KV's max_revisions. + */ + maxMsgsPerSubject: number; +} + +/** + * One source feeding a sourcing stream. Slice 1 honours only + * `source_stream`; the remaining fields land in slice 2/3. + */ +export interface StreamSourceConfigPb { + sourceStream: string; + /** + * Optional NATS-style filter; empty = pull every subject. + * Honoured since slice 2B. + */ + filterSubject: string; + /** + * Start position. 0/0 = pull from beginning (slice 1 default). + * start_seq honoured since 2C. start_time_ms reserved (rejected). + */ + startSeq: number; + startTimeMs: number; + /** Optional subject rewrite. Slice 3. */ + subjectTransform: + | SubjectTransformPb + | undefined; + /** + * Slice 2F: cap on the initial backfill window. When > 0 AND + * there's no persisted state for this (sourcing, source), the + * tail seeds its watermark at max(0, source.last_seq - + * max_initial_backfill) instead of pulling from seq 1. Once + * there's persisted state (i.e. after the first batch), this + * knob is ignored — the tail resumes from the persisted seq. + * Use 0 (default) for "unbounded" (slice 1 behaviour). + */ + maxInitialBackfill: number; + /** + * Slice 3: behaviour when the source's retention sweep drops + * messages past our last_sourced_seq (we've fallen behind and + * the source no longer has the messages we'd next pull). + * * ON_DROP_HALT (default, 0): tail surfaces a persistent + * error and stops advancing — operator must intervene. + * * ON_DROP_SKIP_TO_FIRST_AVAILABLE (1): tail jumps its + * watermark to source.first_seq - 1 and resumes, with + * a warn event surfaced via last_error for one cycle so + * operators can alert on it. + */ + onDrop: OnDropPolicy; + /** + * Slice 3: optional dead-letter stream. When the tail records + * an error (subject_transform mismatch, append_failed, + * on_drop=halt firing), publish a JSON record describing the + * event to this stream so operators can triage without + * scraping logs. Empty (default) = no DLQ. + */ + dlqStream: string; +} + +export interface SubjectTransformPb { + /** NATS-style: e.g. "events.>" with destination "audit.{{wildcard(1)}}". */ + sourcePattern: string; + destination: string; +} + +export interface StreamStatsPb { + lastSeq: number; + msgCount: number; + bytes: number; + blockCount: number; + /** 0 if there are no blocks (empty stream). */ + firstBlock: number; +} + +export interface MessageHeader { + key: string; + value: string; +} + +export interface MessagePb { + seq: number; + subject: string; + tsMs: number; + headers: MessageHeader[]; + payload: Buffer; + /** + * Delivery attempt count assigned by the consumer at fetch time. + * Populated only for Fetch responses; 0 otherwise. + */ + deliverCount: number; +} + +export interface DeliveryPolicyPb { + type: DeliveryPolicyType; + /** Used only when type == DELIVERY_BY_START_SEQ. */ + startSeq: number; + /** Used only when type == DELIVERY_BY_START_TIME. Wall-clock ms. */ + startTimeMs: number; +} + +export interface ConsumerConfigPb { + name: string; + /** Empty = no filter. */ + filterSubject: string; + deliveryPolicy: + | DeliveryPolicyPb + | undefined; + /** 0 = server default (30s). */ + ackWaitMs: number; + /** 0 = server default (5). */ + maxDeliver: number; + /** Empty = no queue group. */ + deliverGroup: string; + /** + * Phase 2 dead-letter routing. When non-empty, every message + * this consumer drops after `max_deliver` attempts is republished + * into the same stream under this subject. Original metadata is + * preserved as `x-waymaker-dlq-*` headers. Empty = silent drop. + * The stream's `subjects_filter` must accept this subject — + * operators typically reserve a pattern like `dlq.>` and include + * it in the stream's filter. + */ + deadLetterSubject: string; +} + +export interface ConsumerStatePb { + config: ConsumerConfigPb | undefined; + ackFloor: number; + lastDelivered: number; + createdAtMs: number; + redeliveredDropped: number; +} + +export interface CreateStreamRequest { + config: StreamConfigPb | undefined; +} + +export interface CreateStreamResponse { + success: boolean; + /** "ok" | "already_exists" | "invalid_config" | "internal" */ + resultCode: string; + message: string; +} + +export interface DeleteStreamRequest { + name: string; +} + +export interface DeleteStreamResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; +} + +export interface GetStreamInfoRequest { + name: string; +} + +export interface GetStreamInfoResponse { + success: boolean; + /** "ok" | "no_such_stream" */ + resultCode: string; + message: string; + config: StreamConfigPb | undefined; + stats: + | StreamStatsPb + | undefined; + /** + * Phase 3 — if a `stream_authority` override is active for this + * stream, the routing claimant + the fence epoch at which it was + * committed. Unset when the stream routes via the ring's hash + * owner. Useful for operators auditing "why is this stream on + * node N when the ring says M?". + */ + authorityOverride?: + | StreamAuthorityOverride + | undefined; + /** + * The ring's hash owner for this stream (ignoring any override). + * When `authority_override` is set and `claimant_node_id != + * ring_owner_node_id`, the override is actively redirecting + * routing. 0 = the response node couldn't compute the ring owner + * (e.g. mid-membership-transition). + */ + ringOwnerNodeId: number; + /** + * Phase 3 — `true` when an operator has pinned this stream + * (auto-GC will not retire its override even when redundant). + */ + pinned: boolean; + /** + * Per-source tail state. Populated when this stream has + * `sources` set in its config and the request lands on the + * sourcing primary. Empty otherwise. + */ + sourcesStatus: SourceStatusPb[]; +} + +export interface SourceStatusPb { + sourceStream: string; + /** Last seq successfully appended to the sourcing stream. */ + lastSourcedSeq: number; + /** Total messages pulled since the tail task started. */ + pulledTotal: number; + /** Most recent error message; empty when healthy. */ + lastError: string; + lastErrorTsMs: number; +} + +export interface StreamAuthorityOverride { + claimantNodeId: number; + fenceEpoch: number; +} + +export interface ClearStreamAuthorityRequest { + stream: string; +} + +export interface ClearStreamAuthorityResponse { + success: boolean; + /** "ok" | "no_leader" | "internal" */ + resultCode: string; + message: string; +} + +export interface ListStreamAuthorityOverridesRequest { +} + +export interface ListStreamAuthorityOverridesResponse { + success: boolean; + resultCode: string; + message: string; + entries: AuthorityOverrideEntry[]; +} + +export interface AuthorityOverrideEntry { + stream: string; + claimantNodeId: number; + fenceEpoch: number; +} + +export interface SetStreamPinnedRequest { + stream: string; + pinned: boolean; +} + +export interface SetStreamPinnedResponse { + success: boolean; + /** "ok" | "no_leader" | "internal" */ + resultCode: string; + message: string; +} + +export interface ListStreamsRequest { +} + +export interface ListStreamsResponse { + names: string[]; +} + +export interface GetStreamSourcesRequest { +} + +export interface GetStreamSourcesResponse { + success: boolean; + /** "ok" */ + resultCode: string; + message: string; + entries: GetStreamSourcesEntry[]; +} + +export interface GetStreamSourcesEntry { + sourcingStream: string; + sourceStream: string; + lastSourcedSeq: number; + pulledTotal: number; + lastError: string; + lastErrorTsMs: number; +} + +/** + * Partial-update of the mutable subset of a stream's config. Fields + * that are present are applied; absent fields leave the existing + * on-disk value unchanged. Setting a Limits bound's optional to 0 is + * a valid way to *clear* that bound (equivalent to "no limit"); to + * leave it unchanged, omit the field. Immutable fields (name, + * subjects_filter, block_size, retention policy type) are not in + * this message — changing them requires a delete + recreate. + */ +export interface UpdateStreamRequest { + name: string; + maxAgeMs?: number | undefined; + maxMsgs?: number | undefined; + maxBytes?: number | undefined; + maxMsgBytes?: number | undefined; + strictLimits?: boolean | undefined; +} + +export interface UpdateStreamResponse { + success: boolean; + /** "ok" | "no_such_stream" | "invalid_config" | "immutable_field" | "internal" */ + resultCode: string; + message: string; + /** + * Effective config after the update — what the next GetStreamInfo + * would return. Useful for clients that want to confirm what + * landed without a follow-up round trip. + */ + config: + | StreamConfigPb + | undefined; + /** + * Number of messages the primary pruned to bring stats under the + * new bounds. 0 = no prune (raise-only update, or already under). + * For drift monitoring. + */ + pruned: number; +} + +export interface PublishRequest { + stream: string; + subject: string; + payload: Buffer; + headers: MessageHeader[]; + /** 0 = server uses wall clock. */ + tsMs: number; + /** + * Optimistic-concurrency hint. When set, the server only + * commits the publish if the latest seq at `subject` matches + * `expected_last_seq` (use 0 to require "subject has never been + * published to"). On mismatch the response carries + * `result_code="wrong_revision"` and `seq` = the current actual + * last seq at the subject. Absent / unset = no check. + */ + expectedLastSeq?: number | undefined; +} + +export interface PublishResponse { + success: boolean; + /** "ok" | "no_such_stream" | "subject_rejected" | "oversize" | "wrong_revision" | "internal" */ + resultCode: string; + message: string; + seq: number; +} + +export interface FetchRequest { + stream: string; + consumer: string; + batchSize: number; +} + +export interface FetchResponse { + success: boolean; + /** "ok" | "no_such_stream" | "no_such_consumer" | "internal" */ + resultCode: string; + message: string; + messages: MessagePb[]; +} + +export interface AckRequest { + stream: string; + consumer: string; + seq: number; +} + +export interface AckResponse { + success: boolean; + /** "ok" | "no_such_stream" | "no_such_consumer" | "internal" */ + resultCode: string; + message: string; +} + +export interface NakRequest { + stream: string; + consumer: string; + seq: number; + /** Wall-clock ms to defer redelivery. 0 = eligible immediately. */ + delayMs: number; +} + +export interface NakResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface TermRequest { + stream: string; + consumer: string; + seq: number; +} + +export interface TermResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface InProgressRequest { + stream: string; + consumer: string; + seq: number; +} + +export interface InProgressResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SubscribeRequest { + stream: string; + consumer: string; + /** + * How many messages per server-side fetch. Smaller batches + * trade throughput for finer-grained per-message latency. 0 + * means use the server default (16). + */ + batchSize: number; + /** + * If true, the server tears down the subscription after the + * first fetch returns 0 messages (after the initial backlog + * drains). Useful for one-shot replays. Default false — keep + * the stream open indefinitely and re-fetch on new appends. + */ + stopWhenEmpty: boolean; +} + +/** + * Server-streamed events on a Subscribe stream. Currently one + * variant — a delivered message — with a tail end-of-stream + * signal if the client requested `stop_when_empty`. + */ +export interface SubscribeEvent { + message?: MessagePb | undefined; + stopped?: SubscribeStopped | undefined; +} + +export interface SubscribeStopped { + reason: string; +} + +export interface CreateConsumerRequest { + stream: string; + config: ConsumerConfigPb | undefined; +} + +export interface CreateConsumerResponse { + success: boolean; + /** "ok" | "no_such_stream" | "already_exists" | "invalid_config" | "internal" */ + resultCode: string; + message: string; +} + +export interface DeleteConsumerRequest { + stream: string; + consumer: string; +} + +export interface DeleteConsumerResponse { + success: boolean; + /** "ok" | "no_such_stream" | "no_such_consumer" | "internal" */ + resultCode: string; + message: string; +} + +export interface ListConsumersRequest { + stream: string; +} + +export interface ListConsumersResponse { + success: boolean; + /** "ok" | "no_such_stream" */ + resultCode: string; + message: string; + consumers: ConsumerStatePb[]; +} + +export interface GetConsumerInfoRequest { + stream: string; + consumer: string; +} + +export interface GetConsumerInfoResponse { + success: boolean; + /** "ok" | "no_such_stream" | "no_such_consumer" */ + resultCode: string; + message: string; + consumer: ConsumerStatePb | undefined; +} + +export interface TransferStreamRequest { + name: string; +} + +/** + * One chunk of redb bytes plus end-of-stream signalling. The body is + * either `data` (a chunk of raw bytes — order-preserving via gRPC's + * stream ordering) or `summary` (the final marker carrying totals so + * the receiver can sanity-check what it got). Implementations should + * stream multiple `data` chunks followed by exactly one `summary`. + */ +export interface TransferStreamChunk { + data?: Buffer | undefined; + summary?: TransferStreamSummary | undefined; +} + +export interface TransferStreamSummary { + totalBytes: number; + /** + * Last seq seen by the source at the moment of transfer — the + * receiver re-opens the file and verifies its stats match, surfacing + * any transfer corruption as a load failure. + */ + streamLastSeq: number; +} + +export interface MigrateStreamRequest { + /** Stream to acquire. */ + name: string; + /** + * Node ID currently holding the data. The receiver opens a + * `TransferStream` against this node via the existing proxy channel + * pool. Must be a current cluster member. + */ + sourceNodeId: number; +} + +export interface MigrateStreamResponse { + success: boolean; + /** "ok" | "source_busy" | "source_unreachable" | "already_exists" | "transfer_corrupted" | "internal" */ + resultCode: string; + message: string; + totalBytes: number; + streamLastSeq: number; +} + +export interface GetClusterStreamStatsRequest { + /** + * When set, also include per-stream stats (msg_count, bytes, + * last_seq) for every stream on every node. Without this the + * response carries only per-node aggregates — much smaller, and + * sufficient for skew-based planning. + */ + includePerStream: boolean; + /** + * Internal flag set on the fan-out sub-calls. When `true`, the + * receiving node skips fanning out to peers and reports only its + * own local registry. The orchestrator's outermost call leaves + * this `false` so a single round-trip from an operator pulls the + * whole cluster's view. Mirrors the lock proxy's `iteration` cap. + */ + localOnly: boolean; +} + +/** One stream's stats as seen by its primary node. */ +export interface PerStreamStats { + name: string; + ownerNodeId: number; + msgCount: number; + bytes: number; + lastSeq: number; +} + +/** + * Per-node summary. Bytes/msg counts are summed across the node's + * local streams. + */ +export interface PerNodeSummary { + nodeId: number; + streamCount: number; + totalMsgCount: number; + totalBytes: number; + /** + * "ok" if the node responded; "unreachable" / "node_standby" / + * "internal" otherwise. The aggregator still emits a row per + * member node so the operator can see which nodes failed to report. + */ + status: string; +} + +export interface GetClusterStreamStatsResponse { + success: boolean; + /** "ok" | "no_leader" | "internal" */ + resultCode: string; + message: string; + nodes: PerNodeSummary[]; + /** Populated when the request set `include_per_stream`. */ + streams: PerStreamStats[]; + /** + * Cluster-wide totals + skew. `skew_count` = max stream_count - + * min stream_count across responding nodes. `skew_bytes` is the + * same in bytes. Both are 0 for a perfectly-balanced cluster. + */ + totalStreamCount: number; + totalMsgCount: number; + totalBytes: number; + skewCount: number; + skewBytes: number; +} + +export interface RebalancePlanEntry { + name: string; + targetNodeId: number; +} + +export interface RebalanceStreamsRequest { + plan: RebalancePlanEntry[]; + /** + * Per-step `MigrateStream` timeout, in milliseconds. 0 = server + * default (currently 30s). + */ + perStepTimeoutMs: number; +} + +export interface RebalanceStepOutcome { + name: string; + targetNodeId: number; + success: boolean; + /** mirrors MigrateStream codes + "skipped_same_node" / "no_source" */ + resultCode: string; + message: string; +} + +export interface RebalanceStreamsResponse { + /** true iff every step succeeded */ + success: boolean; + /** "ok" | "partial" | "no_plan" | "internal" */ + resultCode: string; + message: string; + steps: RebalanceStepOutcome[]; +} + +/** + * Currently no filters. A future slice can add subject / name + * patterns; today every watcher sees every event the node emits. + */ +export interface WatchStreamsRequest { +} + +export interface StreamWatchDetail { + name: string; +} + +export interface ConsumerWatchDetail { + stream: string; + consumer: string; +} + +/** + * Detail carried on WATCH_STREAM_AUTHORITY_CHANGED events. + * `claimant_node_id == 0` + `fence_epoch == 0` means the override + * was cleared (routing reverts to the ring's hash owner); + * otherwise the override is now `(claimant, fence_epoch)`. + */ +export interface AuthorityWatchDetail { + stream: string; + claimantNodeId: number; + fenceEpoch: number; +} + +export interface ReadLatestAtSubjectRequest { + stream: string; + subject: string; +} + +export interface ReadLatestAtSubjectResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; + /** + * Unset when no message has ever been published at this + * subject. Use the presence of `latest` to distinguish + * "subject is empty" from "no such stream" (the latter is in + * result_code). + */ + latest?: MessagePb | undefined; +} + +export interface ListSubjectsByPrefixRequest { + stream: string; + /** Empty prefix matches every subject in the stream. */ + prefix: string; +} + +export interface ListSubjectsByPrefixResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; + subjects: string[]; +} + +export interface ScanExactAtSubjectRequest { + stream: string; + subject: string; + /** + * Start scanning at seq >= `from_seq`. 0 = scan from the + * beginning of the stream. + */ + fromSeq: number; + /** Cap on returned messages. 0 = server default (1000). */ + limit: number; +} + +export interface ScanExactAtSubjectResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; + /** + * Messages at the subject, in seq order. Empty if the subject + * has never been published to, or if the limit returned no + * results in the requested range. + */ + messages: MessagePb[]; +} + +export interface WatchEvent { + type: WatchEventType; + /** + * Server wall-clock at emit time (ms since epoch). Useful for + * ordering across nodes when a client multiplexes watchers. + */ + tsMs: number; + /** + * The watching node's id. For cluster-wide watch built on top of + * per-node streams, the client can deduplicate by (node_id, ts_ms, + * type, detail). + */ + nodeId: number; + stream?: StreamWatchDetail | undefined; + consumer?: ConsumerWatchDetail | undefined; + authority?: + | AuthorityWatchDetail + | undefined; + /** + * Set when this watcher fell behind the server's broadcast buffer + * and missed events. The receiver should treat this as an + * explicit "you missed N events" signal — typically by re-listing + * the cluster to catch back up. After this event, the stream + * continues with fresh events; client need not reconnect. + */ + laggedCount: number; +} + +/** One pending-delivery entry shipped with a replication snapshot. */ +export interface PendingDeliveryPb { + seq: number; + deliveredAtMs: number; + deliverCount: number; +} + +/** + * Full snapshot of one consumer's state at the moment the primary + * committed a fetch/ack/create. Includes the immutable config (so a + * secondary that has never seen this consumer can reconstruct it + * from this message alone), the floor/last_delivered counters, the + * active pending set, the create-time wall-clock, and the running + * `redelivered_dropped` total. + */ +export interface ConsumerStateSnapshot { + stream: string; + config: ConsumerConfigPb | undefined; + ackFloor: number; + lastDelivered: number; + createdAtMs: number; + redeliveredDropped: number; + pending: PendingDeliveryPb[]; + /** + * Whether this snapshot represents a deleted consumer — secondaries + * remove the (stream, consumer) entry from their replica store + * rather than overwriting it. + */ + tombstone: boolean; +} + +export interface ReplicateConsumerStateRequest { + snapshot: ConsumerStateSnapshot | undefined; +} + +export interface ReplicateConsumerStateResponse { + success: boolean; + /** "ok" | "internal" */ + resultCode: string; + message: string; +} + +/** + * One snapshot of a source-tail's persisted progress, pushed from + * the primary to each secondary after each successful batch. + * `tombstone=true` signals "remove this entry" — sent when the + * sourcing stream is deleted so secondaries don't keep stale rows + * they might adopt later. + */ +export interface SourceTailStateSnapshot { + sourcingStream: string; + sourceStream: string; + lastSourcedSeq: number; + pulledTotal: number; + updatedTsMs: number; + tombstone: boolean; +} + +export interface ReplicateSourceTailStateRequest { + snapshot: SourceTailStateSnapshot | undefined; +} + +export interface ReplicateSourceTailStateResponse { + success: boolean; + /** "ok" | "internal" */ + resultCode: string; + message: string; +} + +export interface ReplicateStreamCreateRequest { + /** + * Same shape as CreateStreamRequest's config — the secondary + * opens an identical stream in its replica registry so subsequent + * ReplicateMessage calls land in a config-matched file. + */ + config: StreamConfigPb | undefined; +} + +export interface ReplicateStreamCreateResponse { + success: boolean; + /** "ok" | "already_exists" | "invalid_config" | "internal" */ + resultCode: string; + message: string; +} + +export interface ReplicateMessageRequest { + stream: string; + /** + * The seq the primary assigned. The secondary applies the message + * at this exact seq via `apply_replicated_append` (idempotent on + * replay, errors on out-of-order or divergence). + */ + seq: number; + subject: string; + payload: Buffer; + headers: MessageHeader[]; + tsMs: number; +} + +export interface ReplicateMessageResponse { + success: boolean; + /** "ok" | "no_such_stream" | "out_of_order" | "divergence" | "internal" */ + resultCode: string; + message: string; + /** + * Receiver's last_seq AFTER applying — primary uses this to detect + * when a secondary has fallen behind and needs a `MigrateStream` + * re-seed. + */ + receiverLastSeq: number; +} + +export interface ReplicateStreamDeleteRequest { + name: string; +} + +export interface ReplicateStreamDeleteResponse { + success: boolean; + /** "ok" | "internal" */ + resultCode: string; + message: string; +} + +export interface ReplicateTruncateRequest { + stream: string; + /** + * Drop every message with seq < first_seq. Also raises the + * receiver's `last_seq` to at least `first_seq - 1` so a lagging + * secondary aligns with the primary's expected-next-seq for + * subsequent replication pushes. + */ + firstSeq: number; +} + +export interface ReplicateTruncateResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; + /** + * Number of messages the secondary actually dropped (0 on a no-op + * / idempotent re-call). For drift monitoring. + */ + dropped: number; +} + +/** + * Mirror of UpdateStreamRequest sent from the primary to each + * secondary after a successful UpdateStream. Same partial-update + * semantics: absent fields leave the secondary's on-disk value + * unchanged. The accompanying prune (if any) is replicated via the + * existing ReplicateTruncate path — this message carries only the + * config change. + */ +export interface ReplicateStreamUpdateRequest { + name: string; + maxAgeMs?: number | undefined; + maxMsgs?: number | undefined; + maxBytes?: number | undefined; + maxMsgBytes?: number | undefined; + strictLimits?: boolean | undefined; +} + +export interface ReplicateStreamUpdateResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; +} + +export interface ReplicateWorkQueueAckRequest { + stream: string; + seq: number; +} + +export interface ReplicateWorkQueueAckResponse { + success: boolean; + /** "ok" | "no_such_stream" | "internal" */ + resultCode: string; + message: string; + /** + * Whether the secondary's replica had the seq present before the + * delete (the operation is idempotent, so `false` here is normal + * for a retry / late-arriving call). + */ + wasPresent: boolean; +} + +/** + * Metadata about a stored object. Sent back on Get/Info/List; the + * server reconstructs this from the `objm.` message body + * (JSON-encoded) plus the message seq. Treat this message as a + * blob description, not a payload — payload is fetched via + * GetObject. + */ +export interface ObjectInfo { + /** Object name (the part after the bucket prefix). */ + name: string; + /** Total payload bytes across all chunks (after assembly). */ + totalBytes: number; + /** + * Bytes per chunk (last chunk may be smaller). 0 for empty + * objects. + */ + chunkSize: number; + /** + * Number of `objc..` messages required to reconstitute + * the payload. 0 for empty objects. + */ + chunkCount: number; + /** + * SHA-256 of the assembled payload, hex-encoded. Set by the + * server; verified by Get. + */ + sha256: string; + /** Server wall-clock at metadata-publish time (ms since epoch). */ + tsMs: number; + /** + * Opaque headers the client attached at Put time. Preserved + * verbatim on Get. + */ + headers: MessageHeader[]; + /** + * The metadata message's seq number — doubles as the object + * revision id. A second Put with the same name bumps it. + */ + metadataSeq: number; + /** + * Phase 5 — `true` when the object was Put with `dedupe=true`. + * Chunks are stored at `obj_chunk.` (shared across + * objects in the bucket); `false` for legacy `objc..`. + */ + deduped: boolean; +} + +export interface PutObjectRequest { + bucket: string; + name: string; + payload: Buffer; + /** Bytes per chunk. 0 = server default (1 MiB). */ + chunkSize: number; + /** Optional headers — preserved verbatim in the metadata blob. */ + headers: MessageHeader[]; + /** + * Optional pre-computed SHA-256 hex; the server verifies after + * chunking + before publishing metadata. Empty = the server + * computes its own hash from the payload. + */ + sha256: string; + /** + * Phase 5 cross-object dedupe. When set, each chunk is hashed + * and stored at the content-addressed subject `obj_chunk.`; + * identical content across objects shares storage. Metadata + * records the chunk hashes in order so Get can re-assemble. + * See `waymaker-streams/DEDUPE_DESIGN.md`. + */ + dedupe: boolean; +} + +export interface PutObjectResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" | "sha_mismatch" */ + resultCode: string; + message: string; + info: ObjectInfo | undefined; +} + +/** + * Streaming Put — first frame sets `start`; subsequent frames + * carry `data`. Each non-empty `data` becomes one chunk message + * in seq order. Last frame sets `finish=true` so the server + * commits metadata; closing the stream without `finish=true` + * leaves the upload aborted (orphan chunks). + */ +export interface PutObjectStreamFrame { + start?: PutObjectStart | undefined; + data: Buffer; + finish: boolean; +} + +export interface PutObjectStart { + bucket: string; + name: string; + /** + * Bytes per chunk. 0 = server default. Note: with streaming Put + * the client controls chunk boundaries by frame size — this + * field is purely metadata-recorded, not used to re-chunk. + */ + chunkSize: number; + headers: MessageHeader[]; + /** + * Optional SHA-256 hex. Server verifies against the running + * hash before committing metadata; mismatch aborts the Put + * (chunks already published become orphan; GC reclaims them). + */ + sha256: string; + /** + * Phase 5 cross-object dedupe. When set, each chunk is hashed + * and stored at the content-addressed subject `obj_chunk.`; + * identical content across objects shares storage. See + * `waymaker-streams/DEDUPE_DESIGN.md`. + */ + dedupe: boolean; +} + +export interface GetObjectRequest { + bucket: string; + name: string; +} + +export interface GetObjectResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" | "sha_mismatch" */ + resultCode: string; + message: string; + info: ObjectInfo | undefined; + payload: Buffer; +} + +/** + * Streaming Get — first frame carries `info` (metadata only, no + * data); subsequent frames carry `data` (one per chunk). + * Final frame sets `done=true`. The server stops streaming on + * the first error; in particular `sha_mismatch` is sent as a + * gRPC Status (Aborted), not as a result_code in a frame. + */ +export interface GetObjectStreamFrame { + info?: ObjectInfo | undefined; + data: Buffer; + done: boolean; +} + +export interface DeleteObjectRequest { + bucket: string; + name: string; +} + +export interface DeleteObjectResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; + /** Tombstone metadata seq, useful for client confirmations. */ + tombstoneSeq: number; +} + +export interface GetObjectInfoRequest { + bucket: string; + name: string; +} + +export interface GetObjectInfoResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "no_such_object" | "internal" */ + resultCode: string; + message: string; + /** + * Unset when the object name has no live metadata (never put, + * or tombstoned). + */ + info?: + | ObjectInfo + | undefined; + /** True if the latest metadata is a tombstone (logical delete). */ + deleted: boolean; +} + +export interface ListObjectsRequest { + bucket: string; + /** + * Optional name prefix filter (no leading `objm.` — pass just + * the object-name prefix). + */ + namePrefix: string; + /** Include tombstoned entries? Default false. */ + includeDeleted: boolean; +} + +export interface ListObjectsResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; + entries: ObjectListEntry[]; +} + +export interface ObjectListEntry { + name: string; + totalBytes: number; + deleted: boolean; +} + +export interface ListObjectRevisionsRequest { + bucket: string; + name: string; + /** Start scanning at metadata seq >= `from_seq`. 0 = beginning. */ + fromSeq: number; + /** Cap on returned revisions. 0 = server default (100). */ + limit: number; +} + +export interface ListObjectRevisionsResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; + revisions: ObjectRevisionEntry[]; +} + +export interface GetObjectRangeRequest { + bucket: string; + name: string; + offset: number; + /** Bytes to return. 0 = whole tail (`total_bytes - offset`). */ + len: number; +} + +export interface GetObjectRangeResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "no_such_object" | "incomplete" | "internal" */ + resultCode: string; + message: string; + /** + * The full object's info (size, hash, etc.). Useful for the + * client to know the total size when paginating. + */ + info: + | ObjectInfo + | undefined; + /** + * Bytes [offset, offset + actual_len). `actual_len` may be less + * than the requested `len` when the range extends past the + * object's end. + */ + actualOffset: number; + payload: Buffer; +} + +export interface ObjectRevisionEntry { + /** Metadata message seq — doubles as the revision id. */ + metadataSeq: number; + /** + * Always present, including for tombstones (where `deleted=true` + * and the other fields fall back to 0/empty). + */ + deleted: boolean; + totalBytes: number; + chunkCount: number; + sha256: string; + tsMs: number; +} + +export interface KvCreateBucketRequest { + bucket: string; + /** 0 = unbounded */ + maxBytes: number; + /** 0 = no per-value cap */ + maxValueSize: number; + /** + * Bucket-level TTL (ms). 0 = no time-based eviction. + * Bucket-level TTL is independent of per-key TTL set via KvPut. + */ + maxAgeMs: number; + ephemeral: boolean; +} + +export interface KvCreateBucketResponse { + success: boolean; + /** "ok" | "already_exists" | "invalid_config" | "internal" */ + resultCode: string; + message: string; +} + +export interface KvDeleteBucketRequest { + bucket: string; +} + +export interface KvDeleteBucketResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; +} + +export interface KvPutRequest { + bucket: string; + key: string; + value: Buffer; + /** Per-key TTL in milliseconds. 0 = no TTL. */ + ttlMs: number; +} + +export interface KvCreateRequest { + bucket: string; + key: string; + value: Buffer; + ttlMs: number; +} + +export interface KvUpdateRequest { + bucket: string; + key: string; + value: Buffer; + /** + * The revision the caller believes is current. Server returns + * wrong_revision if mismatch. + */ + expectedRevision: number; + ttlMs: number; +} + +export interface KvPutResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "wrong_revision" | "invalid_key" | "internal" */ + resultCode: string; + message: string; + /** + * Assigned revision (stream sequence) of the newly-written + * value. On wrong_revision, this is the *current* server-side + * revision the caller can retry against. + */ + revision: number; +} + +export interface KvGetRequest { + bucket: string; + key: string; +} + +export interface KvGetResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; + /** Unset when the key has no value or is tombstoned. */ + entry?: KvEntry | undefined; +} + +export interface KvEntry { + value: Buffer; + revision: number; + tsMs: number; +} + +export interface KvDeleteRequest { + bucket: string; + key: string; +} + +export interface KvDeleteResponse { + success: boolean; + /** "ok" | "no_such_bucket" | "internal" */ + resultCode: string; + message: string; + revision: number; +} + +export interface KvKeysRequest { + bucket: string; +} + +export interface KvKeysResponse { + success: boolean; + resultCode: string; + message: string; + entries: KvKeyEntry[]; +} + +export interface KvKeyEntry { + key: string; + revision: number; + /** True if the latest message at this key is a tombstone. */ + deleted: boolean; +} + +export interface KvHistoryRequest { + bucket: string; + key: string; + /** 0 = from beginning */ + fromRevision: number; + /** 0 = server default */ + limit: number; +} + +export interface KvHistoryResponse { + success: boolean; + resultCode: string; + message: string; + entries: KvHistoryEntry[]; +} + +export interface KvHistoryEntry { + value: Buffer; + revision: number; + tsMs: number; + deleted: boolean; +} + +export interface KvTouchRequest { + bucket: string; + key: string; + ttlMs: number; +} + +export interface KvWatchRequest { + bucket: string; + /** + * Empty = watch every key in the bucket. Non-empty = watch only + * this key. + */ + key: string; +} + +export interface KvWatchEvent { + put?: KvPutEvent | undefined; + delete?: KvDeleteEvent | undefined; +} + +export interface KvPutEvent { + key: string; + value: Buffer; + revision: number; + tsMs: number; +} + +export interface KvDeleteEvent { + key: string; + revision: number; + tsMs: number; +} + +export interface CreateHashStoreRequest { + name: string; + maxBytes: number; + ephemeral: boolean; +} + +export interface CreateHashStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteHashStoreRequest { + name: string; +} + +export interface DeleteHashStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HashSetRequest { + bucket: string; + hashKey: string; + field: string; + value: Buffer; +} + +export interface HashSetResponse { + success: boolean; + resultCode: string; + message: string; + revision: number; +} + +export interface HashGetRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashGetResponse { + success: boolean; + resultCode: string; + message: string; + /** Unset when the field has no value or is tombstoned. */ + value?: Buffer | undefined; + revision: number; +} + +export interface HashExistsRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashExistsResponse { + success: boolean; + resultCode: string; + message: string; + exists: boolean; +} + +export interface HashDeleteRequest { + bucket: string; + hashKey: string; + field: string; +} + +export interface HashDeleteResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface HashGetAllRequest { + bucket: string; + hashKey: string; +} + +export interface HashGetAllResponse { + success: boolean; + resultCode: string; + message: string; + entries: HashFieldEntry[]; +} + +export interface HashFieldEntry { + field: string; + value: Buffer; + revision: number; +} + +export interface HashFieldsRequest { + bucket: string; + hashKey: string; +} + +export interface HashFieldsResponse { + success: boolean; + resultCode: string; + message: string; + fields: string[]; +} + +export interface HashLenRequest { + bucket: string; + hashKey: string; +} + +export interface HashLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +export interface CreateSetStoreRequest { + name: string; + maxBytes: number; + ephemeral: boolean; +} + +export interface CreateSetStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteSetStoreRequest { + name: string; +} + +export interface DeleteSetStoreResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetAddRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetAddResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetRemoveRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetRemoveResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface SetIsMemberRequest { + bucket: string; + setKey: string; + member: string; +} + +export interface SetIsMemberResponse { + success: boolean; + resultCode: string; + message: string; + isMember: boolean; +} + +export interface SetMembersRequest { + bucket: string; + setKey: string; +} + +export interface SetMembersResponse { + success: boolean; + resultCode: string; + message: string; + members: string[]; +} + +export interface SetLenRequest { + bucket: string; + setKey: string; +} + +export interface SetLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +export interface CreateQueueRequest { + name: string; + maxBytes: number; + maxMessages: number; + ephemeral: boolean; +} + +export interface CreateQueueResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface DeleteQueueRequest { + name: string; +} + +export interface DeleteQueueResponse { + success: boolean; + resultCode: string; + message: string; +} + +export interface QueuePushRequest { + bucket: string; + value: Buffer; +} + +export interface QueuePushResponse { + success: boolean; + resultCode: string; + message: string; + sequence: number; +} + +export interface QueuePopRequest { + bucket: string; +} + +export interface QueuePopResponse { + success: boolean; + resultCode: string; + message: string; + /** Unset when the queue is empty. */ + value?: Buffer | undefined; +} + +export interface QueueRangeRequest { + bucket: string; + fromSequence: number; + limit: number; +} + +export interface QueueRangeResponse { + success: boolean; + resultCode: string; + message: string; + values: Buffer[]; +} + +export interface QueueLenRequest { + bucket: string; +} + +export interface QueueLenResponse { + success: boolean; + resultCode: string; + message: string; + count: number; +} + +function createBaseLimitsRetention(): LimitsRetention { + return { maxAgeMs: undefined, maxMsgs: undefined, maxBytes: undefined, strictLimits: false }; +} + +export const LimitsRetention: MessageFns = { + encode(message: LimitsRetention, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.maxAgeMs !== undefined) { + writer.uint32(8).uint64(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + writer.uint32(16).uint64(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + writer.uint32(24).uint64(message.maxBytes); + } + if (message.strictLimits !== false) { + writer.uint32(32).bool(message.strictLimits); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LimitsRetention { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLimitsRetention(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.maxAgeMs = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxMsgs = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.strictLimits = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LimitsRetention { + return { + maxAgeMs: isSet(object.maxAgeMs) + ? globalThis.Number(object.maxAgeMs) + : isSet(object.max_age_ms) + ? globalThis.Number(object.max_age_ms) + : undefined, + maxMsgs: isSet(object.maxMsgs) + ? globalThis.Number(object.maxMsgs) + : isSet(object.max_msgs) + ? globalThis.Number(object.max_msgs) + : undefined, + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : undefined, + strictLimits: isSet(object.strictLimits) + ? globalThis.Boolean(object.strictLimits) + : isSet(object.strict_limits) + ? globalThis.Boolean(object.strict_limits) + : false, + }; + }, + + toJSON(message: LimitsRetention): unknown { + const obj: any = {}; + if (message.maxAgeMs !== undefined) { + obj.maxAgeMs = Math.round(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + obj.maxMsgs = Math.round(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.strictLimits !== false) { + obj.strictLimits = message.strictLimits; + } + return obj; + }, + + create(base?: DeepPartial): LimitsRetention { + return LimitsRetention.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): LimitsRetention { + const message = createBaseLimitsRetention(); + message.maxAgeMs = object.maxAgeMs ?? undefined; + message.maxMsgs = object.maxMsgs ?? undefined; + message.maxBytes = object.maxBytes ?? undefined; + message.strictLimits = object.strictLimits ?? false; + return message; + }, +}; + +function createBaseWorkQueueRetention(): WorkQueueRetention { + return {}; +} + +export const WorkQueueRetention: MessageFns = { + encode(_: WorkQueueRetention, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WorkQueueRetention { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWorkQueueRetention(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): WorkQueueRetention { + return {}; + }, + + toJSON(_: WorkQueueRetention): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): WorkQueueRetention { + return WorkQueueRetention.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): WorkQueueRetention { + const message = createBaseWorkQueueRetention(); + return message; + }, +}; + +function createBaseInterestRetention(): InterestRetention { + return {}; +} + +export const InterestRetention: MessageFns = { + encode(_: InterestRetention, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterestRetention { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterestRetention(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): InterestRetention { + return {}; + }, + + toJSON(_: InterestRetention): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): InterestRetention { + return InterestRetention.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): InterestRetention { + const message = createBaseInterestRetention(); + return message; + }, +}; + +function createBaseRetention(): Retention { + return { limits: undefined, workQueue: undefined, interest: undefined }; +} + +export const Retention: MessageFns = { + encode(message: Retention, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.limits !== undefined) { + LimitsRetention.encode(message.limits, writer.uint32(10).fork()).join(); + } + if (message.workQueue !== undefined) { + WorkQueueRetention.encode(message.workQueue, writer.uint32(18).fork()).join(); + } + if (message.interest !== undefined) { + InterestRetention.encode(message.interest, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Retention { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRetention(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.limits = LimitsRetention.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.workQueue = WorkQueueRetention.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.interest = InterestRetention.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Retention { + return { + limits: isSet(object.limits) ? LimitsRetention.fromJSON(object.limits) : undefined, + workQueue: isSet(object.workQueue) + ? WorkQueueRetention.fromJSON(object.workQueue) + : isSet(object.work_queue) + ? WorkQueueRetention.fromJSON(object.work_queue) + : undefined, + interest: isSet(object.interest) ? InterestRetention.fromJSON(object.interest) : undefined, + }; + }, + + toJSON(message: Retention): unknown { + const obj: any = {}; + if (message.limits !== undefined) { + obj.limits = LimitsRetention.toJSON(message.limits); + } + if (message.workQueue !== undefined) { + obj.workQueue = WorkQueueRetention.toJSON(message.workQueue); + } + if (message.interest !== undefined) { + obj.interest = InterestRetention.toJSON(message.interest); + } + return obj; + }, + + create(base?: DeepPartial): Retention { + return Retention.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): Retention { + const message = createBaseRetention(); + message.limits = (object.limits !== undefined && object.limits !== null) + ? LimitsRetention.fromPartial(object.limits) + : undefined; + message.workQueue = (object.workQueue !== undefined && object.workQueue !== null) + ? WorkQueueRetention.fromPartial(object.workQueue) + : undefined; + message.interest = (object.interest !== undefined && object.interest !== null) + ? InterestRetention.fromPartial(object.interest) + : undefined; + return message; + }, +}; + +function createBaseStreamConfigPb(): StreamConfigPb { + return { + name: "", + subjectsFilter: [], + retention: undefined, + blockSize: 0, + maxMsgBytes: 0, + ephemeral: false, + sources: [], + maxMsgsPerSubject: 0, + }; +} + +export const StreamConfigPb: MessageFns = { + encode(message: StreamConfigPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.subjectsFilter) { + writer.uint32(18).string(v!); + } + if (message.retention !== undefined) { + Retention.encode(message.retention, writer.uint32(26).fork()).join(); + } + if (message.blockSize !== 0) { + writer.uint32(32).uint64(message.blockSize); + } + if (message.maxMsgBytes !== 0) { + writer.uint32(40).uint64(message.maxMsgBytes); + } + if (message.ephemeral !== false) { + writer.uint32(48).bool(message.ephemeral); + } + for (const v of message.sources) { + StreamSourceConfigPb.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.maxMsgsPerSubject !== 0) { + writer.uint32(64).uint64(message.maxMsgsPerSubject); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamConfigPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamConfigPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subjectsFilter.push(reader.string()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.retention = Retention.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.blockSize = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxMsgBytes = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.sources.push(StreamSourceConfigPb.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.maxMsgsPerSubject = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamConfigPb { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + subjectsFilter: globalThis.Array.isArray(object?.subjectsFilter) + ? object.subjectsFilter.map((e: any) => globalThis.String(e)) + : globalThis.Array.isArray(object?.subjects_filter) + ? object.subjects_filter.map((e: any) => globalThis.String(e)) + : [], + retention: isSet(object.retention) ? Retention.fromJSON(object.retention) : undefined, + blockSize: isSet(object.blockSize) + ? globalThis.Number(object.blockSize) + : isSet(object.block_size) + ? globalThis.Number(object.block_size) + : 0, + maxMsgBytes: isSet(object.maxMsgBytes) + ? globalThis.Number(object.maxMsgBytes) + : isSet(object.max_msg_bytes) + ? globalThis.Number(object.max_msg_bytes) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + sources: globalThis.Array.isArray(object?.sources) + ? object.sources.map((e: any) => StreamSourceConfigPb.fromJSON(e)) + : [], + maxMsgsPerSubject: isSet(object.maxMsgsPerSubject) + ? globalThis.Number(object.maxMsgsPerSubject) + : isSet(object.max_msgs_per_subject) + ? globalThis.Number(object.max_msgs_per_subject) + : 0, + }; + }, + + toJSON(message: StreamConfigPb): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.subjectsFilter?.length) { + obj.subjectsFilter = message.subjectsFilter; + } + if (message.retention !== undefined) { + obj.retention = Retention.toJSON(message.retention); + } + if (message.blockSize !== 0) { + obj.blockSize = Math.round(message.blockSize); + } + if (message.maxMsgBytes !== 0) { + obj.maxMsgBytes = Math.round(message.maxMsgBytes); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + if (message.sources?.length) { + obj.sources = message.sources.map((e) => StreamSourceConfigPb.toJSON(e)); + } + if (message.maxMsgsPerSubject !== 0) { + obj.maxMsgsPerSubject = Math.round(message.maxMsgsPerSubject); + } + return obj; + }, + + create(base?: DeepPartial): StreamConfigPb { + return StreamConfigPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StreamConfigPb { + const message = createBaseStreamConfigPb(); + message.name = object.name ?? ""; + message.subjectsFilter = object.subjectsFilter?.map((e) => e) || []; + message.retention = (object.retention !== undefined && object.retention !== null) + ? Retention.fromPartial(object.retention) + : undefined; + message.blockSize = object.blockSize ?? 0; + message.maxMsgBytes = object.maxMsgBytes ?? 0; + message.ephemeral = object.ephemeral ?? false; + message.sources = object.sources?.map((e) => StreamSourceConfigPb.fromPartial(e)) || []; + message.maxMsgsPerSubject = object.maxMsgsPerSubject ?? 0; + return message; + }, +}; + +function createBaseStreamSourceConfigPb(): StreamSourceConfigPb { + return { + sourceStream: "", + filterSubject: "", + startSeq: 0, + startTimeMs: 0, + subjectTransform: undefined, + maxInitialBackfill: 0, + onDrop: 0, + dlqStream: "", + }; +} + +export const StreamSourceConfigPb: MessageFns = { + encode(message: StreamSourceConfigPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sourceStream !== "") { + writer.uint32(10).string(message.sourceStream); + } + if (message.filterSubject !== "") { + writer.uint32(18).string(message.filterSubject); + } + if (message.startSeq !== 0) { + writer.uint32(24).uint64(message.startSeq); + } + if (message.startTimeMs !== 0) { + writer.uint32(32).int64(message.startTimeMs); + } + if (message.subjectTransform !== undefined) { + SubjectTransformPb.encode(message.subjectTransform, writer.uint32(42).fork()).join(); + } + if (message.maxInitialBackfill !== 0) { + writer.uint32(48).uint64(message.maxInitialBackfill); + } + if (message.onDrop !== 0) { + writer.uint32(56).int32(message.onDrop); + } + if (message.dlqStream !== "") { + writer.uint32(66).string(message.dlqStream); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamSourceConfigPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamSourceConfigPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sourceStream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.filterSubject = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.startSeq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.startTimeMs = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.subjectTransform = SubjectTransformPb.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.maxInitialBackfill = longToNumber(reader.uint64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.onDrop = reader.int32() as any; + continue; + } + case 8: { + if (tag !== 66) { + break; + } + + message.dlqStream = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamSourceConfigPb { + return { + sourceStream: isSet(object.sourceStream) + ? globalThis.String(object.sourceStream) + : isSet(object.source_stream) + ? globalThis.String(object.source_stream) + : "", + filterSubject: isSet(object.filterSubject) + ? globalThis.String(object.filterSubject) + : isSet(object.filter_subject) + ? globalThis.String(object.filter_subject) + : "", + startSeq: isSet(object.startSeq) + ? globalThis.Number(object.startSeq) + : isSet(object.start_seq) + ? globalThis.Number(object.start_seq) + : 0, + startTimeMs: isSet(object.startTimeMs) + ? globalThis.Number(object.startTimeMs) + : isSet(object.start_time_ms) + ? globalThis.Number(object.start_time_ms) + : 0, + subjectTransform: isSet(object.subjectTransform) + ? SubjectTransformPb.fromJSON(object.subjectTransform) + : isSet(object.subject_transform) + ? SubjectTransformPb.fromJSON(object.subject_transform) + : undefined, + maxInitialBackfill: isSet(object.maxInitialBackfill) + ? globalThis.Number(object.maxInitialBackfill) + : isSet(object.max_initial_backfill) + ? globalThis.Number(object.max_initial_backfill) + : 0, + onDrop: isSet(object.onDrop) + ? onDropPolicyFromJSON(object.onDrop) + : isSet(object.on_drop) + ? onDropPolicyFromJSON(object.on_drop) + : 0, + dlqStream: isSet(object.dlqStream) + ? globalThis.String(object.dlqStream) + : isSet(object.dlq_stream) + ? globalThis.String(object.dlq_stream) + : "", + }; + }, + + toJSON(message: StreamSourceConfigPb): unknown { + const obj: any = {}; + if (message.sourceStream !== "") { + obj.sourceStream = message.sourceStream; + } + if (message.filterSubject !== "") { + obj.filterSubject = message.filterSubject; + } + if (message.startSeq !== 0) { + obj.startSeq = Math.round(message.startSeq); + } + if (message.startTimeMs !== 0) { + obj.startTimeMs = Math.round(message.startTimeMs); + } + if (message.subjectTransform !== undefined) { + obj.subjectTransform = SubjectTransformPb.toJSON(message.subjectTransform); + } + if (message.maxInitialBackfill !== 0) { + obj.maxInitialBackfill = Math.round(message.maxInitialBackfill); + } + if (message.onDrop !== 0) { + obj.onDrop = onDropPolicyToJSON(message.onDrop); + } + if (message.dlqStream !== "") { + obj.dlqStream = message.dlqStream; + } + return obj; + }, + + create(base?: DeepPartial): StreamSourceConfigPb { + return StreamSourceConfigPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StreamSourceConfigPb { + const message = createBaseStreamSourceConfigPb(); + message.sourceStream = object.sourceStream ?? ""; + message.filterSubject = object.filterSubject ?? ""; + message.startSeq = object.startSeq ?? 0; + message.startTimeMs = object.startTimeMs ?? 0; + message.subjectTransform = (object.subjectTransform !== undefined && object.subjectTransform !== null) + ? SubjectTransformPb.fromPartial(object.subjectTransform) + : undefined; + message.maxInitialBackfill = object.maxInitialBackfill ?? 0; + message.onDrop = object.onDrop ?? 0; + message.dlqStream = object.dlqStream ?? ""; + return message; + }, +}; + +function createBaseSubjectTransformPb(): SubjectTransformPb { + return { sourcePattern: "", destination: "" }; +} + +export const SubjectTransformPb: MessageFns = { + encode(message: SubjectTransformPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sourcePattern !== "") { + writer.uint32(10).string(message.sourcePattern); + } + if (message.destination !== "") { + writer.uint32(18).string(message.destination); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubjectTransformPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubjectTransformPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sourcePattern = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.destination = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SubjectTransformPb { + return { + sourcePattern: isSet(object.sourcePattern) + ? globalThis.String(object.sourcePattern) + : isSet(object.source_pattern) + ? globalThis.String(object.source_pattern) + : "", + destination: isSet(object.destination) ? globalThis.String(object.destination) : "", + }; + }, + + toJSON(message: SubjectTransformPb): unknown { + const obj: any = {}; + if (message.sourcePattern !== "") { + obj.sourcePattern = message.sourcePattern; + } + if (message.destination !== "") { + obj.destination = message.destination; + } + return obj; + }, + + create(base?: DeepPartial): SubjectTransformPb { + return SubjectTransformPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SubjectTransformPb { + const message = createBaseSubjectTransformPb(); + message.sourcePattern = object.sourcePattern ?? ""; + message.destination = object.destination ?? ""; + return message; + }, +}; + +function createBaseStreamStatsPb(): StreamStatsPb { + return { lastSeq: 0, msgCount: 0, bytes: 0, blockCount: 0, firstBlock: 0 }; +} + +export const StreamStatsPb: MessageFns = { + encode(message: StreamStatsPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lastSeq !== 0) { + writer.uint32(8).uint64(message.lastSeq); + } + if (message.msgCount !== 0) { + writer.uint32(16).uint64(message.msgCount); + } + if (message.bytes !== 0) { + writer.uint32(24).uint64(message.bytes); + } + if (message.blockCount !== 0) { + writer.uint32(32).uint64(message.blockCount); + } + if (message.firstBlock !== 0) { + writer.uint32(40).uint64(message.firstBlock); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamStatsPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamStatsPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.lastSeq = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.msgCount = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.bytes = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.blockCount = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.firstBlock = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamStatsPb { + return { + lastSeq: isSet(object.lastSeq) + ? globalThis.Number(object.lastSeq) + : isSet(object.last_seq) + ? globalThis.Number(object.last_seq) + : 0, + msgCount: isSet(object.msgCount) + ? globalThis.Number(object.msgCount) + : isSet(object.msg_count) + ? globalThis.Number(object.msg_count) + : 0, + bytes: isSet(object.bytes) ? globalThis.Number(object.bytes) : 0, + blockCount: isSet(object.blockCount) + ? globalThis.Number(object.blockCount) + : isSet(object.block_count) + ? globalThis.Number(object.block_count) + : 0, + firstBlock: isSet(object.firstBlock) + ? globalThis.Number(object.firstBlock) + : isSet(object.first_block) + ? globalThis.Number(object.first_block) + : 0, + }; + }, + + toJSON(message: StreamStatsPb): unknown { + const obj: any = {}; + if (message.lastSeq !== 0) { + obj.lastSeq = Math.round(message.lastSeq); + } + if (message.msgCount !== 0) { + obj.msgCount = Math.round(message.msgCount); + } + if (message.bytes !== 0) { + obj.bytes = Math.round(message.bytes); + } + if (message.blockCount !== 0) { + obj.blockCount = Math.round(message.blockCount); + } + if (message.firstBlock !== 0) { + obj.firstBlock = Math.round(message.firstBlock); + } + return obj; + }, + + create(base?: DeepPartial): StreamStatsPb { + return StreamStatsPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StreamStatsPb { + const message = createBaseStreamStatsPb(); + message.lastSeq = object.lastSeq ?? 0; + message.msgCount = object.msgCount ?? 0; + message.bytes = object.bytes ?? 0; + message.blockCount = object.blockCount ?? 0; + message.firstBlock = object.firstBlock ?? 0; + return message; + }, +}; + +function createBaseMessageHeader(): MessageHeader { + return { key: "", value: "" }; +} + +export const MessageHeader: MessageFns = { + encode(message: MessageHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessageHeader { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: MessageHeader): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create(base?: DeepPartial): MessageHeader { + return MessageHeader.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MessageHeader { + const message = createBaseMessageHeader(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseMessagePb(): MessagePb { + return { seq: 0, subject: "", tsMs: 0, headers: [], payload: Buffer.alloc(0), deliverCount: 0 }; +} + +export const MessagePb: MessageFns = { + encode(message: MessagePb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seq !== 0) { + writer.uint32(8).uint64(message.seq); + } + if (message.subject !== "") { + writer.uint32(18).string(message.subject); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.payload.length !== 0) { + writer.uint32(42).bytes(message.payload); + } + if (message.deliverCount !== 0) { + writer.uint32(48).uint32(message.deliverCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessagePb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessagePb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subject = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.deliverCount = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessagePb { + return { + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + subject: isSet(object.subject) ? globalThis.String(object.subject) : "", + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + deliverCount: isSet(object.deliverCount) + ? globalThis.Number(object.deliverCount) + : isSet(object.deliver_count) + ? globalThis.Number(object.deliver_count) + : 0, + }; + }, + + toJSON(message: MessagePb): unknown { + const obj: any = {}; + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + if (message.subject !== "") { + obj.subject = message.subject; + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + if (message.deliverCount !== 0) { + obj.deliverCount = Math.round(message.deliverCount); + } + return obj; + }, + + create(base?: DeepPartial): MessagePb { + return MessagePb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MessagePb { + const message = createBaseMessagePb(); + message.seq = object.seq ?? 0; + message.subject = object.subject ?? ""; + message.tsMs = object.tsMs ?? 0; + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.payload = object.payload ?? Buffer.alloc(0); + message.deliverCount = object.deliverCount ?? 0; + return message; + }, +}; + +function createBaseDeliveryPolicyPb(): DeliveryPolicyPb { + return { type: 0, startSeq: 0, startTimeMs: 0 }; +} + +export const DeliveryPolicyPb: MessageFns = { + encode(message: DeliveryPolicyPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.startSeq !== 0) { + writer.uint32(16).uint64(message.startSeq); + } + if (message.startTimeMs !== 0) { + writer.uint32(24).int64(message.startTimeMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeliveryPolicyPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeliveryPolicyPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.startSeq = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.startTimeMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeliveryPolicyPb { + return { + type: isSet(object.type) ? deliveryPolicyTypeFromJSON(object.type) : 0, + startSeq: isSet(object.startSeq) + ? globalThis.Number(object.startSeq) + : isSet(object.start_seq) + ? globalThis.Number(object.start_seq) + : 0, + startTimeMs: isSet(object.startTimeMs) + ? globalThis.Number(object.startTimeMs) + : isSet(object.start_time_ms) + ? globalThis.Number(object.start_time_ms) + : 0, + }; + }, + + toJSON(message: DeliveryPolicyPb): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = deliveryPolicyTypeToJSON(message.type); + } + if (message.startSeq !== 0) { + obj.startSeq = Math.round(message.startSeq); + } + if (message.startTimeMs !== 0) { + obj.startTimeMs = Math.round(message.startTimeMs); + } + return obj; + }, + + create(base?: DeepPartial): DeliveryPolicyPb { + return DeliveryPolicyPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeliveryPolicyPb { + const message = createBaseDeliveryPolicyPb(); + message.type = object.type ?? 0; + message.startSeq = object.startSeq ?? 0; + message.startTimeMs = object.startTimeMs ?? 0; + return message; + }, +}; + +function createBaseConsumerConfigPb(): ConsumerConfigPb { + return { + name: "", + filterSubject: "", + deliveryPolicy: undefined, + ackWaitMs: 0, + maxDeliver: 0, + deliverGroup: "", + deadLetterSubject: "", + }; +} + +export const ConsumerConfigPb: MessageFns = { + encode(message: ConsumerConfigPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.filterSubject !== "") { + writer.uint32(18).string(message.filterSubject); + } + if (message.deliveryPolicy !== undefined) { + DeliveryPolicyPb.encode(message.deliveryPolicy, writer.uint32(26).fork()).join(); + } + if (message.ackWaitMs !== 0) { + writer.uint32(32).uint64(message.ackWaitMs); + } + if (message.maxDeliver !== 0) { + writer.uint32(40).uint32(message.maxDeliver); + } + if (message.deliverGroup !== "") { + writer.uint32(50).string(message.deliverGroup); + } + if (message.deadLetterSubject !== "") { + writer.uint32(58).string(message.deadLetterSubject); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsumerConfigPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumerConfigPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.filterSubject = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.deliveryPolicy = DeliveryPolicyPb.decode(reader, reader.uint32()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ackWaitMs = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxDeliver = reader.uint32(); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.deliverGroup = reader.string(); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.deadLetterSubject = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConsumerConfigPb { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + filterSubject: isSet(object.filterSubject) + ? globalThis.String(object.filterSubject) + : isSet(object.filter_subject) + ? globalThis.String(object.filter_subject) + : "", + deliveryPolicy: isSet(object.deliveryPolicy) + ? DeliveryPolicyPb.fromJSON(object.deliveryPolicy) + : isSet(object.delivery_policy) + ? DeliveryPolicyPb.fromJSON(object.delivery_policy) + : undefined, + ackWaitMs: isSet(object.ackWaitMs) + ? globalThis.Number(object.ackWaitMs) + : isSet(object.ack_wait_ms) + ? globalThis.Number(object.ack_wait_ms) + : 0, + maxDeliver: isSet(object.maxDeliver) + ? globalThis.Number(object.maxDeliver) + : isSet(object.max_deliver) + ? globalThis.Number(object.max_deliver) + : 0, + deliverGroup: isSet(object.deliverGroup) + ? globalThis.String(object.deliverGroup) + : isSet(object.deliver_group) + ? globalThis.String(object.deliver_group) + : "", + deadLetterSubject: isSet(object.deadLetterSubject) + ? globalThis.String(object.deadLetterSubject) + : isSet(object.dead_letter_subject) + ? globalThis.String(object.dead_letter_subject) + : "", + }; + }, + + toJSON(message: ConsumerConfigPb): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.filterSubject !== "") { + obj.filterSubject = message.filterSubject; + } + if (message.deliveryPolicy !== undefined) { + obj.deliveryPolicy = DeliveryPolicyPb.toJSON(message.deliveryPolicy); + } + if (message.ackWaitMs !== 0) { + obj.ackWaitMs = Math.round(message.ackWaitMs); + } + if (message.maxDeliver !== 0) { + obj.maxDeliver = Math.round(message.maxDeliver); + } + if (message.deliverGroup !== "") { + obj.deliverGroup = message.deliverGroup; + } + if (message.deadLetterSubject !== "") { + obj.deadLetterSubject = message.deadLetterSubject; + } + return obj; + }, + + create(base?: DeepPartial): ConsumerConfigPb { + return ConsumerConfigPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ConsumerConfigPb { + const message = createBaseConsumerConfigPb(); + message.name = object.name ?? ""; + message.filterSubject = object.filterSubject ?? ""; + message.deliveryPolicy = (object.deliveryPolicy !== undefined && object.deliveryPolicy !== null) + ? DeliveryPolicyPb.fromPartial(object.deliveryPolicy) + : undefined; + message.ackWaitMs = object.ackWaitMs ?? 0; + message.maxDeliver = object.maxDeliver ?? 0; + message.deliverGroup = object.deliverGroup ?? ""; + message.deadLetterSubject = object.deadLetterSubject ?? ""; + return message; + }, +}; + +function createBaseConsumerStatePb(): ConsumerStatePb { + return { config: undefined, ackFloor: 0, lastDelivered: 0, createdAtMs: 0, redeliveredDropped: 0 }; +} + +export const ConsumerStatePb: MessageFns = { + encode(message: ConsumerStatePb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConsumerConfigPb.encode(message.config, writer.uint32(10).fork()).join(); + } + if (message.ackFloor !== 0) { + writer.uint32(16).uint64(message.ackFloor); + } + if (message.lastDelivered !== 0) { + writer.uint32(24).uint64(message.lastDelivered); + } + if (message.createdAtMs !== 0) { + writer.uint32(32).int64(message.createdAtMs); + } + if (message.redeliveredDropped !== 0) { + writer.uint32(40).uint64(message.redeliveredDropped); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsumerStatePb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumerStatePb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.config = ConsumerConfigPb.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.ackFloor = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lastDelivered = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.createdAtMs = longToNumber(reader.int64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.redeliveredDropped = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConsumerStatePb { + return { + config: isSet(object.config) ? ConsumerConfigPb.fromJSON(object.config) : undefined, + ackFloor: isSet(object.ackFloor) + ? globalThis.Number(object.ackFloor) + : isSet(object.ack_floor) + ? globalThis.Number(object.ack_floor) + : 0, + lastDelivered: isSet(object.lastDelivered) + ? globalThis.Number(object.lastDelivered) + : isSet(object.last_delivered) + ? globalThis.Number(object.last_delivered) + : 0, + createdAtMs: isSet(object.createdAtMs) + ? globalThis.Number(object.createdAtMs) + : isSet(object.created_at_ms) + ? globalThis.Number(object.created_at_ms) + : 0, + redeliveredDropped: isSet(object.redeliveredDropped) + ? globalThis.Number(object.redeliveredDropped) + : isSet(object.redelivered_dropped) + ? globalThis.Number(object.redelivered_dropped) + : 0, + }; + }, + + toJSON(message: ConsumerStatePb): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConsumerConfigPb.toJSON(message.config); + } + if (message.ackFloor !== 0) { + obj.ackFloor = Math.round(message.ackFloor); + } + if (message.lastDelivered !== 0) { + obj.lastDelivered = Math.round(message.lastDelivered); + } + if (message.createdAtMs !== 0) { + obj.createdAtMs = Math.round(message.createdAtMs); + } + if (message.redeliveredDropped !== 0) { + obj.redeliveredDropped = Math.round(message.redeliveredDropped); + } + return obj; + }, + + create(base?: DeepPartial): ConsumerStatePb { + return ConsumerStatePb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ConsumerStatePb { + const message = createBaseConsumerStatePb(); + message.config = (object.config !== undefined && object.config !== null) + ? ConsumerConfigPb.fromPartial(object.config) + : undefined; + message.ackFloor = object.ackFloor ?? 0; + message.lastDelivered = object.lastDelivered ?? 0; + message.createdAtMs = object.createdAtMs ?? 0; + message.redeliveredDropped = object.redeliveredDropped ?? 0; + return message; + }, +}; + +function createBaseCreateStreamRequest(): CreateStreamRequest { + return { config: undefined }; +} + +export const CreateStreamRequest: MessageFns = { + encode(message: CreateStreamRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + StreamConfigPb.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateStreamRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateStreamRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.config = StreamConfigPb.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateStreamRequest { + return { config: isSet(object.config) ? StreamConfigPb.fromJSON(object.config) : undefined }; + }, + + toJSON(message: CreateStreamRequest): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = StreamConfigPb.toJSON(message.config); + } + return obj; + }, + + create(base?: DeepPartial): CreateStreamRequest { + return CreateStreamRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateStreamRequest { + const message = createBaseCreateStreamRequest(); + message.config = (object.config !== undefined && object.config !== null) + ? StreamConfigPb.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseCreateStreamResponse(): CreateStreamResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateStreamResponse: MessageFns = { + encode(message: CreateStreamResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateStreamResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateStreamResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateStreamResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateStreamResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateStreamResponse { + return CreateStreamResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateStreamResponse { + const message = createBaseCreateStreamResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteStreamRequest(): DeleteStreamRequest { + return { name: "" }; +} + +export const DeleteStreamRequest: MessageFns = { + encode(message: DeleteStreamRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteStreamRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteStreamRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteStreamRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteStreamRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteStreamRequest { + return DeleteStreamRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteStreamRequest { + const message = createBaseDeleteStreamRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteStreamResponse(): DeleteStreamResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteStreamResponse: MessageFns = { + encode(message: DeleteStreamResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteStreamResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteStreamResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteStreamResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteStreamResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteStreamResponse { + return DeleteStreamResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteStreamResponse { + const message = createBaseDeleteStreamResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseGetStreamInfoRequest(): GetStreamInfoRequest { + return { name: "" }; +} + +export const GetStreamInfoRequest: MessageFns = { + encode(message: GetStreamInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetStreamInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStreamInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetStreamInfoRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: GetStreamInfoRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): GetStreamInfoRequest { + return GetStreamInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetStreamInfoRequest { + const message = createBaseGetStreamInfoRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetStreamInfoResponse(): GetStreamInfoResponse { + return { + success: false, + resultCode: "", + message: "", + config: undefined, + stats: undefined, + authorityOverride: undefined, + ringOwnerNodeId: 0, + pinned: false, + sourcesStatus: [], + }; +} + +export const GetStreamInfoResponse: MessageFns = { + encode(message: GetStreamInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.config !== undefined) { + StreamConfigPb.encode(message.config, writer.uint32(34).fork()).join(); + } + if (message.stats !== undefined) { + StreamStatsPb.encode(message.stats, writer.uint32(42).fork()).join(); + } + if (message.authorityOverride !== undefined) { + StreamAuthorityOverride.encode(message.authorityOverride, writer.uint32(50).fork()).join(); + } + if (message.ringOwnerNodeId !== 0) { + writer.uint32(56).uint64(message.ringOwnerNodeId); + } + if (message.pinned !== false) { + writer.uint32(64).bool(message.pinned); + } + for (const v of message.sourcesStatus) { + SourceStatusPb.encode(v!, writer.uint32(74).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetStreamInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStreamInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.config = StreamConfigPb.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.stats = StreamStatsPb.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.authorityOverride = StreamAuthorityOverride.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.ringOwnerNodeId = longToNumber(reader.uint64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.pinned = reader.bool(); + continue; + } + case 9: { + if (tag !== 74) { + break; + } + + message.sourcesStatus.push(SourceStatusPb.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetStreamInfoResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + config: isSet(object.config) ? StreamConfigPb.fromJSON(object.config) : undefined, + stats: isSet(object.stats) ? StreamStatsPb.fromJSON(object.stats) : undefined, + authorityOverride: isSet(object.authorityOverride) + ? StreamAuthorityOverride.fromJSON(object.authorityOverride) + : isSet(object.authority_override) + ? StreamAuthorityOverride.fromJSON(object.authority_override) + : undefined, + ringOwnerNodeId: isSet(object.ringOwnerNodeId) + ? globalThis.Number(object.ringOwnerNodeId) + : isSet(object.ring_owner_node_id) + ? globalThis.Number(object.ring_owner_node_id) + : 0, + pinned: isSet(object.pinned) ? globalThis.Boolean(object.pinned) : false, + sourcesStatus: globalThis.Array.isArray(object?.sourcesStatus) + ? object.sourcesStatus.map((e: any) => SourceStatusPb.fromJSON(e)) + : globalThis.Array.isArray(object?.sources_status) + ? object.sources_status.map((e: any) => SourceStatusPb.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GetStreamInfoResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.config !== undefined) { + obj.config = StreamConfigPb.toJSON(message.config); + } + if (message.stats !== undefined) { + obj.stats = StreamStatsPb.toJSON(message.stats); + } + if (message.authorityOverride !== undefined) { + obj.authorityOverride = StreamAuthorityOverride.toJSON(message.authorityOverride); + } + if (message.ringOwnerNodeId !== 0) { + obj.ringOwnerNodeId = Math.round(message.ringOwnerNodeId); + } + if (message.pinned !== false) { + obj.pinned = message.pinned; + } + if (message.sourcesStatus?.length) { + obj.sourcesStatus = message.sourcesStatus.map((e) => SourceStatusPb.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): GetStreamInfoResponse { + return GetStreamInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetStreamInfoResponse { + const message = createBaseGetStreamInfoResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? StreamConfigPb.fromPartial(object.config) + : undefined; + message.stats = (object.stats !== undefined && object.stats !== null) + ? StreamStatsPb.fromPartial(object.stats) + : undefined; + message.authorityOverride = (object.authorityOverride !== undefined && object.authorityOverride !== null) + ? StreamAuthorityOverride.fromPartial(object.authorityOverride) + : undefined; + message.ringOwnerNodeId = object.ringOwnerNodeId ?? 0; + message.pinned = object.pinned ?? false; + message.sourcesStatus = object.sourcesStatus?.map((e) => SourceStatusPb.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSourceStatusPb(): SourceStatusPb { + return { sourceStream: "", lastSourcedSeq: 0, pulledTotal: 0, lastError: "", lastErrorTsMs: 0 }; +} + +export const SourceStatusPb: MessageFns = { + encode(message: SourceStatusPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sourceStream !== "") { + writer.uint32(10).string(message.sourceStream); + } + if (message.lastSourcedSeq !== 0) { + writer.uint32(16).uint64(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + writer.uint32(24).uint64(message.pulledTotal); + } + if (message.lastError !== "") { + writer.uint32(34).string(message.lastError); + } + if (message.lastErrorTsMs !== 0) { + writer.uint32(40).int64(message.lastErrorTsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceStatusPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceStatusPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sourceStream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.lastSourcedSeq = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.pulledTotal = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.lastError = reader.string(); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.lastErrorTsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceStatusPb { + return { + sourceStream: isSet(object.sourceStream) + ? globalThis.String(object.sourceStream) + : isSet(object.source_stream) + ? globalThis.String(object.source_stream) + : "", + lastSourcedSeq: isSet(object.lastSourcedSeq) + ? globalThis.Number(object.lastSourcedSeq) + : isSet(object.last_sourced_seq) + ? globalThis.Number(object.last_sourced_seq) + : 0, + pulledTotal: isSet(object.pulledTotal) + ? globalThis.Number(object.pulledTotal) + : isSet(object.pulled_total) + ? globalThis.Number(object.pulled_total) + : 0, + lastError: isSet(object.lastError) + ? globalThis.String(object.lastError) + : isSet(object.last_error) + ? globalThis.String(object.last_error) + : "", + lastErrorTsMs: isSet(object.lastErrorTsMs) + ? globalThis.Number(object.lastErrorTsMs) + : isSet(object.last_error_ts_ms) + ? globalThis.Number(object.last_error_ts_ms) + : 0, + }; + }, + + toJSON(message: SourceStatusPb): unknown { + const obj: any = {}; + if (message.sourceStream !== "") { + obj.sourceStream = message.sourceStream; + } + if (message.lastSourcedSeq !== 0) { + obj.lastSourcedSeq = Math.round(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + obj.pulledTotal = Math.round(message.pulledTotal); + } + if (message.lastError !== "") { + obj.lastError = message.lastError; + } + if (message.lastErrorTsMs !== 0) { + obj.lastErrorTsMs = Math.round(message.lastErrorTsMs); + } + return obj; + }, + + create(base?: DeepPartial): SourceStatusPb { + return SourceStatusPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SourceStatusPb { + const message = createBaseSourceStatusPb(); + message.sourceStream = object.sourceStream ?? ""; + message.lastSourcedSeq = object.lastSourcedSeq ?? 0; + message.pulledTotal = object.pulledTotal ?? 0; + message.lastError = object.lastError ?? ""; + message.lastErrorTsMs = object.lastErrorTsMs ?? 0; + return message; + }, +}; + +function createBaseStreamAuthorityOverride(): StreamAuthorityOverride { + return { claimantNodeId: 0, fenceEpoch: 0 }; +} + +export const StreamAuthorityOverride: MessageFns = { + encode(message: StreamAuthorityOverride, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.claimantNodeId !== 0) { + writer.uint32(8).uint64(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + writer.uint32(16).uint64(message.fenceEpoch); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamAuthorityOverride { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamAuthorityOverride(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.claimantNodeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fenceEpoch = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamAuthorityOverride { + return { + claimantNodeId: isSet(object.claimantNodeId) + ? globalThis.Number(object.claimantNodeId) + : isSet(object.claimant_node_id) + ? globalThis.Number(object.claimant_node_id) + : 0, + fenceEpoch: isSet(object.fenceEpoch) + ? globalThis.Number(object.fenceEpoch) + : isSet(object.fence_epoch) + ? globalThis.Number(object.fence_epoch) + : 0, + }; + }, + + toJSON(message: StreamAuthorityOverride): unknown { + const obj: any = {}; + if (message.claimantNodeId !== 0) { + obj.claimantNodeId = Math.round(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + obj.fenceEpoch = Math.round(message.fenceEpoch); + } + return obj; + }, + + create(base?: DeepPartial): StreamAuthorityOverride { + return StreamAuthorityOverride.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StreamAuthorityOverride { + const message = createBaseStreamAuthorityOverride(); + message.claimantNodeId = object.claimantNodeId ?? 0; + message.fenceEpoch = object.fenceEpoch ?? 0; + return message; + }, +}; + +function createBaseClearStreamAuthorityRequest(): ClearStreamAuthorityRequest { + return { stream: "" }; +} + +export const ClearStreamAuthorityRequest: MessageFns = { + encode(message: ClearStreamAuthorityRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClearStreamAuthorityRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearStreamAuthorityRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClearStreamAuthorityRequest { + return { stream: isSet(object.stream) ? globalThis.String(object.stream) : "" }; + }, + + toJSON(message: ClearStreamAuthorityRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + return obj; + }, + + create(base?: DeepPartial): ClearStreamAuthorityRequest { + return ClearStreamAuthorityRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ClearStreamAuthorityRequest { + const message = createBaseClearStreamAuthorityRequest(); + message.stream = object.stream ?? ""; + return message; + }, +}; + +function createBaseClearStreamAuthorityResponse(): ClearStreamAuthorityResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ClearStreamAuthorityResponse: MessageFns = { + encode(message: ClearStreamAuthorityResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ClearStreamAuthorityResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClearStreamAuthorityResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ClearStreamAuthorityResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ClearStreamAuthorityResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ClearStreamAuthorityResponse { + return ClearStreamAuthorityResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ClearStreamAuthorityResponse { + const message = createBaseClearStreamAuthorityResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseListStreamAuthorityOverridesRequest(): ListStreamAuthorityOverridesRequest { + return {}; +} + +export const ListStreamAuthorityOverridesRequest: MessageFns = { + encode(_: ListStreamAuthorityOverridesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListStreamAuthorityOverridesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListStreamAuthorityOverridesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListStreamAuthorityOverridesRequest { + return {}; + }, + + toJSON(_: ListStreamAuthorityOverridesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): ListStreamAuthorityOverridesRequest { + return ListStreamAuthorityOverridesRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListStreamAuthorityOverridesRequest { + const message = createBaseListStreamAuthorityOverridesRequest(); + return message; + }, +}; + +function createBaseListStreamAuthorityOverridesResponse(): ListStreamAuthorityOverridesResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const ListStreamAuthorityOverridesResponse: MessageFns = { + encode(message: ListStreamAuthorityOverridesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + AuthorityOverrideEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListStreamAuthorityOverridesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListStreamAuthorityOverridesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(AuthorityOverrideEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListStreamAuthorityOverridesResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => AuthorityOverrideEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListStreamAuthorityOverridesResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => AuthorityOverrideEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListStreamAuthorityOverridesResponse { + return ListStreamAuthorityOverridesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListStreamAuthorityOverridesResponse { + const message = createBaseListStreamAuthorityOverridesResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => AuthorityOverrideEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAuthorityOverrideEntry(): AuthorityOverrideEntry { + return { stream: "", claimantNodeId: 0, fenceEpoch: 0 }; +} + +export const AuthorityOverrideEntry: MessageFns = { + encode(message: AuthorityOverrideEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.claimantNodeId !== 0) { + writer.uint32(16).uint64(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + writer.uint32(24).uint64(message.fenceEpoch); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorityOverrideEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorityOverrideEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.claimantNodeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fenceEpoch = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorityOverrideEntry { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + claimantNodeId: isSet(object.claimantNodeId) + ? globalThis.Number(object.claimantNodeId) + : isSet(object.claimant_node_id) + ? globalThis.Number(object.claimant_node_id) + : 0, + fenceEpoch: isSet(object.fenceEpoch) + ? globalThis.Number(object.fenceEpoch) + : isSet(object.fence_epoch) + ? globalThis.Number(object.fence_epoch) + : 0, + }; + }, + + toJSON(message: AuthorityOverrideEntry): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.claimantNodeId !== 0) { + obj.claimantNodeId = Math.round(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + obj.fenceEpoch = Math.round(message.fenceEpoch); + } + return obj; + }, + + create(base?: DeepPartial): AuthorityOverrideEntry { + return AuthorityOverrideEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AuthorityOverrideEntry { + const message = createBaseAuthorityOverrideEntry(); + message.stream = object.stream ?? ""; + message.claimantNodeId = object.claimantNodeId ?? 0; + message.fenceEpoch = object.fenceEpoch ?? 0; + return message; + }, +}; + +function createBaseSetStreamPinnedRequest(): SetStreamPinnedRequest { + return { stream: "", pinned: false }; +} + +export const SetStreamPinnedRequest: MessageFns = { + encode(message: SetStreamPinnedRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.pinned !== false) { + writer.uint32(16).bool(message.pinned); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetStreamPinnedRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetStreamPinnedRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.pinned = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetStreamPinnedRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + pinned: isSet(object.pinned) ? globalThis.Boolean(object.pinned) : false, + }; + }, + + toJSON(message: SetStreamPinnedRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.pinned !== false) { + obj.pinned = message.pinned; + } + return obj; + }, + + create(base?: DeepPartial): SetStreamPinnedRequest { + return SetStreamPinnedRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetStreamPinnedRequest { + const message = createBaseSetStreamPinnedRequest(); + message.stream = object.stream ?? ""; + message.pinned = object.pinned ?? false; + return message; + }, +}; + +function createBaseSetStreamPinnedResponse(): SetStreamPinnedResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const SetStreamPinnedResponse: MessageFns = { + encode(message: SetStreamPinnedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetStreamPinnedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetStreamPinnedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetStreamPinnedResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: SetStreamPinnedResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): SetStreamPinnedResponse { + return SetStreamPinnedResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetStreamPinnedResponse { + const message = createBaseSetStreamPinnedResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseListStreamsRequest(): ListStreamsRequest { + return {}; +} + +export const ListStreamsRequest: MessageFns = { + encode(_: ListStreamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListStreamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListStreamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListStreamsRequest { + return {}; + }, + + toJSON(_: ListStreamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): ListStreamsRequest { + return ListStreamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): ListStreamsRequest { + const message = createBaseListStreamsRequest(); + return message; + }, +}; + +function createBaseListStreamsResponse(): ListStreamsResponse { + return { names: [] }; +} + +export const ListStreamsResponse: MessageFns = { + encode(message: ListStreamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListStreamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListStreamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.names.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListStreamsResponse { + return { names: globalThis.Array.isArray(object?.names) ? object.names.map((e: any) => globalThis.String(e)) : [] }; + }, + + toJSON(message: ListStreamsResponse): unknown { + const obj: any = {}; + if (message.names?.length) { + obj.names = message.names; + } + return obj; + }, + + create(base?: DeepPartial): ListStreamsResponse { + return ListStreamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListStreamsResponse { + const message = createBaseListStreamsResponse(); + message.names = object.names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGetStreamSourcesRequest(): GetStreamSourcesRequest { + return {}; +} + +export const GetStreamSourcesRequest: MessageFns = { + encode(_: GetStreamSourcesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetStreamSourcesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStreamSourcesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetStreamSourcesRequest { + return {}; + }, + + toJSON(_: GetStreamSourcesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): GetStreamSourcesRequest { + return GetStreamSourcesRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): GetStreamSourcesRequest { + const message = createBaseGetStreamSourcesRequest(); + return message; + }, +}; + +function createBaseGetStreamSourcesResponse(): GetStreamSourcesResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const GetStreamSourcesResponse: MessageFns = { + encode(message: GetStreamSourcesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + GetStreamSourcesEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetStreamSourcesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStreamSourcesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(GetStreamSourcesEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetStreamSourcesResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => GetStreamSourcesEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GetStreamSourcesResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => GetStreamSourcesEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): GetStreamSourcesResponse { + return GetStreamSourcesResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetStreamSourcesResponse { + const message = createBaseGetStreamSourcesResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => GetStreamSourcesEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetStreamSourcesEntry(): GetStreamSourcesEntry { + return { sourcingStream: "", sourceStream: "", lastSourcedSeq: 0, pulledTotal: 0, lastError: "", lastErrorTsMs: 0 }; +} + +export const GetStreamSourcesEntry: MessageFns = { + encode(message: GetStreamSourcesEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sourcingStream !== "") { + writer.uint32(10).string(message.sourcingStream); + } + if (message.sourceStream !== "") { + writer.uint32(18).string(message.sourceStream); + } + if (message.lastSourcedSeq !== 0) { + writer.uint32(24).uint64(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + writer.uint32(32).uint64(message.pulledTotal); + } + if (message.lastError !== "") { + writer.uint32(42).string(message.lastError); + } + if (message.lastErrorTsMs !== 0) { + writer.uint32(48).int64(message.lastErrorTsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetStreamSourcesEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetStreamSourcesEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sourcingStream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sourceStream = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lastSourcedSeq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.pulledTotal = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.lastError = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.lastErrorTsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetStreamSourcesEntry { + return { + sourcingStream: isSet(object.sourcingStream) + ? globalThis.String(object.sourcingStream) + : isSet(object.sourcing_stream) + ? globalThis.String(object.sourcing_stream) + : "", + sourceStream: isSet(object.sourceStream) + ? globalThis.String(object.sourceStream) + : isSet(object.source_stream) + ? globalThis.String(object.source_stream) + : "", + lastSourcedSeq: isSet(object.lastSourcedSeq) + ? globalThis.Number(object.lastSourcedSeq) + : isSet(object.last_sourced_seq) + ? globalThis.Number(object.last_sourced_seq) + : 0, + pulledTotal: isSet(object.pulledTotal) + ? globalThis.Number(object.pulledTotal) + : isSet(object.pulled_total) + ? globalThis.Number(object.pulled_total) + : 0, + lastError: isSet(object.lastError) + ? globalThis.String(object.lastError) + : isSet(object.last_error) + ? globalThis.String(object.last_error) + : "", + lastErrorTsMs: isSet(object.lastErrorTsMs) + ? globalThis.Number(object.lastErrorTsMs) + : isSet(object.last_error_ts_ms) + ? globalThis.Number(object.last_error_ts_ms) + : 0, + }; + }, + + toJSON(message: GetStreamSourcesEntry): unknown { + const obj: any = {}; + if (message.sourcingStream !== "") { + obj.sourcingStream = message.sourcingStream; + } + if (message.sourceStream !== "") { + obj.sourceStream = message.sourceStream; + } + if (message.lastSourcedSeq !== 0) { + obj.lastSourcedSeq = Math.round(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + obj.pulledTotal = Math.round(message.pulledTotal); + } + if (message.lastError !== "") { + obj.lastError = message.lastError; + } + if (message.lastErrorTsMs !== 0) { + obj.lastErrorTsMs = Math.round(message.lastErrorTsMs); + } + return obj; + }, + + create(base?: DeepPartial): GetStreamSourcesEntry { + return GetStreamSourcesEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetStreamSourcesEntry { + const message = createBaseGetStreamSourcesEntry(); + message.sourcingStream = object.sourcingStream ?? ""; + message.sourceStream = object.sourceStream ?? ""; + message.lastSourcedSeq = object.lastSourcedSeq ?? 0; + message.pulledTotal = object.pulledTotal ?? 0; + message.lastError = object.lastError ?? ""; + message.lastErrorTsMs = object.lastErrorTsMs ?? 0; + return message; + }, +}; + +function createBaseUpdateStreamRequest(): UpdateStreamRequest { + return { + name: "", + maxAgeMs: undefined, + maxMsgs: undefined, + maxBytes: undefined, + maxMsgBytes: undefined, + strictLimits: undefined, + }; +} + +export const UpdateStreamRequest: MessageFns = { + encode(message: UpdateStreamRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxAgeMs !== undefined) { + writer.uint32(16).uint64(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + writer.uint32(24).uint64(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + writer.uint32(32).uint64(message.maxBytes); + } + if (message.maxMsgBytes !== undefined) { + writer.uint32(40).uint64(message.maxMsgBytes); + } + if (message.strictLimits !== undefined) { + writer.uint32(48).bool(message.strictLimits); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateStreamRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateStreamRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxAgeMs = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxMsgs = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxMsgBytes = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.strictLimits = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateStreamRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxAgeMs: isSet(object.maxAgeMs) + ? globalThis.Number(object.maxAgeMs) + : isSet(object.max_age_ms) + ? globalThis.Number(object.max_age_ms) + : undefined, + maxMsgs: isSet(object.maxMsgs) + ? globalThis.Number(object.maxMsgs) + : isSet(object.max_msgs) + ? globalThis.Number(object.max_msgs) + : undefined, + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : undefined, + maxMsgBytes: isSet(object.maxMsgBytes) + ? globalThis.Number(object.maxMsgBytes) + : isSet(object.max_msg_bytes) + ? globalThis.Number(object.max_msg_bytes) + : undefined, + strictLimits: isSet(object.strictLimits) + ? globalThis.Boolean(object.strictLimits) + : isSet(object.strict_limits) + ? globalThis.Boolean(object.strict_limits) + : undefined, + }; + }, + + toJSON(message: UpdateStreamRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxAgeMs !== undefined) { + obj.maxAgeMs = Math.round(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + obj.maxMsgs = Math.round(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxMsgBytes !== undefined) { + obj.maxMsgBytes = Math.round(message.maxMsgBytes); + } + if (message.strictLimits !== undefined) { + obj.strictLimits = message.strictLimits; + } + return obj; + }, + + create(base?: DeepPartial): UpdateStreamRequest { + return UpdateStreamRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateStreamRequest { + const message = createBaseUpdateStreamRequest(); + message.name = object.name ?? ""; + message.maxAgeMs = object.maxAgeMs ?? undefined; + message.maxMsgs = object.maxMsgs ?? undefined; + message.maxBytes = object.maxBytes ?? undefined; + message.maxMsgBytes = object.maxMsgBytes ?? undefined; + message.strictLimits = object.strictLimits ?? undefined; + return message; + }, +}; + +function createBaseUpdateStreamResponse(): UpdateStreamResponse { + return { success: false, resultCode: "", message: "", config: undefined, pruned: 0 }; +} + +export const UpdateStreamResponse: MessageFns = { + encode(message: UpdateStreamResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.config !== undefined) { + StreamConfigPb.encode(message.config, writer.uint32(34).fork()).join(); + } + if (message.pruned !== 0) { + writer.uint32(40).uint64(message.pruned); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateStreamResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateStreamResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.config = StreamConfigPb.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.pruned = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateStreamResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + config: isSet(object.config) ? StreamConfigPb.fromJSON(object.config) : undefined, + pruned: isSet(object.pruned) ? globalThis.Number(object.pruned) : 0, + }; + }, + + toJSON(message: UpdateStreamResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.config !== undefined) { + obj.config = StreamConfigPb.toJSON(message.config); + } + if (message.pruned !== 0) { + obj.pruned = Math.round(message.pruned); + } + return obj; + }, + + create(base?: DeepPartial): UpdateStreamResponse { + return UpdateStreamResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): UpdateStreamResponse { + const message = createBaseUpdateStreamResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? StreamConfigPb.fromPartial(object.config) + : undefined; + message.pruned = object.pruned ?? 0; + return message; + }, +}; + +function createBasePublishRequest(): PublishRequest { + return { stream: "", subject: "", payload: Buffer.alloc(0), headers: [], tsMs: 0, expectedLastSeq: undefined }; +} + +export const PublishRequest: MessageFns = { + encode(message: PublishRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.subject !== "") { + writer.uint32(18).string(message.subject); + } + if (message.payload.length !== 0) { + writer.uint32(26).bytes(message.payload); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.tsMs !== 0) { + writer.uint32(40).int64(message.tsMs); + } + if (message.expectedLastSeq !== undefined) { + writer.uint32(48).uint64(message.expectedLastSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublishRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublishRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subject = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.expectedLastSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PublishRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + subject: isSet(object.subject) ? globalThis.String(object.subject) : "", + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + expectedLastSeq: isSet(object.expectedLastSeq) + ? globalThis.Number(object.expectedLastSeq) + : isSet(object.expected_last_seq) + ? globalThis.Number(object.expected_last_seq) + : undefined, + }; + }, + + toJSON(message: PublishRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.subject !== "") { + obj.subject = message.subject; + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.expectedLastSeq !== undefined) { + obj.expectedLastSeq = Math.round(message.expectedLastSeq); + } + return obj; + }, + + create(base?: DeepPartial): PublishRequest { + return PublishRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PublishRequest { + const message = createBasePublishRequest(); + message.stream = object.stream ?? ""; + message.subject = object.subject ?? ""; + message.payload = object.payload ?? Buffer.alloc(0); + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.tsMs = object.tsMs ?? 0; + message.expectedLastSeq = object.expectedLastSeq ?? undefined; + return message; + }, +}; + +function createBasePublishResponse(): PublishResponse { + return { success: false, resultCode: "", message: "", seq: 0 }; +} + +export const PublishResponse: MessageFns = { + encode(message: PublishResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.seq !== 0) { + writer.uint32(32).uint64(message.seq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublishResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublishResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PublishResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + }; + }, + + toJSON(message: PublishResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + return obj; + }, + + create(base?: DeepPartial): PublishResponse { + return PublishResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PublishResponse { + const message = createBasePublishResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.seq = object.seq ?? 0; + return message; + }, +}; + +function createBaseFetchRequest(): FetchRequest { + return { stream: "", consumer: "", batchSize: 0 }; +} + +export const FetchRequest: MessageFns = { + encode(message: FetchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.batchSize !== 0) { + writer.uint32(24).uint32(message.batchSize); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FetchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFetchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.batchSize = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FetchRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + batchSize: isSet(object.batchSize) + ? globalThis.Number(object.batchSize) + : isSet(object.batch_size) + ? globalThis.Number(object.batch_size) + : 0, + }; + }, + + toJSON(message: FetchRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.batchSize !== 0) { + obj.batchSize = Math.round(message.batchSize); + } + return obj; + }, + + create(base?: DeepPartial): FetchRequest { + return FetchRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FetchRequest { + const message = createBaseFetchRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.batchSize = object.batchSize ?? 0; + return message; + }, +}; + +function createBaseFetchResponse(): FetchResponse { + return { success: false, resultCode: "", message: "", messages: [] }; +} + +export const FetchResponse: MessageFns = { + encode(message: FetchResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.messages) { + MessagePb.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FetchResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFetchResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.messages.push(MessagePb.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FetchResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + messages: globalThis.Array.isArray(object?.messages) + ? object.messages.map((e: any) => MessagePb.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FetchResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => MessagePb.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): FetchResponse { + return FetchResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): FetchResponse { + const message = createBaseFetchResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.messages = object.messages?.map((e) => MessagePb.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAckRequest(): AckRequest { + return { stream: "", consumer: "", seq: 0 }; +} + +export const AckRequest: MessageFns = { + encode(message: AckRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.seq !== 0) { + writer.uint32(24).uint64(message.seq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AckRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAckRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AckRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + }; + }, + + toJSON(message: AckRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + return obj; + }, + + create(base?: DeepPartial): AckRequest { + return AckRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AckRequest { + const message = createBaseAckRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.seq = object.seq ?? 0; + return message; + }, +}; + +function createBaseAckResponse(): AckResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const AckResponse: MessageFns = { + encode(message: AckResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AckResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: AckResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): AckResponse { + return AckResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AckResponse { + const message = createBaseAckResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseNakRequest(): NakRequest { + return { stream: "", consumer: "", seq: 0, delayMs: 0 }; +} + +export const NakRequest: MessageFns = { + encode(message: NakRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.seq !== 0) { + writer.uint32(24).uint64(message.seq); + } + if (message.delayMs !== 0) { + writer.uint32(32).uint64(message.delayMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NakRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNakRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.delayMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NakRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + delayMs: isSet(object.delayMs) + ? globalThis.Number(object.delayMs) + : isSet(object.delay_ms) + ? globalThis.Number(object.delay_ms) + : 0, + }; + }, + + toJSON(message: NakRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + if (message.delayMs !== 0) { + obj.delayMs = Math.round(message.delayMs); + } + return obj; + }, + + create(base?: DeepPartial): NakRequest { + return NakRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): NakRequest { + const message = createBaseNakRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.seq = object.seq ?? 0; + message.delayMs = object.delayMs ?? 0; + return message; + }, +}; + +function createBaseNakResponse(): NakResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const NakResponse: MessageFns = { + encode(message: NakResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NakResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNakResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NakResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: NakResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): NakResponse { + return NakResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): NakResponse { + const message = createBaseNakResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseTermRequest(): TermRequest { + return { stream: "", consumer: "", seq: 0 }; +} + +export const TermRequest: MessageFns = { + encode(message: TermRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.seq !== 0) { + writer.uint32(24).uint64(message.seq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TermRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTermRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TermRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + }; + }, + + toJSON(message: TermRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + return obj; + }, + + create(base?: DeepPartial): TermRequest { + return TermRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TermRequest { + const message = createBaseTermRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.seq = object.seq ?? 0; + return message; + }, +}; + +function createBaseTermResponse(): TermResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const TermResponse: MessageFns = { + encode(message: TermResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TermResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTermResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TermResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: TermResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): TermResponse { + return TermResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TermResponse { + const message = createBaseTermResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseInProgressRequest(): InProgressRequest { + return { stream: "", consumer: "", seq: 0 }; +} + +export const InProgressRequest: MessageFns = { + encode(message: InProgressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.seq !== 0) { + writer.uint32(24).uint64(message.seq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InProgressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInProgressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InProgressRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + }; + }, + + toJSON(message: InProgressRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + return obj; + }, + + create(base?: DeepPartial): InProgressRequest { + return InProgressRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InProgressRequest { + const message = createBaseInProgressRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.seq = object.seq ?? 0; + return message; + }, +}; + +function createBaseInProgressResponse(): InProgressResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const InProgressResponse: MessageFns = { + encode(message: InProgressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InProgressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInProgressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InProgressResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: InProgressResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): InProgressResponse { + return InProgressResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): InProgressResponse { + const message = createBaseInProgressResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSubscribeRequest(): SubscribeRequest { + return { stream: "", consumer: "", batchSize: 0, stopWhenEmpty: false }; +} + +export const SubscribeRequest: MessageFns = { + encode(message: SubscribeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + if (message.batchSize !== 0) { + writer.uint32(24).uint32(message.batchSize); + } + if (message.stopWhenEmpty !== false) { + writer.uint32(32).bool(message.stopWhenEmpty); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubscribeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubscribeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.batchSize = reader.uint32(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.stopWhenEmpty = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SubscribeRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + batchSize: isSet(object.batchSize) + ? globalThis.Number(object.batchSize) + : isSet(object.batch_size) + ? globalThis.Number(object.batch_size) + : 0, + stopWhenEmpty: isSet(object.stopWhenEmpty) + ? globalThis.Boolean(object.stopWhenEmpty) + : isSet(object.stop_when_empty) + ? globalThis.Boolean(object.stop_when_empty) + : false, + }; + }, + + toJSON(message: SubscribeRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + if (message.batchSize !== 0) { + obj.batchSize = Math.round(message.batchSize); + } + if (message.stopWhenEmpty !== false) { + obj.stopWhenEmpty = message.stopWhenEmpty; + } + return obj; + }, + + create(base?: DeepPartial): SubscribeRequest { + return SubscribeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SubscribeRequest { + const message = createBaseSubscribeRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + message.batchSize = object.batchSize ?? 0; + message.stopWhenEmpty = object.stopWhenEmpty ?? false; + return message; + }, +}; + +function createBaseSubscribeEvent(): SubscribeEvent { + return { message: undefined, stopped: undefined }; +} + +export const SubscribeEvent: MessageFns = { + encode(message: SubscribeEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== undefined) { + MessagePb.encode(message.message, writer.uint32(10).fork()).join(); + } + if (message.stopped !== undefined) { + SubscribeStopped.encode(message.stopped, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubscribeEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubscribeEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.message = MessagePb.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.stopped = SubscribeStopped.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SubscribeEvent { + return { + message: isSet(object.message) ? MessagePb.fromJSON(object.message) : undefined, + stopped: isSet(object.stopped) ? SubscribeStopped.fromJSON(object.stopped) : undefined, + }; + }, + + toJSON(message: SubscribeEvent): unknown { + const obj: any = {}; + if (message.message !== undefined) { + obj.message = MessagePb.toJSON(message.message); + } + if (message.stopped !== undefined) { + obj.stopped = SubscribeStopped.toJSON(message.stopped); + } + return obj; + }, + + create(base?: DeepPartial): SubscribeEvent { + return SubscribeEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SubscribeEvent { + const message = createBaseSubscribeEvent(); + message.message = (object.message !== undefined && object.message !== null) + ? MessagePb.fromPartial(object.message) + : undefined; + message.stopped = (object.stopped !== undefined && object.stopped !== null) + ? SubscribeStopped.fromPartial(object.stopped) + : undefined; + return message; + }, +}; + +function createBaseSubscribeStopped(): SubscribeStopped { + return { reason: "" }; +} + +export const SubscribeStopped: MessageFns = { + encode(message: SubscribeStopped, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.reason !== "") { + writer.uint32(10).string(message.reason); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SubscribeStopped { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSubscribeStopped(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.reason = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SubscribeStopped { + return { reason: isSet(object.reason) ? globalThis.String(object.reason) : "" }; + }, + + toJSON(message: SubscribeStopped): unknown { + const obj: any = {}; + if (message.reason !== "") { + obj.reason = message.reason; + } + return obj; + }, + + create(base?: DeepPartial): SubscribeStopped { + return SubscribeStopped.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SubscribeStopped { + const message = createBaseSubscribeStopped(); + message.reason = object.reason ?? ""; + return message; + }, +}; + +function createBaseCreateConsumerRequest(): CreateConsumerRequest { + return { stream: "", config: undefined }; +} + +export const CreateConsumerRequest: MessageFns = { + encode(message: CreateConsumerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.config !== undefined) { + ConsumerConfigPb.encode(message.config, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateConsumerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateConsumerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.config = ConsumerConfigPb.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateConsumerRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + config: isSet(object.config) ? ConsumerConfigPb.fromJSON(object.config) : undefined, + }; + }, + + toJSON(message: CreateConsumerRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.config !== undefined) { + obj.config = ConsumerConfigPb.toJSON(message.config); + } + return obj; + }, + + create(base?: DeepPartial): CreateConsumerRequest { + return CreateConsumerRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateConsumerRequest { + const message = createBaseCreateConsumerRequest(); + message.stream = object.stream ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? ConsumerConfigPb.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseCreateConsumerResponse(): CreateConsumerResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateConsumerResponse: MessageFns = { + encode(message: CreateConsumerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateConsumerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateConsumerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateConsumerResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateConsumerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateConsumerResponse { + return CreateConsumerResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateConsumerResponse { + const message = createBaseCreateConsumerResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteConsumerRequest(): DeleteConsumerRequest { + return { stream: "", consumer: "" }; +} + +export const DeleteConsumerRequest: MessageFns = { + encode(message: DeleteConsumerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteConsumerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteConsumerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteConsumerRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + }; + }, + + toJSON(message: DeleteConsumerRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + return obj; + }, + + create(base?: DeepPartial): DeleteConsumerRequest { + return DeleteConsumerRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteConsumerRequest { + const message = createBaseDeleteConsumerRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + return message; + }, +}; + +function createBaseDeleteConsumerResponse(): DeleteConsumerResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteConsumerResponse: MessageFns = { + encode(message: DeleteConsumerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteConsumerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteConsumerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteConsumerResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteConsumerResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteConsumerResponse { + return DeleteConsumerResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteConsumerResponse { + const message = createBaseDeleteConsumerResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseListConsumersRequest(): ListConsumersRequest { + return { stream: "" }; +} + +export const ListConsumersRequest: MessageFns = { + encode(message: ListConsumersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListConsumersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListConsumersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListConsumersRequest { + return { stream: isSet(object.stream) ? globalThis.String(object.stream) : "" }; + }, + + toJSON(message: ListConsumersRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + return obj; + }, + + create(base?: DeepPartial): ListConsumersRequest { + return ListConsumersRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListConsumersRequest { + const message = createBaseListConsumersRequest(); + message.stream = object.stream ?? ""; + return message; + }, +}; + +function createBaseListConsumersResponse(): ListConsumersResponse { + return { success: false, resultCode: "", message: "", consumers: [] }; +} + +export const ListConsumersResponse: MessageFns = { + encode(message: ListConsumersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.consumers) { + ConsumerStatePb.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListConsumersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListConsumersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.consumers.push(ConsumerStatePb.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListConsumersResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + consumers: globalThis.Array.isArray(object?.consumers) + ? object.consumers.map((e: any) => ConsumerStatePb.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListConsumersResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.consumers?.length) { + obj.consumers = message.consumers.map((e) => ConsumerStatePb.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListConsumersResponse { + return ListConsumersResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListConsumersResponse { + const message = createBaseListConsumersResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.consumers = object.consumers?.map((e) => ConsumerStatePb.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetConsumerInfoRequest(): GetConsumerInfoRequest { + return { stream: "", consumer: "" }; +} + +export const GetConsumerInfoRequest: MessageFns = { + encode(message: GetConsumerInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConsumerInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConsumerInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConsumerInfoRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + }; + }, + + toJSON(message: GetConsumerInfoRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + return obj; + }, + + create(base?: DeepPartial): GetConsumerInfoRequest { + return GetConsumerInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetConsumerInfoRequest { + const message = createBaseGetConsumerInfoRequest(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + return message; + }, +}; + +function createBaseGetConsumerInfoResponse(): GetConsumerInfoResponse { + return { success: false, resultCode: "", message: "", consumer: undefined }; +} + +export const GetConsumerInfoResponse: MessageFns = { + encode(message: GetConsumerInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.consumer !== undefined) { + ConsumerStatePb.encode(message.consumer, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConsumerInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConsumerInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.consumer = ConsumerStatePb.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConsumerInfoResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + consumer: isSet(object.consumer) ? ConsumerStatePb.fromJSON(object.consumer) : undefined, + }; + }, + + toJSON(message: GetConsumerInfoResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.consumer !== undefined) { + obj.consumer = ConsumerStatePb.toJSON(message.consumer); + } + return obj; + }, + + create(base?: DeepPartial): GetConsumerInfoResponse { + return GetConsumerInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetConsumerInfoResponse { + const message = createBaseGetConsumerInfoResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.consumer = (object.consumer !== undefined && object.consumer !== null) + ? ConsumerStatePb.fromPartial(object.consumer) + : undefined; + return message; + }, +}; + +function createBaseTransferStreamRequest(): TransferStreamRequest { + return { name: "" }; +} + +export const TransferStreamRequest: MessageFns = { + encode(message: TransferStreamRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TransferStreamRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransferStreamRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TransferStreamRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: TransferStreamRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): TransferStreamRequest { + return TransferStreamRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TransferStreamRequest { + const message = createBaseTransferStreamRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseTransferStreamChunk(): TransferStreamChunk { + return { data: undefined, summary: undefined }; +} + +export const TransferStreamChunk: MessageFns = { + encode(message: TransferStreamChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + writer.uint32(10).bytes(message.data); + } + if (message.summary !== undefined) { + TransferStreamSummary.encode(message.summary, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TransferStreamChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransferStreamChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.data = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.summary = TransferStreamSummary.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TransferStreamChunk { + return { + data: isSet(object.data) ? Buffer.from(bytesFromBase64(object.data)) : undefined, + summary: isSet(object.summary) ? TransferStreamSummary.fromJSON(object.summary) : undefined, + }; + }, + + toJSON(message: TransferStreamChunk): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = base64FromBytes(message.data); + } + if (message.summary !== undefined) { + obj.summary = TransferStreamSummary.toJSON(message.summary); + } + return obj; + }, + + create(base?: DeepPartial): TransferStreamChunk { + return TransferStreamChunk.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TransferStreamChunk { + const message = createBaseTransferStreamChunk(); + message.data = object.data ?? undefined; + message.summary = (object.summary !== undefined && object.summary !== null) + ? TransferStreamSummary.fromPartial(object.summary) + : undefined; + return message; + }, +}; + +function createBaseTransferStreamSummary(): TransferStreamSummary { + return { totalBytes: 0, streamLastSeq: 0 }; +} + +export const TransferStreamSummary: MessageFns = { + encode(message: TransferStreamSummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.totalBytes !== 0) { + writer.uint32(8).uint64(message.totalBytes); + } + if (message.streamLastSeq !== 0) { + writer.uint32(16).uint64(message.streamLastSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TransferStreamSummary { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTransferStreamSummary(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.streamLastSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TransferStreamSummary { + return { + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + streamLastSeq: isSet(object.streamLastSeq) + ? globalThis.Number(object.streamLastSeq) + : isSet(object.stream_last_seq) + ? globalThis.Number(object.stream_last_seq) + : 0, + }; + }, + + toJSON(message: TransferStreamSummary): unknown { + const obj: any = {}; + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.streamLastSeq !== 0) { + obj.streamLastSeq = Math.round(message.streamLastSeq); + } + return obj; + }, + + create(base?: DeepPartial): TransferStreamSummary { + return TransferStreamSummary.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): TransferStreamSummary { + const message = createBaseTransferStreamSummary(); + message.totalBytes = object.totalBytes ?? 0; + message.streamLastSeq = object.streamLastSeq ?? 0; + return message; + }, +}; + +function createBaseMigrateStreamRequest(): MigrateStreamRequest { + return { name: "", sourceNodeId: 0 }; +} + +export const MigrateStreamRequest: MessageFns = { + encode(message: MigrateStreamRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.sourceNodeId !== 0) { + writer.uint32(16).uint64(message.sourceNodeId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateStreamRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateStreamRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.sourceNodeId = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateStreamRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + sourceNodeId: isSet(object.sourceNodeId) + ? globalThis.Number(object.sourceNodeId) + : isSet(object.source_node_id) + ? globalThis.Number(object.source_node_id) + : 0, + }; + }, + + toJSON(message: MigrateStreamRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.sourceNodeId !== 0) { + obj.sourceNodeId = Math.round(message.sourceNodeId); + } + return obj; + }, + + create(base?: DeepPartial): MigrateStreamRequest { + return MigrateStreamRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MigrateStreamRequest { + const message = createBaseMigrateStreamRequest(); + message.name = object.name ?? ""; + message.sourceNodeId = object.sourceNodeId ?? 0; + return message; + }, +}; + +function createBaseMigrateStreamResponse(): MigrateStreamResponse { + return { success: false, resultCode: "", message: "", totalBytes: 0, streamLastSeq: 0 }; +} + +export const MigrateStreamResponse: MessageFns = { + encode(message: MigrateStreamResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.totalBytes !== 0) { + writer.uint32(32).uint64(message.totalBytes); + } + if (message.streamLastSeq !== 0) { + writer.uint32(40).uint64(message.streamLastSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MigrateStreamResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMigrateStreamResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.streamLastSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MigrateStreamResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + streamLastSeq: isSet(object.streamLastSeq) + ? globalThis.Number(object.streamLastSeq) + : isSet(object.stream_last_seq) + ? globalThis.Number(object.stream_last_seq) + : 0, + }; + }, + + toJSON(message: MigrateStreamResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.streamLastSeq !== 0) { + obj.streamLastSeq = Math.round(message.streamLastSeq); + } + return obj; + }, + + create(base?: DeepPartial): MigrateStreamResponse { + return MigrateStreamResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): MigrateStreamResponse { + const message = createBaseMigrateStreamResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.totalBytes = object.totalBytes ?? 0; + message.streamLastSeq = object.streamLastSeq ?? 0; + return message; + }, +}; + +function createBaseGetClusterStreamStatsRequest(): GetClusterStreamStatsRequest { + return { includePerStream: false, localOnly: false }; +} + +export const GetClusterStreamStatsRequest: MessageFns = { + encode(message: GetClusterStreamStatsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.includePerStream !== false) { + writer.uint32(8).bool(message.includePerStream); + } + if (message.localOnly !== false) { + writer.uint32(16).bool(message.localOnly); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetClusterStreamStatsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetClusterStreamStatsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.includePerStream = reader.bool(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.localOnly = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetClusterStreamStatsRequest { + return { + includePerStream: isSet(object.includePerStream) + ? globalThis.Boolean(object.includePerStream) + : isSet(object.include_per_stream) + ? globalThis.Boolean(object.include_per_stream) + : false, + localOnly: isSet(object.localOnly) + ? globalThis.Boolean(object.localOnly) + : isSet(object.local_only) + ? globalThis.Boolean(object.local_only) + : false, + }; + }, + + toJSON(message: GetClusterStreamStatsRequest): unknown { + const obj: any = {}; + if (message.includePerStream !== false) { + obj.includePerStream = message.includePerStream; + } + if (message.localOnly !== false) { + obj.localOnly = message.localOnly; + } + return obj; + }, + + create(base?: DeepPartial): GetClusterStreamStatsRequest { + return GetClusterStreamStatsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetClusterStreamStatsRequest { + const message = createBaseGetClusterStreamStatsRequest(); + message.includePerStream = object.includePerStream ?? false; + message.localOnly = object.localOnly ?? false; + return message; + }, +}; + +function createBasePerStreamStats(): PerStreamStats { + return { name: "", ownerNodeId: 0, msgCount: 0, bytes: 0, lastSeq: 0 }; +} + +export const PerStreamStats: MessageFns = { + encode(message: PerStreamStats, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.ownerNodeId !== 0) { + writer.uint32(16).uint64(message.ownerNodeId); + } + if (message.msgCount !== 0) { + writer.uint32(24).uint64(message.msgCount); + } + if (message.bytes !== 0) { + writer.uint32(32).uint64(message.bytes); + } + if (message.lastSeq !== 0) { + writer.uint32(40).uint64(message.lastSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PerStreamStats { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePerStreamStats(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.ownerNodeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.msgCount = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.bytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.lastSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PerStreamStats { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + ownerNodeId: isSet(object.ownerNodeId) + ? globalThis.Number(object.ownerNodeId) + : isSet(object.owner_node_id) + ? globalThis.Number(object.owner_node_id) + : 0, + msgCount: isSet(object.msgCount) + ? globalThis.Number(object.msgCount) + : isSet(object.msg_count) + ? globalThis.Number(object.msg_count) + : 0, + bytes: isSet(object.bytes) ? globalThis.Number(object.bytes) : 0, + lastSeq: isSet(object.lastSeq) + ? globalThis.Number(object.lastSeq) + : isSet(object.last_seq) + ? globalThis.Number(object.last_seq) + : 0, + }; + }, + + toJSON(message: PerStreamStats): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.ownerNodeId !== 0) { + obj.ownerNodeId = Math.round(message.ownerNodeId); + } + if (message.msgCount !== 0) { + obj.msgCount = Math.round(message.msgCount); + } + if (message.bytes !== 0) { + obj.bytes = Math.round(message.bytes); + } + if (message.lastSeq !== 0) { + obj.lastSeq = Math.round(message.lastSeq); + } + return obj; + }, + + create(base?: DeepPartial): PerStreamStats { + return PerStreamStats.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PerStreamStats { + const message = createBasePerStreamStats(); + message.name = object.name ?? ""; + message.ownerNodeId = object.ownerNodeId ?? 0; + message.msgCount = object.msgCount ?? 0; + message.bytes = object.bytes ?? 0; + message.lastSeq = object.lastSeq ?? 0; + return message; + }, +}; + +function createBasePerNodeSummary(): PerNodeSummary { + return { nodeId: 0, streamCount: 0, totalMsgCount: 0, totalBytes: 0, status: "" }; +} + +export const PerNodeSummary: MessageFns = { + encode(message: PerNodeSummary, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nodeId !== 0) { + writer.uint32(8).uint64(message.nodeId); + } + if (message.streamCount !== 0) { + writer.uint32(16).uint64(message.streamCount); + } + if (message.totalMsgCount !== 0) { + writer.uint32(24).uint64(message.totalMsgCount); + } + if (message.totalBytes !== 0) { + writer.uint32(32).uint64(message.totalBytes); + } + if (message.status !== "") { + writer.uint32(42).string(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PerNodeSummary { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePerNodeSummary(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.nodeId = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.streamCount = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.totalMsgCount = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.status = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PerNodeSummary { + return { + nodeId: isSet(object.nodeId) + ? globalThis.Number(object.nodeId) + : isSet(object.node_id) + ? globalThis.Number(object.node_id) + : 0, + streamCount: isSet(object.streamCount) + ? globalThis.Number(object.streamCount) + : isSet(object.stream_count) + ? globalThis.Number(object.stream_count) + : 0, + totalMsgCount: isSet(object.totalMsgCount) + ? globalThis.Number(object.totalMsgCount) + : isSet(object.total_msg_count) + ? globalThis.Number(object.total_msg_count) + : 0, + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + status: isSet(object.status) ? globalThis.String(object.status) : "", + }; + }, + + toJSON(message: PerNodeSummary): unknown { + const obj: any = {}; + if (message.nodeId !== 0) { + obj.nodeId = Math.round(message.nodeId); + } + if (message.streamCount !== 0) { + obj.streamCount = Math.round(message.streamCount); + } + if (message.totalMsgCount !== 0) { + obj.totalMsgCount = Math.round(message.totalMsgCount); + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.status !== "") { + obj.status = message.status; + } + return obj; + }, + + create(base?: DeepPartial): PerNodeSummary { + return PerNodeSummary.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PerNodeSummary { + const message = createBasePerNodeSummary(); + message.nodeId = object.nodeId ?? 0; + message.streamCount = object.streamCount ?? 0; + message.totalMsgCount = object.totalMsgCount ?? 0; + message.totalBytes = object.totalBytes ?? 0; + message.status = object.status ?? ""; + return message; + }, +}; + +function createBaseGetClusterStreamStatsResponse(): GetClusterStreamStatsResponse { + return { + success: false, + resultCode: "", + message: "", + nodes: [], + streams: [], + totalStreamCount: 0, + totalMsgCount: 0, + totalBytes: 0, + skewCount: 0, + skewBytes: 0, + }; +} + +export const GetClusterStreamStatsResponse: MessageFns = { + encode(message: GetClusterStreamStatsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.nodes) { + PerNodeSummary.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.streams) { + PerStreamStats.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.totalStreamCount !== 0) { + writer.uint32(48).uint64(message.totalStreamCount); + } + if (message.totalMsgCount !== 0) { + writer.uint32(56).uint64(message.totalMsgCount); + } + if (message.totalBytes !== 0) { + writer.uint32(64).uint64(message.totalBytes); + } + if (message.skewCount !== 0) { + writer.uint32(72).uint64(message.skewCount); + } + if (message.skewBytes !== 0) { + writer.uint32(80).uint64(message.skewBytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetClusterStreamStatsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetClusterStreamStatsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.nodes.push(PerNodeSummary.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.streams.push(PerStreamStats.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.totalStreamCount = longToNumber(reader.uint64()); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.totalMsgCount = longToNumber(reader.uint64()); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.skewCount = longToNumber(reader.uint64()); + continue; + } + case 10: { + if (tag !== 80) { + break; + } + + message.skewBytes = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetClusterStreamStatsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + nodes: globalThis.Array.isArray(object?.nodes) ? object.nodes.map((e: any) => PerNodeSummary.fromJSON(e)) : [], + streams: globalThis.Array.isArray(object?.streams) + ? object.streams.map((e: any) => PerStreamStats.fromJSON(e)) + : [], + totalStreamCount: isSet(object.totalStreamCount) + ? globalThis.Number(object.totalStreamCount) + : isSet(object.total_stream_count) + ? globalThis.Number(object.total_stream_count) + : 0, + totalMsgCount: isSet(object.totalMsgCount) + ? globalThis.Number(object.totalMsgCount) + : isSet(object.total_msg_count) + ? globalThis.Number(object.total_msg_count) + : 0, + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + skewCount: isSet(object.skewCount) + ? globalThis.Number(object.skewCount) + : isSet(object.skew_count) + ? globalThis.Number(object.skew_count) + : 0, + skewBytes: isSet(object.skewBytes) + ? globalThis.Number(object.skewBytes) + : isSet(object.skew_bytes) + ? globalThis.Number(object.skew_bytes) + : 0, + }; + }, + + toJSON(message: GetClusterStreamStatsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.nodes?.length) { + obj.nodes = message.nodes.map((e) => PerNodeSummary.toJSON(e)); + } + if (message.streams?.length) { + obj.streams = message.streams.map((e) => PerStreamStats.toJSON(e)); + } + if (message.totalStreamCount !== 0) { + obj.totalStreamCount = Math.round(message.totalStreamCount); + } + if (message.totalMsgCount !== 0) { + obj.totalMsgCount = Math.round(message.totalMsgCount); + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.skewCount !== 0) { + obj.skewCount = Math.round(message.skewCount); + } + if (message.skewBytes !== 0) { + obj.skewBytes = Math.round(message.skewBytes); + } + return obj; + }, + + create(base?: DeepPartial): GetClusterStreamStatsResponse { + return GetClusterStreamStatsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetClusterStreamStatsResponse { + const message = createBaseGetClusterStreamStatsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.nodes = object.nodes?.map((e) => PerNodeSummary.fromPartial(e)) || []; + message.streams = object.streams?.map((e) => PerStreamStats.fromPartial(e)) || []; + message.totalStreamCount = object.totalStreamCount ?? 0; + message.totalMsgCount = object.totalMsgCount ?? 0; + message.totalBytes = object.totalBytes ?? 0; + message.skewCount = object.skewCount ?? 0; + message.skewBytes = object.skewBytes ?? 0; + return message; + }, +}; + +function createBaseRebalancePlanEntry(): RebalancePlanEntry { + return { name: "", targetNodeId: 0 }; +} + +export const RebalancePlanEntry: MessageFns = { + encode(message: RebalancePlanEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.targetNodeId !== 0) { + writer.uint32(16).uint64(message.targetNodeId); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RebalancePlanEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRebalancePlanEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.targetNodeId = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RebalancePlanEntry { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + targetNodeId: isSet(object.targetNodeId) + ? globalThis.Number(object.targetNodeId) + : isSet(object.target_node_id) + ? globalThis.Number(object.target_node_id) + : 0, + }; + }, + + toJSON(message: RebalancePlanEntry): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.targetNodeId !== 0) { + obj.targetNodeId = Math.round(message.targetNodeId); + } + return obj; + }, + + create(base?: DeepPartial): RebalancePlanEntry { + return RebalancePlanEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RebalancePlanEntry { + const message = createBaseRebalancePlanEntry(); + message.name = object.name ?? ""; + message.targetNodeId = object.targetNodeId ?? 0; + return message; + }, +}; + +function createBaseRebalanceStreamsRequest(): RebalanceStreamsRequest { + return { plan: [], perStepTimeoutMs: 0 }; +} + +export const RebalanceStreamsRequest: MessageFns = { + encode(message: RebalanceStreamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.plan) { + RebalancePlanEntry.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.perStepTimeoutMs !== 0) { + writer.uint32(16).uint64(message.perStepTimeoutMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RebalanceStreamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRebalanceStreamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.plan.push(RebalancePlanEntry.decode(reader, reader.uint32())); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.perStepTimeoutMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RebalanceStreamsRequest { + return { + plan: globalThis.Array.isArray(object?.plan) ? object.plan.map((e: any) => RebalancePlanEntry.fromJSON(e)) : [], + perStepTimeoutMs: isSet(object.perStepTimeoutMs) + ? globalThis.Number(object.perStepTimeoutMs) + : isSet(object.per_step_timeout_ms) + ? globalThis.Number(object.per_step_timeout_ms) + : 0, + }; + }, + + toJSON(message: RebalanceStreamsRequest): unknown { + const obj: any = {}; + if (message.plan?.length) { + obj.plan = message.plan.map((e) => RebalancePlanEntry.toJSON(e)); + } + if (message.perStepTimeoutMs !== 0) { + obj.perStepTimeoutMs = Math.round(message.perStepTimeoutMs); + } + return obj; + }, + + create(base?: DeepPartial): RebalanceStreamsRequest { + return RebalanceStreamsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RebalanceStreamsRequest { + const message = createBaseRebalanceStreamsRequest(); + message.plan = object.plan?.map((e) => RebalancePlanEntry.fromPartial(e)) || []; + message.perStepTimeoutMs = object.perStepTimeoutMs ?? 0; + return message; + }, +}; + +function createBaseRebalanceStepOutcome(): RebalanceStepOutcome { + return { name: "", targetNodeId: 0, success: false, resultCode: "", message: "" }; +} + +export const RebalanceStepOutcome: MessageFns = { + encode(message: RebalanceStepOutcome, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.targetNodeId !== 0) { + writer.uint32(16).uint64(message.targetNodeId); + } + if (message.success !== false) { + writer.uint32(24).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(34).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(42).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RebalanceStepOutcome { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRebalanceStepOutcome(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.targetNodeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.success = reader.bool(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RebalanceStepOutcome { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + targetNodeId: isSet(object.targetNodeId) + ? globalThis.Number(object.targetNodeId) + : isSet(object.target_node_id) + ? globalThis.Number(object.target_node_id) + : 0, + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: RebalanceStepOutcome): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.targetNodeId !== 0) { + obj.targetNodeId = Math.round(message.targetNodeId); + } + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): RebalanceStepOutcome { + return RebalanceStepOutcome.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RebalanceStepOutcome { + const message = createBaseRebalanceStepOutcome(); + message.name = object.name ?? ""; + message.targetNodeId = object.targetNodeId ?? 0; + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseRebalanceStreamsResponse(): RebalanceStreamsResponse { + return { success: false, resultCode: "", message: "", steps: [] }; +} + +export const RebalanceStreamsResponse: MessageFns = { + encode(message: RebalanceStreamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.steps) { + RebalanceStepOutcome.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RebalanceStreamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRebalanceStreamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.steps.push(RebalanceStepOutcome.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RebalanceStreamsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + steps: globalThis.Array.isArray(object?.steps) + ? object.steps.map((e: any) => RebalanceStepOutcome.fromJSON(e)) + : [], + }; + }, + + toJSON(message: RebalanceStreamsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.steps?.length) { + obj.steps = message.steps.map((e) => RebalanceStepOutcome.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): RebalanceStreamsResponse { + return RebalanceStreamsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): RebalanceStreamsResponse { + const message = createBaseRebalanceStreamsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.steps = object.steps?.map((e) => RebalanceStepOutcome.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseWatchStreamsRequest(): WatchStreamsRequest { + return {}; +} + +export const WatchStreamsRequest: MessageFns = { + encode(_: WatchStreamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WatchStreamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWatchStreamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): WatchStreamsRequest { + return {}; + }, + + toJSON(_: WatchStreamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create(base?: DeepPartial): WatchStreamsRequest { + return WatchStreamsRequest.fromPartial(base ?? {}); + }, + fromPartial(_: DeepPartial): WatchStreamsRequest { + const message = createBaseWatchStreamsRequest(); + return message; + }, +}; + +function createBaseStreamWatchDetail(): StreamWatchDetail { + return { name: "" }; +} + +export const StreamWatchDetail: MessageFns = { + encode(message: StreamWatchDetail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StreamWatchDetail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStreamWatchDetail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StreamWatchDetail { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: StreamWatchDetail): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): StreamWatchDetail { + return StreamWatchDetail.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): StreamWatchDetail { + const message = createBaseStreamWatchDetail(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseConsumerWatchDetail(): ConsumerWatchDetail { + return { stream: "", consumer: "" }; +} + +export const ConsumerWatchDetail: MessageFns = { + encode(message: ConsumerWatchDetail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.consumer !== "") { + writer.uint32(18).string(message.consumer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsumerWatchDetail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumerWatchDetail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.consumer = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConsumerWatchDetail { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + consumer: isSet(object.consumer) ? globalThis.String(object.consumer) : "", + }; + }, + + toJSON(message: ConsumerWatchDetail): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.consumer !== "") { + obj.consumer = message.consumer; + } + return obj; + }, + + create(base?: DeepPartial): ConsumerWatchDetail { + return ConsumerWatchDetail.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ConsumerWatchDetail { + const message = createBaseConsumerWatchDetail(); + message.stream = object.stream ?? ""; + message.consumer = object.consumer ?? ""; + return message; + }, +}; + +function createBaseAuthorityWatchDetail(): AuthorityWatchDetail { + return { stream: "", claimantNodeId: 0, fenceEpoch: 0 }; +} + +export const AuthorityWatchDetail: MessageFns = { + encode(message: AuthorityWatchDetail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.claimantNodeId !== 0) { + writer.uint32(16).uint64(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + writer.uint32(24).uint64(message.fenceEpoch); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthorityWatchDetail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthorityWatchDetail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.claimantNodeId = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fenceEpoch = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthorityWatchDetail { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + claimantNodeId: isSet(object.claimantNodeId) + ? globalThis.Number(object.claimantNodeId) + : isSet(object.claimant_node_id) + ? globalThis.Number(object.claimant_node_id) + : 0, + fenceEpoch: isSet(object.fenceEpoch) + ? globalThis.Number(object.fenceEpoch) + : isSet(object.fence_epoch) + ? globalThis.Number(object.fence_epoch) + : 0, + }; + }, + + toJSON(message: AuthorityWatchDetail): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.claimantNodeId !== 0) { + obj.claimantNodeId = Math.round(message.claimantNodeId); + } + if (message.fenceEpoch !== 0) { + obj.fenceEpoch = Math.round(message.fenceEpoch); + } + return obj; + }, + + create(base?: DeepPartial): AuthorityWatchDetail { + return AuthorityWatchDetail.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): AuthorityWatchDetail { + const message = createBaseAuthorityWatchDetail(); + message.stream = object.stream ?? ""; + message.claimantNodeId = object.claimantNodeId ?? 0; + message.fenceEpoch = object.fenceEpoch ?? 0; + return message; + }, +}; + +function createBaseReadLatestAtSubjectRequest(): ReadLatestAtSubjectRequest { + return { stream: "", subject: "" }; +} + +export const ReadLatestAtSubjectRequest: MessageFns = { + encode(message: ReadLatestAtSubjectRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.subject !== "") { + writer.uint32(18).string(message.subject); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReadLatestAtSubjectRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReadLatestAtSubjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subject = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReadLatestAtSubjectRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + subject: isSet(object.subject) ? globalThis.String(object.subject) : "", + }; + }, + + toJSON(message: ReadLatestAtSubjectRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.subject !== "") { + obj.subject = message.subject; + } + return obj; + }, + + create(base?: DeepPartial): ReadLatestAtSubjectRequest { + return ReadLatestAtSubjectRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReadLatestAtSubjectRequest { + const message = createBaseReadLatestAtSubjectRequest(); + message.stream = object.stream ?? ""; + message.subject = object.subject ?? ""; + return message; + }, +}; + +function createBaseReadLatestAtSubjectResponse(): ReadLatestAtSubjectResponse { + return { success: false, resultCode: "", message: "", latest: undefined }; +} + +export const ReadLatestAtSubjectResponse: MessageFns = { + encode(message: ReadLatestAtSubjectResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.latest !== undefined) { + MessagePb.encode(message.latest, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReadLatestAtSubjectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReadLatestAtSubjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.latest = MessagePb.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReadLatestAtSubjectResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + latest: isSet(object.latest) ? MessagePb.fromJSON(object.latest) : undefined, + }; + }, + + toJSON(message: ReadLatestAtSubjectResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.latest !== undefined) { + obj.latest = MessagePb.toJSON(message.latest); + } + return obj; + }, + + create(base?: DeepPartial): ReadLatestAtSubjectResponse { + return ReadLatestAtSubjectResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReadLatestAtSubjectResponse { + const message = createBaseReadLatestAtSubjectResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.latest = (object.latest !== undefined && object.latest !== null) + ? MessagePb.fromPartial(object.latest) + : undefined; + return message; + }, +}; + +function createBaseListSubjectsByPrefixRequest(): ListSubjectsByPrefixRequest { + return { stream: "", prefix: "" }; +} + +export const ListSubjectsByPrefixRequest: MessageFns = { + encode(message: ListSubjectsByPrefixRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.prefix !== "") { + writer.uint32(18).string(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListSubjectsByPrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListSubjectsByPrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.prefix = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListSubjectsByPrefixRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + prefix: isSet(object.prefix) ? globalThis.String(object.prefix) : "", + }; + }, + + toJSON(message: ListSubjectsByPrefixRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.prefix !== "") { + obj.prefix = message.prefix; + } + return obj; + }, + + create(base?: DeepPartial): ListSubjectsByPrefixRequest { + return ListSubjectsByPrefixRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListSubjectsByPrefixRequest { + const message = createBaseListSubjectsByPrefixRequest(); + message.stream = object.stream ?? ""; + message.prefix = object.prefix ?? ""; + return message; + }, +}; + +function createBaseListSubjectsByPrefixResponse(): ListSubjectsByPrefixResponse { + return { success: false, resultCode: "", message: "", subjects: [] }; +} + +export const ListSubjectsByPrefixResponse: MessageFns = { + encode(message: ListSubjectsByPrefixResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.subjects) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListSubjectsByPrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListSubjectsByPrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.subjects.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListSubjectsByPrefixResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + subjects: globalThis.Array.isArray(object?.subjects) ? object.subjects.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ListSubjectsByPrefixResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.subjects?.length) { + obj.subjects = message.subjects; + } + return obj; + }, + + create(base?: DeepPartial): ListSubjectsByPrefixResponse { + return ListSubjectsByPrefixResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListSubjectsByPrefixResponse { + const message = createBaseListSubjectsByPrefixResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.subjects = object.subjects?.map((e) => e) || []; + return message; + }, +}; + +function createBaseScanExactAtSubjectRequest(): ScanExactAtSubjectRequest { + return { stream: "", subject: "", fromSeq: 0, limit: 0 }; +} + +export const ScanExactAtSubjectRequest: MessageFns = { + encode(message: ScanExactAtSubjectRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.subject !== "") { + writer.uint32(18).string(message.subject); + } + if (message.fromSeq !== 0) { + writer.uint32(24).uint64(message.fromSeq); + } + if (message.limit !== 0) { + writer.uint32(32).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScanExactAtSubjectRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScanExactAtSubjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.subject = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fromSeq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScanExactAtSubjectRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + subject: isSet(object.subject) ? globalThis.String(object.subject) : "", + fromSeq: isSet(object.fromSeq) + ? globalThis.Number(object.fromSeq) + : isSet(object.from_seq) + ? globalThis.Number(object.from_seq) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: ScanExactAtSubjectRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.subject !== "") { + obj.subject = message.subject; + } + if (message.fromSeq !== 0) { + obj.fromSeq = Math.round(message.fromSeq); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): ScanExactAtSubjectRequest { + return ScanExactAtSubjectRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ScanExactAtSubjectRequest { + const message = createBaseScanExactAtSubjectRequest(); + message.stream = object.stream ?? ""; + message.subject = object.subject ?? ""; + message.fromSeq = object.fromSeq ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseScanExactAtSubjectResponse(): ScanExactAtSubjectResponse { + return { success: false, resultCode: "", message: "", messages: [] }; +} + +export const ScanExactAtSubjectResponse: MessageFns = { + encode(message: ScanExactAtSubjectResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.messages) { + MessagePb.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScanExactAtSubjectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScanExactAtSubjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.messages.push(MessagePb.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScanExactAtSubjectResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + messages: globalThis.Array.isArray(object?.messages) + ? object.messages.map((e: any) => MessagePb.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ScanExactAtSubjectResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.messages?.length) { + obj.messages = message.messages.map((e) => MessagePb.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ScanExactAtSubjectResponse { + return ScanExactAtSubjectResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ScanExactAtSubjectResponse { + const message = createBaseScanExactAtSubjectResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.messages = object.messages?.map((e) => MessagePb.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseWatchEvent(): WatchEvent { + return { type: 0, tsMs: 0, nodeId: 0, stream: undefined, consumer: undefined, authority: undefined, laggedCount: 0 }; +} + +export const WatchEvent: MessageFns = { + encode(message: WatchEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.tsMs !== 0) { + writer.uint32(16).int64(message.tsMs); + } + if (message.nodeId !== 0) { + writer.uint32(24).uint64(message.nodeId); + } + if (message.stream !== undefined) { + StreamWatchDetail.encode(message.stream, writer.uint32(34).fork()).join(); + } + if (message.consumer !== undefined) { + ConsumerWatchDetail.encode(message.consumer, writer.uint32(42).fork()).join(); + } + if (message.authority !== undefined) { + AuthorityWatchDetail.encode(message.authority, writer.uint32(58).fork()).join(); + } + if (message.laggedCount !== 0) { + writer.uint32(48).uint64(message.laggedCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WatchEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWatchEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.nodeId = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.stream = StreamWatchDetail.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.consumer = ConsumerWatchDetail.decode(reader, reader.uint32()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.authority = AuthorityWatchDetail.decode(reader, reader.uint32()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.laggedCount = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WatchEvent { + return { + type: isSet(object.type) ? watchEventTypeFromJSON(object.type) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + nodeId: isSet(object.nodeId) + ? globalThis.Number(object.nodeId) + : isSet(object.node_id) + ? globalThis.Number(object.node_id) + : 0, + stream: isSet(object.stream) ? StreamWatchDetail.fromJSON(object.stream) : undefined, + consumer: isSet(object.consumer) ? ConsumerWatchDetail.fromJSON(object.consumer) : undefined, + authority: isSet(object.authority) ? AuthorityWatchDetail.fromJSON(object.authority) : undefined, + laggedCount: isSet(object.laggedCount) + ? globalThis.Number(object.laggedCount) + : isSet(object.lagged_count) + ? globalThis.Number(object.lagged_count) + : 0, + }; + }, + + toJSON(message: WatchEvent): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = watchEventTypeToJSON(message.type); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.nodeId !== 0) { + obj.nodeId = Math.round(message.nodeId); + } + if (message.stream !== undefined) { + obj.stream = StreamWatchDetail.toJSON(message.stream); + } + if (message.consumer !== undefined) { + obj.consumer = ConsumerWatchDetail.toJSON(message.consumer); + } + if (message.authority !== undefined) { + obj.authority = AuthorityWatchDetail.toJSON(message.authority); + } + if (message.laggedCount !== 0) { + obj.laggedCount = Math.round(message.laggedCount); + } + return obj; + }, + + create(base?: DeepPartial): WatchEvent { + return WatchEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): WatchEvent { + const message = createBaseWatchEvent(); + message.type = object.type ?? 0; + message.tsMs = object.tsMs ?? 0; + message.nodeId = object.nodeId ?? 0; + message.stream = (object.stream !== undefined && object.stream !== null) + ? StreamWatchDetail.fromPartial(object.stream) + : undefined; + message.consumer = (object.consumer !== undefined && object.consumer !== null) + ? ConsumerWatchDetail.fromPartial(object.consumer) + : undefined; + message.authority = (object.authority !== undefined && object.authority !== null) + ? AuthorityWatchDetail.fromPartial(object.authority) + : undefined; + message.laggedCount = object.laggedCount ?? 0; + return message; + }, +}; + +function createBasePendingDeliveryPb(): PendingDeliveryPb { + return { seq: 0, deliveredAtMs: 0, deliverCount: 0 }; +} + +export const PendingDeliveryPb: MessageFns = { + encode(message: PendingDeliveryPb, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seq !== 0) { + writer.uint32(8).uint64(message.seq); + } + if (message.deliveredAtMs !== 0) { + writer.uint32(16).int64(message.deliveredAtMs); + } + if (message.deliverCount !== 0) { + writer.uint32(24).uint32(message.deliverCount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PendingDeliveryPb { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePendingDeliveryPb(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.deliveredAtMs = longToNumber(reader.int64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deliverCount = reader.uint32(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PendingDeliveryPb { + return { + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + deliveredAtMs: isSet(object.deliveredAtMs) + ? globalThis.Number(object.deliveredAtMs) + : isSet(object.delivered_at_ms) + ? globalThis.Number(object.delivered_at_ms) + : 0, + deliverCount: isSet(object.deliverCount) + ? globalThis.Number(object.deliverCount) + : isSet(object.deliver_count) + ? globalThis.Number(object.deliver_count) + : 0, + }; + }, + + toJSON(message: PendingDeliveryPb): unknown { + const obj: any = {}; + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + if (message.deliveredAtMs !== 0) { + obj.deliveredAtMs = Math.round(message.deliveredAtMs); + } + if (message.deliverCount !== 0) { + obj.deliverCount = Math.round(message.deliverCount); + } + return obj; + }, + + create(base?: DeepPartial): PendingDeliveryPb { + return PendingDeliveryPb.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PendingDeliveryPb { + const message = createBasePendingDeliveryPb(); + message.seq = object.seq ?? 0; + message.deliveredAtMs = object.deliveredAtMs ?? 0; + message.deliverCount = object.deliverCount ?? 0; + return message; + }, +}; + +function createBaseConsumerStateSnapshot(): ConsumerStateSnapshot { + return { + stream: "", + config: undefined, + ackFloor: 0, + lastDelivered: 0, + createdAtMs: 0, + redeliveredDropped: 0, + pending: [], + tombstone: false, + }; +} + +export const ConsumerStateSnapshot: MessageFns = { + encode(message: ConsumerStateSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.config !== undefined) { + ConsumerConfigPb.encode(message.config, writer.uint32(18).fork()).join(); + } + if (message.ackFloor !== 0) { + writer.uint32(24).uint64(message.ackFloor); + } + if (message.lastDelivered !== 0) { + writer.uint32(32).uint64(message.lastDelivered); + } + if (message.createdAtMs !== 0) { + writer.uint32(40).int64(message.createdAtMs); + } + if (message.redeliveredDropped !== 0) { + writer.uint32(48).uint64(message.redeliveredDropped); + } + for (const v of message.pending) { + PendingDeliveryPb.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.tombstone !== false) { + writer.uint32(64).bool(message.tombstone); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsumerStateSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsumerStateSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.config = ConsumerConfigPb.decode(reader, reader.uint32()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ackFloor = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.lastDelivered = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.createdAtMs = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.redeliveredDropped = longToNumber(reader.uint64()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.pending.push(PendingDeliveryPb.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.tombstone = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConsumerStateSnapshot { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + config: isSet(object.config) ? ConsumerConfigPb.fromJSON(object.config) : undefined, + ackFloor: isSet(object.ackFloor) + ? globalThis.Number(object.ackFloor) + : isSet(object.ack_floor) + ? globalThis.Number(object.ack_floor) + : 0, + lastDelivered: isSet(object.lastDelivered) + ? globalThis.Number(object.lastDelivered) + : isSet(object.last_delivered) + ? globalThis.Number(object.last_delivered) + : 0, + createdAtMs: isSet(object.createdAtMs) + ? globalThis.Number(object.createdAtMs) + : isSet(object.created_at_ms) + ? globalThis.Number(object.created_at_ms) + : 0, + redeliveredDropped: isSet(object.redeliveredDropped) + ? globalThis.Number(object.redeliveredDropped) + : isSet(object.redelivered_dropped) + ? globalThis.Number(object.redelivered_dropped) + : 0, + pending: globalThis.Array.isArray(object?.pending) + ? object.pending.map((e: any) => PendingDeliveryPb.fromJSON(e)) + : [], + tombstone: isSet(object.tombstone) ? globalThis.Boolean(object.tombstone) : false, + }; + }, + + toJSON(message: ConsumerStateSnapshot): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.config !== undefined) { + obj.config = ConsumerConfigPb.toJSON(message.config); + } + if (message.ackFloor !== 0) { + obj.ackFloor = Math.round(message.ackFloor); + } + if (message.lastDelivered !== 0) { + obj.lastDelivered = Math.round(message.lastDelivered); + } + if (message.createdAtMs !== 0) { + obj.createdAtMs = Math.round(message.createdAtMs); + } + if (message.redeliveredDropped !== 0) { + obj.redeliveredDropped = Math.round(message.redeliveredDropped); + } + if (message.pending?.length) { + obj.pending = message.pending.map((e) => PendingDeliveryPb.toJSON(e)); + } + if (message.tombstone !== false) { + obj.tombstone = message.tombstone; + } + return obj; + }, + + create(base?: DeepPartial): ConsumerStateSnapshot { + return ConsumerStateSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ConsumerStateSnapshot { + const message = createBaseConsumerStateSnapshot(); + message.stream = object.stream ?? ""; + message.config = (object.config !== undefined && object.config !== null) + ? ConsumerConfigPb.fromPartial(object.config) + : undefined; + message.ackFloor = object.ackFloor ?? 0; + message.lastDelivered = object.lastDelivered ?? 0; + message.createdAtMs = object.createdAtMs ?? 0; + message.redeliveredDropped = object.redeliveredDropped ?? 0; + message.pending = object.pending?.map((e) => PendingDeliveryPb.fromPartial(e)) || []; + message.tombstone = object.tombstone ?? false; + return message; + }, +}; + +function createBaseReplicateConsumerStateRequest(): ReplicateConsumerStateRequest { + return { snapshot: undefined }; +} + +export const ReplicateConsumerStateRequest: MessageFns = { + encode(message: ReplicateConsumerStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + ConsumerStateSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateConsumerStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateConsumerStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.snapshot = ConsumerStateSnapshot.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateConsumerStateRequest { + return { snapshot: isSet(object.snapshot) ? ConsumerStateSnapshot.fromJSON(object.snapshot) : undefined }; + }, + + toJSON(message: ReplicateConsumerStateRequest): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = ConsumerStateSnapshot.toJSON(message.snapshot); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateConsumerStateRequest { + return ReplicateConsumerStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateConsumerStateRequest { + const message = createBaseReplicateConsumerStateRequest(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? ConsumerStateSnapshot.fromPartial(object.snapshot) + : undefined; + return message; + }, +}; + +function createBaseReplicateConsumerStateResponse(): ReplicateConsumerStateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateConsumerStateResponse: MessageFns = { + encode(message: ReplicateConsumerStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateConsumerStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateConsumerStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateConsumerStateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateConsumerStateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateConsumerStateResponse { + return ReplicateConsumerStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateConsumerStateResponse { + const message = createBaseReplicateConsumerStateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSourceTailStateSnapshot(): SourceTailStateSnapshot { + return { sourcingStream: "", sourceStream: "", lastSourcedSeq: 0, pulledTotal: 0, updatedTsMs: 0, tombstone: false }; +} + +export const SourceTailStateSnapshot: MessageFns = { + encode(message: SourceTailStateSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sourcingStream !== "") { + writer.uint32(10).string(message.sourcingStream); + } + if (message.sourceStream !== "") { + writer.uint32(18).string(message.sourceStream); + } + if (message.lastSourcedSeq !== 0) { + writer.uint32(24).uint64(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + writer.uint32(32).uint64(message.pulledTotal); + } + if (message.updatedTsMs !== 0) { + writer.uint32(40).int64(message.updatedTsMs); + } + if (message.tombstone !== false) { + writer.uint32(48).bool(message.tombstone); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceTailStateSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceTailStateSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.sourcingStream = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.sourceStream = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.lastSourcedSeq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.pulledTotal = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.updatedTsMs = longToNumber(reader.int64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.tombstone = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceTailStateSnapshot { + return { + sourcingStream: isSet(object.sourcingStream) + ? globalThis.String(object.sourcingStream) + : isSet(object.sourcing_stream) + ? globalThis.String(object.sourcing_stream) + : "", + sourceStream: isSet(object.sourceStream) + ? globalThis.String(object.sourceStream) + : isSet(object.source_stream) + ? globalThis.String(object.source_stream) + : "", + lastSourcedSeq: isSet(object.lastSourcedSeq) + ? globalThis.Number(object.lastSourcedSeq) + : isSet(object.last_sourced_seq) + ? globalThis.Number(object.last_sourced_seq) + : 0, + pulledTotal: isSet(object.pulledTotal) + ? globalThis.Number(object.pulledTotal) + : isSet(object.pulled_total) + ? globalThis.Number(object.pulled_total) + : 0, + updatedTsMs: isSet(object.updatedTsMs) + ? globalThis.Number(object.updatedTsMs) + : isSet(object.updated_ts_ms) + ? globalThis.Number(object.updated_ts_ms) + : 0, + tombstone: isSet(object.tombstone) ? globalThis.Boolean(object.tombstone) : false, + }; + }, + + toJSON(message: SourceTailStateSnapshot): unknown { + const obj: any = {}; + if (message.sourcingStream !== "") { + obj.sourcingStream = message.sourcingStream; + } + if (message.sourceStream !== "") { + obj.sourceStream = message.sourceStream; + } + if (message.lastSourcedSeq !== 0) { + obj.lastSourcedSeq = Math.round(message.lastSourcedSeq); + } + if (message.pulledTotal !== 0) { + obj.pulledTotal = Math.round(message.pulledTotal); + } + if (message.updatedTsMs !== 0) { + obj.updatedTsMs = Math.round(message.updatedTsMs); + } + if (message.tombstone !== false) { + obj.tombstone = message.tombstone; + } + return obj; + }, + + create(base?: DeepPartial): SourceTailStateSnapshot { + return SourceTailStateSnapshot.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SourceTailStateSnapshot { + const message = createBaseSourceTailStateSnapshot(); + message.sourcingStream = object.sourcingStream ?? ""; + message.sourceStream = object.sourceStream ?? ""; + message.lastSourcedSeq = object.lastSourcedSeq ?? 0; + message.pulledTotal = object.pulledTotal ?? 0; + message.updatedTsMs = object.updatedTsMs ?? 0; + message.tombstone = object.tombstone ?? false; + return message; + }, +}; + +function createBaseReplicateSourceTailStateRequest(): ReplicateSourceTailStateRequest { + return { snapshot: undefined }; +} + +export const ReplicateSourceTailStateRequest: MessageFns = { + encode(message: ReplicateSourceTailStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + SourceTailStateSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateSourceTailStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateSourceTailStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.snapshot = SourceTailStateSnapshot.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateSourceTailStateRequest { + return { snapshot: isSet(object.snapshot) ? SourceTailStateSnapshot.fromJSON(object.snapshot) : undefined }; + }, + + toJSON(message: ReplicateSourceTailStateRequest): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = SourceTailStateSnapshot.toJSON(message.snapshot); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateSourceTailStateRequest { + return ReplicateSourceTailStateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateSourceTailStateRequest { + const message = createBaseReplicateSourceTailStateRequest(); + message.snapshot = (object.snapshot !== undefined && object.snapshot !== null) + ? SourceTailStateSnapshot.fromPartial(object.snapshot) + : undefined; + return message; + }, +}; + +function createBaseReplicateSourceTailStateResponse(): ReplicateSourceTailStateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateSourceTailStateResponse: MessageFns = { + encode(message: ReplicateSourceTailStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateSourceTailStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateSourceTailStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateSourceTailStateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateSourceTailStateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateSourceTailStateResponse { + return ReplicateSourceTailStateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateSourceTailStateResponse { + const message = createBaseReplicateSourceTailStateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseReplicateStreamCreateRequest(): ReplicateStreamCreateRequest { + return { config: undefined }; +} + +export const ReplicateStreamCreateRequest: MessageFns = { + encode(message: ReplicateStreamCreateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + StreamConfigPb.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamCreateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.config = StreamConfigPb.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamCreateRequest { + return { config: isSet(object.config) ? StreamConfigPb.fromJSON(object.config) : undefined }; + }, + + toJSON(message: ReplicateStreamCreateRequest): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = StreamConfigPb.toJSON(message.config); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamCreateRequest { + return ReplicateStreamCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamCreateRequest { + const message = createBaseReplicateStreamCreateRequest(); + message.config = (object.config !== undefined && object.config !== null) + ? StreamConfigPb.fromPartial(object.config) + : undefined; + return message; + }, +}; + +function createBaseReplicateStreamCreateResponse(): ReplicateStreamCreateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateStreamCreateResponse: MessageFns = { + encode(message: ReplicateStreamCreateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamCreateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamCreateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamCreateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateStreamCreateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamCreateResponse { + return ReplicateStreamCreateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamCreateResponse { + const message = createBaseReplicateStreamCreateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseReplicateMessageRequest(): ReplicateMessageRequest { + return { stream: "", seq: 0, subject: "", payload: Buffer.alloc(0), headers: [], tsMs: 0 }; +} + +export const ReplicateMessageRequest: MessageFns = { + encode(message: ReplicateMessageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.seq !== 0) { + writer.uint32(16).uint64(message.seq); + } + if (message.subject !== "") { + writer.uint32(26).string(message.subject); + } + if (message.payload.length !== 0) { + writer.uint32(34).bytes(message.payload); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.tsMs !== 0) { + writer.uint32(48).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateMessageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateMessageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.subject = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateMessageRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + subject: isSet(object.subject) ? globalThis.String(object.subject) : "", + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: ReplicateMessageRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + if (message.subject !== "") { + obj.subject = message.subject; + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateMessageRequest { + return ReplicateMessageRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateMessageRequest { + const message = createBaseReplicateMessageRequest(); + message.stream = object.stream ?? ""; + message.seq = object.seq ?? 0; + message.subject = object.subject ?? ""; + message.payload = object.payload ?? Buffer.alloc(0); + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseReplicateMessageResponse(): ReplicateMessageResponse { + return { success: false, resultCode: "", message: "", receiverLastSeq: 0 }; +} + +export const ReplicateMessageResponse: MessageFns = { + encode(message: ReplicateMessageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.receiverLastSeq !== 0) { + writer.uint32(32).uint64(message.receiverLastSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateMessageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateMessageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.receiverLastSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateMessageResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + receiverLastSeq: isSet(object.receiverLastSeq) + ? globalThis.Number(object.receiverLastSeq) + : isSet(object.receiver_last_seq) + ? globalThis.Number(object.receiver_last_seq) + : 0, + }; + }, + + toJSON(message: ReplicateMessageResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.receiverLastSeq !== 0) { + obj.receiverLastSeq = Math.round(message.receiverLastSeq); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateMessageResponse { + return ReplicateMessageResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateMessageResponse { + const message = createBaseReplicateMessageResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.receiverLastSeq = object.receiverLastSeq ?? 0; + return message; + }, +}; + +function createBaseReplicateStreamDeleteRequest(): ReplicateStreamDeleteRequest { + return { name: "" }; +} + +export const ReplicateStreamDeleteRequest: MessageFns = { + encode(message: ReplicateStreamDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamDeleteRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: ReplicateStreamDeleteRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamDeleteRequest { + return ReplicateStreamDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamDeleteRequest { + const message = createBaseReplicateStreamDeleteRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseReplicateStreamDeleteResponse(): ReplicateStreamDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateStreamDeleteResponse: MessageFns = { + encode(message: ReplicateStreamDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateStreamDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamDeleteResponse { + return ReplicateStreamDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamDeleteResponse { + const message = createBaseReplicateStreamDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseReplicateTruncateRequest(): ReplicateTruncateRequest { + return { stream: "", firstSeq: 0 }; +} + +export const ReplicateTruncateRequest: MessageFns = { + encode(message: ReplicateTruncateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.firstSeq !== 0) { + writer.uint32(16).uint64(message.firstSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateTruncateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateTruncateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.firstSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateTruncateRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + firstSeq: isSet(object.firstSeq) + ? globalThis.Number(object.firstSeq) + : isSet(object.first_seq) + ? globalThis.Number(object.first_seq) + : 0, + }; + }, + + toJSON(message: ReplicateTruncateRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.firstSeq !== 0) { + obj.firstSeq = Math.round(message.firstSeq); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateTruncateRequest { + return ReplicateTruncateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateTruncateRequest { + const message = createBaseReplicateTruncateRequest(); + message.stream = object.stream ?? ""; + message.firstSeq = object.firstSeq ?? 0; + return message; + }, +}; + +function createBaseReplicateTruncateResponse(): ReplicateTruncateResponse { + return { success: false, resultCode: "", message: "", dropped: 0 }; +} + +export const ReplicateTruncateResponse: MessageFns = { + encode(message: ReplicateTruncateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.dropped !== 0) { + writer.uint32(32).uint64(message.dropped); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateTruncateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateTruncateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.dropped = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateTruncateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + dropped: isSet(object.dropped) ? globalThis.Number(object.dropped) : 0, + }; + }, + + toJSON(message: ReplicateTruncateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.dropped !== 0) { + obj.dropped = Math.round(message.dropped); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateTruncateResponse { + return ReplicateTruncateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateTruncateResponse { + const message = createBaseReplicateTruncateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.dropped = object.dropped ?? 0; + return message; + }, +}; + +function createBaseReplicateStreamUpdateRequest(): ReplicateStreamUpdateRequest { + return { + name: "", + maxAgeMs: undefined, + maxMsgs: undefined, + maxBytes: undefined, + maxMsgBytes: undefined, + strictLimits: undefined, + }; +} + +export const ReplicateStreamUpdateRequest: MessageFns = { + encode(message: ReplicateStreamUpdateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxAgeMs !== undefined) { + writer.uint32(16).uint64(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + writer.uint32(24).uint64(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + writer.uint32(32).uint64(message.maxBytes); + } + if (message.maxMsgBytes !== undefined) { + writer.uint32(40).uint64(message.maxMsgBytes); + } + if (message.strictLimits !== undefined) { + writer.uint32(48).bool(message.strictLimits); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxAgeMs = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxMsgs = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.maxMsgBytes = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.strictLimits = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamUpdateRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxAgeMs: isSet(object.maxAgeMs) + ? globalThis.Number(object.maxAgeMs) + : isSet(object.max_age_ms) + ? globalThis.Number(object.max_age_ms) + : undefined, + maxMsgs: isSet(object.maxMsgs) + ? globalThis.Number(object.maxMsgs) + : isSet(object.max_msgs) + ? globalThis.Number(object.max_msgs) + : undefined, + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : undefined, + maxMsgBytes: isSet(object.maxMsgBytes) + ? globalThis.Number(object.maxMsgBytes) + : isSet(object.max_msg_bytes) + ? globalThis.Number(object.max_msg_bytes) + : undefined, + strictLimits: isSet(object.strictLimits) + ? globalThis.Boolean(object.strictLimits) + : isSet(object.strict_limits) + ? globalThis.Boolean(object.strict_limits) + : undefined, + }; + }, + + toJSON(message: ReplicateStreamUpdateRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxAgeMs !== undefined) { + obj.maxAgeMs = Math.round(message.maxAgeMs); + } + if (message.maxMsgs !== undefined) { + obj.maxMsgs = Math.round(message.maxMsgs); + } + if (message.maxBytes !== undefined) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxMsgBytes !== undefined) { + obj.maxMsgBytes = Math.round(message.maxMsgBytes); + } + if (message.strictLimits !== undefined) { + obj.strictLimits = message.strictLimits; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamUpdateRequest { + return ReplicateStreamUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamUpdateRequest { + const message = createBaseReplicateStreamUpdateRequest(); + message.name = object.name ?? ""; + message.maxAgeMs = object.maxAgeMs ?? undefined; + message.maxMsgs = object.maxMsgs ?? undefined; + message.maxBytes = object.maxBytes ?? undefined; + message.maxMsgBytes = object.maxMsgBytes ?? undefined; + message.strictLimits = object.strictLimits ?? undefined; + return message; + }, +}; + +function createBaseReplicateStreamUpdateResponse(): ReplicateStreamUpdateResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const ReplicateStreamUpdateResponse: MessageFns = { + encode(message: ReplicateStreamUpdateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateStreamUpdateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateStreamUpdateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateStreamUpdateResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: ReplicateStreamUpdateResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateStreamUpdateResponse { + return ReplicateStreamUpdateResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateStreamUpdateResponse { + const message = createBaseReplicateStreamUpdateResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseReplicateWorkQueueAckRequest(): ReplicateWorkQueueAckRequest { + return { stream: "", seq: 0 }; +} + +export const ReplicateWorkQueueAckRequest: MessageFns = { + encode(message: ReplicateWorkQueueAckRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.stream !== "") { + writer.uint32(10).string(message.stream); + } + if (message.seq !== 0) { + writer.uint32(16).uint64(message.seq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateWorkQueueAckRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateWorkQueueAckRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.stream = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.seq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateWorkQueueAckRequest { + return { + stream: isSet(object.stream) ? globalThis.String(object.stream) : "", + seq: isSet(object.seq) ? globalThis.Number(object.seq) : 0, + }; + }, + + toJSON(message: ReplicateWorkQueueAckRequest): unknown { + const obj: any = {}; + if (message.stream !== "") { + obj.stream = message.stream; + } + if (message.seq !== 0) { + obj.seq = Math.round(message.seq); + } + return obj; + }, + + create(base?: DeepPartial): ReplicateWorkQueueAckRequest { + return ReplicateWorkQueueAckRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateWorkQueueAckRequest { + const message = createBaseReplicateWorkQueueAckRequest(); + message.stream = object.stream ?? ""; + message.seq = object.seq ?? 0; + return message; + }, +}; + +function createBaseReplicateWorkQueueAckResponse(): ReplicateWorkQueueAckResponse { + return { success: false, resultCode: "", message: "", wasPresent: false }; +} + +export const ReplicateWorkQueueAckResponse: MessageFns = { + encode(message: ReplicateWorkQueueAckResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.wasPresent !== false) { + writer.uint32(32).bool(message.wasPresent); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ReplicateWorkQueueAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReplicateWorkQueueAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.wasPresent = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ReplicateWorkQueueAckResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + wasPresent: isSet(object.wasPresent) + ? globalThis.Boolean(object.wasPresent) + : isSet(object.was_present) + ? globalThis.Boolean(object.was_present) + : false, + }; + }, + + toJSON(message: ReplicateWorkQueueAckResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.wasPresent !== false) { + obj.wasPresent = message.wasPresent; + } + return obj; + }, + + create(base?: DeepPartial): ReplicateWorkQueueAckResponse { + return ReplicateWorkQueueAckResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ReplicateWorkQueueAckResponse { + const message = createBaseReplicateWorkQueueAckResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.wasPresent = object.wasPresent ?? false; + return message; + }, +}; + +function createBaseObjectInfo(): ObjectInfo { + return { + name: "", + totalBytes: 0, + chunkSize: 0, + chunkCount: 0, + sha256: "", + tsMs: 0, + headers: [], + metadataSeq: 0, + deduped: false, + }; +} + +export const ObjectInfo: MessageFns = { + encode(message: ObjectInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.totalBytes !== 0) { + writer.uint32(16).uint64(message.totalBytes); + } + if (message.chunkSize !== 0) { + writer.uint32(24).uint64(message.chunkSize); + } + if (message.chunkCount !== 0) { + writer.uint32(32).uint64(message.chunkCount); + } + if (message.sha256 !== "") { + writer.uint32(42).string(message.sha256); + } + if (message.tsMs !== 0) { + writer.uint32(48).int64(message.tsMs); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.metadataSeq !== 0) { + writer.uint32(64).uint64(message.metadataSeq); + } + if (message.deduped !== false) { + writer.uint32(72).bool(message.deduped); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.chunkSize = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.chunkCount = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.sha256 = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 7: { + if (tag !== 58) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 8: { + if (tag !== 64) { + break; + } + + message.metadataSeq = longToNumber(reader.uint64()); + continue; + } + case 9: { + if (tag !== 72) { + break; + } + + message.deduped = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ObjectInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + chunkSize: isSet(object.chunkSize) + ? globalThis.Number(object.chunkSize) + : isSet(object.chunk_size) + ? globalThis.Number(object.chunk_size) + : 0, + chunkCount: isSet(object.chunkCount) + ? globalThis.Number(object.chunkCount) + : isSet(object.chunk_count) + ? globalThis.Number(object.chunk_count) + : 0, + sha256: isSet(object.sha256) ? globalThis.String(object.sha256) : "", + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + metadataSeq: isSet(object.metadataSeq) + ? globalThis.Number(object.metadataSeq) + : isSet(object.metadata_seq) + ? globalThis.Number(object.metadata_seq) + : 0, + deduped: isSet(object.deduped) ? globalThis.Boolean(object.deduped) : false, + }; + }, + + toJSON(message: ObjectInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.chunkSize !== 0) { + obj.chunkSize = Math.round(message.chunkSize); + } + if (message.chunkCount !== 0) { + obj.chunkCount = Math.round(message.chunkCount); + } + if (message.sha256 !== "") { + obj.sha256 = message.sha256; + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.metadataSeq !== 0) { + obj.metadataSeq = Math.round(message.metadataSeq); + } + if (message.deduped !== false) { + obj.deduped = message.deduped; + } + return obj; + }, + + create(base?: DeepPartial): ObjectInfo { + return ObjectInfo.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ObjectInfo { + const message = createBaseObjectInfo(); + message.name = object.name ?? ""; + message.totalBytes = object.totalBytes ?? 0; + message.chunkSize = object.chunkSize ?? 0; + message.chunkCount = object.chunkCount ?? 0; + message.sha256 = object.sha256 ?? ""; + message.tsMs = object.tsMs ?? 0; + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.metadataSeq = object.metadataSeq ?? 0; + message.deduped = object.deduped ?? false; + return message; + }, +}; + +function createBasePutObjectRequest(): PutObjectRequest { + return { bucket: "", name: "", payload: Buffer.alloc(0), chunkSize: 0, headers: [], sha256: "", dedupe: false }; +} + +export const PutObjectRequest: MessageFns = { + encode(message: PutObjectRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.payload.length !== 0) { + writer.uint32(26).bytes(message.payload); + } + if (message.chunkSize !== 0) { + writer.uint32(32).uint64(message.chunkSize); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(42).fork()).join(); + } + if (message.sha256 !== "") { + writer.uint32(50).string(message.sha256); + } + if (message.dedupe !== false) { + writer.uint32(56).bool(message.dedupe); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PutObjectRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePutObjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.chunkSize = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.sha256 = reader.string(); + continue; + } + case 7: { + if (tag !== 56) { + break; + } + + message.dedupe = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PutObjectRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + chunkSize: isSet(object.chunkSize) + ? globalThis.Number(object.chunkSize) + : isSet(object.chunk_size) + ? globalThis.Number(object.chunk_size) + : 0, + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + sha256: isSet(object.sha256) ? globalThis.String(object.sha256) : "", + dedupe: isSet(object.dedupe) ? globalThis.Boolean(object.dedupe) : false, + }; + }, + + toJSON(message: PutObjectRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + if (message.chunkSize !== 0) { + obj.chunkSize = Math.round(message.chunkSize); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.sha256 !== "") { + obj.sha256 = message.sha256; + } + if (message.dedupe !== false) { + obj.dedupe = message.dedupe; + } + return obj; + }, + + create(base?: DeepPartial): PutObjectRequest { + return PutObjectRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PutObjectRequest { + const message = createBasePutObjectRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + message.payload = object.payload ?? Buffer.alloc(0); + message.chunkSize = object.chunkSize ?? 0; + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.sha256 = object.sha256 ?? ""; + message.dedupe = object.dedupe ?? false; + return message; + }, +}; + +function createBasePutObjectResponse(): PutObjectResponse { + return { success: false, resultCode: "", message: "", info: undefined }; +} + +export const PutObjectResponse: MessageFns = { + encode(message: PutObjectResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.info !== undefined) { + ObjectInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PutObjectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePutObjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.info = ObjectInfo.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PutObjectResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + info: isSet(object.info) ? ObjectInfo.fromJSON(object.info) : undefined, + }; + }, + + toJSON(message: PutObjectResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.info !== undefined) { + obj.info = ObjectInfo.toJSON(message.info); + } + return obj; + }, + + create(base?: DeepPartial): PutObjectResponse { + return PutObjectResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PutObjectResponse { + const message = createBasePutObjectResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.info = (object.info !== undefined && object.info !== null) + ? ObjectInfo.fromPartial(object.info) + : undefined; + return message; + }, +}; + +function createBasePutObjectStreamFrame(): PutObjectStreamFrame { + return { start: undefined, data: Buffer.alloc(0), finish: false }; +} + +export const PutObjectStreamFrame: MessageFns = { + encode(message: PutObjectStreamFrame, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined) { + PutObjectStart.encode(message.start, writer.uint32(10).fork()).join(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.finish !== false) { + writer.uint32(24).bool(message.finish); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PutObjectStreamFrame { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePutObjectStreamFrame(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.start = PutObjectStart.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.data = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.finish = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PutObjectStreamFrame { + return { + start: isSet(object.start) ? PutObjectStart.fromJSON(object.start) : undefined, + data: isSet(object.data) ? Buffer.from(bytesFromBase64(object.data)) : Buffer.alloc(0), + finish: isSet(object.finish) ? globalThis.Boolean(object.finish) : false, + }; + }, + + toJSON(message: PutObjectStreamFrame): unknown { + const obj: any = {}; + if (message.start !== undefined) { + obj.start = PutObjectStart.toJSON(message.start); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.finish !== false) { + obj.finish = message.finish; + } + return obj; + }, + + create(base?: DeepPartial): PutObjectStreamFrame { + return PutObjectStreamFrame.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PutObjectStreamFrame { + const message = createBasePutObjectStreamFrame(); + message.start = (object.start !== undefined && object.start !== null) + ? PutObjectStart.fromPartial(object.start) + : undefined; + message.data = object.data ?? Buffer.alloc(0); + message.finish = object.finish ?? false; + return message; + }, +}; + +function createBasePutObjectStart(): PutObjectStart { + return { bucket: "", name: "", chunkSize: 0, headers: [], sha256: "", dedupe: false }; +} + +export const PutObjectStart: MessageFns = { + encode(message: PutObjectStart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.chunkSize !== 0) { + writer.uint32(24).uint64(message.chunkSize); + } + for (const v of message.headers) { + MessageHeader.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.sha256 !== "") { + writer.uint32(42).string(message.sha256); + } + if (message.dedupe !== false) { + writer.uint32(48).bool(message.dedupe); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PutObjectStart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePutObjectStart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.chunkSize = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.headers.push(MessageHeader.decode(reader, reader.uint32())); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.sha256 = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.dedupe = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PutObjectStart { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + chunkSize: isSet(object.chunkSize) + ? globalThis.Number(object.chunkSize) + : isSet(object.chunk_size) + ? globalThis.Number(object.chunk_size) + : 0, + headers: globalThis.Array.isArray(object?.headers) + ? object.headers.map((e: any) => MessageHeader.fromJSON(e)) + : [], + sha256: isSet(object.sha256) ? globalThis.String(object.sha256) : "", + dedupe: isSet(object.dedupe) ? globalThis.Boolean(object.dedupe) : false, + }; + }, + + toJSON(message: PutObjectStart): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.chunkSize !== 0) { + obj.chunkSize = Math.round(message.chunkSize); + } + if (message.headers?.length) { + obj.headers = message.headers.map((e) => MessageHeader.toJSON(e)); + } + if (message.sha256 !== "") { + obj.sha256 = message.sha256; + } + if (message.dedupe !== false) { + obj.dedupe = message.dedupe; + } + return obj; + }, + + create(base?: DeepPartial): PutObjectStart { + return PutObjectStart.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): PutObjectStart { + const message = createBasePutObjectStart(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + message.chunkSize = object.chunkSize ?? 0; + message.headers = object.headers?.map((e) => MessageHeader.fromPartial(e)) || []; + message.sha256 = object.sha256 ?? ""; + message.dedupe = object.dedupe ?? false; + return message; + }, +}; + +function createBaseGetObjectRequest(): GetObjectRequest { + return { bucket: "", name: "" }; +} + +export const GetObjectRequest: MessageFns = { + encode(message: GetObjectRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + }; + }, + + toJSON(message: GetObjectRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): GetObjectRequest { + return GetObjectRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectRequest { + const message = createBaseGetObjectRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetObjectResponse(): GetObjectResponse { + return { success: false, resultCode: "", message: "", info: undefined, payload: Buffer.alloc(0) }; +} + +export const GetObjectResponse: MessageFns = { + encode(message: GetObjectResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.info !== undefined) { + ObjectInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.payload.length !== 0) { + writer.uint32(42).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.info = ObjectInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + info: isSet(object.info) ? ObjectInfo.fromJSON(object.info) : undefined, + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + }; + }, + + toJSON(message: GetObjectResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.info !== undefined) { + obj.info = ObjectInfo.toJSON(message.info); + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create(base?: DeepPartial): GetObjectResponse { + return GetObjectResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectResponse { + const message = createBaseGetObjectResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.info = (object.info !== undefined && object.info !== null) + ? ObjectInfo.fromPartial(object.info) + : undefined; + message.payload = object.payload ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseGetObjectStreamFrame(): GetObjectStreamFrame { + return { info: undefined, data: Buffer.alloc(0), done: false }; +} + +export const GetObjectStreamFrame: MessageFns = { + encode(message: GetObjectStreamFrame, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.info !== undefined) { + ObjectInfo.encode(message.info, writer.uint32(10).fork()).join(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.done !== false) { + writer.uint32(24).bool(message.done); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectStreamFrame { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectStreamFrame(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.info = ObjectInfo.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.data = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.done = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectStreamFrame { + return { + info: isSet(object.info) ? ObjectInfo.fromJSON(object.info) : undefined, + data: isSet(object.data) ? Buffer.from(bytesFromBase64(object.data)) : Buffer.alloc(0), + done: isSet(object.done) ? globalThis.Boolean(object.done) : false, + }; + }, + + toJSON(message: GetObjectStreamFrame): unknown { + const obj: any = {}; + if (message.info !== undefined) { + obj.info = ObjectInfo.toJSON(message.info); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.done !== false) { + obj.done = message.done; + } + return obj; + }, + + create(base?: DeepPartial): GetObjectStreamFrame { + return GetObjectStreamFrame.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectStreamFrame { + const message = createBaseGetObjectStreamFrame(); + message.info = (object.info !== undefined && object.info !== null) + ? ObjectInfo.fromPartial(object.info) + : undefined; + message.data = object.data ?? Buffer.alloc(0); + message.done = object.done ?? false; + return message; + }, +}; + +function createBaseDeleteObjectRequest(): DeleteObjectRequest { + return { bucket: "", name: "" }; +} + +export const DeleteObjectRequest: MessageFns = { + encode(message: DeleteObjectRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteObjectRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteObjectRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteObjectRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + }; + }, + + toJSON(message: DeleteObjectRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteObjectRequest { + return DeleteObjectRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteObjectRequest { + const message = createBaseDeleteObjectRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteObjectResponse(): DeleteObjectResponse { + return { success: false, resultCode: "", message: "", tombstoneSeq: 0 }; +} + +export const DeleteObjectResponse: MessageFns = { + encode(message: DeleteObjectResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.tombstoneSeq !== 0) { + writer.uint32(32).uint64(message.tombstoneSeq); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteObjectResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteObjectResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.tombstoneSeq = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteObjectResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + tombstoneSeq: isSet(object.tombstoneSeq) + ? globalThis.Number(object.tombstoneSeq) + : isSet(object.tombstone_seq) + ? globalThis.Number(object.tombstone_seq) + : 0, + }; + }, + + toJSON(message: DeleteObjectResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.tombstoneSeq !== 0) { + obj.tombstoneSeq = Math.round(message.tombstoneSeq); + } + return obj; + }, + + create(base?: DeepPartial): DeleteObjectResponse { + return DeleteObjectResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteObjectResponse { + const message = createBaseDeleteObjectResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.tombstoneSeq = object.tombstoneSeq ?? 0; + return message; + }, +}; + +function createBaseGetObjectInfoRequest(): GetObjectInfoRequest { + return { bucket: "", name: "" }; +} + +export const GetObjectInfoRequest: MessageFns = { + encode(message: GetObjectInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectInfoRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + }; + }, + + toJSON(message: GetObjectInfoRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): GetObjectInfoRequest { + return GetObjectInfoRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectInfoRequest { + const message = createBaseGetObjectInfoRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseGetObjectInfoResponse(): GetObjectInfoResponse { + return { success: false, resultCode: "", message: "", info: undefined, deleted: false }; +} + +export const GetObjectInfoResponse: MessageFns = { + encode(message: GetObjectInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.info !== undefined) { + ObjectInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.deleted !== false) { + writer.uint32(40).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.info = ObjectInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectInfoResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + info: isSet(object.info) ? ObjectInfo.fromJSON(object.info) : undefined, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: GetObjectInfoResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.info !== undefined) { + obj.info = ObjectInfo.toJSON(message.info); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): GetObjectInfoResponse { + return GetObjectInfoResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectInfoResponse { + const message = createBaseGetObjectInfoResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.info = (object.info !== undefined && object.info !== null) + ? ObjectInfo.fromPartial(object.info) + : undefined; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseListObjectsRequest(): ListObjectsRequest { + return { bucket: "", namePrefix: "", includeDeleted: false }; +} + +export const ListObjectsRequest: MessageFns = { + encode(message: ListObjectsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.namePrefix !== "") { + writer.uint32(18).string(message.namePrefix); + } + if (message.includeDeleted !== false) { + writer.uint32(24).bool(message.includeDeleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListObjectsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListObjectsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.namePrefix = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.includeDeleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListObjectsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + namePrefix: isSet(object.namePrefix) + ? globalThis.String(object.namePrefix) + : isSet(object.name_prefix) + ? globalThis.String(object.name_prefix) + : "", + includeDeleted: isSet(object.includeDeleted) + ? globalThis.Boolean(object.includeDeleted) + : isSet(object.include_deleted) + ? globalThis.Boolean(object.include_deleted) + : false, + }; + }, + + toJSON(message: ListObjectsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.namePrefix !== "") { + obj.namePrefix = message.namePrefix; + } + if (message.includeDeleted !== false) { + obj.includeDeleted = message.includeDeleted; + } + return obj; + }, + + create(base?: DeepPartial): ListObjectsRequest { + return ListObjectsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListObjectsRequest { + const message = createBaseListObjectsRequest(); + message.bucket = object.bucket ?? ""; + message.namePrefix = object.namePrefix ?? ""; + message.includeDeleted = object.includeDeleted ?? false; + return message; + }, +}; + +function createBaseListObjectsResponse(): ListObjectsResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const ListObjectsResponse: MessageFns = { + encode(message: ListObjectsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + ObjectListEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListObjectsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListObjectsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(ObjectListEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListObjectsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => ObjectListEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListObjectsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => ObjectListEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListObjectsResponse { + return ListObjectsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListObjectsResponse { + const message = createBaseListObjectsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => ObjectListEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseObjectListEntry(): ObjectListEntry { + return { name: "", totalBytes: 0, deleted: false }; +} + +export const ObjectListEntry: MessageFns = { + encode(message: ObjectListEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.totalBytes !== 0) { + writer.uint32(16).uint64(message.totalBytes); + } + if (message.deleted !== false) { + writer.uint32(24).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectListEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectListEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ObjectListEntry { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: ObjectListEntry): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): ObjectListEntry { + return ObjectListEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ObjectListEntry { + const message = createBaseObjectListEntry(); + message.name = object.name ?? ""; + message.totalBytes = object.totalBytes ?? 0; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseListObjectRevisionsRequest(): ListObjectRevisionsRequest { + return { bucket: "", name: "", fromSeq: 0, limit: 0 }; +} + +export const ListObjectRevisionsRequest: MessageFns = { + encode(message: ListObjectRevisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.fromSeq !== 0) { + writer.uint32(24).uint64(message.fromSeq); + } + if (message.limit !== 0) { + writer.uint32(32).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListObjectRevisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListObjectRevisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fromSeq = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListObjectRevisionsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + fromSeq: isSet(object.fromSeq) + ? globalThis.Number(object.fromSeq) + : isSet(object.from_seq) + ? globalThis.Number(object.from_seq) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: ListObjectRevisionsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.fromSeq !== 0) { + obj.fromSeq = Math.round(message.fromSeq); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): ListObjectRevisionsRequest { + return ListObjectRevisionsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListObjectRevisionsRequest { + const message = createBaseListObjectRevisionsRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + message.fromSeq = object.fromSeq ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseListObjectRevisionsResponse(): ListObjectRevisionsResponse { + return { success: false, resultCode: "", message: "", revisions: [] }; +} + +export const ListObjectRevisionsResponse: MessageFns = { + encode(message: ListObjectRevisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.revisions) { + ObjectRevisionEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListObjectRevisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListObjectRevisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.revisions.push(ObjectRevisionEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListObjectRevisionsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revisions: globalThis.Array.isArray(object?.revisions) + ? object.revisions.map((e: any) => ObjectRevisionEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListObjectRevisionsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revisions?.length) { + obj.revisions = message.revisions.map((e) => ObjectRevisionEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): ListObjectRevisionsResponse { + return ListObjectRevisionsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ListObjectRevisionsResponse { + const message = createBaseListObjectRevisionsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revisions = object.revisions?.map((e) => ObjectRevisionEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGetObjectRangeRequest(): GetObjectRangeRequest { + return { bucket: "", name: "", offset: 0, len: 0 }; +} + +export const GetObjectRangeRequest: MessageFns = { + encode(message: GetObjectRangeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + if (message.offset !== 0) { + writer.uint32(24).uint64(message.offset); + } + if (message.len !== 0) { + writer.uint32(32).uint64(message.len); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectRangeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectRangeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.len = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectRangeRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + len: isSet(object.len) ? globalThis.Number(object.len) : 0, + }; + }, + + toJSON(message: GetObjectRangeRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.len !== 0) { + obj.len = Math.round(message.len); + } + return obj; + }, + + create(base?: DeepPartial): GetObjectRangeRequest { + return GetObjectRangeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectRangeRequest { + const message = createBaseGetObjectRangeRequest(); + message.bucket = object.bucket ?? ""; + message.name = object.name ?? ""; + message.offset = object.offset ?? 0; + message.len = object.len ?? 0; + return message; + }, +}; + +function createBaseGetObjectRangeResponse(): GetObjectRangeResponse { + return { success: false, resultCode: "", message: "", info: undefined, actualOffset: 0, payload: Buffer.alloc(0) }; +} + +export const GetObjectRangeResponse: MessageFns = { + encode(message: GetObjectRangeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.info !== undefined) { + ObjectInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.actualOffset !== 0) { + writer.uint32(40).uint64(message.actualOffset); + } + if (message.payload.length !== 0) { + writer.uint32(50).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetObjectRangeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetObjectRangeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.info = ObjectInfo.decode(reader, reader.uint32()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.actualOffset = longToNumber(reader.uint64()); + continue; + } + case 6: { + if (tag !== 50) { + break; + } + + message.payload = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetObjectRangeResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + info: isSet(object.info) ? ObjectInfo.fromJSON(object.info) : undefined, + actualOffset: isSet(object.actualOffset) + ? globalThis.Number(object.actualOffset) + : isSet(object.actual_offset) + ? globalThis.Number(object.actual_offset) + : 0, + payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0), + }; + }, + + toJSON(message: GetObjectRangeResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.info !== undefined) { + obj.info = ObjectInfo.toJSON(message.info); + } + if (message.actualOffset !== 0) { + obj.actualOffset = Math.round(message.actualOffset); + } + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create(base?: DeepPartial): GetObjectRangeResponse { + return GetObjectRangeResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): GetObjectRangeResponse { + const message = createBaseGetObjectRangeResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.info = (object.info !== undefined && object.info !== null) + ? ObjectInfo.fromPartial(object.info) + : undefined; + message.actualOffset = object.actualOffset ?? 0; + message.payload = object.payload ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseObjectRevisionEntry(): ObjectRevisionEntry { + return { metadataSeq: 0, deleted: false, totalBytes: 0, chunkCount: 0, sha256: "", tsMs: 0 }; +} + +export const ObjectRevisionEntry: MessageFns = { + encode(message: ObjectRevisionEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadataSeq !== 0) { + writer.uint32(8).uint64(message.metadataSeq); + } + if (message.deleted !== false) { + writer.uint32(16).bool(message.deleted); + } + if (message.totalBytes !== 0) { + writer.uint32(24).uint64(message.totalBytes); + } + if (message.chunkCount !== 0) { + writer.uint32(32).uint64(message.chunkCount); + } + if (message.sha256 !== "") { + writer.uint32(42).string(message.sha256); + } + if (message.tsMs !== 0) { + writer.uint32(48).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ObjectRevisionEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseObjectRevisionEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.metadataSeq = longToNumber(reader.uint64()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.deleted = reader.bool(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.totalBytes = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.chunkCount = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 42) { + break; + } + + message.sha256 = reader.string(); + continue; + } + case 6: { + if (tag !== 48) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ObjectRevisionEntry { + return { + metadataSeq: isSet(object.metadataSeq) + ? globalThis.Number(object.metadataSeq) + : isSet(object.metadata_seq) + ? globalThis.Number(object.metadata_seq) + : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + totalBytes: isSet(object.totalBytes) + ? globalThis.Number(object.totalBytes) + : isSet(object.total_bytes) + ? globalThis.Number(object.total_bytes) + : 0, + chunkCount: isSet(object.chunkCount) + ? globalThis.Number(object.chunkCount) + : isSet(object.chunk_count) + ? globalThis.Number(object.chunk_count) + : 0, + sha256: isSet(object.sha256) ? globalThis.String(object.sha256) : "", + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: ObjectRevisionEntry): unknown { + const obj: any = {}; + if (message.metadataSeq !== 0) { + obj.metadataSeq = Math.round(message.metadataSeq); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + if (message.totalBytes !== 0) { + obj.totalBytes = Math.round(message.totalBytes); + } + if (message.chunkCount !== 0) { + obj.chunkCount = Math.round(message.chunkCount); + } + if (message.sha256 !== "") { + obj.sha256 = message.sha256; + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): ObjectRevisionEntry { + return ObjectRevisionEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): ObjectRevisionEntry { + const message = createBaseObjectRevisionEntry(); + message.metadataSeq = object.metadataSeq ?? 0; + message.deleted = object.deleted ?? false; + message.totalBytes = object.totalBytes ?? 0; + message.chunkCount = object.chunkCount ?? 0; + message.sha256 = object.sha256 ?? ""; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseKvCreateBucketRequest(): KvCreateBucketRequest { + return { bucket: "", maxBytes: 0, maxValueSize: 0, maxAgeMs: 0, ephemeral: false }; +} + +export const KvCreateBucketRequest: MessageFns = { + encode(message: KvCreateBucketRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.maxValueSize !== 0) { + writer.uint32(24).uint64(message.maxValueSize); + } + if (message.maxAgeMs !== 0) { + writer.uint32(32).uint64(message.maxAgeMs); + } + if (message.ephemeral !== false) { + writer.uint32(40).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateBucketRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateBucketRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxValueSize = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.maxAgeMs = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateBucketRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + maxValueSize: isSet(object.maxValueSize) + ? globalThis.Number(object.maxValueSize) + : isSet(object.max_value_size) + ? globalThis.Number(object.max_value_size) + : 0, + maxAgeMs: isSet(object.maxAgeMs) + ? globalThis.Number(object.maxAgeMs) + : isSet(object.max_age_ms) + ? globalThis.Number(object.max_age_ms) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: KvCreateBucketRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxValueSize !== 0) { + obj.maxValueSize = Math.round(message.maxValueSize); + } + if (message.maxAgeMs !== 0) { + obj.maxAgeMs = Math.round(message.maxAgeMs); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): KvCreateBucketRequest { + return KvCreateBucketRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateBucketRequest { + const message = createBaseKvCreateBucketRequest(); + message.bucket = object.bucket ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.maxValueSize = object.maxValueSize ?? 0; + message.maxAgeMs = object.maxAgeMs ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseKvCreateBucketResponse(): KvCreateBucketResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const KvCreateBucketResponse: MessageFns = { + encode(message: KvCreateBucketResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateBucketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateBucketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateBucketResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: KvCreateBucketResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): KvCreateBucketResponse { + return KvCreateBucketResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateBucketResponse { + const message = createBaseKvCreateBucketResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseKvDeleteBucketRequest(): KvDeleteBucketRequest { + return { bucket: "" }; +} + +export const KvDeleteBucketRequest: MessageFns = { + encode(message: KvDeleteBucketRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteBucketRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteBucketRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteBucketRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: KvDeleteBucketRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteBucketRequest { + return KvDeleteBucketRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteBucketRequest { + const message = createBaseKvDeleteBucketRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseKvDeleteBucketResponse(): KvDeleteBucketResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const KvDeleteBucketResponse: MessageFns = { + encode(message: KvDeleteBucketResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteBucketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteBucketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteBucketResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: KvDeleteBucketResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteBucketResponse { + return KvDeleteBucketResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteBucketResponse { + const message = createBaseKvDeleteBucketResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseKvPutRequest(): KvPutRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), ttlMs: 0 }; +} + +export const KvPutRequest: MessageFns = { + encode(message: KvPutRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.ttlMs !== 0) { + writer.uint32(32).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvPutRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvPutRequest { + return KvPutRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutRequest { + const message = createBaseKvPutRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvCreateRequest(): KvCreateRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), ttlMs: 0 }; +} + +export const KvCreateRequest: MessageFns = { + encode(message: KvCreateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.ttlMs !== 0) { + writer.uint32(32).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvCreateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvCreateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvCreateRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvCreateRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvCreateRequest { + return KvCreateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvCreateRequest { + const message = createBaseKvCreateRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvUpdateRequest(): KvUpdateRequest { + return { bucket: "", key: "", value: Buffer.alloc(0), expectedRevision: 0, ttlMs: 0 }; +} + +export const KvUpdateRequest: MessageFns = { + encode(message: KvUpdateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + if (message.expectedRevision !== 0) { + writer.uint32(32).uint64(message.expectedRevision); + } + if (message.ttlMs !== 0) { + writer.uint32(40).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvUpdateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvUpdateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.expectedRevision = longToNumber(reader.uint64()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvUpdateRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + expectedRevision: isSet(object.expectedRevision) + ? globalThis.Number(object.expectedRevision) + : isSet(object.expected_revision) + ? globalThis.Number(object.expected_revision) + : 0, + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvUpdateRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.expectedRevision !== 0) { + obj.expectedRevision = Math.round(message.expectedRevision); + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvUpdateRequest { + return KvUpdateRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvUpdateRequest { + const message = createBaseKvUpdateRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.expectedRevision = object.expectedRevision ?? 0; + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvPutResponse(): KvPutResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const KvPutResponse: MessageFns = { + encode(message: KvPutResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: KvPutResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): KvPutResponse { + return KvPutResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutResponse { + const message = createBaseKvPutResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseKvGetRequest(): KvGetRequest { + return { bucket: "", key: "" }; +} + +export const KvGetRequest: MessageFns = { + encode(message: KvGetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvGetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvGetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvGetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvGetRequest { + return KvGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvGetRequest { + const message = createBaseKvGetRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvGetResponse(): KvGetResponse { + return { success: false, resultCode: "", message: "", entry: undefined }; +} + +export const KvGetResponse: MessageFns = { + encode(message: KvGetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.entry !== undefined) { + KvEntry.encode(message.entry, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvGetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entry = KvEntry.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvGetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entry: isSet(object.entry) ? KvEntry.fromJSON(object.entry) : undefined, + }; + }, + + toJSON(message: KvGetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entry !== undefined) { + obj.entry = KvEntry.toJSON(message.entry); + } + return obj; + }, + + create(base?: DeepPartial): KvGetResponse { + return KvGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvGetResponse { + const message = createBaseKvGetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entry = (object.entry !== undefined && object.entry !== null) + ? KvEntry.fromPartial(object.entry) + : undefined; + return message; + }, +}; + +function createBaseKvEntry(): KvEntry { + return { value: Buffer.alloc(0), revision: 0, tsMs: 0 }; +} + +export const KvEntry: MessageFns = { + encode(message: KvEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvEntry { + return { + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvEntry): unknown { + const obj: any = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvEntry { + return KvEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvEntry { + const message = createBaseKvEntry(); + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseKvDeleteRequest(): KvDeleteRequest { + return { bucket: "", key: "" }; +} + +export const KvDeleteRequest: MessageFns = { + encode(message: KvDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvDeleteRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteRequest { + return KvDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteRequest { + const message = createBaseKvDeleteRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvDeleteResponse(): KvDeleteResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const KvDeleteResponse: MessageFns = { + encode(message: KvDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: KvDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteResponse { + return KvDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteResponse { + const message = createBaseKvDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseKvKeysRequest(): KvKeysRequest { + return { bucket: "" }; +} + +export const KvKeysRequest: MessageFns = { + encode(message: KvKeysRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeysRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeysRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeysRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: KvKeysRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): KvKeysRequest { + return KvKeysRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeysRequest { + const message = createBaseKvKeysRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseKvKeysResponse(): KvKeysResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const KvKeysResponse: MessageFns = { + encode(message: KvKeysResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + KvKeyEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeysResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeysResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(KvKeyEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeysResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => KvKeyEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: KvKeysResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => KvKeyEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): KvKeysResponse { + return KvKeysResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeysResponse { + const message = createBaseKvKeysResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => KvKeyEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseKvKeyEntry(): KvKeyEntry { + return { key: "", revision: 0, deleted: false }; +} + +export const KvKeyEntry: MessageFns = { + encode(message: KvKeyEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.deleted !== false) { + writer.uint32(24).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvKeyEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvKeyEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvKeyEntry { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: KvKeyEntry): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): KvKeyEntry { + return KvKeyEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvKeyEntry { + const message = createBaseKvKeyEntry(); + message.key = object.key ?? ""; + message.revision = object.revision ?? 0; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseKvHistoryRequest(): KvHistoryRequest { + return { bucket: "", key: "", fromRevision: 0, limit: 0 }; +} + +export const KvHistoryRequest: MessageFns = { + encode(message: KvHistoryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.fromRevision !== 0) { + writer.uint32(24).uint64(message.fromRevision); + } + if (message.limit !== 0) { + writer.uint32(32).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.fromRevision = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + fromRevision: isSet(object.fromRevision) + ? globalThis.Number(object.fromRevision) + : isSet(object.from_revision) + ? globalThis.Number(object.from_revision) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: KvHistoryRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.fromRevision !== 0) { + obj.fromRevision = Math.round(message.fromRevision); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryRequest { + return KvHistoryRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryRequest { + const message = createBaseKvHistoryRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.fromRevision = object.fromRevision ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseKvHistoryResponse(): KvHistoryResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const KvHistoryResponse: MessageFns = { + encode(message: KvHistoryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + KvHistoryEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(KvHistoryEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => KvHistoryEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: KvHistoryResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => KvHistoryEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryResponse { + return KvHistoryResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryResponse { + const message = createBaseKvHistoryResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => KvHistoryEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseKvHistoryEntry(): KvHistoryEntry { + return { value: Buffer.alloc(0), revision: 0, tsMs: 0, deleted: false }; +} + +export const KvHistoryEntry: MessageFns = { + encode(message: KvHistoryEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.value.length !== 0) { + writer.uint32(10).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + if (message.deleted !== false) { + writer.uint32(32).bool(message.deleted); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvHistoryEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.deleted = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvHistoryEntry { + return { + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false, + }; + }, + + toJSON(message: KvHistoryEntry): unknown { + const obj: any = {}; + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + if (message.deleted !== false) { + obj.deleted = message.deleted; + } + return obj; + }, + + create(base?: DeepPartial): KvHistoryEntry { + return KvHistoryEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvHistoryEntry { + const message = createBaseKvHistoryEntry(); + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + message.deleted = object.deleted ?? false; + return message; + }, +}; + +function createBaseKvTouchRequest(): KvTouchRequest { + return { bucket: "", key: "", ttlMs: 0 }; +} + +export const KvTouchRequest: MessageFns = { + encode(message: KvTouchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.ttlMs !== 0) { + writer.uint32(24).uint64(message.ttlMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvTouchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvTouchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ttlMs = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvTouchRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + ttlMs: isSet(object.ttlMs) + ? globalThis.Number(object.ttlMs) + : isSet(object.ttl_ms) + ? globalThis.Number(object.ttl_ms) + : 0, + }; + }, + + toJSON(message: KvTouchRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.ttlMs !== 0) { + obj.ttlMs = Math.round(message.ttlMs); + } + return obj; + }, + + create(base?: DeepPartial): KvTouchRequest { + return KvTouchRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvTouchRequest { + const message = createBaseKvTouchRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + message.ttlMs = object.ttlMs ?? 0; + return message; + }, +}; + +function createBaseKvWatchRequest(): KvWatchRequest { + return { bucket: "", key: "" }; +} + +export const KvWatchRequest: MessageFns = { + encode(message: KvWatchRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvWatchRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvWatchRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvWatchRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: KvWatchRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create(base?: DeepPartial): KvWatchRequest { + return KvWatchRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvWatchRequest { + const message = createBaseKvWatchRequest(); + message.bucket = object.bucket ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +function createBaseKvWatchEvent(): KvWatchEvent { + return { put: undefined, delete: undefined }; +} + +export const KvWatchEvent: MessageFns = { + encode(message: KvWatchEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.put !== undefined) { + KvPutEvent.encode(message.put, writer.uint32(10).fork()).join(); + } + if (message.delete !== undefined) { + KvDeleteEvent.encode(message.delete, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvWatchEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvWatchEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.put = KvPutEvent.decode(reader, reader.uint32()); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.delete = KvDeleteEvent.decode(reader, reader.uint32()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvWatchEvent { + return { + put: isSet(object.put) ? KvPutEvent.fromJSON(object.put) : undefined, + delete: isSet(object.delete) ? KvDeleteEvent.fromJSON(object.delete) : undefined, + }; + }, + + toJSON(message: KvWatchEvent): unknown { + const obj: any = {}; + if (message.put !== undefined) { + obj.put = KvPutEvent.toJSON(message.put); + } + if (message.delete !== undefined) { + obj.delete = KvDeleteEvent.toJSON(message.delete); + } + return obj; + }, + + create(base?: DeepPartial): KvWatchEvent { + return KvWatchEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvWatchEvent { + const message = createBaseKvWatchEvent(); + message.put = (object.put !== undefined && object.put !== null) ? KvPutEvent.fromPartial(object.put) : undefined; + message.delete = (object.delete !== undefined && object.delete !== null) + ? KvDeleteEvent.fromPartial(object.delete) + : undefined; + return message; + }, +}; + +function createBaseKvPutEvent(): KvPutEvent { + return { key: "", value: Buffer.alloc(0), revision: 0, tsMs: 0 }; +} + +export const KvPutEvent: MessageFns = { + encode(message: KvPutEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(24).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(32).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvPutEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvPutEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvPutEvent { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvPutEvent): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvPutEvent { + return KvPutEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvPutEvent { + const message = createBaseKvPutEvent(); + message.key = object.key ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseKvDeleteEvent(): KvDeleteEvent { + return { key: "", revision: 0, tsMs: 0 }; +} + +export const KvDeleteEvent: MessageFns = { + encode(message: KvDeleteEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.revision !== 0) { + writer.uint32(16).uint64(message.revision); + } + if (message.tsMs !== 0) { + writer.uint32(24).int64(message.tsMs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): KvDeleteEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseKvDeleteEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.tsMs = longToNumber(reader.int64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): KvDeleteEvent { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + tsMs: isSet(object.tsMs) + ? globalThis.Number(object.tsMs) + : isSet(object.ts_ms) + ? globalThis.Number(object.ts_ms) + : 0, + }; + }, + + toJSON(message: KvDeleteEvent): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + if (message.tsMs !== 0) { + obj.tsMs = Math.round(message.tsMs); + } + return obj; + }, + + create(base?: DeepPartial): KvDeleteEvent { + return KvDeleteEvent.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): KvDeleteEvent { + const message = createBaseKvDeleteEvent(); + message.key = object.key ?? ""; + message.revision = object.revision ?? 0; + message.tsMs = object.tsMs ?? 0; + return message; + }, +}; + +function createBaseCreateHashStoreRequest(): CreateHashStoreRequest { + return { name: "", maxBytes: 0, ephemeral: false }; +} + +export const CreateHashStoreRequest: MessageFns = { + encode(message: CreateHashStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.ephemeral !== false) { + writer.uint32(24).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateHashStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateHashStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateHashStoreRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateHashStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateHashStoreRequest { + return CreateHashStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateHashStoreRequest { + const message = createBaseCreateHashStoreRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateHashStoreResponse(): CreateHashStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateHashStoreResponse: MessageFns = { + encode(message: CreateHashStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateHashStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateHashStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateHashStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateHashStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateHashStoreResponse { + return CreateHashStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateHashStoreResponse { + const message = createBaseCreateHashStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteHashStoreRequest(): DeleteHashStoreRequest { + return { name: "" }; +} + +export const DeleteHashStoreRequest: MessageFns = { + encode(message: DeleteHashStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteHashStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteHashStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteHashStoreRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteHashStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteHashStoreRequest { + return DeleteHashStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteHashStoreRequest { + const message = createBaseDeleteHashStoreRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteHashStoreResponse(): DeleteHashStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteHashStoreResponse: MessageFns = { + encode(message: DeleteHashStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteHashStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteHashStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteHashStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteHashStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteHashStoreResponse { + return DeleteHashStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteHashStoreResponse { + const message = createBaseDeleteHashStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHashSetRequest(): HashSetRequest { + return { bucket: "", hashKey: "", field: "", value: Buffer.alloc(0) }; +} + +export const HashSetRequest: MessageFns = { + encode(message: HashSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashSetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + + toJSON(message: HashSetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): HashSetRequest { + return HashSetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashSetRequest { + const message = createBaseHashSetRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + message.value = object.value ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseHashSetResponse(): HashSetResponse { + return { success: false, resultCode: "", message: "", revision: 0 }; +} + +export const HashSetResponse: MessageFns = { + encode(message: HashSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.revision !== 0) { + writer.uint32(32).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashSetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashSetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashSetResponse { + return HashSetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashSetResponse { + const message = createBaseHashSetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashGetRequest(): HashGetRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashGetRequest: MessageFns = { + encode(message: HashGetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashGetRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashGetRequest { + return HashGetRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetRequest { + const message = createBaseHashGetRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashGetResponse(): HashGetResponse { + return { success: false, resultCode: "", message: "", value: undefined, revision: 0 }; +} + +export const HashGetResponse: MessageFns = { + encode(message: HashGetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.value !== undefined) { + writer.uint32(34).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(40).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 5: { + if (tag !== 40) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : undefined, + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashGetResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.value !== undefined) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashGetResponse { + return HashGetResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetResponse { + const message = createBaseHashGetResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.value = object.value ?? undefined; + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashExistsRequest(): HashExistsRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashExistsRequest: MessageFns = { + encode(message: HashExistsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashExistsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashExistsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashExistsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashExistsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashExistsRequest { + return HashExistsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashExistsRequest { + const message = createBaseHashExistsRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashExistsResponse(): HashExistsResponse { + return { success: false, resultCode: "", message: "", exists: false }; +} + +export const HashExistsResponse: MessageFns = { + encode(message: HashExistsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.exists !== false) { + writer.uint32(32).bool(message.exists); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashExistsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashExistsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.exists = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashExistsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, + }; + }, + + toJSON(message: HashExistsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + + create(base?: DeepPartial): HashExistsResponse { + return HashExistsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashExistsResponse { + const message = createBaseHashExistsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.exists = object.exists ?? false; + return message; + }, +}; + +function createBaseHashDeleteRequest(): HashDeleteRequest { + return { bucket: "", hashKey: "", field: "" }; +} + +export const HashDeleteRequest: MessageFns = { + encode(message: HashDeleteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + if (message.field !== "") { + writer.uint32(26).string(message.field); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashDeleteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashDeleteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.field = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashDeleteRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + field: isSet(object.field) ? globalThis.String(object.field) : "", + }; + }, + + toJSON(message: HashDeleteRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + if (message.field !== "") { + obj.field = message.field; + } + return obj; + }, + + create(base?: DeepPartial): HashDeleteRequest { + return HashDeleteRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashDeleteRequest { + const message = createBaseHashDeleteRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + message.field = object.field ?? ""; + return message; + }, +}; + +function createBaseHashDeleteResponse(): HashDeleteResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const HashDeleteResponse: MessageFns = { + encode(message: HashDeleteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashDeleteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashDeleteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashDeleteResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: HashDeleteResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): HashDeleteResponse { + return HashDeleteResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashDeleteResponse { + const message = createBaseHashDeleteResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseHashGetAllRequest(): HashGetAllRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashGetAllRequest: MessageFns = { + encode(message: HashGetAllRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetAllRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetAllRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetAllRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashGetAllRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashGetAllRequest { + return HashGetAllRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetAllRequest { + const message = createBaseHashGetAllRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashGetAllResponse(): HashGetAllResponse { + return { success: false, resultCode: "", message: "", entries: [] }; +} + +export const HashGetAllResponse: MessageFns = { + encode(message: HashGetAllResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.entries) { + HashFieldEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashGetAllResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashGetAllResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.entries.push(HashFieldEntry.decode(reader, reader.uint32())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashGetAllResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + entries: globalThis.Array.isArray(object?.entries) + ? object.entries.map((e: any) => HashFieldEntry.fromJSON(e)) + : [], + }; + }, + + toJSON(message: HashGetAllResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => HashFieldEntry.toJSON(e)); + } + return obj; + }, + + create(base?: DeepPartial): HashGetAllResponse { + return HashGetAllResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashGetAllResponse { + const message = createBaseHashGetAllResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.entries = object.entries?.map((e) => HashFieldEntry.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHashFieldEntry(): HashFieldEntry { + return { field: "", value: Buffer.alloc(0), revision: 0 }; +} + +export const HashFieldEntry: MessageFns = { + encode(message: HashFieldEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field !== "") { + writer.uint32(10).string(message.field); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.revision !== 0) { + writer.uint32(24).uint64(message.revision); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.field = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.revision = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldEntry { + return { + field: isSet(object.field) ? globalThis.String(object.field) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + revision: isSet(object.revision) ? globalThis.Number(object.revision) : 0, + }; + }, + + toJSON(message: HashFieldEntry): unknown { + const obj: any = {}; + if (message.field !== "") { + obj.field = message.field; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.revision !== 0) { + obj.revision = Math.round(message.revision); + } + return obj; + }, + + create(base?: DeepPartial): HashFieldEntry { + return HashFieldEntry.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldEntry { + const message = createBaseHashFieldEntry(); + message.field = object.field ?? ""; + message.value = object.value ?? Buffer.alloc(0); + message.revision = object.revision ?? 0; + return message; + }, +}; + +function createBaseHashFieldsRequest(): HashFieldsRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashFieldsRequest: MessageFns = { + encode(message: HashFieldsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldsRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashFieldsRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashFieldsRequest { + return HashFieldsRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldsRequest { + const message = createBaseHashFieldsRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashFieldsResponse(): HashFieldsResponse { + return { success: false, resultCode: "", message: "", fields: [] }; +} + +export const HashFieldsResponse: MessageFns = { + encode(message: HashFieldsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.fields) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashFieldsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashFieldsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.fields.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashFieldsResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + fields: globalThis.Array.isArray(object?.fields) ? object.fields.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: HashFieldsResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.fields?.length) { + obj.fields = message.fields; + } + return obj; + }, + + create(base?: DeepPartial): HashFieldsResponse { + return HashFieldsResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashFieldsResponse { + const message = createBaseHashFieldsResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.fields = object.fields?.map((e) => e) || []; + return message; + }, +}; + +function createBaseHashLenRequest(): HashLenRequest { + return { bucket: "", hashKey: "" }; +} + +export const HashLenRequest: MessageFns = { + encode(message: HashLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.hashKey !== "") { + writer.uint32(18).string(message.hashKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.hashKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashLenRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + hashKey: isSet(object.hashKey) + ? globalThis.String(object.hashKey) + : isSet(object.hash_key) + ? globalThis.String(object.hash_key) + : "", + }; + }, + + toJSON(message: HashLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.hashKey !== "") { + obj.hashKey = message.hashKey; + } + return obj; + }, + + create(base?: DeepPartial): HashLenRequest { + return HashLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashLenRequest { + const message = createBaseHashLenRequest(); + message.bucket = object.bucket ?? ""; + message.hashKey = object.hashKey ?? ""; + return message; + }, +}; + +function createBaseHashLenResponse(): HashLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const HashLenResponse: MessageFns = { + encode(message: HashLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: HashLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): HashLenResponse { + return HashLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): HashLenResponse { + const message = createBaseHashLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseCreateSetStoreRequest(): CreateSetStoreRequest { + return { name: "", maxBytes: 0, ephemeral: false }; +} + +export const CreateSetStoreRequest: MessageFns = { + encode(message: CreateSetStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.ephemeral !== false) { + writer.uint32(24).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateSetStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateSetStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateSetStoreRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateSetStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateSetStoreRequest { + return CreateSetStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateSetStoreRequest { + const message = createBaseCreateSetStoreRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateSetStoreResponse(): CreateSetStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateSetStoreResponse: MessageFns = { + encode(message: CreateSetStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateSetStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateSetStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateSetStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateSetStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateSetStoreResponse { + return CreateSetStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateSetStoreResponse { + const message = createBaseCreateSetStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteSetStoreRequest(): DeleteSetStoreRequest { + return { name: "" }; +} + +export const DeleteSetStoreRequest: MessageFns = { + encode(message: DeleteSetStoreRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteSetStoreRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteSetStoreRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteSetStoreRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteSetStoreRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteSetStoreRequest { + return DeleteSetStoreRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteSetStoreRequest { + const message = createBaseDeleteSetStoreRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteSetStoreResponse(): DeleteSetStoreResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteSetStoreResponse: MessageFns = { + encode(message: DeleteSetStoreResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteSetStoreResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteSetStoreResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteSetStoreResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteSetStoreResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteSetStoreResponse { + return DeleteSetStoreResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteSetStoreResponse { + const message = createBaseDeleteSetStoreResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetAddRequest(): SetAddRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetAddRequest: MessageFns = { + encode(message: SetAddRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetAddRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetAddRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetAddRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetAddRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetAddRequest { + return SetAddRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetAddRequest { + const message = createBaseSetAddRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetAddResponse(): SetAddResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const SetAddResponse: MessageFns = { + encode(message: SetAddResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetAddResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetAddResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetAddResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: SetAddResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): SetAddResponse { + return SetAddResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetAddResponse { + const message = createBaseSetAddResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetRemoveRequest(): SetRemoveRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetRemoveRequest: MessageFns = { + encode(message: SetRemoveRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetRemoveRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetRemoveRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetRemoveRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetRemoveRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetRemoveRequest { + return SetRemoveRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetRemoveRequest { + const message = createBaseSetRemoveRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetRemoveResponse(): SetRemoveResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const SetRemoveResponse: MessageFns = { + encode(message: SetRemoveResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetRemoveResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetRemoveResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetRemoveResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: SetRemoveResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): SetRemoveResponse { + return SetRemoveResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetRemoveResponse { + const message = createBaseSetRemoveResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseSetIsMemberRequest(): SetIsMemberRequest { + return { bucket: "", setKey: "", member: "" }; +} + +export const SetIsMemberRequest: MessageFns = { + encode(message: SetIsMemberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + if (message.member !== "") { + writer.uint32(26).string(message.member); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetIsMemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetIsMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.member = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetIsMemberRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + member: isSet(object.member) ? globalThis.String(object.member) : "", + }; + }, + + toJSON(message: SetIsMemberRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + if (message.member !== "") { + obj.member = message.member; + } + return obj; + }, + + create(base?: DeepPartial): SetIsMemberRequest { + return SetIsMemberRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetIsMemberRequest { + const message = createBaseSetIsMemberRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + message.member = object.member ?? ""; + return message; + }, +}; + +function createBaseSetIsMemberResponse(): SetIsMemberResponse { + return { success: false, resultCode: "", message: "", isMember: false }; +} + +export const SetIsMemberResponse: MessageFns = { + encode(message: SetIsMemberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.isMember !== false) { + writer.uint32(32).bool(message.isMember); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetIsMemberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetIsMemberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.isMember = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetIsMemberResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + isMember: isSet(object.isMember) + ? globalThis.Boolean(object.isMember) + : isSet(object.is_member) + ? globalThis.Boolean(object.is_member) + : false, + }; + }, + + toJSON(message: SetIsMemberResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.isMember !== false) { + obj.isMember = message.isMember; + } + return obj; + }, + + create(base?: DeepPartial): SetIsMemberResponse { + return SetIsMemberResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetIsMemberResponse { + const message = createBaseSetIsMemberResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.isMember = object.isMember ?? false; + return message; + }, +}; + +function createBaseSetMembersRequest(): SetMembersRequest { + return { bucket: "", setKey: "" }; +} + +export const SetMembersRequest: MessageFns = { + encode(message: SetMembersRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMembersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMembersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetMembersRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + }; + }, + + toJSON(message: SetMembersRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + return obj; + }, + + create(base?: DeepPartial): SetMembersRequest { + return SetMembersRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMembersRequest { + const message = createBaseSetMembersRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + return message; + }, +}; + +function createBaseSetMembersResponse(): SetMembersResponse { + return { success: false, resultCode: "", message: "", members: [] }; +} + +export const SetMembersResponse: MessageFns = { + encode(message: SetMembersResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.members) { + writer.uint32(34).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.members.push(reader.string()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetMembersResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + members: globalThis.Array.isArray(object?.members) ? object.members.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: SetMembersResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.members?.length) { + obj.members = message.members; + } + return obj; + }, + + create(base?: DeepPartial): SetMembersResponse { + return SetMembersResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetMembersResponse { + const message = createBaseSetMembersResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.members = object.members?.map((e) => e) || []; + return message; + }, +}; + +function createBaseSetLenRequest(): SetLenRequest { + return { bucket: "", setKey: "" }; +} + +export const SetLenRequest: MessageFns = { + encode(message: SetLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.setKey !== "") { + writer.uint32(18).string(message.setKey); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.setKey = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetLenRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + setKey: isSet(object.setKey) + ? globalThis.String(object.setKey) + : isSet(object.set_key) + ? globalThis.String(object.set_key) + : "", + }; + }, + + toJSON(message: SetLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.setKey !== "") { + obj.setKey = message.setKey; + } + return obj; + }, + + create(base?: DeepPartial): SetLenRequest { + return SetLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetLenRequest { + const message = createBaseSetLenRequest(); + message.bucket = object.bucket ?? ""; + message.setKey = object.setKey ?? ""; + return message; + }, +}; + +function createBaseSetLenResponse(): SetLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const SetLenResponse: MessageFns = { + encode(message: SetLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SetLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSetLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SetLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: SetLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): SetLenResponse { + return SetLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): SetLenResponse { + const message = createBaseSetLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseCreateQueueRequest(): CreateQueueRequest { + return { name: "", maxBytes: 0, maxMessages: 0, ephemeral: false }; +} + +export const CreateQueueRequest: MessageFns = { + encode(message: CreateQueueRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.maxBytes !== 0) { + writer.uint32(16).uint64(message.maxBytes); + } + if (message.maxMessages !== 0) { + writer.uint32(24).uint64(message.maxMessages); + } + if (message.ephemeral !== false) { + writer.uint32(32).bool(message.ephemeral); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateQueueRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateQueueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.maxBytes = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.maxMessages = longToNumber(reader.uint64()); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.ephemeral = reader.bool(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateQueueRequest { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + maxBytes: isSet(object.maxBytes) + ? globalThis.Number(object.maxBytes) + : isSet(object.max_bytes) + ? globalThis.Number(object.max_bytes) + : 0, + maxMessages: isSet(object.maxMessages) + ? globalThis.Number(object.maxMessages) + : isSet(object.max_messages) + ? globalThis.Number(object.max_messages) + : 0, + ephemeral: isSet(object.ephemeral) ? globalThis.Boolean(object.ephemeral) : false, + }; + }, + + toJSON(message: CreateQueueRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.maxBytes !== 0) { + obj.maxBytes = Math.round(message.maxBytes); + } + if (message.maxMessages !== 0) { + obj.maxMessages = Math.round(message.maxMessages); + } + if (message.ephemeral !== false) { + obj.ephemeral = message.ephemeral; + } + return obj; + }, + + create(base?: DeepPartial): CreateQueueRequest { + return CreateQueueRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateQueueRequest { + const message = createBaseCreateQueueRequest(); + message.name = object.name ?? ""; + message.maxBytes = object.maxBytes ?? 0; + message.maxMessages = object.maxMessages ?? 0; + message.ephemeral = object.ephemeral ?? false; + return message; + }, +}; + +function createBaseCreateQueueResponse(): CreateQueueResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const CreateQueueResponse: MessageFns = { + encode(message: CreateQueueResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CreateQueueResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCreateQueueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CreateQueueResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: CreateQueueResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): CreateQueueResponse { + return CreateQueueResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): CreateQueueResponse { + const message = createBaseCreateQueueResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseDeleteQueueRequest(): DeleteQueueRequest { + return { name: "" }; +} + +export const DeleteQueueRequest: MessageFns = { + encode(message: DeleteQueueRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteQueueRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteQueueRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteQueueRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: DeleteQueueRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create(base?: DeepPartial): DeleteQueueRequest { + return DeleteQueueRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteQueueRequest { + const message = createBaseDeleteQueueRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +function createBaseDeleteQueueResponse(): DeleteQueueResponse { + return { success: false, resultCode: "", message: "" }; +} + +export const DeleteQueueResponse: MessageFns = { + encode(message: DeleteQueueResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeleteQueueResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeleteQueueResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeleteQueueResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + }; + }, + + toJSON(message: DeleteQueueResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create(base?: DeepPartial): DeleteQueueResponse { + return DeleteQueueResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): DeleteQueueResponse { + const message = createBaseDeleteQueueResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + return message; + }, +}; + +function createBaseQueuePushRequest(): QueuePushRequest { + return { bucket: "", value: Buffer.alloc(0) }; +} + +export const QueuePushRequest: MessageFns = { + encode(message: QueuePushRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePushRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePushRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePushRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : Buffer.alloc(0), + }; + }, + + toJSON(message: QueuePushRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): QueuePushRequest { + return QueuePushRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePushRequest { + const message = createBaseQueuePushRequest(); + message.bucket = object.bucket ?? ""; + message.value = object.value ?? Buffer.alloc(0); + return message; + }, +}; + +function createBaseQueuePushResponse(): QueuePushResponse { + return { success: false, resultCode: "", message: "", sequence: 0 }; +} + +export const QueuePushResponse: MessageFns = { + encode(message: QueuePushResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePushResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePushResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePushResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: QueuePushResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create(base?: DeepPartial): QueuePushResponse { + return QueuePushResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePushResponse { + const message = createBaseQueuePushResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +function createBaseQueuePopRequest(): QueuePopRequest { + return { bucket: "" }; +} + +export const QueuePopRequest: MessageFns = { + encode(message: QueuePopRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePopRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePopRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePopRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: QueuePopRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): QueuePopRequest { + return QueuePopRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePopRequest { + const message = createBaseQueuePopRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseQueuePopResponse(): QueuePopResponse { + return { success: false, resultCode: "", message: "", value: undefined }; +} + +export const QueuePopResponse: MessageFns = { + encode(message: QueuePopResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.value !== undefined) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueuePopResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueuePopResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.value = Buffer.from(reader.bytes()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueuePopResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + value: isSet(object.value) ? Buffer.from(bytesFromBase64(object.value)) : undefined, + }; + }, + + toJSON(message: QueuePopResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.value !== undefined) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create(base?: DeepPartial): QueuePopResponse { + return QueuePopResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueuePopResponse { + const message = createBaseQueuePopResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.value = object.value ?? undefined; + return message; + }, +}; + +function createBaseQueueRangeRequest(): QueueRangeRequest { + return { bucket: "", fromSequence: 0, limit: 0 }; +} + +export const QueueRangeRequest: MessageFns = { + encode(message: QueueRangeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + if (message.fromSequence !== 0) { + writer.uint32(16).uint64(message.fromSequence); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueRangeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueRangeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + case 2: { + if (tag !== 16) { + break; + } + + message.fromSequence = longToNumber(reader.uint64()); + continue; + } + case 3: { + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueRangeRequest { + return { + bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "", + fromSequence: isSet(object.fromSequence) + ? globalThis.Number(object.fromSequence) + : isSet(object.from_sequence) + ? globalThis.Number(object.from_sequence) + : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + }; + }, + + toJSON(message: QueueRangeRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + if (message.fromSequence !== 0) { + obj.fromSequence = Math.round(message.fromSequence); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + return obj; + }, + + create(base?: DeepPartial): QueueRangeRequest { + return QueueRangeRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueRangeRequest { + const message = createBaseQueueRangeRequest(); + message.bucket = object.bucket ?? ""; + message.fromSequence = object.fromSequence ?? 0; + message.limit = object.limit ?? 0; + return message; + }, +}; + +function createBaseQueueRangeResponse(): QueueRangeResponse { + return { success: false, resultCode: "", message: "", values: [] }; +} + +export const QueueRangeResponse: MessageFns = { + encode(message: QueueRangeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + for (const v of message.values) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueRangeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueRangeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 34) { + break; + } + + message.values.push(Buffer.from(reader.bytes())); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueRangeResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + values: globalThis.Array.isArray(object?.values) + ? object.values.map((e: any) => Buffer.from(bytesFromBase64(e))) + : [], + }; + }, + + toJSON(message: QueueRangeResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.values?.length) { + obj.values = message.values.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create(base?: DeepPartial): QueueRangeResponse { + return QueueRangeResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueRangeResponse { + const message = createBaseQueueRangeResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.values = object.values?.map((e) => e) || []; + return message; + }, +}; + +function createBaseQueueLenRequest(): QueueLenRequest { + return { bucket: "" }; +} + +export const QueueLenRequest: MessageFns = { + encode(message: QueueLenRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bucket !== "") { + writer.uint32(10).string(message.bucket); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueLenRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueLenRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 10) { + break; + } + + message.bucket = reader.string(); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueLenRequest { + return { bucket: isSet(object.bucket) ? globalThis.String(object.bucket) : "" }; + }, + + toJSON(message: QueueLenRequest): unknown { + const obj: any = {}; + if (message.bucket !== "") { + obj.bucket = message.bucket; + } + return obj; + }, + + create(base?: DeepPartial): QueueLenRequest { + return QueueLenRequest.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueLenRequest { + const message = createBaseQueueLenRequest(); + message.bucket = object.bucket ?? ""; + return message; + }, +}; + +function createBaseQueueLenResponse(): QueueLenResponse { + return { success: false, resultCode: "", message: "", count: 0 }; +} + +export const QueueLenResponse: MessageFns = { + encode(message: QueueLenResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.success !== false) { + writer.uint32(8).bool(message.success); + } + if (message.resultCode !== "") { + writer.uint32(18).string(message.resultCode); + } + if (message.message !== "") { + writer.uint32(26).string(message.message); + } + if (message.count !== 0) { + writer.uint32(32).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueueLenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueueLenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + if (tag !== 8) { + break; + } + + message.success = reader.bool(); + continue; + } + case 2: { + if (tag !== 18) { + break; + } + + message.resultCode = reader.string(); + continue; + } + case 3: { + if (tag !== 26) { + break; + } + + message.message = reader.string(); + continue; + } + case 4: { + if (tag !== 32) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueueLenResponse { + return { + success: isSet(object.success) ? globalThis.Boolean(object.success) : false, + resultCode: isSet(object.resultCode) + ? globalThis.String(object.resultCode) + : isSet(object.result_code) + ? globalThis.String(object.result_code) + : "", + message: isSet(object.message) ? globalThis.String(object.message) : "", + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + }; + }, + + toJSON(message: QueueLenResponse): unknown { + const obj: any = {}; + if (message.success !== false) { + obj.success = message.success; + } + if (message.resultCode !== "") { + obj.resultCode = message.resultCode; + } + if (message.message !== "") { + obj.message = message.message; + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create(base?: DeepPartial): QueueLenResponse { + return QueueLenResponse.fromPartial(base ?? {}); + }, + fromPartial(object: DeepPartial): QueueLenResponse { + const message = createBaseQueueLenResponse(); + message.success = object.success ?? false; + message.resultCode = object.resultCode ?? ""; + message.message = object.message ?? ""; + message.count = object.count ?? 0; + return message; + }, +}; + +export type WaymakerStreamsServiceService = typeof WaymakerStreamsServiceService; +export const WaymakerStreamsServiceService = { + /** --- Stream lifecycle --- */ + createStream: { + path: "/waymaker.streams.WaymakerStreamsService/CreateStream" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateStreamRequest): Buffer => Buffer.from(CreateStreamRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateStreamRequest => CreateStreamRequest.decode(value), + responseSerialize: (value: CreateStreamResponse): Buffer => + Buffer.from(CreateStreamResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateStreamResponse => CreateStreamResponse.decode(value), + }, + deleteStream: { + path: "/waymaker.streams.WaymakerStreamsService/DeleteStream" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteStreamRequest): Buffer => Buffer.from(DeleteStreamRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteStreamRequest => DeleteStreamRequest.decode(value), + responseSerialize: (value: DeleteStreamResponse): Buffer => + Buffer.from(DeleteStreamResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteStreamResponse => DeleteStreamResponse.decode(value), + }, + getStreamInfo: { + path: "/waymaker.streams.WaymakerStreamsService/GetStreamInfo" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetStreamInfoRequest): Buffer => Buffer.from(GetStreamInfoRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetStreamInfoRequest => GetStreamInfoRequest.decode(value), + responseSerialize: (value: GetStreamInfoResponse): Buffer => + Buffer.from(GetStreamInfoResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetStreamInfoResponse => GetStreamInfoResponse.decode(value), + }, + listStreams: { + path: "/waymaker.streams.WaymakerStreamsService/ListStreams" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListStreamsRequest): Buffer => Buffer.from(ListStreamsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListStreamsRequest => ListStreamsRequest.decode(value), + responseSerialize: (value: ListStreamsResponse): Buffer => Buffer.from(ListStreamsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListStreamsResponse => ListStreamsResponse.decode(value), + }, + /** + * Slice 3 cross-stream sources admin: enumerate every + * (sourcing, source) tail running on this node, with current + * last_sourced_seq + pulled_total + last_error. Useful for + * operators auditing the cluster's source topology without + * ListStreams + GetStreamInfo per stream. + */ + getStreamSources: { + path: "/waymaker.streams.WaymakerStreamsService/GetStreamSources" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetStreamSourcesRequest): Buffer => + Buffer.from(GetStreamSourcesRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetStreamSourcesRequest => GetStreamSourcesRequest.decode(value), + responseSerialize: (value: GetStreamSourcesResponse): Buffer => + Buffer.from(GetStreamSourcesResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetStreamSourcesResponse => GetStreamSourcesResponse.decode(value), + }, + /** + * Update the *mutable* subset of a stream's config — the Limits + * retention bounds (max_age_ms / max_msgs / max_bytes), the per- + * message size cap, and the strict-limits toggle. Immutable fields + * (name, subjects_filter, block_size, retention policy type) are + * not touched. Lowering a bound triggers an immediate prune to + * bring stats under the new limit; the primary fans the resulting + * truncation out via `ReplicateTruncate` so secondaries mirror. + * Partial-update semantics: only fields explicitly set in the + * request are applied; unset fields leave the on-disk value + * unchanged. + */ + updateStream: { + path: "/waymaker.streams.WaymakerStreamsService/UpdateStream" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: UpdateStreamRequest): Buffer => Buffer.from(UpdateStreamRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): UpdateStreamRequest => UpdateStreamRequest.decode(value), + responseSerialize: (value: UpdateStreamResponse): Buffer => + Buffer.from(UpdateStreamResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): UpdateStreamResponse => UpdateStreamResponse.decode(value), + }, + /** --- Messages --- */ + publish: { + path: "/waymaker.streams.WaymakerStreamsService/Publish" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: PublishRequest): Buffer => Buffer.from(PublishRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): PublishRequest => PublishRequest.decode(value), + responseSerialize: (value: PublishResponse): Buffer => Buffer.from(PublishResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): PublishResponse => PublishResponse.decode(value), + }, + fetch: { + path: "/waymaker.streams.WaymakerStreamsService/Fetch" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: FetchRequest): Buffer => Buffer.from(FetchRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): FetchRequest => FetchRequest.decode(value), + responseSerialize: (value: FetchResponse): Buffer => Buffer.from(FetchResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): FetchResponse => FetchResponse.decode(value), + }, + ack: { + path: "/waymaker.streams.WaymakerStreamsService/Ack" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: AckRequest): Buffer => Buffer.from(AckRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): AckRequest => AckRequest.decode(value), + responseSerialize: (value: AckResponse): Buffer => Buffer.from(AckResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): AckResponse => AckResponse.decode(value), + }, + /** + * Negative-acknowledge: server resets the pending entry's + * delivered_at_ms so the next fetch redelivers. `delay_ms` defers + * eligibility by that wall-clock window (0 = immediate). The + * message's `deliver_count` keeps climbing toward `max_deliver`. + */ + nak: { + path: "/waymaker.streams.WaymakerStreamsService/Nak" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: NakRequest): Buffer => Buffer.from(NakRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): NakRequest => NakRequest.decode(value), + responseSerialize: (value: NakResponse): Buffer => Buffer.from(NakResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): NakResponse => NakResponse.decode(value), + }, + /** + * Terminal-acknowledge: drop the pending entry permanently + * without redelivery, regardless of `max_deliver`. Does NOT + * trigger WorkQueue delete — other consumers can still observe + * the message. + */ + term: { + path: "/waymaker.streams.WaymakerStreamsService/Term" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: TermRequest): Buffer => Buffer.from(TermRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TermRequest => TermRequest.decode(value), + responseSerialize: (value: TermResponse): Buffer => Buffer.from(TermResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): TermResponse => TermResponse.decode(value), + }, + /** + * Heartbeat-acknowledge: bump delivered_at_ms = now to extend + * the ack_wait window. `deliver_count` is unchanged. + */ + inProgress: { + path: "/waymaker.streams.WaymakerStreamsService/InProgress" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: InProgressRequest): Buffer => Buffer.from(InProgressRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): InProgressRequest => InProgressRequest.decode(value), + responseSerialize: (value: InProgressResponse): Buffer => Buffer.from(InProgressResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): InProgressResponse => InProgressResponse.decode(value), + }, + /** + * Push-mode delivery: the server fetches in a loop and streams + * each delivered message back to the client as it arrives. The + * client acks via the unary Ack RPC just like pull-mode. The + * stream stays open until the client disconnects, the server + * returns an error, or the consumer is deleted. Wakes + * immediately on new appends via the storage layer's subscribe + * primitive — no polling for empty streams. + */ + subscribe: { + path: "/waymaker.streams.WaymakerStreamsService/Subscribe" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: SubscribeRequest): Buffer => Buffer.from(SubscribeRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SubscribeRequest => SubscribeRequest.decode(value), + responseSerialize: (value: SubscribeEvent): Buffer => Buffer.from(SubscribeEvent.encode(value).finish()), + responseDeserialize: (value: Buffer): SubscribeEvent => SubscribeEvent.decode(value), + }, + /** --- Consumers --- */ + createConsumer: { + path: "/waymaker.streams.WaymakerStreamsService/CreateConsumer" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: CreateConsumerRequest): Buffer => + Buffer.from(CreateConsumerRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): CreateConsumerRequest => CreateConsumerRequest.decode(value), + responseSerialize: (value: CreateConsumerResponse): Buffer => + Buffer.from(CreateConsumerResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): CreateConsumerResponse => CreateConsumerResponse.decode(value), + }, + deleteConsumer: { + path: "/waymaker.streams.WaymakerStreamsService/DeleteConsumer" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteConsumerRequest): Buffer => + Buffer.from(DeleteConsumerRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteConsumerRequest => DeleteConsumerRequest.decode(value), + responseSerialize: (value: DeleteConsumerResponse): Buffer => + Buffer.from(DeleteConsumerResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteConsumerResponse => DeleteConsumerResponse.decode(value), + }, + listConsumers: { + path: "/waymaker.streams.WaymakerStreamsService/ListConsumers" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListConsumersRequest): Buffer => Buffer.from(ListConsumersRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListConsumersRequest => ListConsumersRequest.decode(value), + responseSerialize: (value: ListConsumersResponse): Buffer => + Buffer.from(ListConsumersResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListConsumersResponse => ListConsumersResponse.decode(value), + }, + getConsumerInfo: { + path: "/waymaker.streams.WaymakerStreamsService/GetConsumerInfo" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetConsumerInfoRequest): Buffer => + Buffer.from(GetConsumerInfoRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetConsumerInfoRequest => GetConsumerInfoRequest.decode(value), + responseSerialize: (value: GetConsumerInfoResponse): Buffer => + Buffer.from(GetConsumerInfoResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetConsumerInfoResponse => GetConsumerInfoResponse.decode(value), + }, + /** + * --- Rebalancing (Phase 1: operator-driven only) --- + * + * The current owner of a stream serves its raw redb bytes to a peer + * that's pulling the stream over. The handler atomically removes the + * stream from its local registry first, refusing the call if any + * outside reference is still live (operator must drain writers). On + * RPC success the source deletes the local file. See + * STREAMS_SPEC.md §11 for the model and limitations (no automatic + * ring-change sweep yet; the operator is responsible for triggering + * a migrate when membership moves a stream's authority). + */ + transferStream: { + path: "/waymaker.streams.WaymakerStreamsService/TransferStream" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: TransferStreamRequest): Buffer => + Buffer.from(TransferStreamRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): TransferStreamRequest => TransferStreamRequest.decode(value), + responseSerialize: (value: TransferStreamChunk): Buffer => Buffer.from(TransferStreamChunk.encode(value).finish()), + responseDeserialize: (value: Buffer): TransferStreamChunk => TransferStreamChunk.decode(value), + }, + /** + * Admin trigger on the receiving side: pull stream `name` from + * `source_node_id`'s `TransferStream` and own it locally. + */ + migrateStream: { + path: "/waymaker.streams.WaymakerStreamsService/MigrateStream" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: MigrateStreamRequest): Buffer => Buffer.from(MigrateStreamRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): MigrateStreamRequest => MigrateStreamRequest.decode(value), + responseSerialize: (value: MigrateStreamResponse): Buffer => + Buffer.from(MigrateStreamResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): MigrateStreamResponse => MigrateStreamResponse.decode(value), + }, + /** + * Cluster-wide stream inventory + skew report. The receiving node + * queries every cluster member's local `StreamsRegistry` (via the + * existing proxy channel pool) and aggregates the result. Used by + * operators to identify hash-skew imbalance before triggering + * `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + */ + getClusterStreamStats: { + path: "/waymaker.streams.WaymakerStreamsService/GetClusterStreamStats" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetClusterStreamStatsRequest): Buffer => + Buffer.from(GetClusterStreamStatsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetClusterStreamStatsRequest => GetClusterStreamStatsRequest.decode(value), + responseSerialize: (value: GetClusterStreamStatsResponse): Buffer => + Buffer.from(GetClusterStreamStatsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetClusterStreamStatsResponse => GetClusterStreamStatsResponse.decode(value), + }, + /** + * Server-streamed admin watch — emits a WatchEvent each time the + * local node's state mutates (stream / consumer create / delete / + * update). Useful for live dashboards or service-discovery + * clients that want to react to topology changes without + * polling. Local-only for now: each watcher sees events generated + * on the node it connected to. Cluster-wide watch can be built + * on top via a fan-out client; the server doesn't fan out + * automatically because the events would arrive out of any + * single-source ordering anyway under proxy hops. + */ + watchStreams: { + path: "/waymaker.streams.WaymakerStreamsService/WatchStreams" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: WatchStreamsRequest): Buffer => Buffer.from(WatchStreamsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): WatchStreamsRequest => WatchStreamsRequest.decode(value), + responseSerialize: (value: WatchEvent): Buffer => Buffer.from(WatchEvent.encode(value).finish()), + responseDeserialize: (value: Buffer): WatchEvent => WatchEvent.decode(value), + }, + /** + * Read the latest message at a given subject within a stream. + * The foundation for KV-style "last-value wins" lookups on top + * of a stream — KV put = Publish to `.`; KV get = + * this RPC against the same subject. Returns the full + * MessagePb (including headers) so callers can detect KV + * tombstones (`wmkv.tombstone` header). + * + * Returns `success: true` with `message` unset when no message + * has ever been published at this subject (or all have been + * pruned). Routes via `try_route!` like every other per-stream + * RPC. + */ + readLatestAtSubject: { + path: "/waymaker.streams.WaymakerStreamsService/ReadLatestAtSubject" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReadLatestAtSubjectRequest): Buffer => + Buffer.from(ReadLatestAtSubjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReadLatestAtSubjectRequest => ReadLatestAtSubjectRequest.decode(value), + responseSerialize: (value: ReadLatestAtSubjectResponse): Buffer => + Buffer.from(ReadLatestAtSubjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReadLatestAtSubjectResponse => ReadLatestAtSubjectResponse.decode(value), + }, + /** + * List every distinct subject in `stream` whose name starts + * with `prefix`. Cost is O(matching subjects); independent of + * message count. The foundation for `streams-cli kv-keys` and + * service-discovery-style "everything under this namespace" + * lookups. Returns subjects whose latest message is a + * tombstone too — clients that want live-keys-only filter + * tombstones via a follow-up `ReadLatestAtSubject`. + */ + listSubjectsByPrefix: { + path: "/waymaker.streams.WaymakerStreamsService/ListSubjectsByPrefix" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListSubjectsByPrefixRequest): Buffer => + Buffer.from(ListSubjectsByPrefixRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListSubjectsByPrefixRequest => ListSubjectsByPrefixRequest.decode(value), + responseSerialize: (value: ListSubjectsByPrefixResponse): Buffer => + Buffer.from(ListSubjectsByPrefixResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListSubjectsByPrefixResponse => ListSubjectsByPrefixResponse.decode(value), + }, + /** + * Scan all messages published at an exact subject within + * `stream`, in seq order, starting at `from_seq` (0 = from the + * beginning), bounded by `limit`. The foundation for + * `streams-cli kv-history` — operators want to inspect every + * value ever published under a KV key (including tombstones) + * for debugging/audit. Cost is O(matching messages); independent + * of total stream size. Routes via `try_route!` like every + * other per-stream RPC. + */ + scanExactAtSubject: { + path: "/waymaker.streams.WaymakerStreamsService/ScanExactAtSubject" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ScanExactAtSubjectRequest): Buffer => + Buffer.from(ScanExactAtSubjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ScanExactAtSubjectRequest => ScanExactAtSubjectRequest.decode(value), + responseSerialize: (value: ScanExactAtSubjectResponse): Buffer => + Buffer.from(ScanExactAtSubjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ScanExactAtSubjectResponse => ScanExactAtSubjectResponse.decode(value), + }, + /** + * Remove a Phase 3 per-stream authority override. Routing + * reverts to the ring's hash owner. Idempotent: clearing a + * stream with no override succeeds silently. Operators use this + * to retire a stale override (e.g. after a ring shift made the + * override redundant). Commits via a Raft entry so the clear + * applies on every node before the response returns. + */ + clearStreamAuthority: { + path: "/waymaker.streams.WaymakerStreamsService/ClearStreamAuthority" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ClearStreamAuthorityRequest): Buffer => + Buffer.from(ClearStreamAuthorityRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ClearStreamAuthorityRequest => ClearStreamAuthorityRequest.decode(value), + responseSerialize: (value: ClearStreamAuthorityResponse): Buffer => + Buffer.from(ClearStreamAuthorityResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ClearStreamAuthorityResponse => ClearStreamAuthorityResponse.decode(value), + }, + /** + * List every Phase 3 stream_authority override active on the + * responding node. The map is Raft-replicated, so any node's + * response reflects the cluster-wide view (modulo apply lag). + * Useful for ops triage when an unexpected number of overrides + * shows up on /metrics. No fan-out — single-node RPC; the + * returned set is the canonical truth. + */ + listStreamAuthorityOverrides: { + path: "/waymaker.streams.WaymakerStreamsService/ListStreamAuthorityOverrides" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListStreamAuthorityOverridesRequest): Buffer => + Buffer.from(ListStreamAuthorityOverridesRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListStreamAuthorityOverridesRequest => + ListStreamAuthorityOverridesRequest.decode(value), + responseSerialize: (value: ListStreamAuthorityOverridesResponse): Buffer => + Buffer.from(ListStreamAuthorityOverridesResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListStreamAuthorityOverridesResponse => + ListStreamAuthorityOverridesResponse.decode(value), + }, + /** + * Toggle pinned state for `stream`. Pinned streams are exempt + * from the auto-GC sweep that retires redundant overrides — use + * when you want a stream to stay on its current authority node + * even if the ring shifts to make the override redundant. + * Idempotent. Independent of the override itself (pinning a + * stream with no override is benign; the marker sits dormant). + */ + setStreamPinned: { + path: "/waymaker.streams.WaymakerStreamsService/SetStreamPinned" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: SetStreamPinnedRequest): Buffer => + Buffer.from(SetStreamPinnedRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): SetStreamPinnedRequest => SetStreamPinnedRequest.decode(value), + responseSerialize: (value: SetStreamPinnedResponse): Buffer => + Buffer.from(SetStreamPinnedResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): SetStreamPinnedResponse => SetStreamPinnedResponse.decode(value), + }, + putObject: { + path: "/waymaker.streams.WaymakerStreamsService/PutObject" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: PutObjectRequest): Buffer => Buffer.from(PutObjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): PutObjectRequest => PutObjectRequest.decode(value), + responseSerialize: (value: PutObjectResponse): Buffer => Buffer.from(PutObjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): PutObjectResponse => PutObjectResponse.decode(value), + }, + getObject: { + path: "/waymaker.streams.WaymakerStreamsService/GetObject" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetObjectRequest): Buffer => Buffer.from(GetObjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetObjectRequest => GetObjectRequest.decode(value), + responseSerialize: (value: GetObjectResponse): Buffer => Buffer.from(GetObjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetObjectResponse => GetObjectResponse.decode(value), + }, + deleteObject: { + path: "/waymaker.streams.WaymakerStreamsService/DeleteObject" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: DeleteObjectRequest): Buffer => Buffer.from(DeleteObjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): DeleteObjectRequest => DeleteObjectRequest.decode(value), + responseSerialize: (value: DeleteObjectResponse): Buffer => + Buffer.from(DeleteObjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): DeleteObjectResponse => DeleteObjectResponse.decode(value), + }, + getObjectInfo: { + path: "/waymaker.streams.WaymakerStreamsService/GetObjectInfo" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetObjectInfoRequest): Buffer => Buffer.from(GetObjectInfoRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetObjectInfoRequest => GetObjectInfoRequest.decode(value), + responseSerialize: (value: GetObjectInfoResponse): Buffer => + Buffer.from(GetObjectInfoResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetObjectInfoResponse => GetObjectInfoResponse.decode(value), + }, + listObjects: { + path: "/waymaker.streams.WaymakerStreamsService/ListObjects" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListObjectsRequest): Buffer => Buffer.from(ListObjectsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListObjectsRequest => ListObjectsRequest.decode(value), + responseSerialize: (value: ListObjectsResponse): Buffer => Buffer.from(ListObjectsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListObjectsResponse => ListObjectsResponse.decode(value), + }, + /** + * Client-streamed PutObject for arbitrary-size objects. First + * frame MUST set `start { bucket, name, chunk_size, headers, + * sha256 }`. Subsequent frames carry `data` only — each frame's + * `data` is ONE chunk message at `objc..`. The server + * accumulates a running SHA-256 and total-byte count, publishes + * chunks as they arrive (replication fires async), and on the + * last frame (`finish=true`) publishes the metadata. A client + * disconnect before `finish=true` leaves orphan chunks; the GC + * sweep cleans them up. + */ + putObjectStream: { + path: "/waymaker.streams.WaymakerStreamsService/PutObjectStream" as const, + requestStream: true as const, + responseStream: false as const, + requestSerialize: (value: PutObjectStreamFrame): Buffer => Buffer.from(PutObjectStreamFrame.encode(value).finish()), + requestDeserialize: (value: Buffer): PutObjectStreamFrame => PutObjectStreamFrame.decode(value), + responseSerialize: (value: PutObjectResponse): Buffer => Buffer.from(PutObjectResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): PutObjectResponse => PutObjectResponse.decode(value), + }, + /** + * Server-streamed GetObject. First frame carries `info`; + * subsequent frames carry `data` only — one per chunk. Last + * frame sets `done=true`. The client reassembles; the response + * is sent over the wire in chunk-sized pieces so memory usage + * stays bounded on both sides. + */ + getObjectStream: { + path: "/waymaker.streams.WaymakerStreamsService/GetObjectStream" as const, + requestStream: false as const, + responseStream: true as const, + requestSerialize: (value: GetObjectRequest): Buffer => Buffer.from(GetObjectRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetObjectRequest => GetObjectRequest.decode(value), + responseSerialize: (value: GetObjectStreamFrame): Buffer => + Buffer.from(GetObjectStreamFrame.encode(value).finish()), + responseDeserialize: (value: Buffer): GetObjectStreamFrame => GetObjectStreamFrame.decode(value), + }, + /** + * Every revision of `name`'s metadata in seq order — covers + * overwrites + tombstones. Returns one entry per metadata + * message at `objm.`. Chunks are not enumerated; this RPC + * is for object versioning / audit, not for binary diffing. + */ + listObjectRevisions: { + path: "/waymaker.streams.WaymakerStreamsService/ListObjectRevisions" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ListObjectRevisionsRequest): Buffer => + Buffer.from(ListObjectRevisionsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ListObjectRevisionsRequest => ListObjectRevisionsRequest.decode(value), + responseSerialize: (value: ListObjectRevisionsResponse): Buffer => + Buffer.from(ListObjectRevisionsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ListObjectRevisionsResponse => ListObjectRevisionsResponse.decode(value), + }, + /** + * Read a byte range `[offset, offset + len)` from an object's + * assembled payload. Only the chunks that intersect the range + * are loaded server-side — useful for resumable downloads of + * large objects. + * - `offset + len > total_bytes` → returns whatever bytes exist + * in the range (success, possibly empty). + * - `offset > total_bytes` → returns empty payload (success). + * - `len == 0` → returns empty payload (success). + */ + getObjectRange: { + path: "/waymaker.streams.WaymakerStreamsService/GetObjectRange" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: GetObjectRangeRequest): Buffer => + Buffer.from(GetObjectRangeRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): GetObjectRangeRequest => GetObjectRangeRequest.decode(value), + responseSerialize: (value: GetObjectRangeResponse): Buffer => + Buffer.from(GetObjectRangeResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): GetObjectRangeResponse => GetObjectRangeResponse.decode(value), + }, + /** + * Operator-driven rebalance. Takes an explicit plan — a list of + * (stream, target_node) — and executes each step by issuing a + * `MigrateStream` to the target. The plan is *not* auto-generated; + * the operator (or a future automatic planner) is responsible for + * building it from a `GetClusterStreamStats` snapshot. Steps run + * sequentially with a per-step timeout; the response carries + * per-step outcomes so partial success is visible. + */ + rebalanceStreams: { + path: "/waymaker.streams.WaymakerStreamsService/RebalanceStreams" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: RebalanceStreamsRequest): Buffer => + Buffer.from(RebalanceStreamsRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): RebalanceStreamsRequest => RebalanceStreamsRequest.decode(value), + responseSerialize: (value: RebalanceStreamsResponse): Buffer => + Buffer.from(RebalanceStreamsResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): RebalanceStreamsResponse => RebalanceStreamsResponse.decode(value), + }, + /** + * --- Consumer-state replication (Phase 2 §G) --- + * + * The primary for a stream pushes its consumers' full state to the + * stream's `replication_factor - 1` secondaries after every + * state-mutating consumer operation (create_consumer, fetch, ack, + * delete_consumer). The push is fire-and-forget on the primary's + * side — the client RPC has already returned to the caller; the + * replication runs in a background task. Secondaries hold the + * snapshot in memory; adoption-on-failover is a future slice. + */ + replicateConsumerState: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateConsumerState" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateConsumerStateRequest): Buffer => + Buffer.from(ReplicateConsumerStateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateConsumerStateRequest => ReplicateConsumerStateRequest.decode(value), + responseSerialize: (value: ReplicateConsumerStateResponse): Buffer => + Buffer.from(ReplicateConsumerStateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateConsumerStateResponse => + ReplicateConsumerStateResponse.decode(value), + }, + /** + * --- Cross-stream sources state replication (slice 2E) --- + * + * The primary for a sourcing stream pushes the current per-source + * tail watermark to each secondary after every successful batch + * (i.e. once per ~128 source messages). Secondaries persist the + * snapshot via their own SourceTailStore so that on adoption (ring + * shift → secondary becomes primary), `spawn_source_tail_tasks` + * reads the replicated state and resumes from `last_sourced_seq + 1` + * instead of re-pulling from `start_seq` (which would emit + * duplicates with already-replicated provenance headers). + */ + replicateSourceTailState: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateSourceTailState" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateSourceTailStateRequest): Buffer => + Buffer.from(ReplicateSourceTailStateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateSourceTailStateRequest => + ReplicateSourceTailStateRequest.decode(value), + responseSerialize: (value: ReplicateSourceTailStateResponse): Buffer => + Buffer.from(ReplicateSourceTailStateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateSourceTailStateResponse => + ReplicateSourceTailStateResponse.decode(value), + }, + /** + * --- Stream-data replication (Phase 3, chunk 1) --- + * + * The primary for a stream pushes: + * 1. ReplicateStreamCreate once at create time, so secondaries + * know what stream to open in their replica registry with + * what config (block_size, retention, max_msg_bytes, etc.). + * 2. ReplicateMessage on every successful Publish, with the + * seq the primary assigned, so the secondary's replica + * mirrors the message log by seq exactly. + * + * Replica streams live in a per-node "replica registry" rooted at + * `/replicas/.redb`, distinct from the + * primary-owned namespace. The streams handler never serves + * client requests from the replica — it's purely catastrophe + * recovery state until the (future) adoption-on-failover slice + * promotes a replica to primary. + */ + replicateStreamCreate: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateStreamCreate" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateStreamCreateRequest): Buffer => + Buffer.from(ReplicateStreamCreateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateStreamCreateRequest => ReplicateStreamCreateRequest.decode(value), + responseSerialize: (value: ReplicateStreamCreateResponse): Buffer => + Buffer.from(ReplicateStreamCreateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateStreamCreateResponse => ReplicateStreamCreateResponse.decode(value), + }, + replicateMessage: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateMessage" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateMessageRequest): Buffer => + Buffer.from(ReplicateMessageRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateMessageRequest => ReplicateMessageRequest.decode(value), + responseSerialize: (value: ReplicateMessageResponse): Buffer => + Buffer.from(ReplicateMessageResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateMessageResponse => ReplicateMessageResponse.decode(value), + }, + /** + * Tear down the replica when the primary deletes the stream. + * Idempotent — missing replica is success. + */ + replicateStreamDelete: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateStreamDelete" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateStreamDeleteRequest): Buffer => + Buffer.from(ReplicateStreamDeleteRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateStreamDeleteRequest => ReplicateStreamDeleteRequest.decode(value), + responseSerialize: (value: ReplicateStreamDeleteResponse): Buffer => + Buffer.from(ReplicateStreamDeleteResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateStreamDeleteResponse => ReplicateStreamDeleteResponse.decode(value), + }, + /** + * The primary's retention sweep removed messages below + * `first_seq`; the secondary mirrors the same truncation so its + * replica's first_seq advances in lockstep. Idempotent. + */ + replicateTruncate: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateTruncate" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateTruncateRequest): Buffer => + Buffer.from(ReplicateTruncateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateTruncateRequest => ReplicateTruncateRequest.decode(value), + responseSerialize: (value: ReplicateTruncateResponse): Buffer => + Buffer.from(ReplicateTruncateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateTruncateResponse => ReplicateTruncateResponse.decode(value), + }, + /** + * The primary applied an UpdateStream; secondaries mirror the + * mutable subset of the config so a future failover lands on a + * replica whose retention matches the primary's. Carries the same + * narrow shape as UpdateStreamRequest — only the mutable fields, + * with partial-update semantics. + */ + replicateStreamUpdate: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateStreamUpdate" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateStreamUpdateRequest): Buffer => + Buffer.from(ReplicateStreamUpdateRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateStreamUpdateRequest => ReplicateStreamUpdateRequest.decode(value), + responseSerialize: (value: ReplicateStreamUpdateResponse): Buffer => + Buffer.from(ReplicateStreamUpdateResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateStreamUpdateResponse => ReplicateStreamUpdateResponse.decode(value), + }, + /** + * Under `RetentionPolicy::WorkQueue` the primary deletes a message + * on ack (delete-on-first-ack). Without this fan-out, secondaries' + * replica files would still hold the acked message — and after a + * failover, a fresh consumer on the new primary would see it and + * re-deliver, breaking the "each message belongs to exactly one + * consumer at a time" invariant. Idempotent: missing seq on + * secondary is success. + */ + replicateWorkQueueAck: { + path: "/waymaker.streams.WaymakerStreamsService/ReplicateWorkQueueAck" as const, + requestStream: false as const, + responseStream: false as const, + requestSerialize: (value: ReplicateWorkQueueAckRequest): Buffer => + Buffer.from(ReplicateWorkQueueAckRequest.encode(value).finish()), + requestDeserialize: (value: Buffer): ReplicateWorkQueueAckRequest => ReplicateWorkQueueAckRequest.decode(value), + responseSerialize: (value: ReplicateWorkQueueAckResponse): Buffer => + Buffer.from(ReplicateWorkQueueAckResponse.encode(value).finish()), + responseDeserialize: (value: Buffer): ReplicateWorkQueueAckResponse => ReplicateWorkQueueAckResponse.decode(value), + }, +} as const; + +export interface WaymakerStreamsServiceServer extends UntypedServiceImplementation { + /** --- Stream lifecycle --- */ + createStream: handleUnaryCall; + deleteStream: handleUnaryCall; + getStreamInfo: handleUnaryCall; + listStreams: handleUnaryCall; + /** + * Slice 3 cross-stream sources admin: enumerate every + * (sourcing, source) tail running on this node, with current + * last_sourced_seq + pulled_total + last_error. Useful for + * operators auditing the cluster's source topology without + * ListStreams + GetStreamInfo per stream. + */ + getStreamSources: handleUnaryCall; + /** + * Update the *mutable* subset of a stream's config — the Limits + * retention bounds (max_age_ms / max_msgs / max_bytes), the per- + * message size cap, and the strict-limits toggle. Immutable fields + * (name, subjects_filter, block_size, retention policy type) are + * not touched. Lowering a bound triggers an immediate prune to + * bring stats under the new limit; the primary fans the resulting + * truncation out via `ReplicateTruncate` so secondaries mirror. + * Partial-update semantics: only fields explicitly set in the + * request are applied; unset fields leave the on-disk value + * unchanged. + */ + updateStream: handleUnaryCall; + /** --- Messages --- */ + publish: handleUnaryCall; + fetch: handleUnaryCall; + ack: handleUnaryCall; + /** + * Negative-acknowledge: server resets the pending entry's + * delivered_at_ms so the next fetch redelivers. `delay_ms` defers + * eligibility by that wall-clock window (0 = immediate). The + * message's `deliver_count` keeps climbing toward `max_deliver`. + */ + nak: handleUnaryCall; + /** + * Terminal-acknowledge: drop the pending entry permanently + * without redelivery, regardless of `max_deliver`. Does NOT + * trigger WorkQueue delete — other consumers can still observe + * the message. + */ + term: handleUnaryCall; + /** + * Heartbeat-acknowledge: bump delivered_at_ms = now to extend + * the ack_wait window. `deliver_count` is unchanged. + */ + inProgress: handleUnaryCall; + /** + * Push-mode delivery: the server fetches in a loop and streams + * each delivered message back to the client as it arrives. The + * client acks via the unary Ack RPC just like pull-mode. The + * stream stays open until the client disconnects, the server + * returns an error, or the consumer is deleted. Wakes + * immediately on new appends via the storage layer's subscribe + * primitive — no polling for empty streams. + */ + subscribe: handleServerStreamingCall; + /** --- Consumers --- */ + createConsumer: handleUnaryCall; + deleteConsumer: handleUnaryCall; + listConsumers: handleUnaryCall; + getConsumerInfo: handleUnaryCall; + /** + * --- Rebalancing (Phase 1: operator-driven only) --- + * + * The current owner of a stream serves its raw redb bytes to a peer + * that's pulling the stream over. The handler atomically removes the + * stream from its local registry first, refusing the call if any + * outside reference is still live (operator must drain writers). On + * RPC success the source deletes the local file. See + * STREAMS_SPEC.md §11 for the model and limitations (no automatic + * ring-change sweep yet; the operator is responsible for triggering + * a migrate when membership moves a stream's authority). + */ + transferStream: handleServerStreamingCall; + /** + * Admin trigger on the receiving side: pull stream `name` from + * `source_node_id`'s `TransferStream` and own it locally. + */ + migrateStream: handleUnaryCall; + /** + * Cluster-wide stream inventory + skew report. The receiving node + * queries every cluster member's local `StreamsRegistry` (via the + * existing proxy channel pool) and aggregates the result. Used by + * operators to identify hash-skew imbalance before triggering + * `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + */ + getClusterStreamStats: handleUnaryCall; + /** + * Server-streamed admin watch — emits a WatchEvent each time the + * local node's state mutates (stream / consumer create / delete / + * update). Useful for live dashboards or service-discovery + * clients that want to react to topology changes without + * polling. Local-only for now: each watcher sees events generated + * on the node it connected to. Cluster-wide watch can be built + * on top via a fan-out client; the server doesn't fan out + * automatically because the events would arrive out of any + * single-source ordering anyway under proxy hops. + */ + watchStreams: handleServerStreamingCall; + /** + * Read the latest message at a given subject within a stream. + * The foundation for KV-style "last-value wins" lookups on top + * of a stream — KV put = Publish to `.`; KV get = + * this RPC against the same subject. Returns the full + * MessagePb (including headers) so callers can detect KV + * tombstones (`wmkv.tombstone` header). + * + * Returns `success: true` with `message` unset when no message + * has ever been published at this subject (or all have been + * pruned). Routes via `try_route!` like every other per-stream + * RPC. + */ + readLatestAtSubject: handleUnaryCall; + /** + * List every distinct subject in `stream` whose name starts + * with `prefix`. Cost is O(matching subjects); independent of + * message count. The foundation for `streams-cli kv-keys` and + * service-discovery-style "everything under this namespace" + * lookups. Returns subjects whose latest message is a + * tombstone too — clients that want live-keys-only filter + * tombstones via a follow-up `ReadLatestAtSubject`. + */ + listSubjectsByPrefix: handleUnaryCall; + /** + * Scan all messages published at an exact subject within + * `stream`, in seq order, starting at `from_seq` (0 = from the + * beginning), bounded by `limit`. The foundation for + * `streams-cli kv-history` — operators want to inspect every + * value ever published under a KV key (including tombstones) + * for debugging/audit. Cost is O(matching messages); independent + * of total stream size. Routes via `try_route!` like every + * other per-stream RPC. + */ + scanExactAtSubject: handleUnaryCall; + /** + * Remove a Phase 3 per-stream authority override. Routing + * reverts to the ring's hash owner. Idempotent: clearing a + * stream with no override succeeds silently. Operators use this + * to retire a stale override (e.g. after a ring shift made the + * override redundant). Commits via a Raft entry so the clear + * applies on every node before the response returns. + */ + clearStreamAuthority: handleUnaryCall; + /** + * List every Phase 3 stream_authority override active on the + * responding node. The map is Raft-replicated, so any node's + * response reflects the cluster-wide view (modulo apply lag). + * Useful for ops triage when an unexpected number of overrides + * shows up on /metrics. No fan-out — single-node RPC; the + * returned set is the canonical truth. + */ + listStreamAuthorityOverrides: handleUnaryCall< + ListStreamAuthorityOverridesRequest, + ListStreamAuthorityOverridesResponse + >; + /** + * Toggle pinned state for `stream`. Pinned streams are exempt + * from the auto-GC sweep that retires redundant overrides — use + * when you want a stream to stay on its current authority node + * even if the ring shifts to make the override redundant. + * Idempotent. Independent of the override itself (pinning a + * stream with no override is benign; the marker sits dormant). + */ + setStreamPinned: handleUnaryCall; + putObject: handleUnaryCall; + getObject: handleUnaryCall; + deleteObject: handleUnaryCall; + getObjectInfo: handleUnaryCall; + listObjects: handleUnaryCall; + /** + * Client-streamed PutObject for arbitrary-size objects. First + * frame MUST set `start { bucket, name, chunk_size, headers, + * sha256 }`. Subsequent frames carry `data` only — each frame's + * `data` is ONE chunk message at `objc..`. The server + * accumulates a running SHA-256 and total-byte count, publishes + * chunks as they arrive (replication fires async), and on the + * last frame (`finish=true`) publishes the metadata. A client + * disconnect before `finish=true` leaves orphan chunks; the GC + * sweep cleans them up. + */ + putObjectStream: handleClientStreamingCall; + /** + * Server-streamed GetObject. First frame carries `info`; + * subsequent frames carry `data` only — one per chunk. Last + * frame sets `done=true`. The client reassembles; the response + * is sent over the wire in chunk-sized pieces so memory usage + * stays bounded on both sides. + */ + getObjectStream: handleServerStreamingCall; + /** + * Every revision of `name`'s metadata in seq order — covers + * overwrites + tombstones. Returns one entry per metadata + * message at `objm.`. Chunks are not enumerated; this RPC + * is for object versioning / audit, not for binary diffing. + */ + listObjectRevisions: handleUnaryCall; + /** + * Read a byte range `[offset, offset + len)` from an object's + * assembled payload. Only the chunks that intersect the range + * are loaded server-side — useful for resumable downloads of + * large objects. + * - `offset + len > total_bytes` → returns whatever bytes exist + * in the range (success, possibly empty). + * - `offset > total_bytes` → returns empty payload (success). + * - `len == 0` → returns empty payload (success). + */ + getObjectRange: handleUnaryCall; + /** + * Operator-driven rebalance. Takes an explicit plan — a list of + * (stream, target_node) — and executes each step by issuing a + * `MigrateStream` to the target. The plan is *not* auto-generated; + * the operator (or a future automatic planner) is responsible for + * building it from a `GetClusterStreamStats` snapshot. Steps run + * sequentially with a per-step timeout; the response carries + * per-step outcomes so partial success is visible. + */ + rebalanceStreams: handleUnaryCall; + /** + * --- Consumer-state replication (Phase 2 §G) --- + * + * The primary for a stream pushes its consumers' full state to the + * stream's `replication_factor - 1` secondaries after every + * state-mutating consumer operation (create_consumer, fetch, ack, + * delete_consumer). The push is fire-and-forget on the primary's + * side — the client RPC has already returned to the caller; the + * replication runs in a background task. Secondaries hold the + * snapshot in memory; adoption-on-failover is a future slice. + */ + replicateConsumerState: handleUnaryCall; + /** + * --- Cross-stream sources state replication (slice 2E) --- + * + * The primary for a sourcing stream pushes the current per-source + * tail watermark to each secondary after every successful batch + * (i.e. once per ~128 source messages). Secondaries persist the + * snapshot via their own SourceTailStore so that on adoption (ring + * shift → secondary becomes primary), `spawn_source_tail_tasks` + * reads the replicated state and resumes from `last_sourced_seq + 1` + * instead of re-pulling from `start_seq` (which would emit + * duplicates with already-replicated provenance headers). + */ + replicateSourceTailState: handleUnaryCall; + /** + * --- Stream-data replication (Phase 3, chunk 1) --- + * + * The primary for a stream pushes: + * 1. ReplicateStreamCreate once at create time, so secondaries + * know what stream to open in their replica registry with + * what config (block_size, retention, max_msg_bytes, etc.). + * 2. ReplicateMessage on every successful Publish, with the + * seq the primary assigned, so the secondary's replica + * mirrors the message log by seq exactly. + * + * Replica streams live in a per-node "replica registry" rooted at + * `/replicas/.redb`, distinct from the + * primary-owned namespace. The streams handler never serves + * client requests from the replica — it's purely catastrophe + * recovery state until the (future) adoption-on-failover slice + * promotes a replica to primary. + */ + replicateStreamCreate: handleUnaryCall; + replicateMessage: handleUnaryCall; + /** + * Tear down the replica when the primary deletes the stream. + * Idempotent — missing replica is success. + */ + replicateStreamDelete: handleUnaryCall; + /** + * The primary's retention sweep removed messages below + * `first_seq`; the secondary mirrors the same truncation so its + * replica's first_seq advances in lockstep. Idempotent. + */ + replicateTruncate: handleUnaryCall; + /** + * The primary applied an UpdateStream; secondaries mirror the + * mutable subset of the config so a future failover lands on a + * replica whose retention matches the primary's. Carries the same + * narrow shape as UpdateStreamRequest — only the mutable fields, + * with partial-update semantics. + */ + replicateStreamUpdate: handleUnaryCall; + /** + * Under `RetentionPolicy::WorkQueue` the primary deletes a message + * on ack (delete-on-first-ack). Without this fan-out, secondaries' + * replica files would still hold the acked message — and after a + * failover, a fresh consumer on the new primary would see it and + * re-deliver, breaking the "each message belongs to exactly one + * consumer at a time" invariant. Idempotent: missing seq on + * secondary is success. + */ + replicateWorkQueueAck: handleUnaryCall; +} + +export interface WaymakerStreamsServiceClient extends Client { + /** --- Stream lifecycle --- */ + createStream( + request: CreateStreamRequest, + callback: (error: ServiceError | null, response: CreateStreamResponse) => void, + ): ClientUnaryCall; + createStream( + request: CreateStreamRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateStreamResponse) => void, + ): ClientUnaryCall; + createStream( + request: CreateStreamRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateStreamResponse) => void, + ): ClientUnaryCall; + deleteStream( + request: DeleteStreamRequest, + callback: (error: ServiceError | null, response: DeleteStreamResponse) => void, + ): ClientUnaryCall; + deleteStream( + request: DeleteStreamRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteStreamResponse) => void, + ): ClientUnaryCall; + deleteStream( + request: DeleteStreamRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteStreamResponse) => void, + ): ClientUnaryCall; + getStreamInfo( + request: GetStreamInfoRequest, + callback: (error: ServiceError | null, response: GetStreamInfoResponse) => void, + ): ClientUnaryCall; + getStreamInfo( + request: GetStreamInfoRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetStreamInfoResponse) => void, + ): ClientUnaryCall; + getStreamInfo( + request: GetStreamInfoRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetStreamInfoResponse) => void, + ): ClientUnaryCall; + listStreams( + request: ListStreamsRequest, + callback: (error: ServiceError | null, response: ListStreamsResponse) => void, + ): ClientUnaryCall; + listStreams( + request: ListStreamsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListStreamsResponse) => void, + ): ClientUnaryCall; + listStreams( + request: ListStreamsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListStreamsResponse) => void, + ): ClientUnaryCall; + /** + * Slice 3 cross-stream sources admin: enumerate every + * (sourcing, source) tail running on this node, with current + * last_sourced_seq + pulled_total + last_error. Useful for + * operators auditing the cluster's source topology without + * ListStreams + GetStreamInfo per stream. + */ + getStreamSources( + request: GetStreamSourcesRequest, + callback: (error: ServiceError | null, response: GetStreamSourcesResponse) => void, + ): ClientUnaryCall; + getStreamSources( + request: GetStreamSourcesRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetStreamSourcesResponse) => void, + ): ClientUnaryCall; + getStreamSources( + request: GetStreamSourcesRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetStreamSourcesResponse) => void, + ): ClientUnaryCall; + /** + * Update the *mutable* subset of a stream's config — the Limits + * retention bounds (max_age_ms / max_msgs / max_bytes), the per- + * message size cap, and the strict-limits toggle. Immutable fields + * (name, subjects_filter, block_size, retention policy type) are + * not touched. Lowering a bound triggers an immediate prune to + * bring stats under the new limit; the primary fans the resulting + * truncation out via `ReplicateTruncate` so secondaries mirror. + * Partial-update semantics: only fields explicitly set in the + * request are applied; unset fields leave the on-disk value + * unchanged. + */ + updateStream( + request: UpdateStreamRequest, + callback: (error: ServiceError | null, response: UpdateStreamResponse) => void, + ): ClientUnaryCall; + updateStream( + request: UpdateStreamRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: UpdateStreamResponse) => void, + ): ClientUnaryCall; + updateStream( + request: UpdateStreamRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: UpdateStreamResponse) => void, + ): ClientUnaryCall; + /** --- Messages --- */ + publish( + request: PublishRequest, + callback: (error: ServiceError | null, response: PublishResponse) => void, + ): ClientUnaryCall; + publish( + request: PublishRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: PublishResponse) => void, + ): ClientUnaryCall; + publish( + request: PublishRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: PublishResponse) => void, + ): ClientUnaryCall; + fetch( + request: FetchRequest, + callback: (error: ServiceError | null, response: FetchResponse) => void, + ): ClientUnaryCall; + fetch( + request: FetchRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: FetchResponse) => void, + ): ClientUnaryCall; + fetch( + request: FetchRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: FetchResponse) => void, + ): ClientUnaryCall; + ack(request: AckRequest, callback: (error: ServiceError | null, response: AckResponse) => void): ClientUnaryCall; + ack( + request: AckRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: AckResponse) => void, + ): ClientUnaryCall; + ack( + request: AckRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: AckResponse) => void, + ): ClientUnaryCall; + /** + * Negative-acknowledge: server resets the pending entry's + * delivered_at_ms so the next fetch redelivers. `delay_ms` defers + * eligibility by that wall-clock window (0 = immediate). The + * message's `deliver_count` keeps climbing toward `max_deliver`. + */ + nak(request: NakRequest, callback: (error: ServiceError | null, response: NakResponse) => void): ClientUnaryCall; + nak( + request: NakRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: NakResponse) => void, + ): ClientUnaryCall; + nak( + request: NakRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: NakResponse) => void, + ): ClientUnaryCall; + /** + * Terminal-acknowledge: drop the pending entry permanently + * without redelivery, regardless of `max_deliver`. Does NOT + * trigger WorkQueue delete — other consumers can still observe + * the message. + */ + term(request: TermRequest, callback: (error: ServiceError | null, response: TermResponse) => void): ClientUnaryCall; + term( + request: TermRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: TermResponse) => void, + ): ClientUnaryCall; + term( + request: TermRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: TermResponse) => void, + ): ClientUnaryCall; + /** + * Heartbeat-acknowledge: bump delivered_at_ms = now to extend + * the ack_wait window. `deliver_count` is unchanged. + */ + inProgress( + request: InProgressRequest, + callback: (error: ServiceError | null, response: InProgressResponse) => void, + ): ClientUnaryCall; + inProgress( + request: InProgressRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: InProgressResponse) => void, + ): ClientUnaryCall; + inProgress( + request: InProgressRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: InProgressResponse) => void, + ): ClientUnaryCall; + /** + * Push-mode delivery: the server fetches in a loop and streams + * each delivered message back to the client as it arrives. The + * client acks via the unary Ack RPC just like pull-mode. The + * stream stays open until the client disconnects, the server + * returns an error, or the consumer is deleted. Wakes + * immediately on new appends via the storage layer's subscribe + * primitive — no polling for empty streams. + */ + subscribe(request: SubscribeRequest, options?: Partial): ClientReadableStream; + subscribe( + request: SubscribeRequest, + metadata?: Metadata, + options?: Partial, + ): ClientReadableStream; + /** --- Consumers --- */ + createConsumer( + request: CreateConsumerRequest, + callback: (error: ServiceError | null, response: CreateConsumerResponse) => void, + ): ClientUnaryCall; + createConsumer( + request: CreateConsumerRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: CreateConsumerResponse) => void, + ): ClientUnaryCall; + createConsumer( + request: CreateConsumerRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: CreateConsumerResponse) => void, + ): ClientUnaryCall; + deleteConsumer( + request: DeleteConsumerRequest, + callback: (error: ServiceError | null, response: DeleteConsumerResponse) => void, + ): ClientUnaryCall; + deleteConsumer( + request: DeleteConsumerRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteConsumerResponse) => void, + ): ClientUnaryCall; + deleteConsumer( + request: DeleteConsumerRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteConsumerResponse) => void, + ): ClientUnaryCall; + listConsumers( + request: ListConsumersRequest, + callback: (error: ServiceError | null, response: ListConsumersResponse) => void, + ): ClientUnaryCall; + listConsumers( + request: ListConsumersRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListConsumersResponse) => void, + ): ClientUnaryCall; + listConsumers( + request: ListConsumersRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListConsumersResponse) => void, + ): ClientUnaryCall; + getConsumerInfo( + request: GetConsumerInfoRequest, + callback: (error: ServiceError | null, response: GetConsumerInfoResponse) => void, + ): ClientUnaryCall; + getConsumerInfo( + request: GetConsumerInfoRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetConsumerInfoResponse) => void, + ): ClientUnaryCall; + getConsumerInfo( + request: GetConsumerInfoRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetConsumerInfoResponse) => void, + ): ClientUnaryCall; + /** + * --- Rebalancing (Phase 1: operator-driven only) --- + * + * The current owner of a stream serves its raw redb bytes to a peer + * that's pulling the stream over. The handler atomically removes the + * stream from its local registry first, refusing the call if any + * outside reference is still live (operator must drain writers). On + * RPC success the source deletes the local file. See + * STREAMS_SPEC.md §11 for the model and limitations (no automatic + * ring-change sweep yet; the operator is responsible for triggering + * a migrate when membership moves a stream's authority). + */ + transferStream( + request: TransferStreamRequest, + options?: Partial, + ): ClientReadableStream; + transferStream( + request: TransferStreamRequest, + metadata?: Metadata, + options?: Partial, + ): ClientReadableStream; + /** + * Admin trigger on the receiving side: pull stream `name` from + * `source_node_id`'s `TransferStream` and own it locally. + */ + migrateStream( + request: MigrateStreamRequest, + callback: (error: ServiceError | null, response: MigrateStreamResponse) => void, + ): ClientUnaryCall; + migrateStream( + request: MigrateStreamRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: MigrateStreamResponse) => void, + ): ClientUnaryCall; + migrateStream( + request: MigrateStreamRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: MigrateStreamResponse) => void, + ): ClientUnaryCall; + /** + * Cluster-wide stream inventory + skew report. The receiving node + * queries every cluster member's local `StreamsRegistry` (via the + * existing proxy channel pool) and aggregates the result. Used by + * operators to identify hash-skew imbalance before triggering + * `RebalanceStreams`. Also exposed via the `wmkr-status` CLI. + */ + getClusterStreamStats( + request: GetClusterStreamStatsRequest, + callback: (error: ServiceError | null, response: GetClusterStreamStatsResponse) => void, + ): ClientUnaryCall; + getClusterStreamStats( + request: GetClusterStreamStatsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetClusterStreamStatsResponse) => void, + ): ClientUnaryCall; + getClusterStreamStats( + request: GetClusterStreamStatsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetClusterStreamStatsResponse) => void, + ): ClientUnaryCall; + /** + * Server-streamed admin watch — emits a WatchEvent each time the + * local node's state mutates (stream / consumer create / delete / + * update). Useful for live dashboards or service-discovery + * clients that want to react to topology changes without + * polling. Local-only for now: each watcher sees events generated + * on the node it connected to. Cluster-wide watch can be built + * on top via a fan-out client; the server doesn't fan out + * automatically because the events would arrive out of any + * single-source ordering anyway under proxy hops. + */ + watchStreams(request: WatchStreamsRequest, options?: Partial): ClientReadableStream; + watchStreams( + request: WatchStreamsRequest, + metadata?: Metadata, + options?: Partial, + ): ClientReadableStream; + /** + * Read the latest message at a given subject within a stream. + * The foundation for KV-style "last-value wins" lookups on top + * of a stream — KV put = Publish to `.`; KV get = + * this RPC against the same subject. Returns the full + * MessagePb (including headers) so callers can detect KV + * tombstones (`wmkv.tombstone` header). + * + * Returns `success: true` with `message` unset when no message + * has ever been published at this subject (or all have been + * pruned). Routes via `try_route!` like every other per-stream + * RPC. + */ + readLatestAtSubject( + request: ReadLatestAtSubjectRequest, + callback: (error: ServiceError | null, response: ReadLatestAtSubjectResponse) => void, + ): ClientUnaryCall; + readLatestAtSubject( + request: ReadLatestAtSubjectRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReadLatestAtSubjectResponse) => void, + ): ClientUnaryCall; + readLatestAtSubject( + request: ReadLatestAtSubjectRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReadLatestAtSubjectResponse) => void, + ): ClientUnaryCall; + /** + * List every distinct subject in `stream` whose name starts + * with `prefix`. Cost is O(matching subjects); independent of + * message count. The foundation for `streams-cli kv-keys` and + * service-discovery-style "everything under this namespace" + * lookups. Returns subjects whose latest message is a + * tombstone too — clients that want live-keys-only filter + * tombstones via a follow-up `ReadLatestAtSubject`. + */ + listSubjectsByPrefix( + request: ListSubjectsByPrefixRequest, + callback: (error: ServiceError | null, response: ListSubjectsByPrefixResponse) => void, + ): ClientUnaryCall; + listSubjectsByPrefix( + request: ListSubjectsByPrefixRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListSubjectsByPrefixResponse) => void, + ): ClientUnaryCall; + listSubjectsByPrefix( + request: ListSubjectsByPrefixRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListSubjectsByPrefixResponse) => void, + ): ClientUnaryCall; + /** + * Scan all messages published at an exact subject within + * `stream`, in seq order, starting at `from_seq` (0 = from the + * beginning), bounded by `limit`. The foundation for + * `streams-cli kv-history` — operators want to inspect every + * value ever published under a KV key (including tombstones) + * for debugging/audit. Cost is O(matching messages); independent + * of total stream size. Routes via `try_route!` like every + * other per-stream RPC. + */ + scanExactAtSubject( + request: ScanExactAtSubjectRequest, + callback: (error: ServiceError | null, response: ScanExactAtSubjectResponse) => void, + ): ClientUnaryCall; + scanExactAtSubject( + request: ScanExactAtSubjectRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ScanExactAtSubjectResponse) => void, + ): ClientUnaryCall; + scanExactAtSubject( + request: ScanExactAtSubjectRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ScanExactAtSubjectResponse) => void, + ): ClientUnaryCall; + /** + * Remove a Phase 3 per-stream authority override. Routing + * reverts to the ring's hash owner. Idempotent: clearing a + * stream with no override succeeds silently. Operators use this + * to retire a stale override (e.g. after a ring shift made the + * override redundant). Commits via a Raft entry so the clear + * applies on every node before the response returns. + */ + clearStreamAuthority( + request: ClearStreamAuthorityRequest, + callback: (error: ServiceError | null, response: ClearStreamAuthorityResponse) => void, + ): ClientUnaryCall; + clearStreamAuthority( + request: ClearStreamAuthorityRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ClearStreamAuthorityResponse) => void, + ): ClientUnaryCall; + clearStreamAuthority( + request: ClearStreamAuthorityRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ClearStreamAuthorityResponse) => void, + ): ClientUnaryCall; + /** + * List every Phase 3 stream_authority override active on the + * responding node. The map is Raft-replicated, so any node's + * response reflects the cluster-wide view (modulo apply lag). + * Useful for ops triage when an unexpected number of overrides + * shows up on /metrics. No fan-out — single-node RPC; the + * returned set is the canonical truth. + */ + listStreamAuthorityOverrides( + request: ListStreamAuthorityOverridesRequest, + callback: (error: ServiceError | null, response: ListStreamAuthorityOverridesResponse) => void, + ): ClientUnaryCall; + listStreamAuthorityOverrides( + request: ListStreamAuthorityOverridesRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListStreamAuthorityOverridesResponse) => void, + ): ClientUnaryCall; + listStreamAuthorityOverrides( + request: ListStreamAuthorityOverridesRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListStreamAuthorityOverridesResponse) => void, + ): ClientUnaryCall; + /** + * Toggle pinned state for `stream`. Pinned streams are exempt + * from the auto-GC sweep that retires redundant overrides — use + * when you want a stream to stay on its current authority node + * even if the ring shifts to make the override redundant. + * Idempotent. Independent of the override itself (pinning a + * stream with no override is benign; the marker sits dormant). + */ + setStreamPinned( + request: SetStreamPinnedRequest, + callback: (error: ServiceError | null, response: SetStreamPinnedResponse) => void, + ): ClientUnaryCall; + setStreamPinned( + request: SetStreamPinnedRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: SetStreamPinnedResponse) => void, + ): ClientUnaryCall; + setStreamPinned( + request: SetStreamPinnedRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: SetStreamPinnedResponse) => void, + ): ClientUnaryCall; + putObject( + request: PutObjectRequest, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientUnaryCall; + putObject( + request: PutObjectRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientUnaryCall; + putObject( + request: PutObjectRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientUnaryCall; + getObject( + request: GetObjectRequest, + callback: (error: ServiceError | null, response: GetObjectResponse) => void, + ): ClientUnaryCall; + getObject( + request: GetObjectRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetObjectResponse) => void, + ): ClientUnaryCall; + getObject( + request: GetObjectRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetObjectResponse) => void, + ): ClientUnaryCall; + deleteObject( + request: DeleteObjectRequest, + callback: (error: ServiceError | null, response: DeleteObjectResponse) => void, + ): ClientUnaryCall; + deleteObject( + request: DeleteObjectRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: DeleteObjectResponse) => void, + ): ClientUnaryCall; + deleteObject( + request: DeleteObjectRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: DeleteObjectResponse) => void, + ): ClientUnaryCall; + getObjectInfo( + request: GetObjectInfoRequest, + callback: (error: ServiceError | null, response: GetObjectInfoResponse) => void, + ): ClientUnaryCall; + getObjectInfo( + request: GetObjectInfoRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetObjectInfoResponse) => void, + ): ClientUnaryCall; + getObjectInfo( + request: GetObjectInfoRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetObjectInfoResponse) => void, + ): ClientUnaryCall; + listObjects( + request: ListObjectsRequest, + callback: (error: ServiceError | null, response: ListObjectsResponse) => void, + ): ClientUnaryCall; + listObjects( + request: ListObjectsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListObjectsResponse) => void, + ): ClientUnaryCall; + listObjects( + request: ListObjectsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListObjectsResponse) => void, + ): ClientUnaryCall; + /** + * Client-streamed PutObject for arbitrary-size objects. First + * frame MUST set `start { bucket, name, chunk_size, headers, + * sha256 }`. Subsequent frames carry `data` only — each frame's + * `data` is ONE chunk message at `objc..`. The server + * accumulates a running SHA-256 and total-byte count, publishes + * chunks as they arrive (replication fires async), and on the + * last frame (`finish=true`) publishes the metadata. A client + * disconnect before `finish=true` leaves orphan chunks; the GC + * sweep cleans them up. + */ + putObjectStream( + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientWritableStream; + putObjectStream( + metadata: Metadata, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientWritableStream; + putObjectStream( + options: Partial, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientWritableStream; + putObjectStream( + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: PutObjectResponse) => void, + ): ClientWritableStream; + /** + * Server-streamed GetObject. First frame carries `info`; + * subsequent frames carry `data` only — one per chunk. Last + * frame sets `done=true`. The client reassembles; the response + * is sent over the wire in chunk-sized pieces so memory usage + * stays bounded on both sides. + */ + getObjectStream( + request: GetObjectRequest, + options?: Partial, + ): ClientReadableStream; + getObjectStream( + request: GetObjectRequest, + metadata?: Metadata, + options?: Partial, + ): ClientReadableStream; + /** + * Every revision of `name`'s metadata in seq order — covers + * overwrites + tombstones. Returns one entry per metadata + * message at `objm.`. Chunks are not enumerated; this RPC + * is for object versioning / audit, not for binary diffing. + */ + listObjectRevisions( + request: ListObjectRevisionsRequest, + callback: (error: ServiceError | null, response: ListObjectRevisionsResponse) => void, + ): ClientUnaryCall; + listObjectRevisions( + request: ListObjectRevisionsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ListObjectRevisionsResponse) => void, + ): ClientUnaryCall; + listObjectRevisions( + request: ListObjectRevisionsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ListObjectRevisionsResponse) => void, + ): ClientUnaryCall; + /** + * Read a byte range `[offset, offset + len)` from an object's + * assembled payload. Only the chunks that intersect the range + * are loaded server-side — useful for resumable downloads of + * large objects. + * - `offset + len > total_bytes` → returns whatever bytes exist + * in the range (success, possibly empty). + * - `offset > total_bytes` → returns empty payload (success). + * - `len == 0` → returns empty payload (success). + */ + getObjectRange( + request: GetObjectRangeRequest, + callback: (error: ServiceError | null, response: GetObjectRangeResponse) => void, + ): ClientUnaryCall; + getObjectRange( + request: GetObjectRangeRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: GetObjectRangeResponse) => void, + ): ClientUnaryCall; + getObjectRange( + request: GetObjectRangeRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: GetObjectRangeResponse) => void, + ): ClientUnaryCall; + /** + * Operator-driven rebalance. Takes an explicit plan — a list of + * (stream, target_node) — and executes each step by issuing a + * `MigrateStream` to the target. The plan is *not* auto-generated; + * the operator (or a future automatic planner) is responsible for + * building it from a `GetClusterStreamStats` snapshot. Steps run + * sequentially with a per-step timeout; the response carries + * per-step outcomes so partial success is visible. + */ + rebalanceStreams( + request: RebalanceStreamsRequest, + callback: (error: ServiceError | null, response: RebalanceStreamsResponse) => void, + ): ClientUnaryCall; + rebalanceStreams( + request: RebalanceStreamsRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: RebalanceStreamsResponse) => void, + ): ClientUnaryCall; + rebalanceStreams( + request: RebalanceStreamsRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: RebalanceStreamsResponse) => void, + ): ClientUnaryCall; + /** + * --- Consumer-state replication (Phase 2 §G) --- + * + * The primary for a stream pushes its consumers' full state to the + * stream's `replication_factor - 1` secondaries after every + * state-mutating consumer operation (create_consumer, fetch, ack, + * delete_consumer). The push is fire-and-forget on the primary's + * side — the client RPC has already returned to the caller; the + * replication runs in a background task. Secondaries hold the + * snapshot in memory; adoption-on-failover is a future slice. + */ + replicateConsumerState( + request: ReplicateConsumerStateRequest, + callback: (error: ServiceError | null, response: ReplicateConsumerStateResponse) => void, + ): ClientUnaryCall; + replicateConsumerState( + request: ReplicateConsumerStateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateConsumerStateResponse) => void, + ): ClientUnaryCall; + replicateConsumerState( + request: ReplicateConsumerStateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateConsumerStateResponse) => void, + ): ClientUnaryCall; + /** + * --- Cross-stream sources state replication (slice 2E) --- + * + * The primary for a sourcing stream pushes the current per-source + * tail watermark to each secondary after every successful batch + * (i.e. once per ~128 source messages). Secondaries persist the + * snapshot via their own SourceTailStore so that on adoption (ring + * shift → secondary becomes primary), `spawn_source_tail_tasks` + * reads the replicated state and resumes from `last_sourced_seq + 1` + * instead of re-pulling from `start_seq` (which would emit + * duplicates with already-replicated provenance headers). + */ + replicateSourceTailState( + request: ReplicateSourceTailStateRequest, + callback: (error: ServiceError | null, response: ReplicateSourceTailStateResponse) => void, + ): ClientUnaryCall; + replicateSourceTailState( + request: ReplicateSourceTailStateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateSourceTailStateResponse) => void, + ): ClientUnaryCall; + replicateSourceTailState( + request: ReplicateSourceTailStateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateSourceTailStateResponse) => void, + ): ClientUnaryCall; + /** + * --- Stream-data replication (Phase 3, chunk 1) --- + * + * The primary for a stream pushes: + * 1. ReplicateStreamCreate once at create time, so secondaries + * know what stream to open in their replica registry with + * what config (block_size, retention, max_msg_bytes, etc.). + * 2. ReplicateMessage on every successful Publish, with the + * seq the primary assigned, so the secondary's replica + * mirrors the message log by seq exactly. + * + * Replica streams live in a per-node "replica registry" rooted at + * `/replicas/.redb`, distinct from the + * primary-owned namespace. The streams handler never serves + * client requests from the replica — it's purely catastrophe + * recovery state until the (future) adoption-on-failover slice + * promotes a replica to primary. + */ + replicateStreamCreate( + request: ReplicateStreamCreateRequest, + callback: (error: ServiceError | null, response: ReplicateStreamCreateResponse) => void, + ): ClientUnaryCall; + replicateStreamCreate( + request: ReplicateStreamCreateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateStreamCreateResponse) => void, + ): ClientUnaryCall; + replicateStreamCreate( + request: ReplicateStreamCreateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateStreamCreateResponse) => void, + ): ClientUnaryCall; + replicateMessage( + request: ReplicateMessageRequest, + callback: (error: ServiceError | null, response: ReplicateMessageResponse) => void, + ): ClientUnaryCall; + replicateMessage( + request: ReplicateMessageRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateMessageResponse) => void, + ): ClientUnaryCall; + replicateMessage( + request: ReplicateMessageRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateMessageResponse) => void, + ): ClientUnaryCall; + /** + * Tear down the replica when the primary deletes the stream. + * Idempotent — missing replica is success. + */ + replicateStreamDelete( + request: ReplicateStreamDeleteRequest, + callback: (error: ServiceError | null, response: ReplicateStreamDeleteResponse) => void, + ): ClientUnaryCall; + replicateStreamDelete( + request: ReplicateStreamDeleteRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateStreamDeleteResponse) => void, + ): ClientUnaryCall; + replicateStreamDelete( + request: ReplicateStreamDeleteRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateStreamDeleteResponse) => void, + ): ClientUnaryCall; + /** + * The primary's retention sweep removed messages below + * `first_seq`; the secondary mirrors the same truncation so its + * replica's first_seq advances in lockstep. Idempotent. + */ + replicateTruncate( + request: ReplicateTruncateRequest, + callback: (error: ServiceError | null, response: ReplicateTruncateResponse) => void, + ): ClientUnaryCall; + replicateTruncate( + request: ReplicateTruncateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateTruncateResponse) => void, + ): ClientUnaryCall; + replicateTruncate( + request: ReplicateTruncateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateTruncateResponse) => void, + ): ClientUnaryCall; + /** + * The primary applied an UpdateStream; secondaries mirror the + * mutable subset of the config so a future failover lands on a + * replica whose retention matches the primary's. Carries the same + * narrow shape as UpdateStreamRequest — only the mutable fields, + * with partial-update semantics. + */ + replicateStreamUpdate( + request: ReplicateStreamUpdateRequest, + callback: (error: ServiceError | null, response: ReplicateStreamUpdateResponse) => void, + ): ClientUnaryCall; + replicateStreamUpdate( + request: ReplicateStreamUpdateRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateStreamUpdateResponse) => void, + ): ClientUnaryCall; + replicateStreamUpdate( + request: ReplicateStreamUpdateRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateStreamUpdateResponse) => void, + ): ClientUnaryCall; + /** + * Under `RetentionPolicy::WorkQueue` the primary deletes a message + * on ack (delete-on-first-ack). Without this fan-out, secondaries' + * replica files would still hold the acked message — and after a + * failover, a fresh consumer on the new primary would see it and + * re-deliver, breaking the "each message belongs to exactly one + * consumer at a time" invariant. Idempotent: missing seq on + * secondary is success. + */ + replicateWorkQueueAck( + request: ReplicateWorkQueueAckRequest, + callback: (error: ServiceError | null, response: ReplicateWorkQueueAckResponse) => void, + ): ClientUnaryCall; + replicateWorkQueueAck( + request: ReplicateWorkQueueAckRequest, + metadata: Metadata, + callback: (error: ServiceError | null, response: ReplicateWorkQueueAckResponse) => void, + ): ClientUnaryCall; + replicateWorkQueueAck( + request: ReplicateWorkQueueAckRequest, + metadata: Metadata, + options: Partial, + callback: (error: ServiceError | null, response: ReplicateWorkQueueAckResponse) => void, + ): ClientUnaryCall; +} + +export const WaymakerStreamsServiceClient = makeGenericClientConstructor( + WaymakerStreamsServiceService, + "waymaker.streams.WaymakerStreamsService", +) as unknown as { + new ( + address: string, + credentials: ChannelCredentials, + options?: Partial, + ): WaymakerStreamsServiceClient; + service: typeof WaymakerStreamsServiceService; + serviceName: string; +}; + +function bytesFromBase64(b64: string): Uint8Array { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); +} + +function base64FromBytes(arr: Uint8Array): string { + return globalThis.Buffer.from(arr).toString("base64"); +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin ? T + : T extends globalThis.Array ? globalThis.Array> + : T extends ReadonlyArray ? ReadonlyArray> + : T extends {} ? { [K in keyof T]?: DeepPartial } + : Partial; + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export interface MessageFns { + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create(base?: DeepPartial): T; + fromPartial(object: DeepPartial): T; +} diff --git a/ts/src/index.ts b/ts/src/index.ts new file mode 100644 index 0000000..7ab5962 --- /dev/null +++ b/ts/src/index.ts @@ -0,0 +1,83 @@ +/** + * @waymaker/client — Official TypeScript client for waymaker. + * + * Import the client and subsystem modules you need: + * + * ```ts + * import { WaymakerClient, Scope } from "@waymaker/client"; + * + * const client = WaymakerClient.connect("localhost:8818"); + * const lock = await client.acquireLock("leader:myjob", { + * maxWaitMs: 0, + * leaseTtlMs: 60_000, + * scope: Scope.Local, + * }); + * const renewal = lock.spawnRenewal(30_000); + * // ... do work + * await renewal.stop(); + * await lock.unlock(); + * ``` + */ + +// Core +export { WaymakerClient } from "./client"; +export type { ConnectOptions, WaymakerError } from "./client"; +export { isServerError, isWaymakerError, serverError, rpcError, invalidError } from "./client"; + +// Locks — import the module to register the extension methods +import "./lock"; +export { Lock, RenewalHandle, Scope } from "./lock"; +export type { LockConfig, Lease, LockState, AcquiredLock } from "./lock"; + +// Streams — import the module to register the extension methods +import "./stream"; +export { Stream, Consumer, Message } from "./stream"; +export type { + StreamConfig, + StreamUpdate, + ConsumerConfig, + PublishAck, + SourceStatus, + StreamSource, + SubjectTransform, + RetentionPolicy, + DeliverPolicy, + OnDropPolicy, +} from "./stream"; + +// KV — import the module to register the extension methods +import "./kv"; +export { KvBucket } from "./kv"; +export type { KvConfig, HistoryEntry, KvEvent } from "./kv"; + +// Collections — import the module to register the extension methods +import "./collections"; +export { HashStore, Hash, SetStore, SetHandle, Queue } from "./collections"; +export type { HashStoreConfig, SetStoreConfig, QueueConfig } from "./collections"; + +// Sketches — import the module to register the extension methods +import "./sketches"; +export { Bloom, Hll, Cms, TopK, TDigest } from "./sketches"; +export type { + BloomConfig, + BloomInfo, + HllConfig, + CmsConfig, + TopKConfig, + TopKListEntry, + TDigestConfig, +} from "./sketches"; + +// Object store — import the module to register the extension methods +import "./object"; +export { ObjectStore } from "./object"; +export type { + ObjectStoreConfig, + ObjectInfo, + ObjectEntry, + ObjectRevision, + PutOptions, +} from "./object"; + +// Cache — import the module to register the extension methods +import "./cache"; diff --git a/ts/src/kv.ts b/ts/src/kv.ts new file mode 100644 index 0000000..3794b52 --- /dev/null +++ b/ts/src/kv.ts @@ -0,0 +1,351 @@ +/** + * KV subsystem — Put/Get/Create/Update(CAS)/Delete/Keys/History/Touch/Watch. + * + * Entry points on `WaymakerClient`: + * - `client.createKv(config)` → `KvBucket` + * - `client.getOrCreateKv(config)` — idempotent + * - `client.kv(name)` — handle without creation check + * - `client.deleteKv(name)` + * + * Wire conventions (subject format, tombstone/TTL headers) live + * entirely server-side. The client just calls the typed RPCs. + */ + +import * as grpc from "@grpc/grpc-js"; +import { WaymakerClient, callUnary, streamToAsyncIter } from "./client"; +import { serverError } from "./error"; +import type { KvWatchEvent } from "./genpb/kv"; + +// ------------------------------------------------------------------ +// Config +// ------------------------------------------------------------------ + +export interface KvConfig { + name: string; + /** Cap on total bucket bytes. `undefined` = unbounded. */ + maxBytes?: number; + /** Cap on per-value bytes. `undefined` = no cap. */ + maxValueSize?: number; + /** Bucket-level TTL (ms). `undefined` = unbounded. */ + maxAgeMs?: number; + /** Memory-only bucket. */ + ephemeral?: boolean; + /** + * Per-key revision cap. 0 = unbounded. When N > 0, after each + * write the older revisions of that key beyond N most recent are + * dropped. + */ + maxRevisions?: number; +} + +// ------------------------------------------------------------------ +// History + Watch types +// ------------------------------------------------------------------ + +export interface HistoryEntry { + value: Uint8Array; + revision: number; + tsMs: number; + tombstone: boolean; +} + +export type KvEvent = + | { kind: "put"; key: string; value: Uint8Array; revision: number } + | { kind: "delete"; key: string; revision: number }; + +// ------------------------------------------------------------------ +// KvBucket +// ------------------------------------------------------------------ + +export class KvBucket { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** + * Put `value` under `key`. Latest-write-wins. Returns the new revision. + */ + async put(key: string, value: Uint8Array | Buffer | string): Promise { + return this._put(key, value, 0); + } + + /** Put with per-key TTL (ms). */ + async putWithTtl(key: string, value: Uint8Array | Buffer | string, ttlMs: number): Promise { + return this._put(key, value, ttlMs); + } + + private async _put(key: string, value: Uint8Array | Buffer | string, ttlMs: number): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.put(req, cb), { + bucket: this.name, + key, + value: toBuffer(value), + ttlMs, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.revision; + } finally { + c.close(); + } + } + + /** + * Atomic create — fails with `{ kind: "server", code: "wrong_revision" }` + * if the key already exists. + */ + async create(key: string, value: Uint8Array | Buffer | string): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.create(req, cb), { + bucket: this.name, + key, + value: toBuffer(value), + ttlMs: 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.revision; + } finally { + c.close(); + } + } + + /** + * CAS update — succeeds only if current revision matches + * `expectedRevision`. + */ + async update(key: string, value: Uint8Array | Buffer | string, expectedRevision: number): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.update(req, cb), { + bucket: this.name, + key, + value: toBuffer(value), + expectedRevision, + ttlMs: 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.revision; + } finally { + c.close(); + } + } + + /** Get the latest value. `null` when absent or tombstoned. */ + async get(key: string): Promise { + const entry = await this.getWithRevision(key); + return entry ? entry.value : null; + } + + /** Get value + revision. `null` when absent or tombstoned. */ + async getWithRevision(key: string): Promise<{ value: Uint8Array; revision: number } | null> { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.get(req, cb), { + bucket: this.name, + key, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + if (!res.entry) return null; + return { value: res.entry.value, revision: res.entry.revision }; + } finally { + c.close(); + } + } + + /** Tombstone `key`. */ + async delete(key: string): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.delete(req, cb), { + bucket: this.name, + key, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Extend TTL on `key` without changing its value. */ + async touch(key: string, ttlMs: number): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.touch(req, cb), { + bucket: this.name, + key, + ttlMs, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.revision; + } finally { + c.close(); + } + } + + /** List every live key in the bucket (excludes tombstoned). */ + async keys(): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.keys(req, cb), { + bucket: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.entries.filter((e: any) => !e.deleted).map((e: any) => e.key as string); + } finally { + c.close(); + } + } + + /** Historical values at `key` in publish order. */ + async history(key: string): Promise { + const c = this._client._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.history(req, cb), { + bucket: this.name, + key, + fromRevision: 0, + limit: 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.entries.map((e: any) => ({ + value: e.value as Uint8Array, + revision: e.revision as number, + tsMs: e.tsMs as number, + tombstone: e.deleted as boolean, + })); + } finally { + c.close(); + } + } + + /** + * Watch live changes at `key`. Returns an async iterable of events. + * Ends when the server closes the stream (or on error). + */ + async watch(key: string): Promise> { + return this._watchInner(key); + } + + /** Watch every key in the bucket. */ + async watchAll(): Promise> { + return this._watchInner(""); + } + + private async _watchInner(key: string): Promise> { + const c = this._client._kvClient(); + const rpcStream = c.watch({ bucket: this.name, key }); + + async function* gen(): AsyncGenerator { + try { + for await (const raw of streamToAsyncIter(rpcStream)) { + const ev = raw as KvWatchEvent; + if (ev.put !== undefined) { + yield { kind: "put", key: ev.put.key, value: ev.put.value, revision: ev.put.revision }; + } else if (ev.delete !== undefined) { + yield { kind: "delete", key: ev.delete.key, revision: ev.delete.revision }; + } + } + } finally { + c.close(); + } + } + + return gen(); + } +} + +// ------------------------------------------------------------------ +// Client extension methods +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + createKv(config: KvConfig): Promise; + getOrCreateKv(config: KvConfig): Promise; + /** Return a bucket handle without verifying it exists. */ + kv(name: string): KvBucket; + deleteKv(name: string): Promise; + } +} + +WaymakerClient.prototype.createKv = async function ( + this: WaymakerClient, + config: KvConfig +): Promise { + const c = this._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.createBucket(req, cb), { + bucket: config.name, + maxBytes: config.maxBytes ?? 0, + maxValueSize: config.maxValueSize ?? 0, + maxAgeMs: config.maxAgeMs ?? 0, + ephemeral: config.ephemeral ?? false, + maxRevisions: config.maxRevisions ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new KvBucket(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateKv = async function ( + this: WaymakerClient, + config: KvConfig +): Promise { + try { + return await (this as WaymakerClient).createKv(config); + } catch (e) { + if (isServerErrorCode(e, "already_exists")) { + return new KvBucket(this, config.name); + } + throw e; + } +}; + +WaymakerClient.prototype.kv = function ( + this: WaymakerClient, + name: string +): KvBucket { + return new KvBucket(this, name); +}; + +WaymakerClient.prototype.deleteKv = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._kvClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteBucket(req, cb), { bucket: name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// ------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------ + +function toBuffer(v: Uint8Array | Buffer | string): Buffer { + if (typeof v === "string") return Buffer.from(v); + if (Buffer.isBuffer(v)) return v; + return Buffer.from(v); +} + +function isServerErrorCode(err: unknown, code: string): boolean { + return ( + typeof err === "object" && + err !== null && + "kind" in err && + (err as { kind: string }).kind === "server" && + "code" in err && + (err as { code: string }).code === code + ); +} diff --git a/ts/src/lock.ts b/ts/src/lock.ts new file mode 100644 index 0000000..f6e9d47 --- /dev/null +++ b/ts/src/lock.ts @@ -0,0 +1,908 @@ +/** + * Locks subsystem — wraps the rwlock RPCs. + * + * Entry points on `WaymakerClient`: + * - `client.acquireLock(key, config)` — exclusive (write) lock + * - `client.acquireReadLock(key, config)` — shared (read) lock + * - `client.leaseStatus(key, id)` — query a lease + * - `client.multiLock(keys, config)` — atomic multi-key acquire + * - `client.listAcquiredLocks(keyPrefix?)` — list held locks (operator) + * + * The returned `Lock` keeps a background loop that holds the server + * event stream open. On stream end/error it transparently re-binds + * (reusing the original `requestId` so a still-held lease is + * recovered, not re-contended). The lock's live state (fenceToken, + * leaseExpiresAtMs, lost) is readable at any time via the accessor + * methods and notified via an EventEmitter `on("change", cb)`. + * + * ## Leader-election pattern + * + * ```ts + * const lock = await client.acquireLock("leader:myjob", { + * maxWaitMs: 0, // try-acquire (fail fast if held) + * leaseTtlMs: 60_000, + * scope: Scope.Local, + * }); + * const renewal = lock.spawnRenewal(30_000); + * try { + * await doWork(); // work can outlive a single lease window + * } finally { + * await renewal.stop(); + * await lock.unlock(); + * } + * ``` + */ + +import { EventEmitter } from "events"; +import * as crypto from "crypto"; +import * as grpc from "@grpc/grpc-js"; +import { WaymakerClient, callUnary, streamToAsyncIter } from "./client"; +import { + FenceScope, + LockEventType, + type LockRequest, + type LockEvent, + type AcquiredLock, +} from "./genpb/waymaker_locks"; +import { serverError, rpcError, type WaymakerError } from "./error"; + +// ------------------------------------------------------------------ +// Public types +// ------------------------------------------------------------------ + +/** + * Fence-scope tier — controls durability of the per-key fence-token + * counter. Mirrors the proto `FenceScope`. + */ +export enum Scope { + /** Per-process RAM. Resets on restart / rebalance. Fastest. */ + Ephemeral = FenceScope.ScopeEphemeral, + /** Disk-persisted on the owning node. Survives restart, not rebalance. */ + Local = FenceScope.ScopeLocal, + /** Raft-replicated — cluster-wide monotonic. One Raft commit per acquire. */ + Quorum = FenceScope.ScopeQuorum, +} + +/** Configuration for `acquireLock` / `acquireReadLock`. */ +export interface LockConfig { + /** + * Max time (ms) to wait for the lock. `0` = try-acquire (fail + * immediately if contended). `undefined` / very large = block up + * to `u32::MAX` ms (~49 days). + */ + maxWaitMs?: number; + /** Lease TTL (ms). Default 30 000 (30 s). */ + leaseTtlMs?: number; + /** Priority class — higher jumps the queue. Default 0. */ + priority?: number; + /** Fence-token durability. Default `Scope.Ephemeral`. */ + scope?: Scope; + /** Free-form requester metadata for operator audit. */ + requesterInfo?: string; + /** Application name shown in operator dashboards. */ + requesterApplication?: string; + /** + * Idempotency key for retries of the same logical acquire. + * Auto-filled with a random UUID if left empty. + */ + requestId?: string; +} + +/** Lease details returned by `leaseStatus` / `extend`. */ +export interface Lease { + id: string; + key: string; + acquiredAtMs: number; + leaseExpiresAtMs: number; + fenceToken: number; + priority: number; +} + +/** Live snapshot of a held lock's state, emitted on `"change"` events. */ +export interface LockState { + /** Current lease id. Stable across re-bind; changes if truly re-won. */ + id: string; + /** + * Current fence token. Re-read before every fenced side effect — a + * lost-then-re-won lock carries a higher token. + */ + fenceToken: number; + /** Lease expiry (epoch ms), updated from heartbeats / re-acquire. */ + leaseExpiresAtMs: number; + /** + * `true` once the client can no longer prove it holds the lock. + * A lost holder must stop acting as the holder. + */ + lost: boolean; +} + +// ------------------------------------------------------------------ +// Constants +// ------------------------------------------------------------------ + +const HOLD_BASE_BACKOFF_MS = 200; +const HOLD_MAX_BACKOFF_MS = 10_000; +const HOLD_RPC_TIMEOUT_MS = 10_000; + +// ------------------------------------------------------------------ +// Lock class +// ------------------------------------------------------------------ + +/** + * An acquired lock. The lease is kept alive server-side by TTL + + * renewal. This handle tracks live state and drives the background + * re-bind loop. + * + * Dropping the handle (without calling `unlock`) does NOT release + * the server-side lease — the TTL will eventually expire it, or a + * caller to `spawnRenewal` will keep it alive. Call `unlock()` + * explicitly when done. + */ +export class Lock extends EventEmitter { + readonly key: string; + + private _state: LockState; + private readonly _stopped: { value: boolean }; + private readonly _stopCallbacks: Array<() => void> = []; + private _holdLoopPromise: Promise; + + /** @internal — constructed by acquireLock/acquireReadLock */ + constructor( + private readonly _client: WaymakerClient, + key: string, + initState: LockState, + reacquireReq: LockRequest, + initStream: grpc.ClientReadableStream, + read: boolean + ) { + super(); + this.key = key; + this._state = initState; + this._stopped = { value: false }; + + this._holdLoopPromise = holdLoop( + _client, + key, + read, + reacquireReq, + initStream, + initState, + this._stopped, + this._stopCallbacks, + (next) => this._publish(next) + ); + } + + // ---- Live state accessors ---------------------------------------- + + /** Current lease id (live). */ + id(): string { + return this._state.id; + } + + /** + * Current fence token (live). Re-read before every fenced side + * effect — a lost-then-re-won lock carries a higher token. + */ + fenceToken(): number { + return this._state.fenceToken; + } + + /** Current lease expiry, epoch ms (live). */ + leaseExpiresAtMs(): number { + return this._state.leaseExpiresAtMs; + } + + /** `true` once the client has lost the lock and cannot re-win it. */ + isLost(): boolean { + return this._state.lost; + } + + /** Current state snapshot. */ + state(): Readonly { + return this._state; + } + + // ---- Operations -------------------------------------------------- + + /** + * Extend the lease by `additionalMs` milliseconds. + */ + async extend(additionalMs: number): Promise { + const c = this._client._locksClient(); + try { + const res = await callUnary( + c, + (req, cb) => c.extendLease(req, cb), + { + key: this.key, + id: this.id(), + leaseTimeout: clampMs(additionalMs), + } + ); + if (!res.success) throw serverError(res.resultCode, res.message); + const lease = res.lease; + if (!lease) throw serverError("internal", "missing lease in ExtendLease response"); + return { + id: lease.id, + key: lease.key, + acquiredAtMs: lease.createdAt, + leaseExpiresAtMs: lease.leaseExpiresAt, + fenceToken: lease.fenceToken, + priority: lease.priority, + }; + } finally { + c.close(); + } + } + + /** + * Release the lock. Stops the background hold loop FIRST (so it + * cannot re-acquire a lock we're about to release), then sends + * `UnLock`. After this returns, the handle is invalid. + */ + async unlock(): Promise { + this._stopHold(); + const id = this.id(); + const c = this._client._locksClient(); + try { + const res = await callUnary( + c, + (req, cb) => c.unLock(req, cb), + { key: this.key, id } + ); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** + * Spawn a background task that periodically extends the lease. + * Returns a `RenewalHandle` — call `.stop()` or drop it to halt. + * + * `everyMs` is the renewal interval; the TTL sent to the server is + * `everyMs * 2` so the lease always outlasts the next tick. + * + * The renewal reads the *live* lock id each tick, so it correctly + * tracks a re-won lock's new id after a primary failure. + */ + spawnRenewal(everyMs: number): RenewalHandle { + const ttlMs = Math.min(everyMs * 2, 0xffffffff); + const stopped = { value: false }; + const callbacks: Array<() => void> = []; + + const loop = async () => { + // Skip the first interval — caller just got a fresh lease. + await sleep(everyMs, stopped, callbacks); + while (!stopped.value) { + if (!this._state.lost) { + const id = this.id(); + const c = this._client._locksClient(); + try { + // Bound the RPC so a wedged server can't freeze the renewal. + await withTimeout( + callUnary(c, (req, cb) => c.extendLease(req, cb), { + key: this.key, + id, + leaseTimeout: clampMs(ttlMs), + }), + everyMs + ); + } catch { + // Ignore renewal errors — keep trying next tick. + } finally { + c.close(); + } + } + await sleep(everyMs, stopped, callbacks); + } + }; + + loop(); // fire and forget — errors are swallowed intentionally + + return new RenewalHandle(stopped, callbacks); + } + + // ------------------------------------------------------------------ + + private _publish(next: LockState): void { + const prev = this._state; + if ( + prev.id !== next.id || + prev.fenceToken !== next.fenceToken || + prev.leaseExpiresAtMs !== next.leaseExpiresAtMs || + prev.lost !== next.lost + ) { + this._state = next; + this.emit("change", next); + } + } + + private _stopHold(): void { + this._stopped.value = true; + for (const cb of this._stopCallbacks) cb(); + this._stopCallbacks.length = 0; + } + + /** + * Wait for the background hold loop to exit. Useful in tests or + * when you need to ensure the loop has fully stopped after + * `unlock()`. + */ + async waitForHoldLoop(): Promise { + await this._holdLoopPromise; + } +} + +// ------------------------------------------------------------------ +// RenewalHandle +// ------------------------------------------------------------------ + +/** + * Returned by `Lock.spawnRenewal`. Drop or call `stop()` to halt. + */ +export class RenewalHandle { + private _stopped: { value: boolean }; + private _callbacks: Array<() => void>; + + /** @internal */ + constructor(stopped: { value: boolean }, callbacks: Array<() => void>) { + this._stopped = stopped; + this._callbacks = callbacks; + } + + /** Halt renewal. Returns after any in-flight RPC times out. */ + stop(): void { + this._stopped.value = true; + for (const cb of this._callbacks) cb(); + this._callbacks.length = 0; + } +} + +// ------------------------------------------------------------------ +// Background hold loop (mirrors Rust hold_loop / drain_stream / +// reacquire / confirm_ownership) +// ------------------------------------------------------------------ + +type PublishFn = (state: LockState) => void; + +async function holdLoop( + client: WaymakerClient, + key: string, + read: boolean, + reacquireReq: LockRequest, + initStream: grpc.ClientReadableStream, + initState: LockState, + stopped: { value: boolean }, + stopCallbacks: Array<() => void>, + publish: PublishFn +): Promise { + let cur = { ...initState }; + let stream = initStream; + + // Register a stop callback so unlock() can cancel the current + // blocking wait inside drain_stream. + let drainCancel: (() => void) | null = null; + stopCallbacks.push(() => { + drainCancel?.(); + }); + + while (true) { + if (stopped.value) return; + + const drained = await drainStream( + stream, + cur, + stopped, + (cancel) => { drainCancel = cancel; }, + (next) => { + cur = { ...next }; + publish(cur); + } + ); + + if (drained === "stopped") return; + + // Stream ended or lease gone — attempt re-bind with backoff. + let backoff = HOLD_BASE_BACKOFF_MS; + + while (true) { + if (stopped.value) return; + + const rebound = await withRaceStop( + reacquire(client, read, reacquireReq), + stopped, + stopCallbacks + ); + if (rebound === null) return; // stopped + + if (rebound.kind === "bound") { + const next: LockState = { + id: rebound.id, + fenceToken: rebound.fenceToken, + leaseExpiresAtMs: rebound.leaseExpiresAtMs, + lost: false, + }; + cur = { ...next }; + publish(cur); + stream = rebound.stream; + break; // resume draining the fresh stream + } + + // NotBound — check if we still own the lease. + const ownership = await withRaceStop( + confirmOwnership(client, key, cur.id), + stopped, + stopCallbacks + ); + if (ownership === null) return; // stopped + + if (ownership.kind === "held") { + const next: LockState = { ...cur, leaseExpiresAtMs: ownership.leaseExpiresAtMs }; + cur = { ...next }; + publish(cur); + // Still ours; keep monitoring with backoff. + } else if (ownership.kind === "lost") { + const next: LockState = { ...cur, lost: true }; + cur = { ...next }; + publish(cur); + return; + } + // Unknown — transient; back off and retry. + + const slept = await withRaceStop(sleep(backoff, stopped, stopCallbacks), stopped, stopCallbacks); + if (slept === null) return; + backoff = Math.min(backoff * 2, HOLD_MAX_BACKOFF_MS); + } + } +} + +// ------------------------------------------------------------------ +// drain_stream: consume the event stream, updating state on +// Heartbeat/Acquired events, returning "stopped" or "disconnected". +// ------------------------------------------------------------------ + +type Drained = "stopped" | "disconnected"; + +function drainStream( + stream: grpc.ClientReadableStream, + cur: LockState, + stopped: { value: boolean }, + setCancelFn: (fn: () => void) => void, + onUpdate: (next: LockState) => void +): Promise { + return new Promise((resolve) => { + let done = false; + const finish = (result: Drained) => { + if (done) return; + done = true; + stream.removeAllListeners(); + resolve(result); + }; + + setCancelFn(() => finish("stopped")); + + if (stopped.value) { + stream.destroy(); + finish("stopped"); + return; + } + + stream.on("data", (ev: LockEvent) => { + if (stopped.value) { + stream.destroy(); + finish("stopped"); + return; + } + const et = ev.eventType; + if (et === LockEventType.Heartbeat) { + onUpdate({ ...cur, leaseExpiresAtMs: ev.leaseExpiresAt }); + cur = { ...cur, leaseExpiresAtMs: ev.leaseExpiresAt }; + } else if (et === LockEventType.Acquired) { + const next: LockState = { + id: ev.id, + fenceToken: ev.fenceToken, + leaseExpiresAtMs: ev.leaseExpiresAt, + lost: false, + }; + onUpdate(next); + cur = { ...next }; + } else if (et === LockEventType.Expired || et === LockEventType.Failed) { + finish("disconnected"); + } + // Waiting / Unknown — ignore. + }); + + stream.on("end", () => finish("disconnected")); + stream.on("error", () => finish("disconnected")); + }); +} + +// ------------------------------------------------------------------ +// reacquire: one idempotent re-acquire attempt (maxWait=0, same +// requestId). Returns "bound" with a fresh stream, or "not_bound". +// ------------------------------------------------------------------ + +type Rebound = + | { kind: "bound"; stream: grpc.ClientReadableStream; id: string; fenceToken: number; leaseExpiresAtMs: number } + | { kind: "not_bound" }; + +async function reacquire( + client: WaymakerClient, + read: boolean, + req: LockRequest +): Promise { + const attempt = (): Promise => + new Promise((resolve) => { + const c = client._locksClient(); + const stream: grpc.ClientReadableStream = read + ? c.readLock(req) + : c.lock(req); + + let resolved = false; + const finish = (r: Rebound) => { + if (resolved) return; + resolved = true; + if (r.kind !== "bound") { + stream.destroy(); + c.close(); + } + resolve(r); + }; + + stream.on("data", (ev: LockEvent) => { + const et = ev.eventType; + if (et === LockEventType.Acquired) { + // Detach listeners before handing stream to caller. + stream.removeAllListeners("end"); + stream.removeAllListeners("error"); + finish({ + kind: "bound", + stream, + id: ev.id, + fenceToken: ev.fenceToken, + leaseExpiresAtMs: ev.leaseExpiresAt, + }); + } else if (et === LockEventType.Failed || et === LockEventType.Expired) { + finish({ kind: "not_bound" }); + } + // Waiting / Heartbeat — keep reading. + }); + stream.on("end", () => finish({ kind: "not_bound" })); + stream.on("error", () => finish({ kind: "not_bound" })); + }); + + try { + return await withTimeout(attempt(), HOLD_RPC_TIMEOUT_MS); + } catch { + return { kind: "not_bound" }; + } +} + +// ------------------------------------------------------------------ +// confirmOwnership: query lease_status to see if we still hold the lock. +// ------------------------------------------------------------------ + +type Ownership = + | { kind: "held"; leaseExpiresAtMs: number } + | { kind: "lost" } + | { kind: "unknown" }; + +async function confirmOwnership( + client: WaymakerClient, + key: string, + id: string +): Promise { + const c = client._locksClient(); + try { + const res = await withTimeout( + callUnary(c, (req, cb) => c.leaseStatus(req, cb), { key, id }), + HOLD_RPC_TIMEOUT_MS + ); + if (res.success && res.lease) { + return { kind: "held", leaseExpiresAtMs: res.lease.leaseExpiresAt }; + } + return { kind: "lost" }; + } catch { + return { kind: "unknown" }; + } finally { + c.close(); + } +} + +// ------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------ + +/** Sleep for `ms`; resolve early if `stopped` becomes true. */ +function sleep( + ms: number, + stopped: { value: boolean }, + callbacks: Array<() => void> +): Promise { + return new Promise((resolve) => { + if (stopped.value) { resolve(); return; } + const t = setTimeout(() => { + const idx = callbacks.indexOf(cancelFn); + if (idx !== -1) callbacks.splice(idx, 1); + resolve(); + }, ms); + const cancelFn = () => { + clearTimeout(t); + resolve(); + }; + callbacks.push(cancelFn); + }); +} + +/** + * Race `promise` against `stopped`. Returns the promise's value, or + * `null` if `stopped` becomes true first. + */ +function withRaceStop( + promise: Promise, + stopped: { value: boolean }, + callbacks: Array<() => void> +): Promise { + if (stopped.value) return Promise.resolve(null); + let resolve: (v: T | null) => void; + const outer = new Promise((res) => { resolve = res; }); + const cancelFn = () => resolve(null); + callbacks.push(cancelFn); + + promise.then( + (v) => { + const idx = callbacks.indexOf(cancelFn); + if (idx !== -1) callbacks.splice(idx, 1); + resolve(v); + }, + () => { + const idx = callbacks.indexOf(cancelFn); + if (idx !== -1) callbacks.splice(idx, 1); + resolve(null); + } + ); + return outer; +} + +/** Reject if `promise` doesn't resolve within `ms`. */ +function withTimeout(promise: Promise, ms: number): Promise { + return new Promise((resolve, reject) => { + const t = setTimeout(() => reject(new Error("timeout")), ms); + promise.then( + (v) => { clearTimeout(t); resolve(v); }, + (e) => { clearTimeout(t); reject(e); } + ); + }); +} + +/** Clamp a duration in ms to uint32 range. */ +function clampMs(ms: number): number { + return Math.min(Math.max(0, Math.round(ms)), 0xffffffff); +} + +/** Generate a random UUID v4. */ +function randomUuid(): string { + return crypto.randomUUID(); +} + +/** Build a `LockRequest` proto from config + key. */ +function buildLockRequest(key: string, config: LockConfig): { req: LockRequest; requestId: string } { + const requestId = config.requestId && config.requestId.length > 0 + ? config.requestId + : randomUuid(); + const req: LockRequest = { + key, + maxWaitPeriod: clampMs(config.maxWaitMs ?? 3_600_000), + maxLeasePeriod: clampMs(config.leaseTtlMs ?? 30_000), + priority: config.priority ?? 0, + requesterInfo: config.requesterInfo ?? "", + requesterApplication: config.requesterApplication ?? "waymaker-ts-client", + requestId, + fenceScope: (config.scope as unknown as FenceScope) ?? FenceScope.ScopeEphemeral, + }; + return { req, requestId }; +} + +// ------------------------------------------------------------------ +// Client extension methods (acquire_lock, multi_lock, etc.) +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + /** + * Acquire an exclusive (write) lock. Blocks until granted or + * `maxWaitMs` elapses. A `maxWaitMs=0` fails immediately if the + * lock is contended. + */ + acquireLock(key: string, config?: LockConfig): Promise; + + /** + * Acquire a shared (read) lock. Multiple readers can hold + * concurrently; any write-lock waiter blocks new readers. + */ + acquireReadLock(key: string, config?: LockConfig): Promise; + + /** Query the current state of a lease by key + id. */ + leaseStatus(key: string, id: string): Promise; + + /** + * Acquire N locks atomically. Server sorts keys lexicographically + * to guarantee deadlock-free ordering. Returns the leases on + * success; on failure every partial lock is already released. + */ + multiLock( + keys: Array<{ key: string; writeLock: boolean }>, + config?: LockConfig + ): Promise; + + /** + * List held locks on the serving node. Operator introspection + * surface. In a multi-node cluster, call on each node to see the + * full picture. + */ + listAcquiredLocks(keyPrefix?: string): Promise; + } +} + +WaymakerClient.prototype.acquireLock = function ( + this: WaymakerClient, + key: string, + config: LockConfig = {} +): Promise { + return acquireLockInner(this, key, config, false); +}; + +WaymakerClient.prototype.acquireReadLock = function ( + this: WaymakerClient, + key: string, + config: LockConfig = {} +): Promise { + return acquireLockInner(this, key, config, true); +}; + +WaymakerClient.prototype.leaseStatus = async function ( + this: WaymakerClient, + key: string, + id: string +): Promise { + const c = this._locksClient(); + try { + const res = await callUnary(c, (req, cb) => c.leaseStatus(req, cb), { key, id }); + if (!res.success) throw serverError(res.resultCode, res.message); + const lease = res.lease; + if (!lease) throw serverError("internal", "missing lease in LeaseStatus response"); + return { + id: lease.id, + key: lease.key, + acquiredAtMs: lease.createdAt, + leaseExpiresAtMs: lease.leaseExpiresAt, + fenceToken: lease.fenceToken, + priority: lease.priority, + }; + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.multiLock = async function ( + this: WaymakerClient, + keys: Array<{ key: string; writeLock: boolean }>, + config: LockConfig = {} +): Promise { + const requestId = config.requestId && config.requestId.length > 0 + ? config.requestId + : randomUuid(); + const c = this._locksClient(); + try { + const res = await callUnary(c, (req, cb) => c.multiLock(req, cb), { + keys, + maxWaitPeriod: clampMs(config.maxWaitMs ?? 3_600_000), + maxLeasePeriod: clampMs(config.leaseTtlMs ?? 30_000), + priority: config.priority ?? 0, + requesterInfo: config.requesterInfo ?? "", + requesterApplication: config.requesterApplication ?? "waymaker-ts-client", + requestId, + fenceScope: (config.scope as unknown as FenceScope) ?? FenceScope.ScopeEphemeral, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.leases.map((lease: any) => ({ + id: lease.id as string, + key: lease.key as string, + acquiredAtMs: lease.createdAt as number, + leaseExpiresAtMs: lease.leaseExpiresAt as number, + fenceToken: lease.fenceToken as number, + priority: lease.priority as number, + })); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.listAcquiredLocks = async function ( + this: WaymakerClient, + keyPrefix = "" +): Promise { + const c = this._locksClient(); + try { + const res = await callUnary(c, (req, cb) => c.listAcquiredLocks(req, cb), { keyPrefix }); + if (!res.success) throw serverError("rpc_error", "listAcquiredLocks failed"); + return res.locks; + } finally { + c.close(); + } +}; + +// ------------------------------------------------------------------ +// Core acquire logic +// ------------------------------------------------------------------ + +async function acquireLockInner( + client: WaymakerClient, + key: string, + config: LockConfig, + read: boolean +): Promise { + const { req, requestId } = buildLockRequest(key, config); + + // Template for transparent re-acquire after stream drop: same + // requestId (so a still-held lease is recovered idempotently) but + // never block (maxWaitPeriod=0). + const reacquireReq: LockRequest = { ...req, maxWaitPeriod: 0 }; + + const c = client._locksClient(); + const stream: grpc.ClientReadableStream = read + ? c.readLock(req) + : c.lock(req); + + // Consume events until Acquired / Failed / Expired. + return new Promise((resolve, reject) => { + let resolved = false; + const finish = (result: Lock | WaymakerError) => { + if (resolved) return; + resolved = true; + stream.removeAllListeners(); + c.close(); + if (result instanceof Lock) { + resolve(result); + } else { + reject(result); + } + }; + + stream.on("data", (ev: LockEvent) => { + const et = ev.eventType; + if (et === LockEventType.Acquired) { + const initState: LockState = { + id: ev.id, + fenceToken: ev.fenceToken, + leaseExpiresAtMs: ev.leaseExpiresAt, + lost: false, + }; + // Detach our listeners — the Lock's hold loop takes over. + stream.removeAllListeners("end"); + stream.removeAllListeners("error"); + const lock = new Lock(client, key, initState, reacquireReq, stream, read); + finish(lock); + } else if (et === LockEventType.Failed) { + finish(serverError("failed", ev.message)); + } else if (et === LockEventType.Expired) { + finish(serverError("expired", ev.message)); + } + // Waiting / Heartbeat / Unknown — keep reading. + }); + + stream.on("end", () => { + if (!resolved) finish(serverError("stream_closed", "lock stream closed before acquire")); + }); + + stream.on("error", (err: Error) => { + if (!resolved) finish(rpcError(err as { message: string; code?: number })); + }); + }); +} + +// Re-export types needed by callers. +export type { AcquiredLock } from "./genpb/waymaker_locks"; diff --git a/ts/src/object.ts b/ts/src/object.ts new file mode 100644 index 0000000..27e2037 --- /dev/null +++ b/ts/src/object.ts @@ -0,0 +1,346 @@ +/** + * Object store subsystem — chunked put/get with metadata. + * + * An object-store bucket is backed by a stream with subject filters + * `objm.>` (metadata) and `objc.>` (chunks). The wrapper hides + * the wire convention; create / get via the typed entry points. + * + * Entry points on `WaymakerClient`: + * - `client.createObjectStore(config)` — create the backing stream + * - `client.getOrCreateObjectStore(config)` — idempotent + * - `client.objectStore(name)` — handle without creation + * + * `Store` carries per-object operations: + * - `store.put(name, payload)` / `store.putWith(name, payload, opts)` + * - `store.get(name)` → `{ info, payload }` + * - `store.getRange(name, offset, len)` → `{ info, offset, payload }` + * - `store.info(name)` → `ObjectInfo | null` + * - `store.delete(name)` → tombstoneSeq + * - `store.list(prefix)` / `store.listWithDeleted(prefix)` + * - `store.revisions(name)` + */ + +import { WaymakerClient, callUnary } from "./client"; +import { serverError } from "./error"; + +// ------------------------------------------------------------------ +// Config & types +// ------------------------------------------------------------------ + +export interface ObjectStoreConfig { + name: string; + /** Cap on total bucket bytes. `undefined` = unbounded. */ + maxBytes?: number; + /** Memory-only bucket. */ + ephemeral?: boolean; +} + +export interface ObjectInfo { + name: string; + totalBytes: number; + chunkCount: number; + chunkSize: number; + sha256: string; + tsMs: number; + headers: Array<[string, string]>; + revision: number; + deduped: boolean; +} + +export interface ObjectEntry { + name: string; + totalBytes: number; + deleted: boolean; +} + +export interface ObjectRevision { + metadataSeq: number; + totalBytes: number; + sha256: string; + tsMs: number; + deleted: boolean; +} + +export interface PutOptions { + /** Bytes per chunk. 0 = server default (1 MiB). */ + chunkSize?: number; + /** Optional headers on the object's metadata. */ + headers?: Array<[string, string]>; + /** Pre-computed SHA-256 hex. Empty = server computes. */ + sha256?: string; + /** Content-addressed chunk dedup. */ + dedupe?: boolean; +} + +// ------------------------------------------------------------------ +// Store handle +// ------------------------------------------------------------------ + +export class ObjectStore { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Put a whole object. Server chunks server-side. */ + async put(name: string, payload: Uint8Array | Buffer | string): Promise { + return this.putWith(name, payload, {}); + } + + /** Put with explicit options. */ + async putWith( + name: string, + payload: Uint8Array | Buffer | string, + opts: PutOptions + ): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.putObject(req, cb), { + bucket: this.name, + name, + payload: toBuffer(payload), + chunkSize: opts.chunkSize ?? 0, + headers: (opts.headers ?? []).map(([key, value]) => ({ key, value })), + sha256: opts.sha256 ?? "", + dedupe: opts.dedupe ?? false, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + if (!res.info) throw serverError("internal", "missing info in PutObject response"); + return fromPbInfo(res.info); + } finally { + c.close(); + } + } + + /** Get an object's full payload + metadata. */ + async get(name: string): Promise<{ info: ObjectInfo; payload: Uint8Array }> { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getObject(req, cb), { + bucket: this.name, + name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + if (!res.info) throw serverError("internal", "missing info in GetObject response"); + return { info: fromPbInfo(res.info), payload: res.payload }; + } finally { + c.close(); + } + } + + /** Read a byte range. `len=0` reads from `offset` to end. */ + async getRange( + name: string, + offset: number, + len: number + ): Promise<{ info: ObjectInfo; actualOffset: number; payload: Uint8Array }> { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getObjectRange(req, cb), { + bucket: this.name, + name, + offset, + len, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + if (!res.info) throw serverError("internal", "missing info in GetObjectRange response"); + return { info: fromPbInfo(res.info), actualOffset: res.actualOffset, payload: res.payload }; + } finally { + c.close(); + } + } + + /** Get metadata without payload. `null` if tombstoned. */ + async info(name: string): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getObjectInfo(req, cb), { + bucket: this.name, + name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + if (res.deleted) return null; + return res.info ? fromPbInfo(res.info) : null; + } finally { + c.close(); + } + } + + /** Tombstone an object. Returns the tombstone sequence. */ + async delete(name: string): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteObject(req, cb), { + bucket: this.name, + name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.tombstoneSeq; + } finally { + c.close(); + } + } + + /** List objects (excludes tombstoned). */ + async list(namePrefix = ""): Promise { + return this._listInner(namePrefix, false); + } + + /** List objects including tombstoned. */ + async listWithDeleted(namePrefix = ""): Promise { + return this._listInner(namePrefix, true); + } + + private async _listInner(namePrefix: string, includeDeleted: boolean): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.listObjects(req, cb), { + bucket: this.name, + namePrefix, + includeDeleted, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.entries.map((e: any) => ({ + name: e.name as string, + totalBytes: e.totalBytes as number, + deleted: e.deleted as boolean, + })); + } finally { + c.close(); + } + } + + /** List every metadata revision of `name` in sequence order. */ + async revisions(name: string): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.listObjectRevisions(req, cb), { + bucket: this.name, + name, + fromSeq: 0, + limit: 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.revisions.map((r: any) => ({ + metadataSeq: r.metadataSeq as number, + totalBytes: r.totalBytes as number, + sha256: r.sha256 as string, + tsMs: r.tsMs, + deleted: r.deleted, + })); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Client extension methods +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + createObjectStore(config: ObjectStoreConfig): Promise; + getOrCreateObjectStore(config: ObjectStoreConfig): Promise; + objectStore(name: string): ObjectStore; + } +} + +WaymakerClient.prototype.createObjectStore = async function ( + this: WaymakerClient, + config: ObjectStoreConfig +): Promise { + const c = this._streamsClient(); + try { + const streamConfig = buildStreamConfig(config); + const res = await callUnary(c, (req, cb) => c.createStream(req, cb), { + config: streamConfig, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new ObjectStore(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateObjectStore = async function ( + this: WaymakerClient, + config: ObjectStoreConfig +): Promise { + const c = this._streamsClient(); + try { + // Try getStreamInfo first; create if missing. + const infoRes = await callUnary(c, (req, cb) => c.getStreamInfo(req, cb), { name: config.name }); + if (infoRes.success) return new ObjectStore(this, config.name); + } catch { + // fall through to create + } finally { + c.close(); + } + return (this as WaymakerClient).createObjectStore(config); +}; + +WaymakerClient.prototype.objectStore = function ( + this: WaymakerClient, + name: string +): ObjectStore { + return new ObjectStore(this, name); +}; + +// ------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------ + +function toBuffer(v: Uint8Array | Buffer | string): Buffer { + if (typeof v === "string") return Buffer.from(v); + if (Buffer.isBuffer(v)) return v; + return Buffer.from(v); +} + +function fromPbInfo(i: { + name: string; + totalBytes: number; + chunkCount: number; + chunkSize: number; + sha256: string; + tsMs: number; + headers: Array<{ key: string; value: string }>; + metadataSeq: number; + deduped: boolean; +}): ObjectInfo { + return { + name: i.name, + totalBytes: i.totalBytes, + chunkCount: i.chunkCount, + chunkSize: i.chunkSize, + sha256: i.sha256, + tsMs: i.tsMs, + headers: i.headers.map((h) => [h.key, h.value] as [string, string]), + revision: i.metadataSeq, + deduped: i.deduped, + }; +} + +function buildStreamConfig(config: ObjectStoreConfig) { + return { + name: config.name, + subjectsFilter: ["objm.>", "objc.>"], + retention: { + limits: { + maxAgeMs: 0, + maxMsgs: 0, + maxBytes: config.maxBytes ?? 0, + strictLimits: false, + }, + }, + blockSize: 0, + maxMsgBytes: 0, + ephemeral: config.ephemeral ?? false, + maxMsgsPerSubject: 0, + sources: [], + }; +} diff --git a/ts/src/sketches.ts b/ts/src/sketches.ts new file mode 100644 index 0000000..4fc05f0 --- /dev/null +++ b/ts/src/sketches.ts @@ -0,0 +1,580 @@ +/** + * Sketches subsystem — probabilistic data structures. + * + * Entry points on `WaymakerClient`: + * - Bloom: `createBloom` / `bloom` / `deleteBloom` + * - HLL: `createHll` / `hll` / `deleteHll` + * - CMS: `createCms` / `cms` / `deleteCms` + * - TopK: `createTopK` / `topk` / `deleteTopK` + * - t-digest: `createTDigest` / `tdigest` / `deleteTDigest` + * + * CMS / TopK / t-digest are proto-complete but server returns + * `unimplemented` on every call (implementation deferred). + */ + +import { WaymakerClient, callUnary } from "./client"; +import { serverError } from "./error"; + +// ------------------------------------------------------------------ +// Bloom filter +// ------------------------------------------------------------------ + +export interface BloomConfig { + name: string; + capacity: number; + /** False-positive rate (e.g. 0.01). 0 = server default (0.01). */ + errorRate?: number; +} + +export interface BloomInfo { + capacity: number; + errorRate: number; + bitsSet: number; + bitCount: number; + hashCount: number; + itemsAdded: number; +} + +export class Bloom { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Add one item. */ + async add(item: Uint8Array | Buffer | string): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomAdd(req, cb), { + name: this.name, + item: toBuffer(item), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Add many items. */ + async addMany(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomMultiAdd(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Probabilistic membership test. `true` = probably present. */ + async exists(item: Uint8Array | Buffer | string): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomExists(req, cb), { + name: this.name, + item: toBuffer(item), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.exists; + } finally { + c.close(); + } + } + + /** Probabilistic membership for many items. */ + async existsMany(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomMultiExists(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.exists; + } finally { + c.close(); + } + } + + /** Get filter metadata. */ + async info(): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomInfo(req, cb), { + name: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return { + capacity: res.capacity, + errorRate: res.errorRate, + bitsSet: res.bitsSet, + bitCount: res.bitCount, + hashCount: res.hashCount, + itemsAdded: res.itemsAdded, + }; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// HyperLogLog +// ------------------------------------------------------------------ + +export interface HllConfig { + name: string; + /** 2^precision = register count. Valid 4..18. 0 = server default (14). */ + precision?: number; +} + +export class Hll { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Add items. */ + async add(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.hllAdd(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Estimated cardinality. */ + async count(): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.hllCount(req, cb), { + name: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.estimate; + } finally { + c.close(); + } + } + + /** Merge `sources` into this HLL (union of their registers). */ + async mergeFrom(sources: string[]): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.hllMerge(req, cb), { + destination: this.name, + sources, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Count-Min Sketch +// ------------------------------------------------------------------ + +export interface CmsConfig { + name: string; + /** Sketch width (columns). 0 = server default. */ + width?: number; + /** Sketch depth (rows). 0 = server default. */ + depth?: number; +} + +export class Cms { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Increment item counts. Returns the new count per item. */ + async incr(items: Array<{ item: Uint8Array | Buffer | string; count: number }>): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.cmsIncrBy(req, cb), { + name: this.name, + items: items.map(({ item, count }) => ({ item: toBuffer(item), count })), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.counts; + } finally { + c.close(); + } + } + + /** Query estimated counts. */ + async query(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.cmsQuery(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.counts; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Top-K +// ------------------------------------------------------------------ + +export interface TopKConfig { + name: string; + k: number; + /** Underlying sketch width. 0 = server default. */ + width?: number; + /** Underlying sketch depth. 0 = server default. */ + depth?: number; + /** Probability-decay factor (0..1). 0 = server default. */ + decay?: number; +} + +export interface TopKListEntry { + item: Uint8Array; + count: number; +} + +export class TopK { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Add items. Returns evicted item (if any) per slot. */ + async add(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.topKAdd(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.evicted; + } finally { + c.close(); + } + } + + /** Test membership in top-K. */ + async query(items: Array): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.topKQuery(req, cb), { + name: this.name, + items: items.map(toBuffer), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.inTopK; + } finally { + c.close(); + } + } + + /** List the current top-K entries. */ + async list(): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.topKList(req, cb), { + name: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return res.entries.map((e: any) => ({ item: e.item as Buffer, count: e.count as number })); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// t-digest +// ------------------------------------------------------------------ + +export interface TDigestConfig { + name: string; + /** Compression. Higher = better tail accuracy. 0 = server default. */ + compression?: number; +} + +export class TDigest { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Add values. */ + async add(values: number[]): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.tDigestAdd(req, cb), { + name: this.name, + values, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Estimate quantiles (0..1). */ + async quantile(quantiles: number[]): Promise { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.tDigestQuantile(req, cb), { + name: this.name, + quantiles, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.values; + } finally { + c.close(); + } + } + + /** Get min and max values. */ + async minMax(): Promise<{ min: number; max: number }> { + const c = this._client._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.tDigestMinMax(req, cb), { + name: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return { min: res.min, max: res.max }; + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Client extension methods +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + createBloom(config: BloomConfig): Promise; + bloom(name: string): Bloom; + deleteBloom(name: string): Promise; + + createHll(config: HllConfig): Promise; + hll(name: string): Hll; + deleteHll(name: string): Promise; + + createCms(config: CmsConfig): Promise; + cms(name: string): Cms; + deleteCms(name: string): Promise; + + createTopK(config: TopKConfig): Promise; + topk(name: string): TopK; + deleteTopK(name: string): Promise; + + createTDigest(config: TDigestConfig): Promise; + tdigest(name: string): TDigest; + deleteTDigest(name: string): Promise; + } +} + +// Bloom +WaymakerClient.prototype.createBloom = async function ( + this: WaymakerClient, + config: BloomConfig +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomReserve(req, cb), { + name: config.name, + capacity: config.capacity, + errorRate: config.errorRate ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Bloom(this, config.name); + } finally { + c.close(); + } +}; +WaymakerClient.prototype.bloom = function (this: WaymakerClient, name: string): Bloom { + return new Bloom(this, name); +}; +WaymakerClient.prototype.deleteBloom = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.bloomDelete(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// HLL +WaymakerClient.prototype.createHll = async function ( + this: WaymakerClient, + config: HllConfig +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.hllReserve(req, cb), { + name: config.name, + precision: config.precision ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Hll(this, config.name); + } finally { + c.close(); + } +}; +WaymakerClient.prototype.hll = function (this: WaymakerClient, name: string): Hll { + return new Hll(this, name); +}; +WaymakerClient.prototype.deleteHll = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.hllDelete(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// CMS +WaymakerClient.prototype.createCms = async function ( + this: WaymakerClient, + config: CmsConfig +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.cmsReserve(req, cb), { + name: config.name, + width: config.width ?? 0, + depth: config.depth ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Cms(this, config.name); + } finally { + c.close(); + } +}; +WaymakerClient.prototype.cms = function (this: WaymakerClient, name: string): Cms { + return new Cms(this, name); +}; +WaymakerClient.prototype.deleteCms = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.cmsDelete(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// TopK +WaymakerClient.prototype.createTopK = async function ( + this: WaymakerClient, + config: TopKConfig +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.topKReserve(req, cb), { + name: config.name, + k: config.k, + width: config.width ?? 0, + depth: config.depth ?? 0, + decay: config.decay ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new TopK(this, config.name); + } finally { + c.close(); + } +}; +WaymakerClient.prototype.topk = function (this: WaymakerClient, name: string): TopK { + return new TopK(this, name); +}; +WaymakerClient.prototype.deleteTopK = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.topKDelete(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// TDigest +WaymakerClient.prototype.createTDigest = async function ( + this: WaymakerClient, + config: TDigestConfig +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.tDigestCreate(req, cb), { + name: config.name, + compression: config.compression ?? 0, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new TDigest(this, config.name); + } finally { + c.close(); + } +}; +WaymakerClient.prototype.tdigest = function (this: WaymakerClient, name: string): TDigest { + return new TDigest(this, name); +}; +WaymakerClient.prototype.deleteTDigest = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._sketchesClient(); + try { + const res = await callUnary(c, (req, cb) => c.tDigestDelete(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +// ------------------------------------------------------------------ +// Helpers +// ------------------------------------------------------------------ + +function toBuffer(v: Uint8Array | Buffer | string): Buffer { + if (typeof v === "string") return Buffer.from(v); + if (Buffer.isBuffer(v)) return v; + return Buffer.from(v); +} diff --git a/ts/src/stream.ts b/ts/src/stream.ts new file mode 100644 index 0000000..71e8649 --- /dev/null +++ b/ts/src/stream.ts @@ -0,0 +1,647 @@ +/** + * Streams subsystem — publish, consumers, ack/nak, stream management. + * + * Entry points on `WaymakerClient`: + * - `client.createStream(config)` — create a new stream + * - `client.getStream(name)` — handle to existing stream + * - `client.getOrCreateStream(config)` — idempotent + * - `client.updateStream(name, update)` — mutate limits + * - `client.deleteStream(name)` + * - `client.getStreamSources()` — per-(sourcing, source) tail status + * + * Returned `Stream` carries per-stream operations: + * - `stream.publish(subject, payload)` + * - `stream.createConsumer(config)` → `Consumer` + * - `stream.getConsumer(name)` / `getOrCreateConsumer` / `deleteConsumer` + * - `stream.sourcesStatus()` + * + * Returned `Consumer` carries: + * - `consumer.messages()` → `AsyncIterable` (push/subscribe) + * - `consumer.fetch(batchSize)` → `Message[]` (pull) + * - `message.ack()` / `nak()` / `term()` / `inProgress()` + */ + +import * as grpc from "@grpc/grpc-js"; +import { WaymakerClient, callUnary, streamToAsyncIter } from "./client"; +import { serverError, rpcError } from "./error"; +import type { + MessagePb, + MessageHeader, + SubscribeEvent, +} from "./genpb/waymaker_streams"; + +// ------------------------------------------------------------------ +// Enums +// ------------------------------------------------------------------ + +export enum RetentionPolicy { + Limits = "limits", + WorkQueue = "work_queue", + Interest = "interest", +} + +export enum DeliverPolicy { + All = "all", + New = "new", + Last = "last", + ByStartSequence = "by_start_sequence", + ByStartTime = "by_start_time", +} + +export enum OnDropPolicy { + Halt = 0, + SkipToFirstAvailable = 1, +} + +// ------------------------------------------------------------------ +// Config types +// ------------------------------------------------------------------ + +export interface SubjectTransform { + sourcePattern: string; + destination: string; +} + +export interface StreamSource { + sourceStream: string; + /** NATS wildcard pattern. Empty = all. */ + filterSubject?: string; + /** First source seq. 0 = beginning. Mutually exclusive with startTimeMs. */ + startSeq?: number; + /** Wall-clock start time (ms since epoch). Mutually exclusive with startSeq. */ + startTimeMs?: number; + /** Cap on initial backfill. 0 = no cap. */ + maxInitialBackfill?: number; + /** Subject rewrite. */ + subjectTransform?: SubjectTransform; + /** What to do when source retention drops messages past our watermark. */ + onDrop?: OnDropPolicy; + /** Dead-letter stream. */ + dlqStream?: string; +} + +export interface StreamConfig { + name: string; + subjects?: string[]; + retention?: RetentionPolicy; + maxAgeMs?: number; + maxMessages?: number; + maxBytes?: number; + maxMessageSize?: number; + /** Block size override. 0 = server default. */ + blockSize?: number; + /** Reject publishes over limits instead of dropping oldest. */ + strictLimits?: boolean; + /** Memory-only; survives failover via replication. */ + ephemeral?: boolean; + /** Per-subject revision cap. 0 = unbounded. */ + maxMsgsPerSubject?: number; + /** Cross-stream sources. */ + sources?: StreamSource[]; +} + +export interface StreamUpdate { + maxAgeMs?: number; + maxMsgs?: number; + maxBytes?: number; + maxMsgBytes?: number; + strictLimits?: boolean; +} + +export interface ConsumerConfig { + durableName: string; + filterSubject?: string; + deliverPolicy?: DeliverPolicy; + /** Start sequence for ByStartSequence. */ + startSeq?: number; + /** Start time (ms) for ByStartTime. */ + startTimeMs?: number; + /** Ack-wait window (ms). Default 30 000. */ + ackWaitMs?: number; + /** Max delivery attempts. Default 5. */ + maxDeliver?: number; + /** Queue group label for shared consumption. */ + deliverGroup?: string; + /** Dead-letter subject within the stream. */ + deadLetterSubject?: string; +} + +// ------------------------------------------------------------------ +// PublishAck +// ------------------------------------------------------------------ + +export interface PublishAck { + sequence: number; +} + +// ------------------------------------------------------------------ +// SourceStatus +// ------------------------------------------------------------------ + +export interface SourceStatus { + sourcingStream: string; + sourceStream: string; + lastSourcedSeq: number; + pulledTotal: number; + lastError: string; + lastErrorTsMs: number; +} + +// ------------------------------------------------------------------ +// Message +// ------------------------------------------------------------------ + +export class Message { + readonly subject: string; + readonly payload: Buffer; + readonly headers: Array<[string, string]>; + readonly sequence: number; + readonly tsMs: number; + readonly deliverCount: number; + + /** @internal */ + constructor( + private readonly _client: WaymakerClient, + private readonly _stream: string, + private readonly _consumer: string, + pb: MessagePb + ) { + this.subject = pb.subject; + this.payload = Buffer.from(pb.payload); + this.headers = pb.headers.map((h: MessageHeader) => [h.key, h.value]); + this.sequence = pb.seq; + this.tsMs = pb.tsMs; + this.deliverCount = pb.deliverCount; + } + + /** Positive acknowledgment — message is consumed. */ + async ack(): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.ack(req, cb), { + stream: this._stream, + consumer: this._consumer, + seq: this.sequence, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Negative acknowledgment — request immediate redelivery. */ + async nak(): Promise { + await this.nakWithDelay(0); + } + + /** Negative acknowledgment with delay (ms). */ + async nakWithDelay(delayMs: number): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.nak(req, cb), { + stream: this._stream, + consumer: this._consumer, + seq: this.sequence, + delayMs, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Terminal acknowledgment — permanently drop regardless of maxDeliver. */ + async term(): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.term(req, cb), { + stream: this._stream, + consumer: this._consumer, + seq: this.sequence, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Heartbeat — extend ack_wait without acking. */ + async inProgress(): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.inProgress(req, cb), { + stream: this._stream, + consumer: this._consumer, + seq: this.sequence, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Consumer +// ------------------------------------------------------------------ + +export class Consumer { + /** @internal */ + constructor( + private readonly _client: WaymakerClient, + private readonly _stream: string, + readonly name: string + ) {} + + /** Parent stream name. */ + get stream(): string { return this._stream; } + + /** + * Open a push-mode subscription. Returns an `AsyncIterable` + * that yields delivered messages until the underlying RPC closes. + * + * ```ts + * for await (const msg of await consumer.messages()) { + * await msg.ack(); + * } + * ``` + */ + async messages(batchSize = 0): Promise> { + const c = this._client._streamsClient(); + const rpcStream: grpc.ClientReadableStream = c.subscribe({ + stream: this._stream, + consumer: this.name, + batchSize, + stopWhenEmpty: false, + }); + + const client = this._client; + const streamName = this._stream; + const consumerName = this.name; + + async function* gen(): AsyncGenerator { + try { + for await (const event of streamToAsyncIter(rpcStream)) { + const ev = event as SubscribeEvent; + if (ev.message !== undefined) { + yield new Message(client, streamName, consumerName, ev.message); + } else if (ev.stopped !== undefined) { + if (ev.stopped.reason && ev.stopped.reason.length > 0) { + throw serverError("subscribe_stopped", ev.stopped.reason); + } + return; + } + } + } finally { + c.close(); + } + } + + return gen(); + } + + /** + * Pull-style: fetch up to `batchSize` messages right now. + * Returns the batch immediately (possibly empty). + */ + async fetch(batchSize: number): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.fetch(req, cb), { + stream: this._stream, + consumer: this.name, + batchSize, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return res.messages.map( + (m: MessagePb) => new Message(this._client, this._stream, this.name, m) + ); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Stream handle +// ------------------------------------------------------------------ + +export class Stream { + readonly name: string; + + /** @internal */ + constructor(private readonly _client: WaymakerClient, name: string) { + this.name = name; + } + + /** Publish a message. */ + async publish(subject: string, payload: Uint8Array | Buffer | string): Promise { + return this.publishWithHeaders(subject, [], payload); + } + + /** Publish with explicit headers. */ + async publishWithHeaders( + subject: string, + headers: Array<[string, string]>, + payload: Uint8Array | Buffer | string + ): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.publish(req, cb), { + stream: this.name, + subject, + payload: toBuffer(payload), + headers: headers.map(([key, value]) => ({ key, value })), + tsMs: 0, + expectedLastSeq: undefined, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return { sequence: res.seq }; + } finally { + c.close(); + } + } + + /** Create a new consumer. */ + async createConsumer(config: ConsumerConfig): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.createConsumer(req, cb), { + stream: this.name, + config: buildConsumerConfigPb(config), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Consumer(this._client, this.name, config.durableName); + } finally { + c.close(); + } + } + + /** Idempotent: create if not exists, otherwise return handle. */ + async getOrCreateConsumer(config: ConsumerConfig): Promise { + try { + return await this.createConsumer(config); + } catch (e) { + if (isServerErrorCode(e, "already_exists")) { + return new Consumer(this._client, this.name, config.durableName); + } + throw e; + } + } + + /** Return a handle to an existing consumer. */ + async getConsumer(name: string): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getConsumerInfo(req, cb), { + stream: this.name, + consumer: name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Consumer(this._client, this.name, name); + } finally { + c.close(); + } + } + + /** Delete a consumer. */ + async deleteConsumer(name: string): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteConsumer(req, cb), { + stream: this.name, + consumer: name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } + } + + /** Per-source tail status for this stream. */ + async sourcesStatus(): Promise { + const c = this._client._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getStreamInfo(req, cb), { + name: this.name, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (res.sourcesStatus ?? []).map((s: any) => ({ + sourcingStream: this.name, + sourceStream: s.sourceStream as string, + lastSourcedSeq: s.lastSourcedSeq as number, + pulledTotal: s.pulledTotal as number, + lastError: s.lastError as string, + lastErrorTsMs: s.lastErrorTsMs as number, + })); + } finally { + c.close(); + } + } +} + +// ------------------------------------------------------------------ +// Proto conversion helpers +// ------------------------------------------------------------------ + +function buildStreamConfigPb(config: StreamConfig) { + const retention = config.retention ?? RetentionPolicy.Limits; + let retentionPb: object; + if (retention === RetentionPolicy.Limits) { + retentionPb = { + limits: { + maxAgeMs: config.maxAgeMs, + maxMsgs: config.maxMessages, + maxBytes: config.maxBytes, + strictLimits: config.strictLimits ?? false, + }, + }; + } else if (retention === RetentionPolicy.WorkQueue) { + retentionPb = { workQueue: {} }; + } else { + retentionPb = { interest: {} }; + } + + return { + name: config.name, + subjectsFilter: config.subjects ?? [], + retention: retentionPb, + blockSize: config.blockSize ?? 0, + maxMsgBytes: config.maxMessageSize ?? 0, + ephemeral: config.ephemeral ?? false, + maxMsgsPerSubject: config.maxMsgsPerSubject ?? 0, + sources: (config.sources ?? []).map((s) => ({ + sourceStream: s.sourceStream, + filterSubject: s.filterSubject ?? "", + startSeq: s.startSeq ?? 0, + startTimeMs: s.startTimeMs ?? 0, + subjectTransform: s.subjectTransform + ? { sourcePattern: s.subjectTransform.sourcePattern, destination: s.subjectTransform.destination } + : undefined, + maxInitialBackfill: s.maxInitialBackfill ?? 0, + onDrop: s.onDrop ?? OnDropPolicy.Halt, + dlqStream: s.dlqStream ?? "", + })), + }; +} + +function buildConsumerConfigPb(config: ConsumerConfig) { + const policy = config.deliverPolicy ?? DeliverPolicy.All; + let ty = 0; // DeliveryAll + let startSeq = 0; + let startTimeMs = 0; + if (policy === DeliverPolicy.New) { + ty = 3; // DeliveryByStartTime + startTimeMs = Date.now(); + } else if (policy === DeliverPolicy.Last) { + ty = 2; // DeliveryLast + } else if (policy === DeliverPolicy.ByStartSequence) { + ty = 1; // DeliveryByStartSeq + startSeq = config.startSeq ?? 0; + } else if (policy === DeliverPolicy.ByStartTime) { + ty = 3; // DeliveryByStartTime + startTimeMs = config.startTimeMs ?? 0; + } + + return { + name: config.durableName, + filterSubject: config.filterSubject ?? "", + deliveryPolicy: { type: ty, startSeq, startTimeMs }, + ackWaitMs: config.ackWaitMs ?? 30_000, + maxDeliver: config.maxDeliver ?? 5, + deliverGroup: config.deliverGroup ?? "", + deadLetterSubject: config.deadLetterSubject ?? "", + }; +} + +function toBuffer(v: Uint8Array | Buffer | string): Buffer { + if (typeof v === "string") return Buffer.from(v); + if (Buffer.isBuffer(v)) return v; + return Buffer.from(v); +} + +function isServerErrorCode(err: unknown, code: string): boolean { + return ( + typeof err === "object" && + err !== null && + "kind" in err && + (err as { kind: string }).kind === "server" && + "code" in err && + (err as { code: string }).code === code + ); +} + +// ------------------------------------------------------------------ +// Client extension methods +// ------------------------------------------------------------------ + +declare module "./client" { + interface WaymakerClient { + createStream(config: StreamConfig): Promise; + getStream(name: string): Promise; + getOrCreateStream(config: StreamConfig): Promise; + updateStream(name: string, update: StreamUpdate): Promise; + deleteStream(name: string): Promise; + getStreamSources(): Promise; + } +} + +WaymakerClient.prototype.createStream = async function ( + this: WaymakerClient, + config: StreamConfig +): Promise { + const c = this._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.createStream(req, cb), { + config: buildStreamConfigPb(config), + }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Stream(this, config.name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getStream = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getStreamInfo(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + return new Stream(this, name); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getOrCreateStream = async function ( + this: WaymakerClient, + config: StreamConfig +): Promise { + try { + return await (this as WaymakerClient).getStream(config.name); + } catch (e) { + if (isServerErrorCode(e, "no_such_stream")) { + return (this as WaymakerClient).createStream(config); + } + throw e; + } +}; + +WaymakerClient.prototype.updateStream = async function ( + this: WaymakerClient, + name: string, + update: StreamUpdate +): Promise { + const c = this._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.updateStream(req, cb), { + name, + maxAgeMs: update.maxAgeMs, + maxMsgs: update.maxMsgs, + maxBytes: update.maxBytes, + maxMsgBytes: update.maxMsgBytes, + strictLimits: update.strictLimits, + }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.deleteStream = async function ( + this: WaymakerClient, + name: string +): Promise { + const c = this._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.deleteStream(req, cb), { name }); + if (!res.success) throw serverError(res.resultCode, res.message); + } finally { + c.close(); + } +}; + +WaymakerClient.prototype.getStreamSources = async function ( + this: WaymakerClient +): Promise { + const c = this._streamsClient(); + try { + const res = await callUnary(c, (req, cb) => c.getStreamSources(req, cb), {}); + if (!res.success) throw serverError(res.resultCode, res.message); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (res.entries ?? []).map((e: any) => ({ + sourcingStream: e.sourcingStream as string, + sourceStream: e.sourceStream as string, + lastSourcedSeq: e.lastSourcedSeq as number, + pulledTotal: e.pulledTotal as number, + lastError: e.lastError as string, + lastErrorTsMs: e.lastErrorTsMs as number, + })); + } finally { + c.close(); + } +}; diff --git a/ts/tsconfig.json b/ts/tsconfig.json new file mode 100644 index 0000000..5505f49 --- /dev/null +++ b/ts/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "moduleResolution": "node", + "lib": ["ES2020"], + "declaration": true, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true + }, + "include": ["src/**/*.ts"], + "exclude": ["node_modules", "dist"] +}