revsync

package
v1.0.495 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 4 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 revsync plans which session-revocation entries ride one SyncRevocations message when the full set does not fit that leg's byte budget (AU-50 request leg, AU-71 reply leg; IM-015, ADR-0049).

THE RULE. A leg that does not fit is DEFERRED, never dropped:

  • Nothing is removed from any revocation list. The planner only chooses which entries ride THIS tick; the rest ride later ones. Dropping an entry from the list to make the message fit would un-revoke a session, which is the fail-open direction this control may not take.
  • Half of the budget is a strict priority PREFIX, so the entries that matter most go out on the very next tick however large the backlog: on the request leg that is the node's OWN logouts first (no other node can tell the fleet about them), then account revocations, then learned tokens; each class latest-expiry first, which is the newest session and the longest remaining protection.
  • The other half is a ROTATING WINDOW over everything the prefix did not carry, resuming where the previous tick stopped. That is what makes "deferred" true rather than a polite word for "dropped": every live entry is sent within ceil(backlog / window) ticks, including the oldest local one, which a fixed prefix would starve for as long as the backlog stayed large.

The common case pays exactly one marshal, measured, and sent unchanged when it fits. The planner runs only on the over-budget path.

Ownership: package main owns the byte budgets (derived from the cluster gRPC frame limits), the Cursor instances (one on the Data Plane client, one per requesting node on the Control Plane's aggregator), the deferral counters, the rate-limited log line and the RPC itself. This package owns the priority order, the rotation and the request wire envelope. It holds no package-level state, starts no goroutines and does no I/O or logging; its only Culvert import is internal/session, for the RevocationEntry wire type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRequest

func BuildRequest(nodeID string, local, other []session.RevocationEntry, budget int, cur *Cursor) (body []byte, deferred int, err error)

BuildRequest marshals a node's revocation request within budget bytes, local logouts first. local and other are the two halves of session's ExportRevocationsByOrigin. It reports how many entries were deferred to a later tick and advances cur.

func BuildResponse

func BuildResponse(entries []session.RevocationEntry, budget int, cur *Cursor) (body []byte, deferred int, err error)

BuildResponse marshals the CP's reply within budget bytes (AU-71). Every entry is remote to the requester, so the classes are account first (one entry withdraws every session an identity holds), then tokens.

Types

type Cursor

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

Cursor is where the rotating window stopped. It is a KEY rather than an index, so entries that expire or arrive between ticks do not shift the resume point onto entries that were already sent. The zero value is ready and means "no rotation in progress"; a Cursor belongs to exactly one (leg, peer) pair and is not safe for concurrent use.

func (Cursor) Active

func (c Cursor) Active() bool

Active reports whether a rotation is in progress, i.e. the previous message was over budget and left entries for a later tick. An owner that keeps one Cursor per peer can release an inactive one.

type Request

type Request struct {
	NodeID  string                    `json:"node_id"`
	Entries []session.RevocationEntry `json:"entries"`
}

Request is the DP→CP SyncRevocations body. The field names are the wire contract the CP handler decodes.

Jump to

Keyboard shortcuts

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