Discovery and permissions
Listing streams, and reading what a session was granted.
ListStreamsRequest
ListStreamsRequest asks for one page of stream identities.
type ListStreamsRequest struct {
// IncludeStats asks for per-stream counts, byte sizes and time bounds.
//
// OPT-IN, because it is not free. With stream.idx v4 the node answers from
// the index rather than by opening chunk files, but it is still an index
// read per stream on the page -- so a caller that only needs identities,
// like a completion list, should not pay for it.
IncludeStats bool
// Limit caps the page. 0 means DefaultListStreamsPage; anything above
// MaxListStreamsPage is refused rather than clamped, because a client that
// asked for more than the protocol allows has misunderstood the contract
// and silently giving it less is how it concludes there is no more data.
Limit uint16
// Cursor is the last stream id of the previous page, in String() form.
// Empty starts from the beginning. The next page is everything strictly
// greater, in the registry's sorted order.
Cursor string
// Match, when set, returns ONLY the stream with this exact id.
//
// It exists so that fetching one stream's detail is not "page until you
// find it": that costs O(registry) round trips for a single lookup, and it
// is the shape a caller writes when the protocol gives them nothing
// better. An empty result means the stream does not exist, which is what
// lets a detail endpoint answer 404 without a second call.
//
// This is the narrowest possible filter, deliberately. General filtering
// belongs in the frame too -- filtering AFTER pagination returns short
// pages that look like missing data -- but exact-match is the one case
// with an unambiguous answer, and shipping it does not commit the protocol
// to a query language.
Match string
// Exchange, Symbol and Timeframe filter the listing. Empty means "any".
//
// They are applied by the NODE, before the page limit. Filtering in the
// caller after a page arrives returns short pages -- ten results asked
// for, three delivered, and more available -- which is indistinguishable
// from missing data.
//
// Symbol matching is a case-insensitive PREFIX; exchange and timeframe are
// exact. That asymmetry is what a search box actually wants: you type
// "BTC" to find BTCUSDT, but you pick an exchange from a list.
Exchange string
Symbol string
Timeframe string
// SortBy orders the results; Descending reverses that order. See
// ListSortBy for why anything but the default costs a full registry scan.
SortBy ListSortBy
Descending bool
// ServedHere asks the node to list only streams whose partition it
// SERVES — not those it holds as a copy, nor files of a partition it no
// longer has a role in. A cluster-wide listing sets it on every node so
// each stream is answered once, by its primary (§7.7.6). A node with no
// cluster serves everything it holds, so the flag changes nothing there.
ServedHere bool
}
ListStreamsRequest asks a node to enumerate the streams it holds.
func ParseListStreamsPayload(payload []byte) (ListStreamsRequest, error)
ParseListStreamsPayload decodes a LIST_STREAMS payload.
ListStreamsResponse
ListStreamsResponse is one page, plus whether more follow.
type ListStreamsResponse struct {
// Streams is this page, in the registry's sorted order.
Streams []StreamID
// Stats is parallel to Streams when the request asked for it, and nil
// otherwise. Parallel slices rather than a struct per stream, so a client
// that did not ask for stats decodes exactly what it did before.
Stats []StreamStats
// HasMore reports that more identities follow the last one here. A client
// resumes by sending that identity's String() as the next Cursor.
HasMore bool
}
ListStreamsResponse is one page of stream identities.
func ParseListStreamsResponsePayload(payload []byte) (ListStreamsResponse, error)
ParseListStreamsResponsePayload decodes a LIST_STREAMS_RESPONSE payload.
Permission bits
const (
PermReadTicks = PermReadTicks
PermReadCandles = PermReadCandles
PermWriteTicks = PermWriteTicks
PermWriteCandles = PermWriteCandles
// PermListStreams grants stream discovery -- enumerating what a node
// holds. Separate from the read bits on purpose: exposing prices and
// exposing the catalog of instruments are different disclosures.
PermListStreams = PermListStreams
// PermAdminStream grants setting a stream's metadata -- calendar,
// closures, lineage -- with SetStreamMetadata and its siblings. Reading
// metadata needs only PermReadCandles.
PermAdminStream = PermAdminStream
)
Permission bits, as returned by Client.GrantedPermissions and tested with Client.HasPermission.
These are no longer something a caller REQUESTS. Until 2026-09-10 they were the values for an Options.Permissions field, which the client filled in itself and the server enforced verbatim – a request the server rubber- stamped. Permissions now arrive inside a signed token and the server decides the grant; these constants are how you read what you got.
PermissionNames
func PermissionNames(bitmap uint64) []string
PermissionNames renders a permission bitmap as readable names, for logging what a session was granted.
MaxTokenValidity
const MaxTokenValidity = MaxTokenValidity
MaxTokenValidity is the longest lifetime a session token may be issued with. mirexa-token issue refuses to exceed it and the server refuses to accept a token that does.