model

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 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 model defines the application's data models.

Package model defines the application's data models.

Index

Constants

View Source
const (
	DefinitionVhosts      = "vhosts"
	DefinitionUsers       = "users"
	DefinitionPermissions = "permissions"
	DefinitionQueues      = "queues"
	DefinitionExchanges   = "exchanges"
	DefinitionBindings    = "bindings"
	DefinitionPolicies    = "policies"
	DefinitionParameters  = "parameters"
)

The kinds of object a definitions document carries, as keys in its count map. They are stable identifiers the renderer labels rather than sentences.

View Source
const (
	SecretAccessKey = "accessKey"
	SecretSecretKey = "secretKey"
)

Secret keys the connection store uses.

They double as the legacy on-disk field names, which is what makes the migration a rename rather than a re-encryption: the stored ENC: values move across untouched and the user never re-enters a credential.

Reserved for RocketMQ's ACL, and not to be reused. They skip applyCredentials' generic loop and are written only through SetACL, so another family storing under these names has them silently cleared; and resolveACLCredentials fills them from global settings for any profile that named no mechanism. A cloud driver names its own - awsAccessKeyId and the like.

View Source
const (
	// CloseBehaviorMinimizeToTray hides the window and keeps the process alive
	// so the background collector keeps sampling.
	CloseBehaviorMinimizeToTray = "minimizeToTray"
	// CloseBehaviorQuit terminates the application.
	CloseBehaviorQuit = "quit"
)

Close behaviours for the main window.

View Source
const UIScaleAuto = "auto"

UIScaleAuto sizes the interface from the window instead of pinning a step.

View Source
const UnknownMetric = -1

UnknownMetric marks a numeric field no broker reported, so the UI renders "—" instead of an invented zero. A destination that genuinely has no partitions and one whose partition count failed to load are different things and must not look alike.

Variables

This section is empty.

Functions

func PermToInt

func PermToInt(perm TopicPerm) int

PermToInt converts a permission to its integer code.

func ValidUIScale

func ValidUIScale(value string) bool

ValidUIScale reports whether value names a step on the interface size ladder. Keep in step with FONT_SIZES in frontend/src/lib/uiScale.ts.

Types

type AccessConfig

type AccessConfig struct {
	AccessKey          string   `json:"accessKey"`
	SecretKey          string   `json:"secretKey"` // write-only; never sent back
	WhiteRemoteAddress string   `json:"whiteRemoteAddress"`
	IsAdmin            bool     `json:"isAdmin"`
	DefaultTopicPerm   string   `json:"defaultTopicPerm"`
	DefaultGroupPerm   string   `json:"defaultGroupPerm"`
	TopicPerms         []string `json:"topicPerms"`
	GroupPerms         []string `json:"groupPerms"`
}

AccessConfig is one access-control entry.

The shape follows RocketMQ ACL, the only implementation today. It is a struct rather than the eight positional arguments the service used, so a caller cannot silently transpose two permission lists.

type AccessPolicy

type AccessPolicy struct {
	Resource string   `json:"resource"` // a topic, a group, or the cluster
	Actions  []string `json:"actions"`  // PUB, SUB, and the family's own verbs
	Effect   string   `json:"effect"`   // Allow, Deny

	// SourceIPs narrows the rule to callers from these addresses. Empty means
	// any source.
	SourceIPs []string `json:"sourceIps"`

	// Decision is what the broker actually decided for this policy, which is
	// not always its effect - a later rule can override an earlier one.
	Decision string `json:"decision"`
}

AccessPolicy grants or denies actions on one resource.

type AccessPrincipal

type AccessPrincipal struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Status string `json:"status"`
}

AccessPrincipal is one identity the broker authenticates.

RocketMQ 5.3 calls it a user, Kafka a principal. Type and status stay the family's own words: what values they take differs per family, and normalising them would lose exactly what an operator has to type back.

type AccessPrincipalSpec

type AccessPrincipalSpec struct {
	Name   string `json:"name"`
	Secret string `json:"secret"`
	Type   string `json:"type"`
	Status string `json:"status"`
}

AccessPrincipalSpec creates or updates a principal.

Secret is write-only and never travels back: the broker stores it hashed and there is nothing to show even if it did.

type AccessRule

type AccessRule struct {
	Subject     string         `json:"subject"`
	Policies    []AccessPolicy `json:"policies"`
	Description string         `json:"description"`
}

AccessRule is everything one subject is permitted to do.

Identity-based rather than key-based, which is what separates it from AccessConfig: a rule names a subject the broker already knows, where an AccessConfig carries the credential and the permissions together.

type AckResult added in v0.0.5

type AckResult struct {
	// Acknowledged is how many of the named ids were actually owed. It is not
	// how many were asked for: acknowledging an id twice succeeds and settles
	// nothing.
	Acknowledged int64 `json:"acknowledged"`
}

AckResult is what an acknowledgement settled.

type AclUser added in v0.0.5

type AclUser struct {
	Name string `json:"name"`

	// Enabled is the on/off flag. A disabled user still exists with all its
	// rules, which is the difference between suspending an application and
	// removing it.
	Enabled bool `json:"enabled"`

	// NoPassword means the user authenticates with any password, or none. It
	// is not the same as having no passwords set: that user cannot log in at
	// all, and confusing the two is how a server is left open.
	NoPassword bool `json:"noPassword"`
	// PasswordCount is how many hashes are set. The hashes themselves never
	// leave the driver.
	PasswordCount int `json:"passwordCount"`

	// KeyPatterns, ChannelPatterns and CommandRules are Redis's own words,
	// passed through rather than interpreted: the rule language has more forms
	// than a UI can model, and rewriting one is how a permission changes
	// meaning on its way to the screen.
	KeyPatterns     []string `json:"keyPatterns"`
	ChannelPatterns []string `json:"channelPatterns"`
	CommandRules    string   `json:"commandRules"`

	// Selectors are the parenthesised groups a user may carry. They are shown
	// verbatim because nothing else here can express them.
	Selectors []string `json:"selectors"`

	// Rule is the whole line as the server stated it. It is what an operator
	// checks against, and the only form guaranteed to be complete.
	Rule string `json:"rule"`
}

AclUser is one principal the server authenticates, as Redis states it.

A third access model beside AccessAdmin's credential pairs and AccessDirectory's principals-and-rules. Redis puts everything on the user: what it may run, which keys it may touch, which channels it may subscribe to, and - since 7.0 - selectors granting a different set for a subset of keys. None of that fits a permission attached to a subject, and a page that showed only the command rules would hide the half that actually contains the data.

type AclUserSpec added in v0.0.5

type AclUserSpec struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`

	// Password is a new password. Empty keeps whatever is stored, which the
	// driver arranges by re-applying the existing hashes after the reset.
	Password string `json:"password"`
	// ClearPasswords removes every password, leaving a user that cannot
	// authenticate at all.
	ClearPasswords bool `json:"clearPasswords"`
	// NoPassword lets the user authenticate with anything. Deliberately
	// separate from having no password, which is the opposite outcome.
	NoPassword bool `json:"noPassword"`

	KeyPatterns     []string `json:"keyPatterns"`
	ChannelPatterns []string `json:"channelPatterns"`
	CommandRules    []string `json:"commandRules"`
}

AclUserSpec creates or replaces a user.

Replaces, not merges: SETUSER is additive by default, so an edit that removed a key pattern would leave it in place and the form would be lying about what it saved. The driver resets the user and applies the whole spec, which makes what is on screen what is on the server.

type AclVersionInfo

type AclVersionInfo struct {
	BrokerAddr  string `json:"brokerAddr"`
	BrokerName  string `json:"brokerName"`
	ClusterName string `json:"clusterName"`
	Version     string `json:"version"`
}

AclVersionInfo holds ACL config version information.

type AppSettings

type AppSettings struct {
	// General
	Theme           string `json:"theme"`           // Theme: "system" | "light" | "dark"
	Language        string `json:"language"`        // Language: "en" | "zh"
	UIScale         string `json:"uiScale"`         // Interface size: "auto" or a px step
	UIFont          string `json:"uiFont"`          // UI font
	MonospaceFont   string `json:"monospaceFont"`   // Monospace font
	AutoConnectLast bool   `json:"autoConnectLast"` // Auto-connect to last cluster on startup
	UpdatePolicy    string `json:"updatePolicy"`    // How far updates go on their own: "off" | "notify" | "download" | "auto"
	CloseBehavior   string `json:"closeBehavior"`   // Close behaviour: "minimizeToTray" | "quit"

	// Connection and network
	ConnectTimeoutMs int    `json:"connectTimeoutMs"` // Connect timeout (ms)
	RequestTimeoutMs int    `json:"requestTimeoutMs"` // Request timeout (ms)
	GlobalAccessKey  string `json:"globalAccessKey"`  // Default AccessKey
	GlobalSecretKey  string `json:"globalSecretKey"`  // Default SecretKey

	// Monitoring and alerts
	LagAlertThreshold    int  `json:"lagAlertThreshold"`    // Consumer lag alert threshold (0=disabled)
	DiskAlertThreshold   int  `json:"diskAlertThreshold"`   // CommitLog disk alert threshold percent (0=disabled)
	DesktopNotifications bool `json:"desktopNotifications"` // System notification on new alerts

	// Messages and display
	Timezone              string `json:"timezone"`              // Timezone: "local" | "utc"
	TimestampFormat       string `json:"timestampFormat"`       // Timestamp format: "datetime" | "ms"
	AutoFormatJson        bool   `json:"autoFormatJson"`        // Auto-format JSON
	MaxPayloadRenderBytes int    `json:"maxPayloadRenderBytes"` // Message truncation threshold (bytes)
	FetchLimit            int    `json:"fetchLimit"`            // Page fetch size
}

AppSettings holds application settings.

func DefaultSettings

func DefaultSettings() *AppSettings

DefaultSettings returns the default settings.

type AuthConfig

type AuthConfig struct {
	Mechanism AuthMechanism `json:"mechanism"`
}

AuthConfig carries the non-secret half of a connection's credentials. The secret half lives in ConnectionProfile.Secrets.

type AuthMechanism

type AuthMechanism string

AuthMechanism is how a connection authenticates.

const (
	AuthNone      AuthMechanism = "none"
	AuthACL       AuthMechanism = "acl" // RocketMQ AccessKey / SecretKey
	AuthPlain     AuthMechanism = "plain"
	AuthSASLPlain AuthMechanism = "sasl-plain"
	AuthSASLScram AuthMechanism = "sasl-scram"
	AuthToken     AuthMechanism = "token"
	AuthMutualTLS AuthMechanism = "mtls"

	// AuthNKey is a challenge signed with an Ed25519 seed, and AuthCreds is
	// that seed packaged with a JWT in a file the client library reads.
	//
	// Neither is a variation on the pairs above. A token is a shared string the
	// server compares; an nkey proves possession of a private key against a
	// nonce the server issues, and a creds file additionally carries the claims
	// that say what the bearer may do. NATS is the family that has them.
	AuthNKey  AuthMechanism = "nkey"
	AuthCreds AuthMechanism = "creds"
)

type AutoClaimRequest added in v0.0.5

type AutoClaimRequest struct {
	Ref       SubscriptionRef `json:"ref"`
	Consumer  string          `json:"consumer"`
	MinIdleMs int64           `json:"minIdleMs"`
	// Start is where to resume from, for walking a long pending list. Empty
	// starts at the beginning.
	Start string `json:"start"`
	Count int    `json:"count"`
}

AutoClaimRequest moves whatever has been idle too long, without naming ids.

type Binding

type Binding struct {
	ID          int    `json:"id"` // list key for the renderer
	Namespace   string `json:"namespace"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	// DestinationKind separates a queue target from an exchange target; the
	// same source and name can bind to both.
	DestinationKind string            `json:"destinationKind"`
	RoutingKey      string            `json:"routingKey"`
	Arguments       map[string]string `json:"arguments"`

	// PropertiesKey is the broker's own identifier for this binding, and the
	// only way to delete one. A binding has no name, and the same source,
	// destination and routing key can exist more than once with different
	// arguments - so anything a caller made up would delete a different
	// binding or none. It comes back with the listing.
	PropertiesKey string `json:"propertiesKey"`
}

Binding is a route from an exchange to a queue or another exchange.

Only RabbitMQ has first-class bindings, which is why the canonical page set has no counterpart for them and the driver contributes a page of its own.

type BrokerCensus added in v0.0.2

type BrokerCensus struct {
	ClusterName    string `json:"clusterName"`
	Version        string `json:"version"`
	RuntimeVersion string `json:"runtimeVersion"`

	Queues      int `json:"queues"`
	Exchanges   int `json:"exchanges"`
	Connections int `json:"connections"`
	Channels    int `json:"channels"`
	Consumers   int `json:"consumers"`

	// Ready is deliverable now, Unacknowledged is with a consumer that has not
	// acked yet. Total is what the broker holds and is not always their sum:
	// it counts messages in states neither covers.
	Ready          int64 `json:"ready"`
	Unacknowledged int64 `json:"unacknowledged"`
	Total          int64 `json:"total"`

	Rates BrokerRates `json:"rates"`
}

BrokerCensus is a broker-wide snapshot: how many of each object exists, how much is sitting in queues, and how fast messages are moving through.

It is separate from ClusterOverview because the two answer different questions. ClusterOverview is the topology - how many nodes, how many are up - and every family has one. This is the broker's own running total, which only a family with a single endpoint that aggregates the cluster can report; RabbitMQ's management API is one, and RocketMQ has no counterpart.

Counts a family does not report carry UnknownMetric rather than zero, so the page renders an em dash instead of a measurement that was never taken.

type BrokerHealth added in v0.0.2

type BrokerHealth struct {
	Checks             []*HealthCheck       `json:"checks"`
	Alarms             []*ResourceAlarm     `json:"alarms"`
	FeatureFlags       []*FeatureFlag       `json:"featureFlags"`
	DeprecatedFeatures []*DeprecatedFeature `json:"deprecatedFeatures"`
}

BrokerHealth is everything a cluster page asks beyond the node list.

type BrokerNode

