wire

package
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wire defines the JSON-over-HTTP contract shared by the mqlite broker (server) and the Go SDK client. It mirrors the proto sketch in design §7.2. One source of truth so the two sides can never drift.

JSON conventions: `body` is base64 (Go marshals []byte as base64, matching the curl examples in §7.4); timestamps are epoch-ms integers; seq numbers are integers. Unary RPC = HTTP POST to /mqlite.v1.<Service>/<Method>.

Index

Constants

View Source
const (
	PathSend            = "/mqlite.v1.QueueService/Send"
	PathReceive         = "/mqlite.v1.QueueService/Receive"
	PathComplete        = "/mqlite.v1.QueueService/Complete"
	PathCompleteBatch   = "/mqlite.v1.QueueService/CompleteBatch"
	PathAbandon         = "/mqlite.v1.QueueService/Abandon"
	PathReject          = "/mqlite.v1.QueueService/Reject"
	PathDefer           = "/mqlite.v1.QueueService/Defer"
	PathReceiveDeferred = "/mqlite.v1.QueueService/ReceiveDeferred"
	PathRenew           = "/mqlite.v1.QueueService/Renew"
	PathRenewBatch      = "/mqlite.v1.QueueService/RenewBatch"
	PathSchedule        = "/mqlite.v1.QueueService/Schedule"
	PathCancel          = "/mqlite.v1.QueueService/Cancel"
	PathPeek            = "/mqlite.v1.QueueService/Peek"
	PathStats           = "/mqlite.v1.QueueService/Stats"

	PathDeleteQueue           = "/mqlite.v1.AdminService/DeleteQueue"
	PathCreateQueue           = "/mqlite.v1.AdminService/CreateQueue"
	PathSubscribe             = "/mqlite.v1.AdminService/Subscribe"
	PathListQueues            = "/mqlite.v1.AdminService/ListQueues"
	PathListSubscriptions     = "/mqlite.v1.AdminService/ListSubscriptions"
	PathListSubscriptionsPage = "/mqlite.v1.AdminService/ListSubscriptionsPage"
	PathDeleteSubscription    = "/mqlite.v1.AdminService/DeleteSubscription"
	PathTestFilter            = "/mqlite.v1.AdminService/TestFilter"
	PathRedrive               = "/mqlite.v1.AdminService/Redrive"
	PathPurge                 = "/mqlite.v1.AdminService/Purge"
	PathStatus                = "/mqlite.v1.AdminService/Status"
	PathObserve               = "/mqlite.v1.AdminService/Observe"

	PathCreateKey = "/mqlite.v1.AuthService/CreateKey"
	PathListKeys  = "/mqlite.v1.AuthService/ListKeys"
	PathRevokeKey = "/mqlite.v1.AuthService/RevokeKey"
)

Route paths (Connect-style: /package.Service/Method).

View Source
const MaxDeleteResponseBytes = 4 << 10

MaxDeleteResponseBytes bounds the complete acknowledgement returned by a broker or intermediary. A valid response contains only two small fields.

View Source
const MaxKeyResponseBytes = 2 << 20

MaxKeyResponseBytes bounds even a full 1000-key page with escaped 128-byte names.

View Source
const MaxListSubscriptionsPageResponseBytes = 32 << 20

An inventory response can contain 1,000 filters of up to 4 KiB each. Leave room for JSON escaping while still bounding an untrusted broker or proxy.

View Source
const MaxObserveResponseBytes = 32 << 20

MaxObserveResponseBytes bounds the complete inventory before client allocation.

View Source
const ServerTimeHeader = "X-Mqlite-Server-Time-Ms"

ServerTimeHeader carries the broker wall clock at response write time as UTC epoch milliseconds. Clients combine it with their local monotonic clock and a conservative transport budget instead of comparing lease timestamps against a potentially skewed wall clock. Older clients safely ignore the additive header.

Variables

This section is empty.

Functions

func ObservationRPCNames added in v0.3.2

func ObservationRPCNames() []string

