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

startfavourites

package
v0.21.0 Latest Latest
Warning

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

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

Documentation

Overview

Package startfavourites keeps the processes each person starred on the Tasks app's Start view, so the list they start from most opens with those at the top on every browser and device they sign in from (ADR-0466).

A mark stores a process id under a user id and nothing else. It is a bookmark, never a grant — the shop's favourites (ADR-0348) and the diagram shortcuts (ADR-0460) settled that, and this takes it over unchanged: whether the person may start the process is decided where the start is made, not here.

It is not the diagram shortcuts' "process" kind, although both name a process by its id. Those are resolved against the diagram's design-time scope, so a person who starts a process without being a member of its application could not mark it — and that person is exactly who the Start view is for. Nor are a modeler's favourite diagrams and somebody's favourite forms to fill in the same list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	// UserID owns the record and is its key.
	UserID string `json:"userId"`
	// ProcessIDs are kept in the order they were marked. A process id rather than a
	// deployment key, because a key names one version and a mark names the process:
	// deploying v2 must not leave the star on v1.
	ProcessIDs []string `json:"processIds"`
	// UpdatedAt is Unix nanos, like every other timestamp Atlas writes.
	UpdatedAt int64 `json:"updatedAt"`
}

Record is one person's marks.

type Service

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

Service serves one person's start favourites: read the list, mark one process, clear one. There is no listing across people and no admin view.

func New

func New(loop *runloop.Loop, store *Store, known func(string) bool, limit func() int) *Service

New builds the service over the store, serializing every access on the loop: a sidecar store does no locking of its own, and two tabs starring at once is the ordinary case.

func (*Service) HandleGet

func (s *Service) HandleGet(w http.ResponseWriter, r *http.Request)

HandleGet answers this person's marks.

func (*Service) HandleMark

func (s *Service) HandleMark(w http.ResponseWriter, r *http.Request)

HandleMark stars one deployed process for this person. Marking one already marked writes nothing.

func (*Service) HandleUnmark

func (s *Service) HandleUnmark(w http.ResponseWriter, r *http.Request)

HandleUnmark clears one mark. It is never checked against the engine, so a mark on a process deleted since can always be taken away; clearing one never made is not an error either.

type Store

type Store struct {
	*sidecar.Store[Record]
}

Store is the durable home of the start favourites: one JSON file per user id, with the atomic-write discipline every design-time store shares. It is owned by the run loop and does no locking of its own.

func NewStore

func NewStore(dir string) (*Store, error)

NewStore opens (creating if needed) the favourites directory. The key is the user id under the default filename scheme, whose hex encoding makes any id a directory hands out a safe filename and keeps a key from addressing a file outside the store.

Jump to

Keyboard shortcuts

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