type BrokerNode struct {
	ID                    int        `json:"id"`                    // Node ID
	Cluster               string     `json:"cluster"`               // Cluster name
	BrokerName            string     `json:"brokerName"`            // Broker name
	BrokerID              int        `json:"brokerId"`              // Broker ID
	Role                  BrokerRole `json:"role"`                  // Role (MASTER/SLAVE)
	Address               string     `json:"address"`               // Primary address
	HAAddress             string     `json:"haAddress"`             // HA address
	Version               string     `json:"version"`               // Version
	Status                NodeStatus `json:"status"`                // Node status
	Topics                int        `json:"topics"`                // Topic count
	Groups                int        `json:"groups"`                // Consumer group count
	TpsIn                 int        `json:"tpsIn"`                 // Inbound TPS
	TpsOut                int        `json:"tpsOut"`                // Outbound TPS
	TpsHistoryTimestamps  []int64    `json:"tpsHistoryTimestamps"`  // Unix-second timestamps for TPS history
	TpsInHistory          []int      `json:"tpsInHistory"`          // Inbound TPS history
	TpsOutHistory         []int      `json:"tpsOutHistory"`         // Outbound TPS history
	MsgInToday            int64      `json:"msgInToday"`            // Messages in today
	MsgOutToday           int64      `json:"msgOutToday"`           // Messages out today
	CommitLogDiskUsage    int        `json:"commitLogDiskUsage"`    // CommitLog disk usage percent
	ConsumeQueueDiskUsage int        `json:"consumeQueueDiskUsage"` // ConsumeQueue disk usage percent
	LastUpdate            string     `json:"lastUpdate"`            // Last update time
	Remark                string     `json:"remark"`                // Remark
}

BrokerNode holds Broker node information.

type BrokerRates added in v0.0.2

type BrokerRates struct {
	Publish   float64 `json:"publish"`
	Deliver   float64 `json:"deliver"`
	Ack       float64 `json:"ack"`
	Redeliver float64 `json:"redeliver"`
	// Unroutable is publishes that matched no binding. It has no counterpart
	// in a family that publishes straight to a destination, and it is the
	// first thing worth knowing when messages "disappear" on a topology whose
	// bindings are wrong.
	Unroutable float64 `json:"unroutable"`
}

BrokerRates is messages per second, as the broker computes them over its own sampling window rather than as anything measured here.

type BrokerRole

type BrokerRole string

BrokerRole is the Broker role.

const (
	RoleMaster BrokerRole = "MASTER"
	RoleSlave  BrokerRole = "SLAVE"
)

type Capabilities

type Capabilities struct {
	Supported []Capability `json:"supported"`

	// Degraded explains a capability the family has but this endpoint lacks.
	// A RocketMQ Proxy endpoint is a data plane only, so it reports no topic
	// listing, no cluster topology and no ACL.
	Degraded map[Capability]string `json:"degraded"`

	// Caveats annotates a capability that works but has a consequence worth
	// warning about. Browsing a RabbitMQ queue goes through basic.get, which
	// alters queue state even when the message is requeued.
	Caveats map[Capability]string `json:"caveats"`
}

Capabilities is what one live connection can actually do.

Three states reach the UI, and they must stay distinguishable: a capability in Supported renders normally; one in Degraded renders disabled with the reason; one in neither is hidden outright. Silent absence and explained absence look identical to a user otherwise, which makes a deliberately limited endpoint read as a bug.

func NewCapabilities

func NewCapabilities(supported ...Capability) Capabilities

NewCapabilities builds a capability set with no degraded entries or caveats.

func (Capabilities) Caveat

func (c Capabilities) Caveat(capability Capability) (string, bool)

Caveat returns the warning attached to a supported capability.

func (Capabilities) DegradedReason

func (c Capabilities) DegradedReason(capability Capability) (string, bool)

DegradedReason returns why an unsupported capability is missing here.

func (Capabilities) Has

func (c Capabilities) Has(capability Capability) bool

Has reports whether the connection supports the capability.

func (Capabilities) WithCaveat

func (c Capabilities) WithCaveat(capability Capability, caveat string) Capabilities

WithCaveat returns a copy that keeps capability supported but warns about it.

func (Capabilities) WithDegraded

func (c Capabilities) WithDegraded(capability Capability, reason string) Capabilities

WithDegraded returns a copy that reports capability as unavailable here. It also drops it from Supported, so the two can never disagree.

type Capability

type Capability string

Capability names one operation the UI gates on.

The values cross the bridge and are matched as literals in the renderer, so renaming one means changing frontend/src/mq/capabilities.ts in the same commit.

const (
	CapDestinationList   Capability = "destination.list"
	CapDestinationCreate Capability = "destination.create"
	CapDestinationUpdate Capability = "destination.update"
	CapDestinationDelete Capability = "destination.delete"
	CapPartitions        Capability = "destination.partitions"

	// CapShards is a family whose destination is divided into parts that are
	// objects rather than indexes.
	//
	// Distinct from CapPartitions, and the distinction is not a shade of
	// meaning. That capability's page is built around a partition number and
	// the read range at it, which is all every family that has one reports. A
	// Kinesis shard is named, owns the slice of the hash space that decides
	// which records land on it, and is changed by being split or merged rather
	// than resized - which leaves the old shard in place, closed, still
	// holding its records and named as its children's parent. A page built for
	// a number would drop exactly that.
	CapShards Capability = "destination.shards"

	// CapChannels is a family whose clients and peers reach it only through a
	// named, configured object that exists whether or not anything is using
	// it.
	//
	// Distinct from CapClientInspect, and the distinction is not a shade of
	// meaning. That capability's page lists the transport connections open
	// right now: each appears when an application connects, disappears when it
	// goes, and is addressed by a peer address. An IBM MQ channel is a
	// definition an administrator made. It exists with nothing connected, it
	// is what decides whether a connection is allowed at all, one definition
	// can have hundreds of running instances, and a message channel can sit in
	// doubt over a batch with no client anywhere near it. A page built for
	// connections would be empty on a queue manager whose applications are all
	// idle, which is exactly when somebody is looking for why they cannot
	// connect.
	CapChannels Capability = "channel.list"

	// CapDestinationPurge empties a destination without deleting it, and
	// CapDestinationMove drains one into another. Separate capabilities
	// because they are separate buttons with very different blast radii: one
	// discards, the other relocates.
	CapDestinationPurge Capability = "destination.purge"
	CapDestinationMove  Capability = "destination.move"

	// CapQueueRebalance spreads replicated destinations' leaders back across
	// the cluster. Only a family that elects a leader per destination has it.
	CapQueueRebalance Capability = "destination.rebalance"

	// CapStreamTrim discards entries from the head of a destination that keeps
	// a log, by count or by position, and deletes named entries outright.
	//
	// Distinct from CapDestinationPurge, which empties a destination in one
	// call and is the whole of what it can do. A trim is a bound the operator
	// chooses, and emptying is one setting of it - a family with this needs no
	// separate purge, and offering both would be two controls for one command.
	CapStreamTrim Capability = "destination.trim"

	CapSubscriptionList   Capability = "subscription.list"
	CapSubscriptionCreate Capability = "subscription.create"
	CapSubscriptionDelete Capability = "subscription.delete"
	CapSubscriptionLag    Capability = "subscription.lag"
	CapOffsetReset        Capability = "subscription.resetOffset"
	// CapOffsetClone is copying one subscription's read position onto another.
	// It is not CapOffsetReset: reset moves a group in time, this hands a
	// second group the first one's exact per-queue positions.
	CapOffsetClone Capability = "subscription.cloneOffset"
	// CapQueueOffset is writing one queue's read position directly. Distinct
	// from CapOffsetReset, which moves a whole subscription to a moment in
	// time and lets the broker find each queue's position for itself.
	CapQueueOffset Capability = "subscription.queueOffset"
	// CapSubscriptionPosition is moving a subscription to a named place in the
	// log rather than to a moment in time.
	//
	// Distinct from CapOffsetReset for a reason that is not cosmetic: a stream
	// entry's id is milliseconds plus a sequence within them, so a timestamp
	// cannot pick between entries sharing a millisecond, and has no way to
	// spell "the end" at all. A family whose positions are ids needs to say
	// which id.
	CapSubscriptionPosition Capability = "subscription.position"
	// CapSubscriptionRuntime is asking a connected consumer what it is doing:
	// which queues it holds and how fast it is getting through them. Only a
	// live client can answer, so a family without client introspection - or a
	// group with nothing connected - simply has no answer.
	CapSubscriptionRuntime Capability = "subscription.runtime"

	// CapPendingEntries is a family that keeps, per subscription, a list of
	// what it has handed out and not had acknowledged.
	//
	// It answers the same page as CapDLQ and CapDeadLetterTopology and cannot
	// do it their way. A dead letter is a message that was given up on and
	// moved somewhere; a pending entry is a delivery record - an id, who holds
	// it, how long they have held it and how many times it has been tried -
	// and the entry itself never moves.
	CapPendingEntries Capability = "message.pending"
	// CapPendingAdmin is acting on that list: acknowledging entries so they
	// stop being owed, and moving them to another consumer. Separate from
	// reading it, because taking work from a consumer that is merely busy is a
	// different permission and a different mistake.
	CapPendingAdmin Capability = "message.pendingAdmin"

	CapMessageQuery  Capability = "message.query"
	CapMessageByID   Capability = "message.byId"
	CapMessageTrack  Capability = "message.track"
	CapMessageResend Capability = "message.resend"
	// CapMessageReplay is handing one message back to one connected consumer
	// and reporting what its handler returned. Distinct from CapMessageResend,
	// which puts a copy back on the retry path for whoever picks it up.
	CapMessageReplay   Capability = "message.replay"
	CapMessageLiveTail Capability = "message.liveTail"
	// CapLiveStream is following what a broker pushes rather than what it
	// stores. Distinct from CapMessageLiveTail, which is an incremental read
	// of a durable log: a family can have one and not the other, and MQTT has
	// no log to tail at all.
	CapLiveStream Capability = "message.liveStream"
	CapDLQ        Capability = "message.dlq"
	CapPublish    Capability = "message.publish"

	// CapPublishRich is a send console that can set what the family's own
	// protocol carries - an exchange and routing key, headers, and the
	// delivery guarantees - rather than only a destination and a body.
	CapPublishRich Capability = "message.publishRich"
	// CapEntryPublish is a send console for a family whose message is an
	// ordered set of named fields rather than a body.
	//
	// A third shape beside CapPublish and CapPublishRich, and it has to be:
	// the first is a topic with tags, keys and a delay level, the second is an
	// exchange with a routing key and AMQP properties, and neither has
	// anywhere to put a field list or an explicit id.
	CapEntryPublish Capability = "message.publishEntry"
	// CapProducerInspect is asking who is currently publishing. It needs a
	// producer group to ask about: the broker tracks connections per group and
	// offers no way to enumerate the groups themselves.
	CapProducerInspect Capability = "message.producerInspect"
	// CapDelayedDelivery is scheduling a message for later. RocketMQ has delay
	// levels, Kafka has nothing, RabbitMQ needs a plugin.
	CapDelayedDelivery Capability = "message.delayedDelivery"

	CapClusterTopology Capability = "cluster.topology"
	// CapDirectory is listing the discovery tier a cluster is reached
	// through. Families whose nodes find each other have no such tier and do
	// not report it.
	CapDirectory Capability = "cluster.directory"
	// CapNodeConfig is reading the effective settings of a node or of the
	// cluster's discovery tier - what they are actually running with, which is
	// not always what their config files say.
	CapNodeConfig Capability = "cluster.nodeConfig"
	// CapNodeMaintenance is running a broker's own housekeeping on demand -
	// reclaiming space the broker would otherwise get to on its own schedule.
	CapNodeMaintenance Capability = "cluster.nodeMaintenance"
	// CapNodeWritePerm is taking a node out of the write path and putting it
	// back, which is how a broker is drained before it is stopped.
	CapNodeWritePerm  Capability = "cluster.writePerm"
	CapClusterMetrics Capability = "cluster.metrics"

	// CapReassign is rewriting where a destination's replicas live. Only a
	// family whose placement is data an administrator can edit has it, and
	// only Kafka's is: the replica list is a field, and the cluster copies the
	// log to its new home in the background.
	CapReassign Capability = "destination.reassign"

	// CapTransactions is a family whose producers can write across partitions
	// atomically, and whose unfinished transactions hold readers back. Only a
	// family with that mechanism has anything to report.
	CapTransactions Capability = "transaction.list"

	// CapQuotaList and CapQuotaAdmin are limits attached to a client rather
	// than to a destination - what one user, application or address may do to
	// the cluster as a whole. Only a family that throttles by identity has
	// them.
	CapQuotaList  Capability = "quota.list"
	CapQuotaAdmin Capability = "quota.admin"

	// CapSlowLog is a broker that keeps a record of the commands that took
	// longest.
	//
	// Distinct from CapNodeConfig, which is what a node is running with: this
	// is what has actually been slow on it, and it is the first thing anyone
	// looks at when a server is fine on every other figure and still not
	// keeping up.
	CapSlowLog Capability = "cluster.slowLog"

	// CapLogDirs is a broker that reports what its partitions occupy on disk.
	// Distinct from CapNodeConfig, which is what a node is running with: this
	// is where its space has gone, and it is the only disk figure Kafka has -
	// the protocol reports no free space and no percentage anywhere.
	CapLogDirs Capability = "cluster.logDirs"

	// CapClusterCensus is a broker that keeps its own running totals - object
	// counts, queued depth and message rates for the whole cluster in one
	// answer. A family whose figures can only be assembled by walking every
	// destination does not have it.
	CapClusterCensus Capability = "cluster.census"

	// CapClientInspect is a broker that can name the transport connections and
	// channels open against it. Families that expose producers and consumers
	// but not the sessions underneath them do not have it.
	CapClientInspect Capability = "client.inspect"

	// CapClientClose disconnects a client from the broker. Separate from
	// inspecting them: a monitoring user can list every connection and close
	// none.
	CapClientClose Capability = "client.close"

	// CapClusterHealth is a broker that answers questions about its own
	// health, rather than one whose health has to be inferred from its
	// metrics.
	CapClusterHealth Capability = "cluster.health"

	// CapDeadLetterTopology is a family whose dead-letter queues are ordinary
	// queues something else points at, found by walking the topology, rather
	// than a per-group topic the broker names for you. Both answer the same
	// page; neither can answer it the other's way.
	CapDeadLetterTopology Capability = "message.dlqTopology"
	CapAccessControl      Capability = "access.control"
	// CapAccessDirectory is identity-based access control: principals the
	// broker authenticates and rules attached to a subject. Distinct from
	// CapAccessControl, which is the credential-carrying kind a broker will
	// take a write for and never read back.
	CapAccessDirectory Capability = "access.directory"

	// CapAclUsers is a broker whose access control lives entirely on the user:
	// what it may run, which keys it may touch, which channels it may
	// subscribe to.
	//
	// A third model beside CapAccessControl's credential pairs and
	// CapAccessDirectory's rules attached to a subject. Redis attaches
	// everything to the principal, including the key patterns that decide what
	// data it can reach - and a page built for either of the others would show
	// the commands and hide the half that contains the data.
	CapAclUsers Capability = "access.aclUsers"

	// CapNamespaceList and CapNamespaceAdmin are families whose namespaces are
	// objects rather than labels - a RabbitMQ virtual host holds its own
	// queues, exchanges, policies and permissions, and nothing crosses
	// between two of them.
	CapNamespaceList  Capability = "namespace.list"
	CapNamespaceAdmin Capability = "namespace.admin"
	// CapNamespaceLimits caps a namespace as a whole rather than one
	// destination inside it.
	CapNamespaceLimits Capability = "namespace.limits"

	// CapIdentityList and CapIdentityAdmin are a broker that keeps its own
	// users, as opposed to one that authenticates against a credential pair
	// stored in a config file. CapIdentityPermissions is the second half of
	// that: what a user may touch, which RabbitMQ keeps separately from what
	// it may administer.
	CapIdentityList        Capability = "identity.list"
	CapIdentityAdmin       Capability = "identity.admin"
	CapIdentityPermissions Capability = "identity.permissions"

	// CapPolicyList and CapPolicyAdmin are settings applied to destinations by
	// pattern rather than at declaration. Only a family whose destinations are
	// otherwise immutable needs them, which is what makes them RabbitMQ's.
	CapPolicyList  Capability = "policy.list"
	CapPolicyAdmin Capability = "policy.admin"
	// CapParameterAdmin reads and removes the component configuration the
	// broker stores for its plugins.
	CapParameterAdmin Capability = "parameter.admin"

	// CapDefinitions is a broker that can hand back its whole topology as one
	// document and take it back. It is the only backup some families offer of
	// anything but message data.
	CapDefinitionsExport Capability = "definitions.export"
	CapDefinitionsImport Capability = "definitions.import"

	// CapReplication is moving messages between brokers - shovels and
	// federation. It is the capability most likely to be reported as degraded
	// rather than absent: both are plugins, so a broker that could do this
	// perfectly well simply has not been asked to.
	CapReplication Capability = "replication.admin"

	// CapStreamClients is who is reading and writing a stream over a protocol
	// that is not the family's main one. Degraded rather than absent for the
	// same reason as replication: it is a plugin.
	CapStreamClients Capability = "stream.clients"
	CapRouting       Capability = "routing.exchanges"

	// CapRoutingAdmin creates and deletes exchanges and bindings. Separate
	// from reading them: a connection may list a topology it has no permission
	// to change.
	CapRoutingAdmin Capability = "routing.admin"

	// CapConnectionScope is a family whose connection carries a scope that is
	// a naming convention rather than a broker object - a RocketMQ namespace
	// is a prefix the client puts on every resource it names.
	//
	// Distinct from CapNamespaceList, whose namespaces are objects one page
	// browses. This one re-points the whole connection, every page at once,
	// which is why the shell offers the switch and no page does.
	CapConnectionScope Capability = "connection.scope"
)