ObservationRPCNames returns the baseline required RPC observation vocabulary. New routes are additive so newer clients can still observe older brokers.

func ObservationRequestCodes added in v0.3.2

func ObservationRequestCodes() []string

ObservationRequestCodes returns a fresh copy of the bounded whole-request outcomes.

func ReadDeleteResponse added in v0.4.0

func ReadDeleteResponse(reader io.Reader) ([]byte, error)

ReadDeleteResponse reads one bounded acknowledgement so truncated or oversized successes cannot be mistaken for an accepted deletion.

func ReadKeyResponse added in v0.3.1

func ReadKeyResponse(reader io.Reader) ([]byte, error)

ReadKeyResponse reads one bounded response without exposing partial contents when the connection is truncated or an intermediary returns an oversized body.

func ReadListSubscriptionsPageResponse added in v0.4.0

func ReadListSubscriptionsPageResponse(reader io.Reader) ([]byte, error)

ReadListSubscriptionsPageResponse reads one complete, bounded inventory page. DecodeListSubscriptionsPageResponse performs the semantic validation.

func ReadObserveResponse added in v0.3.2

func ReadObserveResponse(reader io.Reader) ([]byte, error)

ReadObserveResponse bounds full-response validation before allocating an inventory.

Types

type AccessKey added in v0.3.1

type AccessKey struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
	CreatedAtMs int64    `json:"created_at_ms"`
	ExpiresAtMs int64    `json:"expires_at_ms"`
	RevokedAtMs int64    `json:"revoked_at_ms"`
}

AccessKey exposes public metadata only; the secret and its digest are never listed.

func FromAccessKey added in v0.3.1

func FromAccessKey(key engine.AccessKey) AccessKey

FromAccessKey converts public metadata without exposing authentication material.

type AuthenticationObservation added in v0.3.2

type AuthenticationObservation struct {
	Outcome string `json:"outcome"`
	Count   uint64 `json:"count"`
}

AuthenticationObservation counts one final authentication/authorization outcome per protected request. No credential, key identifier or client address is a label.

type CancelRequest

type CancelRequest struct {
	Queue     string `json:"queue"`
	SeqNumber int64  `json:"seq_number"`
}

type CompleteBatchRequest added in v0.1.1

type CompleteBatchRequest struct {
	Queue    string       `json:"queue"`
	Messages []SettleItem `json:"messages"`
}

type CompleteBatchResponse added in v0.1.1

type CompleteBatchResponse struct {
	Results []SettleItemResult `json:"results"`
}

type CreateKeyRequest added in v0.3.1

