seats

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: GPL-3.0 Imports: 12 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 seats reads the party's seat map — peers/seats.md on the fleet's sessions root (UCC design v2 § 5 § Address): one row per label, the agent id a sender addresses, naming where a message to it lands and the kinds the row accepts. UCC writes the map; peer reads it for its card and at the border of every delivery.

The grammar (K0, proposed by plan unit U11): the record's body holds one markdown table whose header names the columns label, to and accepts, in any order; other columns and the frontmatter are UCC's and are ignored.

| label  | to                                                                         | accepts                       |
|--------|----------------------------------------------------------------------------|-------------------------------|
| leader | [[projects/demo/rosters/leader-peer-v1]]  | text task question answer ack |
| zt     | human [[projects/demo/rosters/advisor-demo]] | text question answer |
| hook   | service https://example.net/peer/hook                                      | text                          |

The columns:

  • label: an agent id, [A-Za-z0-9._-]{1,64}, unique in the map.
  • to: a seat — [[<session>/rosters/<role>-<slug>]], the roster record's path under the root, so the seat's session is the part before /rosters/ — or human [[<session>/rosters/<role>-<slug>]], a person, whose messages are born in the session of the seat that relays to them (UCC's amendment; a bare human names no session and is refused), or service <url> with an https URL.
  • accepts: one or more of the eight kinds — text task question answer doc file card ack — separated by spaces.
  • rooms (optional, plan v2 decision 3): the rooms whose records with no agent in to land in this row's session — room names as this host names them, room ids, or * for every room — separated by spaces; empty or absent, none. A service row takes no rooms: a room record lands in a session.

A row outside the grammar makes the whole map invalid: nothing is delivered by a map that cannot be read, and nothing is consumed.

Index

Constants

This section is empty.

Variables

View Source
var ErrMap = errors.New("seats: the map cannot be read")

ErrMap is a map outside the grammar.

Kinds is the vocabulary accepts draws from.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind is what a row's to column names.

const (
	Seat    Kind = iota + 1 // [[<session>/rosters/<role>-<slug>]]
	Human                   // human [[<session>/rosters/<role>-<slug>]]
	Service                 // service <url>
)

func (Kind) String

func (k Kind) String() string

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map is a parsed seat map.

func Load

func Load(path string) (*Map, error)

Load reads and parses the map at path.

func Parse

func Parse(b []byte) (*Map, error)

Parse reads the map's bytes.

func (*Map) Agents

func (m *Map) Agents() []card.Agent

Agents is the map as the card's agent list, in the map's order: every row is an agent of the party with the row's accepts (design §3.3).

func (*Map) InRoom added in v0.2.0

func (m *Map) InRoom(name, id string) []Row

InRoom is the rows, in the map's order, whose rooms column names the room — by this host's name for it, by its id, or by * — the rows a room record with no agent in to lands in.

func (*Map) Labels added in v0.5.8

func (m *Map) Labels() []string

Labels is every label, in the map's order.

func (*Map) LabelsAccepting added in v0.5.7

func (m *Map) LabelsAccepting(kind string) []string

LabelsAccepting is the labels of the rows that accept kind, in the map's order — the labels a sender may address a kind message to.

func (*Map) LabelsOfSeat added in v0.5.8

func (m *Map) LabelsOfSeat(seat string) []string

LabelsOfSeat is the labels, in the map's order, of the seat and human rows whose to names the seat — the roster record's path under the root, a wikilink's text: the labels that seat answers for.

func (*Map) Len

func (m *Map) Len() int

Len is the number of rows.

func (*Map) Row

func (m *Map) Row(label string) (Row, bool)

Row is the label's row.

type Row

type Row struct {
	Label string
	Kind  Kind
	// Seat rows, and human rows for the seat that relays to the person:
	// Session is the session's path under the root, Seat the roster
	// record's path under it (the wikilink's text).
	Session, Seat string
	// Service rows: the callback URL.
	URL string
	// Accepts is the row's subset of the eight kinds, in the row's order.
	Accepts []string
	// Rooms is the rooms column: room names, room ids or "*"; nil for none.
	Rooms []string
}

Row is one label of the map.

Jump to

Keyboard shortcuts

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