type Channel added in v0.1.0

type Channel struct {
	Name string      `json:"name"`
	Type ChannelType `json:"type"`

	// Description is what the definition says about itself.
	Description string `json:"description"`

	// ConnectionName is where this channel dials, or where its running
	// instance connected from - which of the two depends on the type, and the
	// difference is worth keeping rather than splitting into two fields
	// nobody could fill for the other half. A sender's is configured; a
	// receiver's exists only while something is connected.
	ConnectionName string `json:"connectionName"`

	// TransmissionQueue is the queue a sender or server channel drains.
	// Empty on every other type, and empty on a sender is a misconfiguration
	// rather than a default.
	TransmissionQueue string `json:"transmissionQueue"`

	// Status is the definition's overall state. Where several instances are
	// running it is the one furthest from healthy, because a page showing
	// "running" for a definition with one instance retrying would hide the
	// only row worth looking at.
	Status ChannelStatus `json:"status"`

	// Substate is what a running instance is waiting on - receiving, sending,
	// committing, resolving a name. It is the field that separates a channel
	// that is busy from one that is stuck, and both report "running".
	Substate string `json:"substate"`

	// Instances is how many are running. A server-connection channel is one
	// definition and one instance per connected application, so this is the
	// only place a client count appears for this family.
	Instances int `json:"instances"`

	// RemoteQueueManager is what answered at the other end. Empty until a
	// channel has connected at least once, which is why a sender that has
	// never worked shows a connection name and no partner.
	RemoteQueueManager string `json:"remoteQueueManager"`

	// Messages, BytesSent and BytesReceived are this instance's totals since
	// it started, not the definition's lifetime. They reset when a channel
	// restarts, which is worth knowing before reading a zero as "never used".
	// UnknownMetric where nothing is running.
	Messages      int64 `json:"messages"`
	BytesSent     int64 `json:"bytesSent"`
	BytesReceived int64 `json:"bytesReceived"`

	// StartedAt is when the running instance started, as the queue manager
	// spells it. It is text rather than an instant because MQ prints its own
	// local date and clock with no zone at all.
	StartedAt string `json:"startedAt"`
	// LastMessageAt is when a message last crossed. Empty on a channel that
	// has carried none, which on a sender that is running is the interesting
	// case.
	LastMessageAt string `json:"lastMessageAt"`

	// InDoubt is a message channel that sent a batch and never learned whether
	// the other end committed it. Nothing else on any page reports it, and it
	// is the state that needs a human: the batch is neither delivered nor
	// resendable until somebody resolves it.
	InDoubt bool `json:"inDoubt"`

	// StopRequested is an operator having asked a running channel to stop,
	// which it will do at the end of its current batch. Without it a channel
	// that is quietly winding down looks identical to one that is working.
	StopRequested bool `json:"stopRequested"`
}

Channel is one channel definition and the aggregate state of its instances.

type ChannelStatus added in v0.1.0

type ChannelStatus string

ChannelStatus is what a channel is doing now.

Empty means the queue manager reported no status at all, which is not the same as stopped: a channel that has never been started has no status object, and a client-connection channel never has one. The distinction is the whole value of the page - "inactive" is normal for a channel nobody uses, and "retrying" on the same channel means something is wrong.

const (
	ChannelInactive     ChannelStatus = "inactive"
	ChannelRunning      ChannelStatus = "running"
	ChannelStarting     ChannelStatus = "starting"
	ChannelBinding      ChannelStatus = "binding"
	ChannelInitializing ChannelStatus = "initializing"
	ChannelRetrying     ChannelStatus = "retrying"
	ChannelStopping     ChannelStatus = "stopping"
	ChannelStopped      ChannelStatus = "stopped"
	ChannelPaused       ChannelStatus = "paused"
	ChannelRequesting   ChannelStatus = "requesting"
	ChannelSwitching    ChannelStatus = "switching"
)

type ChannelType added in v0.1.0

type ChannelType string

ChannelType is which direction a channel works in, and what is at the other end. The values are the family's own words, lower-camelled by the API.

const (
	// ChannelServerConnection is how a client application connects. It is the
	// one type with no partner queue manager: an application connects to it,
	// and there may be hundreds of instances of one definition at once.
	ChannelServerConnection ChannelType = "serverConnection"
	// ChannelClientConnection is the other half of that pair, and it is a
	// definition this queue manager holds on behalf of clients rather than one
	// it runs. It never has a status.
	ChannelClientConnection ChannelType = "clientConnection"

	// The message channels, which move messages between queue managers. A
	// sender drains a transmission queue towards a receiver; a server and a
	// requester are the same pair started from the other end.
	ChannelSender    ChannelType = "sender"
	ChannelReceiver  ChannelType = "receiver"
	ChannelServer    ChannelType = "server"
	ChannelRequester ChannelType = "requester"

	// The cluster pair, which a queue manager starts for itself: a cluster
	// sender is often defined automatically from a repository's information
	// rather than by an administrator.
	ChannelClusterSender   ChannelType = "clusterSender"
	ChannelClusterReceiver ChannelType = "clusterReceiver"

	// ChannelAMQP is the queue manager's AMQP 1.0 listener, which is a channel
	// here for the same reason a server-connection channel is: it is where a
	// client arrives.
	ChannelAMQP ChannelType = "amqp"
)

type ClaimRequest added in v0.0.5

type ClaimRequest struct {
	Ref SubscriptionRef `json:"ref"`
	// Consumer is the new owner. It need not exist yet - claiming creates it,
	// which is how a replacement worker takes over from a dead one.
	Consumer string   `json:"consumer"`
	IDs      []string `json:"ids"`
	// MinIdleMs refuses to claim anything touched more recently than this. It
	// is the guard against taking work from a consumer that is simply busy:
	// zero claims regardless, which is a choice rather than a default.
	MinIdleMs int64 `json:"minIdleMs"`
}

ClaimRequest moves named entries to another consumer.

type ClaimResult added in v0.0.5

type ClaimResult struct {
	// Claimed are the entries that changed owner.
	Claimed []string `json:"claimed"`

	// Deleted are ids that were in the pending list and no longer in the
	// stream - trimmed or XDEL'd while owed to somebody. An auto-claim drops
	// them from the pending list, and reporting them is the only way an
	// operator learns that work was lost rather than moved.
	Deleted []string `json:"deleted"`

	// NextStart is where a further auto-claim would resume. "0-0" means the
	// walk reached the end.
	NextStart string `json:"nextStart"`
}

ClaimResult is what a claim moved.

type ClientChannel added in v0.0.2

type ClientChannel struct {
	Name       string `json:"name"`
	Number     int    `json:"number"`
	Connection string `json:"connection"`

	Namespace string `json:"namespace"`
	User      string `json:"user"`
	Node      string `json:"node"`

	// There is deliberately no state field. The management API reports one but
	// the client library does not model it, and the two flags that matter -
	// flow-blocked and idle-since - are here in full, so deriving a word from
	// them would be inventing a field rather than reporting one.
	Consumers     int `json:"consumers"`
	PrefetchCount int `json:"prefetchCount"`

	// Unacknowledged is delivered and not yet acked. Unconfirmed is published
	// and not yet confirmed back to the publisher. They are the two sides of
	// in-flight work and fail for opposite reasons.
	Unacknowledged int `json:"unacknowledged"`
	Unconfirmed    int `json:"unconfirmed"`

	// Confirms and Transactional are the two delivery guarantees a channel can
	// be in, and they are mutually exclusive in AMQP.
	Confirms      bool `json:"confirms"`
	Transactional bool `json:"transactional"`

	// FlowBlocked is the broker telling this channel to stop publishing. It is
	// the single most useful field here: a publisher that has slowed down for
	// no apparent reason is usually looking at this.
	FlowBlocked bool `json:"flowBlocked"`

	// IdleSince is when the channel last did anything, as the broker spells
	// it. Empty means it is busy now.
	IdleSince string `json:"idleSince"`
}

ClientChannel is one multiplexed session inside a connection.

A channel is where the interesting failure lives: prefetch and unacknowledged counts are per channel, and a consumer that has stopped acknowledging shows up here long before the queue depth makes it obvious.

type ClientConnection added in v0.0.2

type ClientConnection struct {
	// Name is the broker's own identifier, of the form "host:port -> host:port".
	// It is what a close request names, so it is the key rather than a label.
	Name string `json:"name"`
	// ClientName is what the application called itself, or "" when it said
	// nothing. Most libraries send nothing, which is why the peer address
	// stays the primary identifier.
	ClientName string `json:"clientName"`

	Namespace string `json:"namespace"`
	User      string `json:"user"`
	Node      string `json:"node"`
	PeerHost  string `json:"peerHost"`
	PeerPort  int    `json:"peerPort"`

	// Protocol is the wire protocol this connection speaks. A broker with the
	// MQTT or STOMP plugins on carries connections that are not AMQP at all,
	// and treating them alike would misreport both.
	Protocol string `json:"protocol"`
	State    string `json:"state"`
	Channels int    `json:"channels"`

	// TLS is whether the transport is encrypted, and Cipher names how. An
	// empty cipher on a TLS connection means the broker did not report one.
	TLS    bool   `json:"tls"`
	Cipher string `json:"cipher"`

	// HeartbeatSec is what the two sides negotiated. Zero means heartbeats are
	// off, which is worth seeing: a connection with none can sit half-open
	// through a network partition and look healthy from both ends.
	HeartbeatSec int `json:"heartbeatSec"`

	RecvBytes    int64   `json:"recvBytes"`
	SendBytes    int64   `json:"sendBytes"`
	RecvByteRate float64 `json:"recvByteRate"`
	SendByteRate float64 `json:"sendByteRate"`

	// ConnectedAtMs is when the connection was established, in Unix
	// milliseconds, or 0 when the broker did not report it.
	ConnectedAtMs int64 `json:"connectedAtMs"`

	// BlockedBy is why the broker last stopped this connection publishing -
	// a resource alarm, usually memory or disk. Empty means it was never
	// blocked.
	BlockedBy string `json:"blockedBy"`

	// Attributes carries family-specific detail the canonical fields have no
	// home for, the same way Destination, Subscription and Node do. Two
	// families arrived at it independently, which is the argument for it being
	// here: MQTT's session state - clean start, session expiry, the queued and
	// in-flight counts, whether the session outlives the connection - is the
	// whole substance of one of its clients, and Redis reports what a
	// connection was last running, how long it has been idle and which library
	// it is. Its keys are a contract between one driver and that driver's
	// frontend module.
	Attributes map[string]string `json:"attributes"`
}

ClientConnection is one application's connection to the broker.

It has no counterpart in the canonical vocabulary on purpose. RocketMQ and Kafka expose producers and consumers, which are roles; this is the transport underneath them, and an operator uses it for a different job - finding which host is holding a connection open, which one is being throttled, and which one to close when an application will not let go.

func (*ClientConnection) Attribute added in v0.0.5

func (c *ClientConnection) Attribute(key string) string

Attribute returns a driver-specific field.

type ClientQuota added in v0.0.3

type ClientQuota struct {
	// Entity is the identity this quota applies to, one component per
	// dimension, sorted so two equal quotas read the same.
	Entity []QuotaEntity `json:"entity"`

	// Limits are Kafka's own keys - producer_byte_rate, consumer_byte_rate,
	// request_percentage, controller_mutation_rate - passed through as given.
	// This app does not curate the list: a cluster knows keys this build has
	// never heard of.
	Limits map[string]float64 `json:"limits"`
}

ClientQuota caps what one client may do to a cluster.

Only Kafka has this shape: a limit is attached to an entity - a user, a client id, an IP address, or a combination - rather than to a destination, and an entity with no name is the default every unmatched client falls back to. That default is the whole reason the model needs a flag rather than an empty string: a quota on the user named "" and the quota every user without one of their own inherits are different rows.

type CloneOffsetRequest

type CloneOffsetRequest struct {
	From string `json:"from"`
	To   string `json:"to"`

	// Destination narrows the copy to one topic. Empty copies every topic the
	// source group reads.
	Destination string `json:"destination"`

	// FromOffline reads the source's positions from stored offsets rather than
	// from its live consumers. Required when the source group is already shut
	// down, which is the ordinary case during a migration.
	FromOffline bool `json:"fromOffline"`
}

CloneOffsetRequest copies one subscription's read position onto another.

The usual reason is standing up a replacement consumer group without replaying everything the old one already handled: the new group starts exactly where the old one is.

type ClusterInfo

type ClusterInfo struct {
	ClusterName   string        `json:"clusterName"`   // Cluster name
	TotalBrokers  int           `json:"totalBrokers"`  // Total Broker count
	OnlineBrokers int           `json:"onlineBrokers"` // Online Broker count
	TotalTopics   int           `json:"totalTopics"`   // Total Topic count
	TotalGroups   int           `json:"totalGroups"`   // Total consumer group count
	AvgDiskUsage  int           `json:"avgDiskUsage"`  // Average disk usage percent
	NameServers   []string      `json:"nameServers"`   // NameServer list
	Brokers       []*BrokerNode `json:"brokers"`       // Broker list
}

ClusterInfo holds cluster overview information.

type ClusterOverview

type ClusterOverview struct {
	Name          string `json:"name"`
	TotalNodes    int    `json:"totalNodes"`
	OnlineNodes   int    `json:"onlineNodes"`
	Destinations  int    `json:"destinations"` // UnknownMetric when not enumerable
	Subscriptions int    `json:"subscriptions"`
	AvgDiskUsage  int    `json:"avgDiskUsage"` // percent; UnknownMetric when not reported

	// Attributes carries family-specific detail the canonical header has no
	// field for, the same way Node and Destination do. Kafka's health is
	// counted in partitions - under-replicated, offline, leaderless - which no
	// other family has and which is the whole reason its overview exists.
	Attributes map[string]string `json:"attributes"`
}

ClusterOverview is the aggregate the Cluster page header shows.

func (*ClusterOverview) Attribute added in v0.0.3

func (o *ClusterOverview) Attribute(key string) string

Attribute returns a driver-specific field.

type Connection

type Connection struct {
	ID         int              `json:"id"`         // Connection ID
	Name       string           `json:"name"`       // Connection name
	Group      string           `json:"group"`      // Free-form group label; empty means ungrouped
	NameServer string           `json:"nameServer"` // NameServer address
	TimeoutSec int              `json:"timeoutSec"` // Timeout in seconds
	EnableACL  bool             `json:"enableACL"`  // Whether ACL authentication is enabled
	AccessKey  string           `json:"accessKey"`  // ACL AccessKey
	SecretKey  string           `json:"secretKey"`  // ACL SecretKey
	Status     ConnectionStatus `json:"status"`     // Connection status
	LastCheck  string           `json:"lastCheck"`  // Last health-check time
	IsDefault  bool             `json:"isDefault"`  // Whether this is the default connection
	Remark     string           `json:"remark"`     // Remark
}

Connection holds connection configuration.

type ConnectionProfile

type ConnectionProfile struct {
	ID         int              `json:"id"`
	Name       string           `json:"name"`
	Group      string           `json:"group"` // free-form label; empty means ungrouped
	Kind       MQKind           `json:"kind"`
	Endpoints  string           `json:"endpoints"` // driver parses; replaces NameServer
	TimeoutSec int              `json:"timeoutSec"`
	Auth       AuthConfig       `json:"auth"`
	Status     ConnectionStatus `json:"status"`
	LastCheck  string           `json:"lastCheck"`
	IsDefault  bool             `json:"isDefault"`
	Remark     string           `json:"remark"`

	// Options holds non-secret driver-specific settings, validated against the
	// driver's form schema. It is what lets a new family add fields without
	// changing the stored schema.
	Options map[string]string `json:"options"`

	// Secrets is encrypted at rest and never leaves the Go process. The bridge
	// replaces it with the list of configured key names.
	Secrets map[string]string `json:"-"`
}

ConnectionProfile is one saved connection, of any family.

It replaces Connection, whose NameServer / EnableACL / AccessKey / SecretKey fields were RocketMQ concepts sitting in the shared schema.

func (*ConnectionProfile) ACLEnabled

func (p *ConnectionProfile) ACLEnabled() bool

ACLEnabled reports whether the profile authenticates with a key pair.

func (*ConnectionProfile) Clone

Clone returns a deep copy, so a caller cannot mutate stored state through the maps it hands back.

func (*ConnectionProfile) ConfiguredSecrets

func (p *ConnectionProfile) ConfiguredSecrets() []string

ConfiguredSecrets lists the credential keys that hold a value. It is what the bridge sends instead of the secrets themselves, so a form can show "already set" without the value ever reaching the renderer.

The result is sorted: map order would otherwise change between calls and make the renderer re-render on an unchanged connection.

func (*ConnectionProfile) Option

func (p *ConnectionProfile) Option(key string) string

Option returns a driver-specific setting.

func (*ConnectionProfile) Secret

func (p *ConnectionProfile) Secret(key string) string

Secret returns a stored credential.

func (*ConnectionProfile) SetACL

func (p *ConnectionProfile) SetACL(enabled bool, accessKey, secretKey string)

SetACL sets the mechanism and the key pair together.

They are one decision, not three: a profile with the ACL mechanism and no keys, or keys with the mechanism off, are both states nothing should be able to produce. Turning ACL off clears the stored keys rather than orphaning them.

func (*ConnectionProfile) SetOption

func (p *ConnectionProfile) SetOption(key, value string)

SetOption stores a driver-specific setting, creating the map on first use.

func (*ConnectionProfile) SetSecret

func (p *ConnectionProfile) SetSecret(key, value string)

SetSecret stores a credential, creating the map on first use. An empty value removes the key, so ConfiguredSecrets never reports a blank one.

type ConnectionRecord

type ConnectionRecord struct {
	ConnectionProfile
	Secrets map[string]string `json:"secrets,omitempty"`

	// Read on load, never written. A file written before broker kinds existed
	// carries these instead of endpoints, auth and secrets.
	LegacyNameServer string `json:"nameServer,omitempty"`
	LegacyEnableACL  bool   `json:"enableACL,omitempty"`
	LegacyAccessKey  string `json:"accessKey,omitempty"`
	LegacySecretKey  string `json:"secretKey,omitempty"`
}

ConnectionRecord is the serialisable form of a profile.

ConnectionProfile.Secrets is json:"-" so a credential can never reach the renderer by accident. Anything that deliberately persists or exports a profile goes through this record instead, which carries the secrets explicitly and still reads the pre-kind field names on the way in.

func NewConnectionRecord

func NewConnectionRecord(profile *ConnectionProfile) *ConnectionRecord

NewConnectionRecord prepares a profile for storage.

func (*ConnectionRecord) Profile

func (r *ConnectionRecord) Profile() *ConnectionProfile

Profile applies the pre-kind compatibility rules and returns the profile.

Secrets are passed through as stored: the ENC: values move across untouched, which is what keeps the migration from asking anyone to re-enter a credential.

func (*ConnectionRecord) Secret

func (r *ConnectionRecord) Secret(key string) string

Secret returns a stored credential.

It shadows the embedded profile's accessor deliberately: a record keeps its credentials in its own map, and reading through the embedded profile would always find nothing.

func (*ConnectionRecord) SetSecret

func (r *ConnectionRecord) SetSecret(key, value string)

SetSecret stores a credential on the record.

type ConnectionStatus

type ConnectionStatus string

ConnectionStatus is the connection status.

const (
	StatusOnline  ConnectionStatus = "online"
	StatusOffline ConnectionStatus = "offline"
)

type ConsumeMode

type ConsumeMode string

ConsumeMode is the consume mode.

const (
	// ModeUnknown is a group whose message model nobody has reported yet.
	// Only a connected client knows it, so an idle group keeps this.
	ModeUnknown      ConsumeMode = ""
	ModeClustering   ConsumeMode = "CLUSTERING"
	ModeBroadcasting ConsumeMode = "BROADCASTING"
)

type ConsumeThroughput

type ConsumeThroughput struct {
	Destination string `json:"destination"`

	PullLatencyMs    float64 `json:"pullLatencyMs"`
	PullRate         float64 `json:"pullRate"`
	ConsumeLatencyMs float64 `json:"consumeLatencyMs"`
	SuccessRate      float64 `json:"successRate"`
	FailureRate      float64 `json:"failureRate"`
	FailedMessages   int64   `json:"failedMessages"`
}

ConsumeThroughput is one destination's consume rates for one client.

type ConsumerGroupConfig

type ConsumerGroupConfig struct {
	Group       string      `json:"group"`       // Consumer group name
	Cluster     string      `json:"cluster"`     // Cluster name
	BrokerAddr  string      `json:"brokerAddr"`  // Broker address
	ConsumeMode ConsumeMode `json:"consumeMode"` // Consume mode
	MaxRetry    int         `json:"maxRetry"`    // Max retry times
	Topics      []string    `json:"topics"`      // Subscribed Topic list
	Remark      string      `json:"remark"`      // Remark
}

ConsumerGroupConfig holds consumer group create/update configuration.

type ConsumerGroupItem

type ConsumerGroupItem struct {
	ID            int         `json:"id"`            // Consumer group ID
	Group         string      `json:"group"`         // Consumer group name
	Cluster       string      `json:"cluster"`       // Cluster name
	ConsumeMode   ConsumeMode `json:"consumeMode"`   // Consume mode
	Status        GroupStatus `json:"status"`        // Status
	OnlineClients int         `json:"onlineClients"` // Online client count
	TopicCount    int         `json:"topicCount"`    // Subscribed Topic count
	Lag           int64       `json:"lag"`           // Message lag
	RetryQps      int         `json:"retryQps"`      // Retry QPS
	DLQ           int         `json:"dlq"`           // Dead-letter count
	MaxRetry      int         `json:"maxRetry"`      // Max retry times
	// BroadcastEnabled is the stored consumeBroadcastEnable permission, not
	// ConsumeMode: one is what the group is allowed to do, the other what a
	// connected client reports it is doing.
	BroadcastEnabled bool                `json:"broadcastEnabled"`
	LastUpdate       string              `json:"lastUpdate"`    // Last update time
	Remark           string              `json:"remark"`        // Remark
	Subscriptions    []GroupSubscription `json:"subscriptions"` // Subscription list
	Clients          []GroupClient       `json:"clients"`       // Client list
}

ConsumerGroupItem holds consumer group information.

type DeadLetterQueue added in v0.0.2

type DeadLetterQueue struct {
	Namespace string `json:"namespace"`
	// Name is the queue dead letters land in. It has no special status on the
	// broker - it is an ordinary queue that something else points at.
	Name  string `json:"name"`
	Depth int64  `json:"depth"`
	// Consumers is how many are draining it. A dead-letter queue with a
	// consumer is a retry pipeline; one without is a backlog nobody is
	// looking at, which is the case worth surfacing.
	Consumers int `json:"consumers"`

	// Sources are the queues whose dead-letter exchange routes here, and the
	// reason this queue matters. A dead-letter queue with no sources is one
	// whose producers were deleted or reconfigured, and it will never receive
	// anything again.
	Sources []*DeadLetterSource `json:"sources"`
}

DeadLetterQueue is a queue that receives what other queues could not keep.

It is not the shape DeadLetterReader describes, and that is the point. RocketMQ gives every consumer group a dead-letter topic of its own, named after it, so a group name is enough to find one. RabbitMQ has no such thing: a queue is declared with a dead-letter exchange, that exchange routes like any other, and whatever it routes to becomes a dead-letter queue by convention rather than by declaration. Finding one means walking the topology backwards.

type DeadLetterSource added in v0.0.2

type DeadLetterSource struct {
	Queue string `json:"queue"`
	// Subscription is which reader of the source queue dead-lettered, where
	// the family attaches the policy to a subscriber rather than to the queue.
	// A Pulsar dead-letter topic is named "<topic>-<subscription>-DLQ", so
	// without this the page could name the topic and not who gave up on it -
	// and one topic read by five subscriptions has five separate answers.
	//
	// Empty on RabbitMQ, where the policy belongs to the queue itself.
	Subscription string `json:"subscription"`
	// Exchange is what the source queue was declared to dead-letter through.
	Exchange string `json:"exchange"`
	// RoutingKey is the key the message is re-published with. Empty means the
	// message keeps its original routing key, which is the default and changes
	// where it lands.
	RoutingKey string `json:"routingKey"`
}

DeadLetterSource is one queue that dead-letters into another.

type Definitions added in v0.0.2

type Definitions struct {
	// Namespace is set when the export was scoped to one virtual host, and
	// empty for a whole-broker export.
	Namespace string `json:"namespace"`
	// Document is the JSON itself, laid out for reading.
	Document string `json:"document"`
	// Counts is what it contains, by kind. It is what makes an otherwise
	// opaque file reviewable before it is applied somewhere else.
	Counts map[string]int `json:"counts"`
}

Definitions is a broker's whole topology, minus the messages.

It is the only backup RabbitMQ offers of anything but message data, and it is what a cluster is rebuilt from: virtual hosts, users and permissions, queues, exchanges, bindings, policies and parameters in one document.

type DeprecatedFeature added in v0.0.2

type DeprecatedFeature struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// Phase is how far along the removal is: permitted by default, denied by
	// default, disconnected, or removed.
	Phase      string `json:"phase"`
	ProvidedBy string `json:"providedBy"`
	DocURL     string `json:"docUrl"`
	// InUse is set when the broker reports this feature is actually being
	// used on this cluster, which turns it from background into a work item.
	InUse bool `json:"inUse"`
}

DeprecatedFeature is something this cluster still allows that a later release will not.

The list of what is deprecated is background; the list of what is deprecated *and in use here* is a work item, which is why the two are reported separately rather than as one list with a flag.

type Destination

type Destination struct {
	ID  int            `json:"id"` // list key for the renderer, not broker data
	Ref DestinationRef `json:"ref"`

	Partitions  int   `json:"partitions"`  // UnknownMetric where the family has none
	Subscribers int   `json:"subscribers"` // consumer groups, subscriptions or consumers
	Depth       int64 `json:"depth"`       // messages held; UnknownMetric when not reported
	RateIn      int   `json:"rateIn"`      // messages per second in
	RateOut     int   `json:"rateOut"`     // messages per second out

	LastUpdated string            `json:"lastUpdated"`
	Attributes  map[string]string `json:"attributes"`
}

Destination is a topic, queue or stream as the canonical pages see it.

Attributes carries whatever the family has and the canonical model does not: RocketMQ permissions and queue counts, RabbitMQ durability and queue type, Kafka replication factor. Its keys are a contract between one driver's Go side and that driver's frontend module, not part of the shared vocabulary.

func (*Destination) Attribute

func (d *Destination) Attribute(key string) string

Attribute returns a driver-specific field.

type DestinationFilter

type DestinationFilter struct {
	Namespace       string `json:"namespace"`
	IncludeInternal bool   `json:"includeInternal"`
}

DestinationFilter narrows a destination listing.

IncludeInternal covers the objects every family hides by default and names differently: RocketMQ system topics, RabbitMQ amq.* exchanges, Kafka's __consumer_offsets.

type DestinationRef

type DestinationRef struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

DestinationRef identifies a destination across families.

Flat families leave Namespace empty; Pulsar fills tenant/namespace and RabbitMQ fills the vhost. It is a struct rather than a string because joining and re-splitting those parts loses information for any name that contains the separator.

type DestinationSpec

type DestinationSpec struct {
	Ref        DestinationRef    `json:"ref"`
	Partitions int               `json:"partitions"` // ignored where unsupported
	Attributes map[string]string `json:"attributes"`
}

DestinationSpec is a create or update request.

type DriverDescriptor

type DriverDescriptor struct {
	Kind        MQKind      `json:"kind"`
	DefaultPort string      `json:"defaultPort"`
	Form        []FormField `json:"form"`

	// MaxCapabilities is the best case for the family. A live connection can
	// only narrow it, never widen it, and the driver conformance test asserts
	// every entry is backed by an implemented interface.
	MaxCapabilities []Capability `json:"maxCapabilities"`

	// ScopeOption names the option field the shell's scope switcher writes,
	// for a family that declares CapConnectionScope. Empty everywhere else:
	// a connection whose scope is a broker object is not re-pointed by
	// editing its profile.
	ScopeOption string `json:"scopeOption"`
}

DriverDescriptor is what a family can do before any connection is open.

Display strings are deliberately absent: the renderer resolves them from the i18n bundle under mq.<kind>.*, so translations stay where translations live.

func (DriverDescriptor) RequiresEndpoints added in v0.1.0

func (d DriverDescriptor) RequiresEndpoints() bool

RequiresEndpoints reports whether the family must be given an address. Hosted families declare no endpoint field: they are reached by a region and a credential.

type ExchangeSpec added in v0.0.2

type ExchangeSpec struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	// Type is direct, fanout, topic or headers, and cannot be changed once
	// declared.
	Type       string `json:"type"`
	Transient  bool   `json:"transient"`
	AutoDelete bool   `json:"autoDelete"`
	// Arguments as JSON, so alternate-exchange and anything a plugin
	// understands arrive with their types intact.
	Arguments string `json:"arguments"`
}

ExchangeSpec declares an exchange.

Transient rather than Durable, so the zero value is the safe one: an exchange that survives a restart. A transient exchange disappears with the node and takes its bindings with it.

type FeatureFlag added in v0.0.2

type FeatureFlag struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// State is the broker's own word - "enabled", "disabled", "unavailable".
	State      string `json:"state"`
	Stability  string `json:"stability"`
	ProvidedBy string `json:"providedBy"`
	DocURL     string `json:"docUrl"`
}

FeatureFlag is a behaviour change that has to be enabled before the cluster can use it, and cannot be turned off again once it is.

It matters on a page about nodes because a flag that is not enabled everywhere blocks a rolling upgrade: the cluster cannot move to a version that requires it until every node agrees.

type FederationUpstream added in v0.0.2

type FederationUpstream struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	// URI has its password removed.
	URI []string `json:"uri"`

	// Exchange and Queue are which of the two this upstream federates, and
	// exactly one of them is set.
	Exchange string `json:"exchange"`
	Queue    string `json:"queue"`
	// MaxHops stops a federation loop between brokers from carrying a message
	// forever.
	MaxHops int    `json:"maxHops"`
	AckMode string `json:"ackMode"`

	// State is the running link's status, and Error is why it is not running.
	// An upstream is configuration; a link is a connection that either works
	// or explains itself.
	State string `json:"state"`
	Error string `json:"error"`
}

FederationUpstream is another broker this one pulls from.

Different from a shovel in what it is for: a shovel moves messages once, from somewhere to somewhere; federation keeps two brokers' exchanges or queues in step continuously.

type FieldCond

type FieldCond struct {
	Field  string   `json:"field"`
	Equals []string `json:"equals"`
}

FieldCond hides a field unless another field holds one of Equals.

type FieldTarget

type FieldTarget string

FieldTarget says which part of a ConnectionProfile a field writes into. Secrets are encrypted at rest and never serialised back to the renderer.

const (
	TargetEndpoints FieldTarget = "endpoints"
	TargetOption    FieldTarget = "option"
	TargetSecret    FieldTarget = "secret"
	TargetAuth      FieldTarget = "auth"
)

type FieldType

type FieldType string

FieldType is how the renderer draws one connection-form field.

const (
	FieldText         FieldType = "text"
	FieldPassword     FieldType = "password"
	FieldNumber       FieldType = "number"
	FieldSelect       FieldType = "select"
	FieldSwitch       FieldType = "switch"
	FieldEndpointList FieldType = "endpoint-list"
)

type FormField

type FormField struct {
	Key         string       `json:"key"`
	Target      FieldTarget  `json:"target"`
	Type        FieldType    `json:"type"`
	LabelKey    string       `json:"labelKey"` // i18n key, never a literal
	Placeholder string       `json:"placeholder"`
	Default     string       `json:"default"`
	Required    bool         `json:"required"`
	VisibleWhen *FieldCond   `json:"visibleWhen"`
	Options     []FormOption `json:"options"`

	// Validate names a validator the renderer already implements, such as
	// "host-port" or "url". Shipping a regex across the bridge would move
	// validation logic out of review and into data.
	Validate string `json:"validate"`
}

FormField is one row of a driver's connection form.

type FormOption

type FormOption struct {
	Value    string `json:"value"`
	LabelKey string `json:"labelKey"`
}

FormOption is one choice in a select field.

type GroupClient

type GroupClient struct {
	ClientID      string `json:"clientId"`      // Client ID
	IP            string `json:"ip"`            // IP address
	Version       string `json:"version"`       // Version
	LastHeartbeat string `json:"lastHeartbeat"` // Last heartbeat time
}

GroupClient holds consumer client information.

type GroupConsumer added in v0.0.5

type GroupConsumer struct {
	Name string `json:"name"`
	// Pending is how many entries this consumer has been handed and not
	// acknowledged. They are its responsibility until it acknowledges them or
	// somebody claims them away.
	Pending int64 `json:"pending"`
	// IdleMs is how long since it last read anything. A high idle with a
	// pending count above zero is the shape of a consumer that died holding
	// work.
	IdleMs int64 `json:"idleMs"`
	// InactiveMs is how long since it last did anything at all, which Redis
	// tracks separately: a consumer polling an empty stream is idle but not
	// inactive. Redis 7.2 and later; zero on an older server.
	InactiveMs int64 `json:"inactiveMs"`
}

GroupConsumer is one member of a consumer group.

It is not the canonical SubscriptionClient, and cannot be: that is a set of queue assignments with a broker and a queue id, pull and consume latencies, and a locked flag for ordered delivery. A group consumer has a name, how much it is holding, and how long it has been quiet - and filling the other shape would mean inventing every field but one.

It is also not model.StreamConsumer, which is RabbitMQ's: a client attached over the stream protocol, with a connection, a peer host and an offset. The two are different objects that both reasonably answer to "stream consumer", which is why neither name is shared.

type GroupStatus

type GroupStatus string

GroupStatus is the consumer group status.

const (
	GroupOnline  GroupStatus = "online"
	GroupWarning GroupStatus = "warning"
	GroupOffline GroupStatus = "offline"
)

type GroupSubscription

type GroupSubscription struct {
	Topic      string `json:"topic"`      // Topic name
	Expression string `json:"expression"` // Filter expression
	ConsumeTps int    `json:"consumeTps"` // Consume TPS
}

GroupSubscription is a subscription relationship.

type HealthCheck added in v0.0.2

type HealthCheck struct {
	// ID is a stable key the UI labels from, not a sentence.
	ID string `json:"id"`
	// Passed is false when the check failed and unknown when the broker could
	// not run it at all, which is why Unavailable exists rather than a third
	// value here.
	Passed bool `json:"passed"`
	// Unavailable means this endpoint is not on this broker - an older
	// version, or a check that needs a plugin. It reads differently from a
	// failure and must not be shown as one.
	Unavailable bool   `json:"unavailable"`
	Reason      string `json:"reason"`
}

HealthCheck is one question the broker answers about itself.

RabbitMQ's health endpoints are deliberately narrow: each asks one thing and answers ok or not, with a sentence when not. Collapsing them into a single "healthy" flag would throw away the only part an operator can act on, which is which check failed and what it said.

type Identity added in v0.0.2

type Identity struct {
	Name string `json:"name"`
	// Tags gate the management API: administrator, monitoring, policymaker,
	// management. They have nothing to do with the permissions below - a user
	// with every tag and no permission can read every page and touch no queue.
	Tags []string `json:"tags"`
	// HasPassword is false for a user that can only authenticate another way,
	// which is a deliberate configuration rather than a broken one. The
	// password itself never comes back.
	HasPassword bool `json:"hasPassword"`

	// Permissions is what this identity may do inside each namespace.
	Permissions []*NamespacePermission `json:"permissions"`
}

Identity is a principal the broker authenticates.

It is not AccessConfig and not AccessPrincipal. RocketMQ's plain_acl entry carries a key, a secret and its permissions together, and 5.3's auth store keeps rules attached to a subject; RabbitMQ keeps a user with tags in one place and its per-virtual-host permissions in another, and the tags decide what the management API lets it do while the permissions decide what its AMQP connections may touch. Those are two different systems on one name, and flattening them would lose which one is refusing an operation.

type IdentitySpec added in v0.0.2

type IdentitySpec struct {
	Name string   `json:"name"`
	Tags []string `json:"tags"`
	// Password sets a new one. Empty means leave whatever is stored alone,
	// which is what lets tags be edited without knowing it.
	Password string `json:"password"`
	// WithoutPassword asks for an identity that cannot authenticate with one
	// at all - correct for certificate or OAuth authentication.
	//
	// It is a separate flag rather than an empty password because the two are
	// opposite instructions and the broker has no way to express "keep it":
	// its update endpoint replaces the whole user, so leaving the field out
	// removes the password rather than preserving it.
	WithoutPassword bool `json:"withoutPassword"`
}

IdentitySpec creates or updates an identity.

type LiveBatch added in v0.0.5

type LiveBatch struct {
	// Messages are oldest first, which is the order a stream appends in.
	Messages []*LiveMessage `json:"messages"`
	// Cursor is what to pass next time. It advances even when nothing came
	// back, so a caller that polls a quiet stream does not re-ask for the
	// same window forever.
	Cursor int64 `json:"cursor"`
	// Dropped is every message this stream discarded because the buffer was
	// full when it arrived — a running total, not a delta, so a caller that
	// polls irregularly still sees the whole loss. A stream that is quietly
	// losing messages and one that is quiet look the same without it.
	Dropped int64 `json:"dropped"`
	// Received is the running total the stream has seen.
	Received int64 `json:"received"`
	// Live mirrors LiveSubscription.Live at the moment of the poll.
	Live bool `json:"live"`
}

LiveBatch is one poll's worth of a stream.

type LiveFilter added in v0.0.5

type LiveFilter struct {
	// Pattern is the family's own filter syntax, unparsed. MQTT's + and #
	// wildcards mean nothing to another family, and translating them into a
	// neutral form would only lose the difference between them.
	Pattern string `json:"pattern"`
	// Options are the family's per-filter settings — for MQTT, the QoS to
	// subscribe at.
	Options map[string]string `json:"options"`
}

LiveFilter is one pattern a stream subscribes to.

type LiveMessage added in v0.0.5

type LiveMessage struct {
	// Seq orders the stream and is what the caller hands back to ask for more.
	// It is unique within one subscription and means nothing outside it.
	Seq int64 `json:"seq"`
	// Destination is where the message was actually published, which a
	// wildcard subscription cannot infer from the filter that matched it.
	Destination string `json:"destination"`
	// Filter is which of the subscription's filters matched, so a stream
	// watching several can be read back apart.
	Filter     string `json:"filter"`
	ReceivedAt string `json:"receivedAt"`
	Body       string `json:"body"`
	// Truncated says the body was cut to the driver's per-message limit. A
	// silently shortened payload reads as a malformed message.
	Truncated bool `json:"truncated"`
	// Attributes carry what the family puts on a message — for MQTT, the QoS,
	// the retain flag and the 5.0 properties.
	Attributes map[string]string `json:"attributes"`
}

LiveMessage is one message as it arrived.

type LiveSubscription added in v0.0.5

type LiveSubscription struct {
	ID        string       `json:"id"`
	Filters   []LiveFilter `json:"filters"`
	StartedAt string       `json:"startedAt"`
	// Received is every message this stream has seen, including any it later
	// had to drop.
	Received int64 `json:"received"`
	Dropped  int64 `json:"dropped"`
	// Live is false once the session behind the stream dropped. The stream
	// itself survives — a reconnect resubscribes it — so this is the
	// difference between "nothing is being published" and "we stopped
	// listening", which look identical otherwise.
	Live bool `json:"live"`
}

LiveSubscription is one stream that was started.

type LiveSubscriptionSpec added in v0.0.5

type LiveSubscriptionSpec struct {
	Filters []LiveFilter `json:"filters"`
	// Buffer is how many messages to hold between two polls. Zero takes the
	// driver's default. It is a bound on memory, and the reason Dropped below
	// has to be reported rather than assumed to be zero.
	Buffer int `json:"buffer"`
}

LiveSubscriptionSpec asks a connection to start streaming.

type LogDirPartition added in v0.0.3

type LogDirPartition struct {
	Broker    int32  `json:"broker"`
	Dir       string `json:"dir"`
	Topic     string `json:"topic"`
	Partition int32  `json:"partition"`
	Size      int64  `json:"size"`
	OffsetLag int64  `json:"offsetLag"`

	// IsFuture marks a replica being moved into this directory. Until the move
	// finishes the broker holds two copies of the partition.
	IsFuture bool `json:"isFuture"`
}

LogDirPartition is one partition's footprint on disk.

type LogDirSummary added in v0.0.3

type LogDirSummary struct {
	Broker int32  `json:"broker"`
	Path   string `json:"path"`
	Size   int64  `json:"size"`

	Partitions int `json:"partitions"`

	// OffsetLag summed over the partitions here. Non-zero on a directory being
	// moved into, which is the case an operator watches this for.
	OffsetLag int64 `json:"offsetLag"`

	// Err is why this directory could not be described, empty when it could.
	// A directory that failed is not counted in any total: a disk that cannot
	// answer must not make a cluster look smaller than it is.
	Err string `json:"err"`
}

LogDirSummary is one directory a broker stores partitions in.

Kafka is the only family that reports this, and it reports only what is occupied: there is no free space and no percentage anywhere in its protocol. A cluster page therefore shows a size and not a meter, which is the honest rendering of what the broker knows.

type MQKind

type MQKind string

MQKind identifies a broker family.

The values are the key for the driver registry, the per-kind settings defaults and the `kind` field in connections.json, so they are part of the on-disk format and must not be renamed.

const (
	KindRocketMQ    MQKind = "rocketmq"
	KindKafka       MQKind = "kafka"
	KindRabbitMQ    MQKind = "rabbitmq"
	KindPulsar      MQKind = "pulsar"
	KindActiveMQ    MQKind = "activemq"
	KindRedisStream MQKind = "redis-stream"
	KindNATS        MQKind = "nats"
	KindNSQ         MQKind = "nsq"
	KindMQTT        MQKind = "mqtt"

	// Hosted families authenticate through Options and Secrets rather than
	// Endpoints: there is no broker address to dial, only a region and a
	// credential.
	KindSQS             MQKind = "sqs"
	KindGooglePubSub    MQKind = "google-pubsub"
	KindAzureServiceBus MQKind = "azure-servicebus"
	KindKinesis         MQKind = "kinesis"
	KindIBMMQ           MQKind = "ibmmq"
	KindSolace          MQKind = "solace"
)

func KnownKinds

func KnownKinds() []MQKind

KnownKinds lists every family the vocabulary covers, in the order the UI offers them. A kind being listed here does not mean a driver is registered for it; the driver registry is the authority on what can actually connect.

func (MQKind) DisplayName

func (k MQKind) DisplayName() string

DisplayName spells the family for a reader. An unknown kind is its own name: a profile stored by a newer build should still be nameable by an older one.

type MaintenanceTask

type MaintenanceTask string

MaintenanceTask is a housekeeping job a node can be asked to run now.

The set is closed rather than a free-form command string: these reclaim disk and cannot be undone, so what the UI can trigger has to be enumerable and reviewable, not whatever a caller types.

const (
	// TaskCleanExpiredQueues drops consume queues whose messages have already
	// aged out of the log. Safe: it removes only what is already unreadable.
	TaskCleanExpiredQueues MaintenanceTask = "cleanExpiredQueues"

	// TaskCleanUnusedTopics drops queue files for topics no longer in the
	// route table. A topic deleted moments ago may still be in use by a
	// producer that has not refreshed its route.
	TaskCleanUnusedTopics MaintenanceTask = "cleanUnusedTopics"

	// TaskDeleteExpiredLogs forces the commit log retention sweep to run now
	// instead of at its scheduled hour. This is the destructive one: it
	// deletes message data that is past retention but may still be within
	// what someone expected to be able to replay.
	TaskDeleteExpiredLogs MaintenanceTask = "deleteExpiredLogs"

	// TaskSnapshot writes the dataset to disk now rather than at whatever
	// point the save rules would next reach. It removes nothing: a server that
	// has been running a while with no save rule has everything in memory and
	// nothing on disk, and this is what closes that gap before a restart.
	TaskSnapshot MaintenanceTask = "snapshot"

	// TaskRewriteAppendLog compacts the append-only file into the smallest set
	// of commands that rebuilds the same dataset. It reclaims disk without
	// losing anything, which is the opposite of a retention sweep.
	TaskRewriteAppendLog MaintenanceTask = "rewriteAppendLog"
)

func KnownMaintenanceTasks

func KnownMaintenanceTasks() []MaintenanceTask

KnownMaintenanceTasks lists the retention sweeps, for the dialog that offers them.

It is not every task in the vocabulary, and must not become one. What a node can be asked to run differs by family, and a dialog offering the union would put controls in front of an operator that their broker refuses - so a family with tasks of its own names them on its own board. The two Redis has are not here for that reason: they are additive rather than sweeps, and the dialog this feeds confirms every entry as though it deleted something.

func (MaintenanceTask) Destructive

func (t MaintenanceTask) Destructive() bool

Destructive reports whether a task removes message data rather than only reclaiming what is already unreachable. The UI confirms those differently.

type MessageItem

type MessageItem struct {
	ID             int               `json:"id"`             // Message sequence number
	Cluster        string            `json:"cluster"`        // Cluster name
	Topic          string            `json:"topic"`          // Topic name
	MessageID      string            `json:"messageId"`      // Message ID
	Tags           string            `json:"tags"`           // Message tags
	Keys           string            `json:"keys"`           // Message keys
	QueueID        int               `json:"queueId"`        // Queue ID
	QueueOffset    int64             `json:"queueOffset"`    // Queue offset
	StoreHost      string            `json:"storeHost"`      // Store host
	BornHost       string            `json:"bornHost"`       // Born host
	StoreTime      string            `json:"storeTime"`      // Store time
	StoreTimestamp int64             `json:"storeTimestamp"` // Store timestamp
	Status         MessageStatus     `json:"status"`         // Message status
	RetryTimes     int               `json:"retryTimes"`     // Retry times
	Body           string            `json:"body"`           // Message body
	Properties     map[string]string `json:"properties"`     // Message properties
}

MessageItem holds message information.

type MessageQueryParams

type MessageQueryParams struct {
	Cluster    string `json:"cluster"`    // Cluster name
	Topic      string `json:"topic"`      // Topic name
	MessageID  string `json:"messageId"`  // Message ID
	MessageKey string `json:"messageKey"` // Message key
	StartTime  int64  `json:"startTime"`  // Start timestamp
	EndTime    int64  `json:"endTime"`    // End timestamp
	MaxResults int    `json:"maxResults"` // Maximum result count

	// Filters narrows a search by something only one family has: a RocketMQ
	// tag, a Kafka header, a RabbitMQ routing key. The keys are a contract
	// between one driver and its frontend module.
	Filters map[string]string `json:"filters"`
}

MessageQueryParams holds message query parameters.

type MessageStatus

type MessageStatus string

MessageStatus is the message status.

const (
	MsgNormal MessageStatus = "normal"
	MsgRetry  MessageStatus = "retry"
	MsgDLQ    MessageStatus = "dlq"
)

type MessageTrackItem

type MessageTrackItem struct {
	ConsumerGroup string `json:"consumerGroup"` // Consumer group
	TrackType     string `json:"trackType"`     // Track type: CONSUMED / NOT_CONSUME_YET / CONSUMED_BUT_FILTERED / UNKNOWN
	ConsumeStatus string `json:"consumeStatus"` // Consume status description
	ExceptionDesc string `json:"exceptionDesc"` // Exception description
}

MessageTrackItem holds message track information.

type MoveRequest added in v0.0.2

type MoveRequest struct {
	Namespace string `json:"namespace"`
	From      string `json:"from"`
	// ToExchange may be empty, which is the default exchange - it routes by
	// queue name, so an empty exchange with a routing key sends straight to
	// the queue of that name.
	ToExchange string `json:"toExchange"`
	// ToRoutingKey empty means each message keeps its own, which is what sends
	// a batch back through the topology it originally took.
	ToRoutingKey string `json:"toRoutingKey"`
	// Limit caps one run. Moving is one round trip per message, so a page
	// asks for a batch rather than for a whole backlog.
	Limit int `json:"limit"`
}

MoveRequest drains one queue into an exchange.

The target is an exchange and a routing key rather than a queue, because that is how a message enters RabbitMQ at all: publishing straight to a queue means publishing to the default exchange with the queue's name as the key, which the caller can ask for explicitly.

type Namespace added in v0.0.2

type Namespace struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// Tags are free labels the operator sets, not the broker.
	Tags []string `json:"tags"`
	// DefaultQueueType is what a queue declared here without a type becomes.
	// Setting it to quorum is how a cluster stops accumulating classic queues
	// by accident.
	DefaultQueueType string `json:"defaultQueueType"`
	// Tracing writes every message through this vhost to a log exchange. It is
	// expensive and is meant to be switched on for minutes, not left on.
	Tracing bool `json:"tracing"`

	// Messages is what its queues are collectively holding, split the same way
	// a queue's depth is.
	Messages       int64 `json:"messages"`
	Ready          int64 `json:"ready"`
	Unacknowledged int64 `json:"unacknowledged"`

	// Limits caps the vhost as a whole - max-connections, max-queues. Absent
	// means uncapped, which is the default and is worth distinguishing from a
	// limit of zero.
	Limits map[string]int `json:"limits"`

	// Attributes carries family-specific detail, the same way Node and
	// Destination do. A NATS account is an isolation boundary with none of a
	// vhost's furniture: no queue type to default, nothing to trace, and
	// instead a system-account flag, a JetStream footprint and a note of how
	// many servers the figures came from.
	Attributes map[string]string `json:"attributes"`
}

Namespace is one isolated world inside a broker.

A RabbitMQ virtual host is not a label: queues, exchanges, bindings, policies and permissions all live inside one and nothing crosses between them, so two vhosts can hold a queue of the same name that have nothing to do with each other. That is why it is a page rather than a filter.

The word is Namespace because the canonical vocabulary already uses it - a destination's Ref carries one - and RabbitMQ is the only family so far whose namespaces are objects you can create.

type NamespacePermission added in v0.0.2

type NamespacePermission struct {
	Namespace string `json:"namespace"`
	Identity  string `json:"identity"`
	// Configure is declaring and deleting queues and exchanges.
	Configure string `json:"configure"`
	// Write is publishing to an exchange, and binding.
	Write string `json:"write"`
	// Read is consuming from a queue, and binding.
	Read string `json:"read"`
}

NamespacePermission is one identity's rights inside one namespace.

The three fields are regular expressions matched against a resource's name, and the distinction between an empty one and ".*" is the whole model: empty matches nothing and permits nothing, ".*" matches everything. A page that rendered an empty pattern as "none set" would be describing the opposite of what it does.

type NamespaceSpec added in v0.0.2

type NamespaceSpec struct {
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	Tags             []string `json:"tags"`
	DefaultQueueType string   `json:"defaultQueueType"`
	Tracing          bool     `json:"tracing"`
}

NamespaceSpec creates or updates a namespace.

type Node

type Node struct {
	ID      int    `json:"id"` // list key for the renderer, not broker data
	Name    string `json:"name"`
	Address string `json:"address"`
	Cluster string `json:"cluster"` // grouping label; empty where the family has none
	Version string `json:"version"`

	Status    NodeStatus `json:"status"`
	RateIn    int        `json:"rateIn"`    // messages per second in
	RateOut   int        `json:"rateOut"`   // messages per second out
	DiskUsage int        `json:"diskUsage"` // percent; UnknownMetric when not reported

	LastSeen string `json:"lastSeen"`

	// TPS history is sampled locally by the collector, not reported by any
	// broker, which is why a driver never fills these.
	TpsHistoryTimestamps []int64 `json:"tpsHistoryTimestamps"` // Unix seconds
	TpsInHistory         []int   `json:"tpsInHistory"`
	TpsOutHistory        []int   `json:"tpsOutHistory"`

	// Replicas is how far each follower of this node trails it, where the
	// family replicates. Empty on a follower, and on a leader with none.
	//
	// Canonical rather than an attribute because every replicating family has
	// the question - RocketMQ slaves, Kafka ISR, RabbitMQ quorum members - and
	// "is a replica falling behind" is the one thing a cluster page is opened
	// to answer during an incident.
	//
	// Filled only by NodeDetail: it costs a request per node, which a list
	// should not pay.
	Replicas []ReplicaStatus `json:"replicas"`

	// Attributes carries family-specific detail the canonical page renders
	// through the driver's own column set: RocketMQ master/slave role and
	// CommitLog usage, Kafka controller and ISR, RabbitMQ disc/ram node type.
	Attributes map[string]string `json:"attributes"`
}

Node is one broker, RabbitMQ node or Kafka broker as the canonical Cluster page sees it.

It is deliberately thinner than BrokerNode: the TPS history arrays there are filled by the cluster service from local samples, not by any broker, so they stay out of what a driver has to produce.

func (*Node) Attribute

func (n *Node) Attribute(key string) string

Attribute returns a driver-specific field.

type NodeStatus

type NodeStatus string

NodeStatus is the node status.

const (
	NodeOnline  NodeStatus = "online"
	NodeWarning NodeStatus = "warning"
	NodeOffline NodeStatus = "offline"

	// NodeUnknown is a node whose health the family does not report. A
	// RocketMQ name server is one: the admin protocol names the addresses the
	// client dials and says nothing about whether each of them answers, and
	// calling that "online" would be inventing a check nobody ran.
	NodeUnknown NodeStatus = "unknown"
)

type PartitionReassignment added in v0.0.3

type PartitionReassignment struct {
	Topic     string `json:"topic"`
	Partition int32  `json:"partition"`

	// Replicas is where the partition lives right now, which during a move is
	// the union of where it was and where it is going.
	Replicas []int32 `json:"replicas"`
	// Adding and Removing are the two halves of the move still in flight.
	Adding   []int32 `json:"adding"`
	Removing []int32 `json:"removing"`
}

PartitionReassignment is one partition being moved between brokers.

Only Kafka has this: a partition's replica list is data an administrator can rewrite, and the cluster then copies the log to its new home in the background. What makes it worth a page of its own is that it is the one operation here with no completion event - the only way to know it finished is that the partition stops reporting one.

type PendingByConsumer added in v0.0.5

type PendingByConsumer struct {
	Consumer string `json:"consumer"`
	Count    int64  `json:"count"`
}

PendingByConsumer is one consumer's share of a pending list.

type PendingEntry added in v0.0.5

type PendingEntry struct {
	Ref SubscriptionRef `json:"ref"`

	ID       string `json:"id"`
	Consumer string `json:"consumer"`
	// IdleMs is how long since it was delivered. It is the column an operator
	// sorts by: an entry idle for hours is one nothing is coming back for.
	IdleMs int64 `json:"idleMs"`
	// Deliveries counts how many times it has been handed out. Above one means
	// something claimed it or a consumer restarted; climbing means an entry
	// that keeps being retried and keeps failing.
	Deliveries int64 `json:"deliveries"`
}

PendingEntry is one delivery that has not been acknowledged.

It is a delivery record rather than a message: what it carries is who was given the entry, how long ago, and how many times. The entry's own contents are a separate read, because a pending list of a thousand would otherwise fetch a thousand bodies nobody asked to see.

type PendingQuery added in v0.0.5

type PendingQuery struct {
	Ref SubscriptionRef `json:"ref"`

	// Consumer narrows to one consumer's share. Empty is all of them.
	Consumer string `json:"consumer"`
	// MinIdleMs narrows to entries nothing has touched for at least this long,
	// which is how the ones worth acting on are found.
	MinIdleMs int64 `json:"minIdleMs"`
	// Start and End bound the ids. Empty means the whole list.
	Start string `json:"start"`
	End   string `json:"end"`
	Count int    `json:"count"`
}

PendingQuery narrows a group's pending list.

type PendingSummary added in v0.0.5

type PendingSummary struct {
	Ref SubscriptionRef `json:"ref"`

	// Count is how many entries the group is owed in total.
	Count int64 `json:"count"`
	// MinID and MaxID bound them. The oldest is what an operator acts on: it
	// is the entry that has been stuck the longest.
	MinID string `json:"minId"`
	MaxID string `json:"maxId"`

	// PerConsumer says who is holding what, which is how a single dead
	// consumer is told apart from a group that is generally behind.
	PerConsumer []PendingByConsumer `json:"perConsumer"`
}

PendingSummary is a group's pending list at a glance.

type Policy added in v0.0.2

type Policy struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	// Pattern is a regular expression matched against the destination's name.
	Pattern string `json:"pattern"`
	// ApplyTo is "queues", "exchanges", "classic_queues", "quorum_queues",
	// "streams" or "all".
	ApplyTo string `json:"applyTo"`
	// Priority breaks ties. Higher wins, and only the winner applies.
	Priority int `json:"priority"`
	// Definition is the settings applied, as JSON so the types survive.
	Definition string `json:"definition"`
	// Operator marks a policy set by the operator rather than the user. The
	// broker applies both, and where they set the same key the operator's more
	// restrictive value wins - which is the point of them.
	Operator bool `json:"operator"`
}

Policy applies settings to every destination whose name matches a pattern.

It is the answer to something RabbitMQ otherwise cannot do: a queue's arguments are fixed at declaration, so the only way to change a live queue's TTL, length limit or dead-letter exchange is a policy matching it. That makes this page the edit form the queue page does not have.

Only one policy applies to a given queue - the highest priority that matches - which is the rule most people get wrong. Policies do not merge.

type PositionRequest added in v0.0.5

type PositionRequest struct {
	Ref SubscriptionRef `json:"ref"`

	// Position is an entry id, or one of the two the family spells specially:
	// "0" for the beginning of what the stream still holds, "$" for whatever
	// arrives next.
	Position string `json:"position"`
}

PositionRequest moves where a subscription reads to a named place in the log.

Separate from ResetOffsetRequest, which names a moment in time. A stream entry's id already is a moment - milliseconds and a sequence within them - so a timestamp alone cannot say which of the entries sharing a millisecond to start from, and cannot say "the end" at all. On a busy stream that sequence is the difference between replaying a batch and skipping it.

type ProducerClient

type ProducerClient struct {
	ClientID string `json:"clientId"`
	Address  string `json:"address"`
	Language string `json:"language"`
	Version  string `json:"version"`
}

ProducerClient is one connected publisher.

There is no list of publishers the way there is of subscriptions: a broker tracks connections per producer group and offers no way to enumerate the groups, so a caller has to name one. That is why this is not a Producer type with a Ref - there is nothing to list, only something to look up.

type PublishRequest added in v0.0.2

type PublishRequest struct {
	Namespace string `json:"namespace"`
	// Exchange empty is the default exchange, which routes by queue name -
	// so an empty exchange with a routing key publishes straight to the queue
	// of that name.
	Exchange   string `json:"exchange"`
	RoutingKey string `json:"routingKey"`
	Body       string `json:"body"`

	// Persistent decides whether the message survives a broker restart. A
	// transient message on a durable queue is still lost with the node.
	Persistent bool `json:"persistent"`
	// Mandatory asks the broker to hand the message back rather than drop it
	// when nothing is bound to take it. Without it an unroutable publish is
	// still confirmed, so a send console that did not set it would report
	// success for a message that no longer exists.
	Mandatory bool `json:"mandatory"`

	Headers map[string]string `json:"headers"`

	ContentType   string `json:"contentType"`
	CorrelationID string `json:"correlationId"`
	ReplyTo       string `json:"replyTo"`
	MessageID     string `json:"messageId"`
	Type          string `json:"type"`
	AppID         string `json:"appId"`
	// Expiration is a per-message TTL in milliseconds, as a string, which is
	// how AMQP carries it.
	Expiration string `json:"expiration"`
	// Priority is only honoured on a queue declared with x-max-priority.
	Priority int `json:"priority"`

	// Count sends the same message more than once, for generating load or
	// filling a queue to test a consumer.
	Count int `json:"count"`
}

PublishRequest is a message as a send console collects it.

It is not the canonical MessagePublisher's shape and cannot be. That takes a topic, tags, keys and a delay level, which is RocketMQ's vocabulary: a RabbitMQ message goes to an exchange with a routing key, carries a table of headers and a fixed set of AMQP properties, and has no tags or delay at all.

type PublishResult added in v0.0.2

type PublishResult struct {
	// Sent is how many the broker confirmed.
	Sent int `json:"sent"`
	// Unroutable is how many it handed back because nothing was bound. They
	// were not delivered anywhere, and on a mandatory publish that is the only
	// way to find out.
	Unroutable int `json:"unroutable"`
	// Reason is the broker's own words for the last message handed back.
	Reason string `json:"reason"`
}

PublishResult is what the broker said about the send.

Confirmed and Routed are different facts and the difference is the whole point of this type. A confirm means the broker took responsibility for the message; routing means something was bound to receive it. An unroutable publish is confirmed and then dropped, so a page reporting only the confirm would call that a success.

type QueueAssignment

type QueueAssignment struct {
	Destination string `json:"destination"`
	Node        string `json:"node"` // the broker holding this queue
	QueueID     int    `json:"queueId"`

	// Pending is what this client has buffered but not yet finished, which is
	// not the same as the group's backlog on the broker.
	Pending      int64 `json:"pending"`
	PendingBytes int64 `json:"pendingBytes"`

	LastPull    string `json:"lastPull"`
	LastConsume string `json:"lastConsume"`

	// Locked matters only where a family locks a queue to one consumer for
	// ordered delivery; Dropped means the client is releasing it in a rebalance.
	Locked  bool `json:"locked"`
	Dropped bool `json:"dropped"`
}

QueueAssignment is one queue a consumer holds, and how far behind it is.

type QueueOffsetRequest

type QueueOffsetRequest struct {
	Subscription string `json:"subscription"`
	Destination  string `json:"destination"`

	// Node is the broker holding the queue. The offset lives on it, not in the
	// route table, so it cannot be inferred from the destination.
	Node    string `json:"node"`
	QueueID int    `json:"queueId"`
	Offset  int64  `json:"offset"`
}

QueueOffsetRequest sets one queue's read position to an exact offset.

It is not a reset: a reset names a moment and lets the broker find a position per queue, which is the safe gesture for a whole group. This writes a number to one queue, which is the surgical one - the queue whose backlog the page just showed, moved past a message nobody can consume.

type QueuePosition

type QueuePosition struct {
	Node    string `json:"node"` // the broker holding it
	QueueID int    `json:"queueId"`
	Offset  int64  `json:"offset"`
}

QueuePosition is one partition's place in a tail.

type QuotaEntity added in v0.0.3

type QuotaEntity struct {
	// Type is "user", "client-id" or "ip".
	Type string `json:"type"`
	// Name is the entity's name. Meaningless when Default is set.
	Name string `json:"name"`
	// Default marks the fallback every client of this type inherits when no
	// quota names them. Not the same as an empty name.
	Default bool `json:"default"`
}

QuotaEntity is one dimension of a quota's identity.

type ReplayRequest

type ReplayRequest struct {
	Subscription string `json:"subscription"`
	ClientID     string `json:"clientId"`
	Destination  string `json:"destination"`
	MessageID    string `json:"messageId"`
}

ReplayRequest asks one connected consumer to handle a message again, now.

It names a client rather than a group because that is the point: a group would hand the message to whichever member the rebalance picked, and the question being asked is why one particular consumer chokes on it.

type ReplayResult

type ReplayResult struct {
	Result  string `json:"result"`
	Remark  string `json:"remark"`
	SpentMs int64  `json:"spentMs"`

	// Ordered and AutoCommit describe how the client was configured to consume,
	// which changes what a failure means: an ordered consumer blocks its queue
	// on one it cannot handle.
	Ordered    bool `json:"ordered"`
	AutoCommit bool `json:"autoCommit"`
}

ReplayResult is what that consumer's own handler returned.

This is not a delivery receipt: the broker forwarded the message and the client ran its listener, so a failure here is the application's, reported back verbatim in Remark.

type ReplicaStatus

type ReplicaStatus struct {
	Address string `json:"address"`

	// BehindBytes is how far this replica trails the leader's log. Zero means
	// caught up; UnknownMetric means the family reports no such figure.
	BehindBytes int64 `json:"behindBytes"`

	// InSync is the family's own verdict, which is not simply BehindBytes == 0:
	// a replica can be a little behind and still count as in sync.
	InSync bool `json:"inSync"`
}

ReplicaStatus is one follower's replication state.

type ResetOffsetRequest

type ResetOffsetRequest struct {
	Group     string `json:"group"`     // Consumer group name
	Topic     string `json:"topic"`     // Topic name
	Timestamp int64  `json:"timestamp"` // Timestamp (milliseconds)
	Force     bool   `json:"force"`     // Whether to force reset
}

ResetOffsetRequest is a request to reset offsets.

type ResourceAlarm added in v0.0.2

type ResourceAlarm struct {
	Node     string `json:"node"`
	Resource string `json:"resource"`
}

ResourceAlarm is a node that has crossed a memory or disk watermark.

While one is in effect the broker refuses publishes from every connection, which makes it the first thing worth showing on a cluster page.

type RuntimeParameter added in v0.0.2

type RuntimeParameter struct {
	Component string `json:"component"`
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	// Value is JSON, because a parameter's shape is defined by whichever
	// plugin owns the component and this app cannot know it.
	Value string `json:"value"`
}

RuntimeParameter is a component's configuration, kept by the broker rather than in a file.

Shovels and federation upstreams are stored as these, which is why the page shows them: a parameter with an unfamiliar component name is usually a plugin's configuration, and being able to see it is the difference between diagnosing one and guessing.

type Scope added in v0.0.9

type Scope struct {
	Name string `json:"name"`
	// Destinations and Subscriptions are how many of each carry the name.
	Destinations  int `json:"destinations"`
	Subscriptions int `json:"subscriptions"`
}

Scope is one value a connection's scope can be pointed at.

Distinct from Namespace, which is a broker object carrying its own settings, limits and permissions. A scope is a naming convention - a RocketMQ namespace is a prefix the client puts in front of every resource it names - so nothing creates one, nothing removes one, and the only evidence one exists is that some topic or group carries it. The counts are therefore not decoration: they are the whole answer to whether a name means anything on this cluster.

type Shard added in v0.1.0

type Shard struct {
	ID string `json:"id"`

	// ParentID is the shard this one was split from or merged out of, and
	// AdjacentParentID is the second parent a merge has. Both empty means the
	// shard was there when the stream was created.
	//
	// They are what makes a listing a lineage rather than a set: a consumer
	// that has to read a stream in order has to finish a parent before it
	// starts a child, and the parent is the only place that says so.
	ParentID         string `json:"parentId"`
	AdjacentParentID string `json:"adjacentParentId"`

	// StartHashKey and EndHashKey bound the slice of the key space this shard
	// takes. They are 128-bit unsigned integers, so they are carried as
	// decimal strings: the largest of them does not fit in an int64, and a
	// float would round the low digits away - which are exactly the digits
	// that decide which of two neighbouring shards a key lands on.
	StartHashKey string `json:"startHashKey"`
	EndHashKey   string `json:"endHashKey"`

	// StartSequence is the first sequence number in the shard, and
	// EndSequence is the last. EndSequence is set only on a closed shard, and
	// setting it is what closing means.
	StartSequence string `json:"startSequence"`
	EndSequence   string `json:"endSequence"`

	// Closed is true for a shard that takes no more writes because it was
	// split or merged. It still holds its records until retention expires, so
	// it is not the same as deleted and must not be hidden - a stream that
	// looks like it lost data usually just has a closed parent nobody drained.
	Closed bool `json:"closed"`
}

Shard is one part of a stream, open or closed.

type Shovel added in v0.0.2

type Shovel struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
	// State is what the broker reports it is doing - running, starting,
	// terminated. Empty means it reported nothing, which itself says the
	// shovel is defined and has not started.
	State string `json:"state"`
	// Type is dynamic or static: a static shovel comes from the broker's
	// config file and cannot be deleted from here.
	Type  string `json:"type"`
	Since string `json:"since"`

	// Source and Target say what it moves, in words - one of a queue or an
	// exchange at each end, never both.
	Source string `json:"source"`
	Target string `json:"target"`

	AckMode string `json:"ackMode"`
	// SourceURI and TargetURI have their passwords removed. They are the one
	// place the management API stores another broker's credential in plain
	// text and hands it back on request.
	SourceURI []string `json:"sourceUri"`
	TargetURI []string `json:"targetUri"`
}