type CreateKeyRequest struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`
	ExpiresAtMs int64    `json:"expires_at_ms,omitempty"`
}

type CreateKeyResponse added in v0.3.1

type CreateKeyResponse struct {
	Key   AccessKey `json:"key"`
	Token string    `json:"token"`
}

CreateKeyResponse returns the secret exactly once, at creation.

func DecodeCreateKeyResponse added in v0.3.1

func DecodeCreateKeyResponse(data []byte, request CreateKeyRequest) (CreateKeyResponse, error)

DecodeCreateKeyResponse validates the complete one-time result against its request. Unknown fields are discarded; errors never include response secrets.

type CreateQueueRequest

type CreateQueueRequest struct {
	Name   string          `json:"name"`
	Config QueueConfigJSON `json:"config"`
}

type DeleteQueueRequest added in v0.3.3

type DeleteQueueRequest struct {
	Name  string `json:"name"`
	Force bool   `json:"force,omitempty"`
}

type DeleteQueueResponse added in v0.3.3

type DeleteQueueResponse = DeleteResponse

Queue and subscription deletion deliberately share one strict lifecycle acknowledgement. The aliases preserve the resource-specific public names.

type DeleteResponse added in v0.4.0

type DeleteResponse struct {
	Deleted bool   `json:"deleted"`
	State   string `json:"state"`
}

func DecodeDeleteResponse added in v0.4.0

func DecodeDeleteResponse(data []byte) (DeleteResponse, error)

DecodeDeleteResponse requires an explicit, internally consistent acknowledgement. Unknown fields remain forward compatible, but both current fields must be present and carry one of the two defined state combinations.

type DeleteSubscriptionRequest added in v0.4.0

type DeleteSubscriptionRequest struct {
	Topic string `json:"topic"`
	Name  string `json:"name"`
	Force bool   `json:"force,omitempty"`
}

type DeleteSubscriptionResponse added in v0.4.0

type DeleteSubscriptionResponse = DeleteResponse

type DiscoveryCard added in v0.3.0

type DiscoveryCard struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Version     string   `json:"version"`
	Status      string   `json:"status"`
	Auth        string   `json:"auth"`
	Docs        string   `json:"docs"`
	Endpoints   []string `json:"endpoints"`
	Health      string   `json:"health"`
	Metrics     string   `json:"metrics,omitempty"` // present only when the authenticated metrics endpoint is enabled
	UI          string   `json:"ui,omitempty"`      // present only when the console is enabled
}

DiscoveryCard is the open, unauthenticated "/" response: a machine-readable description of the broker for humans and agents. Endpoints is the complete catalog of RPC route paths (agents iterate it); Auth is "bearer" when RPCs need a token or "none" when auth is off. The exact shape is pinned by the server's TestDiscoveryCardPinned so any drift is loud (MQLITE-87).

type Empty

type Empty struct{}

type ErrorBody

type ErrorBody struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	// Resource refines a broad code without changing it. Older clients ignore
	// this additive field; newer clients use "queue" to restore the SDK's
	// ErrQueueNotFound/ErrNotFound hierarchy across HTTP.
	Resource string `json:"resource,omitempty"`
}

ErrorBody is the Connect-style JSON error envelope.

type HTTPObservation added in v0.3.2

type HTTPObservation struct {
	State          string                      `json:"state"`
	Requests       []RequestObservation        `json:"requests"`
	Authentication []AuthenticationObservation `json:"authentication"`
	HandlerLatency []RPCLatencyObservation     `json:"handler_latency"`
}

HTTPObservation contains process-lifetime transport measurements. All labels are bounded by registered routes and a fixed outcome vocabulary.

type LatencyBucket added in v0.3.2

type LatencyBucket struct {
	UpperBoundSeconds float64 `json:"upper_bound_seconds"`
	Count             uint64  `json:"count"`
}

type ListKeysRequest added in v0.3.1

type ListKeysRequest struct {
	AfterID string `json:"after_id,omitempty"`
	Limit   int    `json:"limit,omitempty"`
	Sort    string `json:"sort,omitempty"`
}

type ListKeysResponse added in v0.3.1

type ListKeysResponse struct {
	Keys        []AccessKey `json:"keys"`
	NextAfterID string      `json:"next_after_id,omitempty"`
}

func DecodeListKeysResponse added in v0.3.1

func DecodeListKeysResponse(data []byte, request ListKeysRequest) (ListKeysResponse, error)

DecodeListKeysResponse validates bounded, ordered metadata and cursor progress.

type ListQueuesResponse

type ListQueuesResponse struct {
	Queues []QueueInfoJSON `json:"queues"`
}

type ListSubscriptionsPageRequest added in v0.4.0

type ListSubscriptionsPageRequest struct {
	Topic           string `json:"topic,omitempty"`
	After           string `json:"after,omitempty"`
	Limit           int    `json:"limit,omitempty"`
	IncludeDeleting bool   `json:"include_deleting,omitempty"`
}

type ListSubscriptionsPageResponse added in v0.4.0

type ListSubscriptionsPageResponse struct {
	Subscriptions []SubscriptionPageJSON `json:"subscriptions"`
	Total         int                    `json:"total"`
	NextAfter     string                 `json:"next_after,omitempty"`
}

func DecodeListSubscriptionsPageResponse added in v0.4.0

func DecodeListSubscriptionsPageResponse(data []byte, request ListSubscriptionsPageRequest) (ListSubscriptionsPageResponse, error)

DecodeListSubscriptionsPageResponse validates a complete page against the request that produced it. Unknown fields remain forward compatible, while the current fields must be present, bounded, scoped and keyset ordered.

type ListSubscriptionsResponse added in v0.2.0

type ListSubscriptionsResponse struct {
	Subscriptions []SubscriptionJSON `json:"subscriptions"`
}

type Message

type Message struct {
	SeqNumber             int64             `json:"seq_number,omitempty"`
	EnqueuedAtMs          int64             `json:"enqueued_at_ms,omitempty"`
	ExpiresAtMs           int64             `json:"expires_at_ms,omitempty"`
	VisibleAtMs           int64             `json:"visible_at_ms,omitempty"`
	LockedUntilMs         int64             `json:"locked_until_ms,omitempty"`
	DeliveryCount         int               `json:"delivery_count,omitempty"`
	LockToken             string            `json:"lock_token,omitempty"`
	State                 string            `json:"state,omitempty"`
	DeadLetterReason      string            `json:"dead_letter_reason,omitempty"`
	DeadLetterDescription string            `json:"dead_letter_description,omitempty"`
	MessageID             string            `json:"message_id,omitempty"`
	CorrelationID         string            `json:"correlation_id,omitempty"`
	ReplyTo               string            `json:"reply_to,omitempty"`
	GroupID               string            `json:"group_id,omitempty"`
	ContentType           string            `json:"content_type,omitempty"`
	Subject               string            `json:"subject,omitempty"`
	Properties            map[string]string `json:"properties,omitempty"`
	Body                  []byte            `json:"body,omitempty"` // base64 in JSON
}

Message is the wire form of a message (both send input and receive output).

func FromEngineMessage

func FromEngineMessage(m *engine.Message) Message

func FromPeeked

func FromPeeked(p *engine.PeekedMessage) Message

func (Message) ToOut

func (m Message) ToOut() engine.OutMessage

type MetricsRequest

type MetricsRequest struct {
	Queue string `json:"queue"`
}

type MetricsResponse

type MetricsResponse struct {
	Queue              string `json:"queue"`
	Active             int64  `json:"active"`
	Locked             int64  `json:"locked"`
	Deferred           int64  `json:"deferred"`
	Scheduled          int64  `json:"scheduled"`
	DeadLettered       int64  `json:"dead_lettered"`
	Total              int64  `json:"total"`
	OldestMessageAgeMs int64  `json:"oldest_message_age_ms"`
}

type ObserveRequest added in v0.3.2

type ObserveRequest struct{}

ObserveRequest samples all queues and runtime measurements without returning message bodies, credentials, database paths or administrative configuration.

type ObserveResponse added in v0.3.2

type ObserveResponse struct {
	engine.ObservabilitySnapshot
	Version string          `json:"version"`
	Access  string          `json:"access"`
	HTTP    HTTPObservation `json:"http"`
}

ObserveResponse is the canonical observation shared by the SDK, CLI, console, MCP and Prometheus serializer. Access describes this request's visibility; it is not a metric. The HTTP domain is not_applicable in pure embedded mode.

func DecodeObserveResponse added in v0.3.2

func DecodeObserveResponse(data []byte) (ObserveResponse, error)

DecodeObserveResponse rejects incomplete observations instead of treating absent measurements as healthy zeros. Unknown fields remain forward compatible. Errors never include response contents, which may come from an untrusted HTTP peer.

type PeekRequest

type PeekRequest struct {
	Queue   string `json:"queue"`
	FromSeq int64  `json:"from_seq,omitempty"`
	State   string `json:"state,omitempty"`
	Max     int    `json:"max,omitempty"`
}

type PeekResponse

type PeekResponse struct {
	Messages []Message `json:"messages"`
}

type PurgeRequest

type PurgeRequest struct {
	Queue       string `json:"queue"`
	Max         int    `json:"max,omitempty"`
	OlderThanMs int64  `json:"older_than_ms,omitempty"`
}

type PurgeResponse

type PurgeResponse struct {
	Purged int `json:"purged"`
}

type QueueConfigJSON

type QueueConfigJSON struct {
	Kind               string `json:"kind,omitempty"`
	LockDurationMs     int64  `json:"lock_duration_ms,omitempty"`
	MaxDeliveryCount   int    `json:"max_delivery_count,omitempty"`
	DefaultTTLMs       int64  `json:"default_ttl_ms,omitempty"`
	DeadLetterOnExpire *bool  `json:"dead_letter_on_expire,omitempty"`
	DedupWindowMs      int64  `json:"dedup_window_ms,omitempty"`
	OrderingMode       string `json:"ordering_mode,omitempty"`
	// Per-queue DLQ retention overrides (MQLITE-29): 0 inherits the broker default,
	// >0 sets this queue's bound, -1 is explicitly unbounded.
	DLQMaxAgeMs int64 `json:"dlq_max_age_ms,omitempty"`
	DLQMaxCount int   `json:"dlq_max_count,omitempty"`
	DLQMaxBytes int64 `json:"dlq_max_bytes,omitempty"`
}

func (QueueConfigJSON) ToConfig

func (c QueueConfigJSON) ToConfig() engine.QueueConfig

type QueueInfoJSON

type QueueInfoJSON struct {
	State            string `json:"state"`
	Name             string `json:"name"`
	Kind             string `json:"kind"`
	LockDurationMs   int64  `json:"lock_duration_ms"`
	MaxDeliveryCount int    `json:"max_delivery_count"`
	DefaultTTLMs     int64  `json:"default_ttl_ms"`
	DedupWindowMs    int64  `json:"dedup_window_ms"`
}

type RPCLatencyObservation added in v0.3.2

type RPCLatencyObservation struct {
	RPC        string          `json:"rpc"`
	Buckets    []LatencyBucket `json:"buckets"`
	Count      uint64          `json:"count"`
	SumSeconds float64         `json:"sum_seconds"`
}

RPCLatencyObservation preserves the original post-authentication handler timing scope. Its finite buckets are cumulative; Count is also the +Inf bucket.

type ReceiveDeferredRequest

type ReceiveDeferredRequest struct {
	Queue      string  `json:"queue"`
	SeqNumbers []int64 `json:"seq_numbers"`
}

type ReceiveRequest

type ReceiveRequest struct {
	Queue       string `json:"queue"`
	MaxMessages int    `json:"max_messages,omitempty"`
	WaitTimeMs  int64  `json:"wait_time_ms,omitempty"`
	ReceiveMode int    `json:"receive_mode,omitempty"`       // 0=peek-lock, 1=receive-and-delete
	AttemptID   string `json:"receive_attempt_id,omitempty"` // idempotency key for retried receives
}

type ReceiveResponse

type ReceiveResponse struct {
	Messages []Message `json:"messages"`
}

func (*ReceiveResponse) UnmarshalJSON added in v0.4.3

func (r *ReceiveResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects a successful response that does not explicitly carry the claimed batch. A proxy-generated {} or {"messages":null} cannot be treated as an empty Receive: the broker may already have claimed messages for the attempt ID whose acknowledgement was damaged in transit.

type RedriveRequest

type RedriveRequest struct {
	Queue       string `json:"queue"`
	Target      string `json:"target,omitempty"`
	Max         int    `json:"max,omitempty"`
	OlderThanMs int64  `json:"older_than_ms,omitempty"`
	RatePerSec  int    `json:"rate_per_sec,omitempty"`
}

type RedriveResponse

type RedriveResponse struct {
	Moved int `json:"moved"`
}

type RenewBatchRequest added in v0.3.0

type RenewBatchRequest struct {
	Queue    string       `json:"queue"`
	Messages []SettleItem `json:"messages"`
}

RenewBatch extends many leases in one request. Renewing N messages with N separate Renew calls costs N round trips, which on a slow link outlasts the lease it is trying to save.

type RenewBatchResponse added in v0.3.0

type RenewBatchResponse struct {
	Results []SettleItemResult `json:"results"`
}

type RequestObservation added in v0.3.2

type RequestObservation struct {
	RPC             string  `json:"rpc"`
	Code            string  `json:"code"`
	Count           uint64  `json:"count"`
	DurationSeconds float64 `json:"duration_seconds"`
}

RequestObservation counts completed registered RPC requests, including auth rejection. DurationSeconds is cumulative elapsed time including authentication. Empty, successful Receive calls count as ok, even after a normal long poll.

type RevokeKeyRequest added in v0.3.1

type RevokeKeyRequest struct {
	ID string `json:"id"`
}

type RevokeKeyResponse added in v0.3.1

type RevokeKeyResponse struct {
	Ok bool `json:"ok"`
}

func DecodeRevokeKeyResponse added in v0.3.1

func DecodeRevokeKeyResponse(data []byte) (RevokeKeyResponse, error)

DecodeRevokeKeyResponse accepts only an explicit successful acknowledgement.

type SendMessage added in v0.4.1

type SendMessage struct {
	Message
	TTLMs int64 `json:"ttl_ms,omitempty"`
}

SendMessage is the send-only extension for a message in a mixed-TTL batch. Embedding keeps the JSON object flat without changing the released Message struct (and therefore without breaking its external unkeyed literals).

func (SendMessage) ToOut added in v0.4.1

func (m SendMessage) ToOut() engine.OutMessage

ToOut converts a send-only wire message to the engine form.

type SendRequest

type SendRequest struct {
	Queue                  string    `json:"queue"`
	Messages               []Message `json:"messages"`
	ScheduledEnqueueTimeMs int64     `json:"scheduled_enqueue_time_ms,omitempty"`
	TTLMs                  int64     `json:"ttl_ms,omitempty"`
}

type SendResponse

type SendResponse struct {
	SeqNumbers []int64 `json:"seq_numbers"`
}

SendResponse returns one sequence number per input message, positionally. In a multi-message batch a slot is 0 when that message hit a dedup conflict (same message_id, different body): the offending message is skipped so the rest of the batch still commits, and seq 0 marks the slot that was NOT enqueued. A single-message Send instead surfaces that conflict as a 409 (already_exists) rather than a 200 with a 0, so a non-batch client never has to special-case it.

func (*SendResponse) UnmarshalJSON added in v0.4.3

func (r *SendResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON rejects impossible acknowledgements while preserving sequence zero for topic publishes without a match and skipped batch dedup slots.

type SendWithMessageTTLsRequest added in v0.4.1

type SendWithMessageTTLsRequest struct {
	Queue                  string        `json:"queue"`
	Messages               []SendMessage `json:"messages"`
	ScheduledEnqueueTimeMs int64         `json:"scheduled_enqueue_time_ms,omitempty"`
	TTLMs                  int64         `json:"ttl_ms,omitempty"`
}

SendWithMessageTTLsRequest represents either the legacy request-level TTL or the additive per-message form on the same route; positive values must not be set in both places. The server decodes this superset, while clients continue to send SendRequest for a uniform batch.

type SettleItem added in v0.1.1

type SettleItem struct {
	SeqNumber int64  `json:"seq_number"`
	LockToken string `json:"lock_token"`
}

CompleteBatch settles many messages in one round-trip (fixes the drain N+1).

type SettleItemResult added in v0.1.1

type SettleItemResult struct {
	SeqNumber int64 `json:"seq_number"`
	Ok        bool  `json:"ok"`
	// LockedUntilMs: the deadline a RenewBatch committed (absent for other settle operations).
	// A renewing client needs it to know when to renew next.
	LockedUntilMs int64 `json:"locked_until_ms,omitempty"`
}

func (*SettleItemResult) UnmarshalJSON added in v0.4.3

func (r *SettleItemResult) UnmarshalJSON(data []byte) error

UnmarshalJSON requires every positional batch result to say whether its operation succeeded. Missing ok must not collapse into the bool zero value, which would incorrectly look like an explicit lock-loss result.

type SettleRequest

type SettleRequest struct {
	Queue                 string `json:"queue"`
	SeqNumber             int64  `json:"seq_number"`
	LockToken             string `json:"lock_token"`
	DeadLetterReason      string `json:"dead_letter_reason,omitempty"`
	DeadLetterDescription string `json:"dead_letter_description,omitempty"`
	DelayMs               int64  `json:"delay_ms,omitempty"` // Abandon backoff
}

type SettleResponse

type SettleResponse struct {
	Ok bool `json:"ok"`
}

func (*SettleResponse) UnmarshalJSON added in v0.4.3

func (r *SettleResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON preserves the distinction between an explicit negative acknowledgement and a malformed successful response that omitted ok.

type StatusResponse added in v0.2.0

type StatusResponse struct {
	Version       string `json:"version"`
	Backend       string `json:"backend"` // memory | local file | remote libSQL/Turso
	Remote        bool   `json:"remote"`
	Location      string `json:"location"`
	SchemaVersion string `json:"schema_version"`
	PingMs        int64  `json:"ping_ms"`       // SELECT 1 read round-trip; -1 if it failed
	DBSizeBytes   int64  `json:"db_size_bytes"` // local on-disk footprint; 0 for memory/remote
	Queues        int    `json:"queues"`
	Subscriptions int    `json:"subscriptions"`
	ServerTimeMs  int64  `json:"server_time_ms,omitempty"` // lifecycle clock near response assembly; absent means unavailable
	UptimeMs      int64  `json:"uptime_ms"`
	Auth          bool   `json:"auth"`
}

StatusResponse is a desensitized runtime snapshot (AdminService/Status). It never includes a connection string or auth token: `location` is a local path or a masked remote host.

type SubscribeRequest

type SubscribeRequest struct {
	Topic  string         `json:"topic"`
	Name   string         `json:"name"`
	Filter *engine.Filter `json:"filter,omitempty"`
}

type SubscribeWithOptionsRequest added in v0.4.0

type SubscribeWithOptionsRequest struct {
	Topic  string         `json:"topic"`
	Name   string         `json:"name"`
	Filter *engine.Filter `json:"filter,omitempty"`
	TTLMs  int64          `json:"ttl_ms,omitempty"`
}

SubscribeWithOptionsRequest adds optional fixed-lifetime creation to the existing Subscribe route. SubscribeRequest deliberately remains unchanged so released clients using keyed or unkeyed literals keep compiling unchanged.

func (*SubscribeWithOptionsRequest) UnmarshalJSON added in v0.4.0

func (r *SubscribeWithOptionsRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON distinguishes an omitted or explicit zero TTL from null. Both omission and zero mean permanent creation or preservation of an existing lifetime; positive integers request a fixed lifetime.

type SubscriptionJSON added in v0.2.0

type SubscriptionJSON struct {
	Topic string `json:"topic"`
	Name  string `json:"name"`
	Expr  string `json:"expr,omitempty"`
}

SubscriptionJSON is one topic→subscription mapping + its filter expression.

type SubscriptionPageJSON added in v0.4.0

type SubscriptionPageJSON struct {
	Topic       string `json:"topic"`
	Name        string `json:"name"`
	Expr        string `json:"expr,omitempty"`
	State       string `json:"state"`
	CreatedAtMs int64  `json:"created_at_ms"`
	ExpiresAtMs int64  `json:"expires_at_ms"`
}

SubscriptionPageJSON is one lifecycle-aware paged subscription entry.

type TestFilterRequest added in v0.2.0

type TestFilterRequest struct {
	Expr    string   `json:"expr"`
	Message *Message `json:"message,omitempty"`
}

TestFilter dry-runs a filter expression: it compiles `expr` and, if `message` is given, evaluates it (no enqueue). Message carries the sample (body base64, subject, properties, and optional enqueued_at_ms/visible_at_ms for time fields).

type TestFilterResponse added in v0.2.0

type TestFilterResponse struct {
	Valid   bool   `json:"valid"`
	Error   string `json:"error,omitempty"`
	Ran     bool   `json:"ran"`
	Matched bool   `json:"matched"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL