Help us shape the future of Go! Take the 2026 Go Developer Survey

workspacefeed

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package workspacefeed keeps the change position behind the service feed of Workspaces (ADR 0009). A Workspace takes the next position whenever it is created, an owner is added, removed or transferred, an owner's email or verification changes, or it is deleted, restored or erased (ADR 0043). The service endpoint reads Workspaces in the order of that position (ee/staff), so what a caller saved as its cursor always names a place in the order of changes.

Two ent hooks keep it so no write path can forget it. Hook runs on every transaction client (the event bus's): the change and its position commit together, in the order the positions were taken. Guard runs on the plain client (db.NewEntClient) and refuses a change to the feed outside a transaction, where the position would be a separate statement that a crash loses and a concurrent change commits out of order. The hook reads Memberships of any Workspace to find the one a change belongs to, which is why this package is on the closed list of raw-client packages in docs/architecture.md.

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedsTransaction = errors.New("workspace feed change outside a transaction")

ErrNeedsTransaction is what Guard returns for a change to the feed made on a client that is not bound to a transaction.

Functions

func Guard

func Guard(next ent.Mutator) ent.Mutator

Guard is the ent hook for a client that is not bound to a transaction: it refuses every mutation that Hook would give a position to. Such a change goes through the event bus's transaction (events.Bus.WithinTx).

func Hook

func Hook(next ent.Mutator) ent.Mutator

Hook is the ent hook to install on a client bound to a transaction (Client.Use). It is a no-op for every mutation that cannot change what the feed reports.

Types

This section is empty.

Jump to

Keyboard shortcuts

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