Shovel moves messages from one broker to another, or between two places on the same one.

It is a plugin rather than core RabbitMQ, which is why the capability can be degraded: a stock broker has none, and that is a deployment choice rather than a failure.

type SlowLogEntry added in v0.0.5

type SlowLogEntry struct {
	// ID is the server's own sequence number, which only ever increases. It is
	// how a reader tells a new entry from one they have already looked at.
	ID int64 `json:"id"`

	// TimestampMs is when the command ran, and DurationMicros how long it took
	// - microseconds because the threshold that captured it is set in them,
	// and rounding to milliseconds would put most entries at zero.
	TimestampMs    int64 `json:"timestampMs"`
	DurationMicros int64 `json:"durationMicros"`

	// Command is the command and its arguments as the server recorded them.
	// Redis truncates both the argument count and each argument's length, so
	// this is what was logged rather than what was sent.
	Command []string `json:"command"`

	// Client is who ran it. The name is whatever that connection set with
	// CLIENT SETNAME, which for this app is the profile name - so an operator
	// can tell their own console apart from the service they are debugging.
	ClientAddress string `json:"clientAddress"`
	ClientName    string `json:"clientName"`
}

SlowLogEntry is one command the server recorded as slow.

It is the only view in this app of a single request rather than of an aggregate, which is what makes it worth having: an average hides the one KEYS somebody ran against a million-key database, and that one command is usually the whole answer.

type StreamAddRequest added in v0.0.5

type StreamAddRequest struct {
	Ref    DestinationRef `json:"ref"`
	Fields []StreamField  `json:"fields"`

	// ID is an explicit entry id. Empty means the server generates one from
	// its clock, which is what almost every producer does and the only way to
	// keep ids monotonic without coordinating.
	ID string `json:"id"`

	// Count writes the same entry more than once, for filling a stream to test
	// a consumer. Each copy gets its own id.
	Count int `json:"count"`
}

StreamAddRequest writes entries to a stream.

type StreamAddResult added in v0.0.5

type StreamAddResult struct {
	IDs []string `json:"ids"`
}

StreamAddResult is what the server assigned.

The ids rather than a count, because an id is the only handle on an entry: without them a caller that has just written something has no way to look it up, delete it, or point a consumer group at it.

type StreamClients added in v0.0.2

type StreamClients struct {
	Publishers []*StreamPublisher `json:"publishers"`
	Consumers  []*StreamConsumer  `json:"consumers"`
}

StreamClients is who is reading and writing a stream over the stream protocol.

Separate from the consumer list every other queue type has, because the stream protocol is not AMQP: a client on port 5552 never appears in /api/consumers. A stream being read by three applications reports zero consumers there, which is the misreading this exists to prevent.

type StreamConsumer added in v0.0.2

type StreamConsumer struct {
	Connection string `json:"connection"`
	PeerHost   string `json:"peerHost"`
	User       string `json:"user"`
	Node       string `json:"node"`

	// Offset is where in the stream this client has read to, and Lag is how
	// far that is behind the end. A stream keeps its messages after they are
	// read, so lag is the only thing that says whether a consumer is keeping
	// up - there is no queue depth to fall behind on.
	Offset int64 `json:"offset"`
	Lag    int64 `json:"lag"`

	Consumed int64 `json:"consumed"`
	// Credits is how many messages the broker may still send before the
	// client asks for more. Zero on an active consumer means it has stopped
	// asking.
	Credits int `json:"credits"`
	// Active is false for a single-active-consumer subscription that is
	// connected and waiting its turn, which is working rather than stuck.
	Active bool `json:"active"`
}

StreamConsumer is one client reading a stream.

type StreamField added in v0.0.5

type StreamField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

StreamField is one field of an entry being written.

A slice rather than a map, because XADD takes an ordered list and the order is the producer's. Reading loses it - the client hands fields back as a map - but writing must not: a form that reordered what someone typed would be changing the entry on the way out.

type StreamPublisher added in v0.0.2

type StreamPublisher struct {
	// Reference is the publisher's own name, which the broker uses to
	// deduplicate messages across a reconnect. Empty means the client sent
	// none, so it gets no deduplication.
	Reference  string `json:"reference"`
	Connection string `json:"connection"`
	PeerHost   string `json:"peerHost"`
	User       string `json:"user"`
	Node       string `json:"node"`

	Published int64 `json:"published"`
	Confirmed int64 `json:"confirmed"`
	Errored   int64 `json:"errored"`
}

StreamPublisher is one client writing to a stream.

type Subscription

type Subscription struct {
	ID  int             `json:"id"` // list key for the renderer, not broker data
	Ref SubscriptionRef `json:"ref"`

	Status       SubscriptionStatus `json:"status"`
	Members      int                `json:"members"`      // connected consumers
	Destinations int                `json:"destinations"` // how many it reads from
	Backlog      int64              `json:"backlog"`      // UnknownMetric when not reported
	RateOut      int                `json:"rateOut"`      // messages per second consumed

	LastUpdated string            `json:"lastUpdated"`
	Attributes  map[string]string `json:"attributes"`
}

Subscription is a consumer group, a Pulsar subscription or a RabbitMQ queue consumer, as the canonical pages see it.

Backlog is deliberately not called lag: RocketMQ and Kafka compute it from offsets, RabbitMQ reads ready plus unacknowledged, and Redis Stream reads XPENDING. The number means "messages still owed to this subscriber" in all three, but only the first two have an offset behind it — which is why resetting position is a separate capability.

func (*Subscription) Attribute

func (s *Subscription) Attribute(key string) string

Attribute returns a driver-specific field.

type SubscriptionClient

type SubscriptionClient struct {
	ClientID string `json:"clientId"`

	// Assignments is which queues this client currently holds. It is the
	// answer to "why is one consumer behind and the others idle", which a
	// group-level backlog cannot give.
	Assignments []QueueAssignment `json:"assignments"`

	// Throughput is per destination, because a client reading two topics can
	// be healthy on one and stalled on the other.
	Throughput []ConsumeThroughput `json:"throughput"`

	// Properties is what the client reports about itself - version, consume
	// mode, thread counts. Free-form because every family names them
	// differently and none of it is worth a canonical field.
	Properties map[string]string `json:"properties"`
}

SubscriptionClient is what one connected consumer is actually doing.

It is separate from the client list a Subscription carries because the two answer different questions and cost different things. The list says who is connected, and comes back with the group. This is a round trip to that one client, so it is fetched when someone asks about it.

type SubscriptionRef

type SubscriptionRef struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

SubscriptionRef identifies a consumer group, subscription or queue consumer.

type SubscriptionSpec

type SubscriptionSpec struct {
	Ref        SubscriptionRef   `json:"ref"`
	Attributes map[string]string `json:"attributes"`
}

SubscriptionSpec is a create or update request.

type SubscriptionStatus

type SubscriptionStatus string

SubscriptionStatus is the health of a subscription.

const (
	SubscriptionOnline  SubscriptionStatus = "online"
	SubscriptionWarning SubscriptionStatus = "warning"
	SubscriptionOffline SubscriptionStatus = "offline"
)

type TailBatch

type TailBatch struct {
	// Messages are oldest first, which is the order a tail appends in.
	Messages []*MessageItem `json:"messages"`

	// Cursor is what to pass next time. It advances even when no message came
	// back, because a partition can move on without this tail matching any.
	Cursor TailCursor `json:"cursor"`

	// Dropped counts messages that aged out of the log between two polls -
	// a tail slower than the retention it is watching. Reporting it is the
	// difference between a quiet tail and one that is silently losing.
	Dropped int64 `json:"dropped"`
}

TailBatch is one poll's worth of a tail.

type TailCursor

type TailCursor struct {
	Positions []QueuePosition `json:"positions"`
}

TailCursor is where a tail has read to, per partition.

An empty cursor means "start at the end": a tail opens on what arrives next rather than replaying what is already stored, which is what the message query is for.

type TopicConfig

type TopicConfig struct {
	Topic       string           `json:"topic"`       // Topic name
	Cluster     string           `json:"cluster"`     // Cluster name
	BrokerAddr  string           `json:"brokerAddr"`  // Broker address
	ReadQueue   int              `json:"readQueue"`   // Read queue count
	WriteQueue  int              `json:"writeQueue"`  // Write queue count
	Perm        TopicPerm        `json:"perm"`        // Permission
	MessageType TopicMessageType `json:"messageType"` // Message type
	Description string           `json:"description"` // Description
}

TopicConfig holds Topic create/update configuration.

type TopicItem

type TopicItem struct {
	ID             int              `json:"id"`             // Topic ID
	Topic          string           `json:"topic"`          // Topic name
	Cluster        string           `json:"cluster"`        // Cluster name
	ReadQueue      int              `json:"readQueue"`      // Read queue count
	WriteQueue     int              `json:"writeQueue"`     // Write queue count
	Perm           TopicPerm        `json:"perm"`           // Permission
	MessageType    TopicMessageType `json:"messageType"`    // Message type
	ConsumerGroups int              `json:"consumerGroups"` // Consumer group count
	// Subscribers names the groups behind ConsumerGroups. Only a per-topic
	// lookup fills it: the list enrichment asks for the count alone.
	Subscribers []string         `json:"subscribers"`
	TpsIn       int              `json:"tpsIn"`       // Inbound TPS
	TpsOut      int              `json:"tpsOut"`      // Outbound TPS
	LastUpdated string           `json:"lastUpdated"` // Last update time
	Description string           `json:"description"` // Description
	Routes      []TopicRouteItem `json:"routes"`      // Route information
}

TopicItem holds Topic information.

type TopicMessageType

type TopicMessageType string

TopicMessageType is the message type.

const (
	MessageTypeNormal TopicMessageType = "Normal"
	MessageTypeFIFO   TopicMessageType = "FIFO"
)

type TopicPerm

type TopicPerm string

TopicPerm is the Topic permission.

const (
	PermRW   TopicPerm = "RW"
	PermR    TopicPerm = "R"
	PermW    TopicPerm = "W"
	PermDeny TopicPerm = "DENY"
)

func IntToPerm

func IntToPerm(perm int) TopicPerm

IntToPerm converts an integer code to a permission.

type TopicPermission added in v0.0.2

type TopicPermission struct {
	Namespace string `json:"namespace"`
	Identity  string `json:"identity"`
	// Exchange is which topic exchange this applies to.
	Exchange string `json:"exchange"`
	Write    string `json:"write"`
	Read     string `json:"read"`
}

TopicPermission narrows write and read further, for topic exchanges only.

Separate from NamespacePermission because it is a separate endpoint and because it does nothing on its own: it is a filter applied on top of the permissions above, and a user with no write permission gains none from a topic permission that would allow it.

type TopicRouteItem

type TopicRouteItem struct {
	Broker     string    `json:"broker"`     // Broker name
	BrokerAddr string    `json:"brokerAddr"` // Broker address
	ReadQueue  int       `json:"readQueue"`  // Read queue count
	WriteQueue int       `json:"writeQueue"` // Write queue count
	Perm       TopicPerm `json:"perm"`       // Permission
}

TopicRouteItem is a Topic route entry.

type Transaction added in v0.0.3

type Transaction struct {
	ID          string `json:"id"`
	State       string `json:"state"`
	Coordinator int32  `json:"coordinator"`

	ProducerID    int64 `json:"producerId"`
	ProducerEpoch int16 `json:"producerEpoch"`

	// StartedAt is when the transaction began, in milliseconds, or
	// UnknownMetric where the coordinator does not report it.
	StartedAt int64 `json:"startedAt"`
	// TimeoutMs is how long the cluster will wait before aborting it itself.
	TimeoutMs int32 `json:"timeoutMs"`

	// Partitions are the topic partitions this transaction has written to and
	// not yet resolved. They are the ones whose readers are being held up.
	Partitions []string `json:"partitions"`

	// Open is whether the transaction has not finished: the coordinator is
	// still going to write a marker for it. Derived from the state rather than
	// reported, and derived here so that which states count is decided once.
	//
	// Separate from Holding because a transaction can be open and hold
	// nothing - it has written to no partition yet - and because a finished
	// transaction stays listed for a while, which is why the page must be able
	// to tell "still running" from "ran".
	Open bool `json:"open"`

	// Holding is the driver's verdict on whether this transaction is actually
	// keeping readers back: open, and holding at least one partition.
	Holding bool `json:"holding"`
}

Transaction is one transactional producer's session, as the cluster sees it.

Kafka only. The reason it is worth a panel is what a stuck one does: a transaction that is Ongoing holds the last stable offset of every partition it has written to, and a consumer reading committed records will not advance past it. One producer that died mid-transaction can stall an entire pipeline while every other figure on every other page looks healthy.

type TrimRequest added in v0.0.5

type TrimRequest struct {
	Ref      DestinationRef `json:"ref"`
	Strategy TrimStrategy   `json:"strategy"`

	// MaxLen is how many of the newest entries to keep. Zero empties the
	// stream, which is the only "purge" Redis has - there is no separate
	// command, and offering one under another name would be two controls for
	// one thing.
	MaxLen int64 `json:"maxLen"`

	// MinID is the lowest entry id to keep. Everything before it goes.
	MinID string `json:"minId"`

	// Approx lets the server stop at a macro-node boundary rather than
	// splitting one, which is much cheaper and is what Redis's own docs
	// recommend. It means the stream may keep slightly more than asked, never
	// less, so a page that offers it has to say so.
	Approx bool `json:"approx"`
}

TrimRequest discards entries from the head of a stream.

type TrimResult added in v0.0.5

type TrimResult struct {
	Removed int64 `json:"removed"`
}

TrimResult is what the trim actually did.

The count matters even when Approx was set, and especially then: it is the only way to tell "kept a few extra at a node boundary" from "matched nothing and did nothing at all".

type TrimStrategy added in v0.0.5

type TrimStrategy string

TrimStrategy is how a trim decides what to discard.

The two are not interchangeable. A length keeps a count and lets the oldest go whatever they are; a minimum id keeps a moment and lets everything before it go however many that is. An operator reclaiming disk wants the first; one dropping everything before an incident wants the second.

const (
	TrimMaxLen TrimStrategy = "maxlen"
	TrimMinID  TrimStrategy = "minid"
)

Jump to

Keyboard shortcuts

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