Documentation
¶
Overview ¶
Package tasks is the tasks service: tasks derived from items, captured by the user or opened by other services, and the verbs that move them.
Index ¶
- Constants
- Variables
- func Ended(e task.Task, err error) (bool, error)
- func Lookup[K comparable, V any](ctx context.Context, key string, k K, all func() (map[K]V, error), ...) (V, bool, error)
- func Once[T any](ctx context.Context, key string, load func() (T, error)) (T, error)
- func PairsTasks(handler string) bool
- func ProposalFrom(g gate.Gate) string
- func UnitLookup[V any](ctx context.Context, key string, u unit.Unit, ...) (V, bool, error)
- func WakeIn(ctx context.Context, ws interface{ ... }, id task.ID) (wake.Wake, bool, error)
- func WithPass(ctx context.Context, p *Pass) context.Context
- type AllWakes
- type Authority
- type CardFacts
- type Deps
- type Ending
- type Facts
- type GateSweeper
- type GateText
- type GateWords
- type Gates
- type Items
- type Keep
- type Merger
- type OpenRequest
- type OwedBy
- type Page
- type Pass
- type ProjectDeps
- type ProjectState
- type ProjectStore
- type PropStore
- type Reader
- type Recategorizer
- type Request
- type Result
- type Review
- type ReviewStep
- type Service
- func (s *Service) Accepts(t task.Task, v task.Verb, a task.Actor) error
- func (s *Service) Addressed(ctx context.Context, id task.ID, e task.Task, req Request) (Request, error)
- func (s *Service) Allowed(ctx context.Context, t task.Task, req Request) (gated bool, err error)
- func (s *Service) Attach(ctx context.Context, id task.ID, u unit.Unit) error
- func (s *Service) Capture(ctx context.Context, title, notes string, u *unit.Unit) (task.Task, error)
- func (s *Service) Children(ctx context.Context) (map[task.ID][]task.ID, error)
- func (s *Service) Close(ctx context.Context, id task.ID, to task.Category) error
- func (s *Service) Counts(ctx context.Context, area string) (task.Counters, error)
- func (s *Service) CountsWhere(ctx context.Context, area string, ...) (task.Counters, error)
- func (s *Service) Do(ctx context.Context, id task.ID, req Request) (Result, error)
- func (s *Service) EndHeld(ctx context.Context, id task.ID, c task.Category) error
- func (s *Service) Handles(e task.Task, verb task.Verb) bool
- func (s *Service) HeldOpen(ctx context.Context) ([]task.ID, error)
- func (s *Service) HoldersOf(ctx context.Context, u unit.Unit) ([]task.Task, error)
- func (s *Service) Linked(ctx context.Context, ls []link.Link) error
- func (s *Service) Match(ctx context.Context, text string, except task.ID) ([]task.Task, error)
- func (s *Service) Me() task.Me
- func (s *Service) MergeOf(ctx context.Context, id task.ID) (merge.Record, bool, error)
- func (s *Service) Nudged(ctx context.Context, id task.ID, u unit.Unit, its []string, at time.Time) error
- func (s *Service) Open(ctx context.Context, r OpenRequest) (task.Task, error)
- func (s *Service) OpenTasksOf(ctx context.Context, u unit.Unit) ([]task.Task, error)
- func (s *Service) ProjectsStatus(ctx context.Context) (map[task.ID]ProjectState, error)
- func (s *Service) PropsOf(ctx context.Context, id task.ID) (task.Props, error)
- func (s *Service) Recategorize(ctx context.Context) ([]string, error)
- func (s *Service) RecordVerb(ctx context.Context, e task.Task, req Request) error
- func (s *Service) Register(class, handler string, h VerbHandler)
- func (s *Service) RegisterView(over, prefix string, src ViewSource)
- func (s *Service) Rejected(ctx context.Context, g gate.Gate)
- func (s *Service) ReopenOwn(ctx context.Context, u unit.Unit) (task.ID, bool, error)
- func (s *Service) Retitle(ctx context.Context, id task.ID, title string) error
- func (s *Service) Review(ctx context.Context) (Review, error)
- func (s *Service) ReviewStepDone(ctx context.Context, step string) (Review, error)
- func (s *Service) Rouse(ctx context.Context, id task.ID) error
- func (s *Service) ServeProjects(d ProjectDeps)
- func (s *Service) ServesReview() bool
- func (s *Service) SetMe(me task.Me)
- func (s *Service) SetProp(ctx context.Context, id task.ID, name string, v task.Value, w task.Writer) error
- func (s *Service) Sets(ctx context.Context, views []task.View, keep Keep) (map[task.View][]task.Task, error)
- func (s *Service) Sleep(ctx context.Context, id task.ID, w wake.Wake) error
- func (s *Service) Snapshot(ctx context.Context) (Snapshot, error)
- func (s *Service) Stored(ctx context.Context, ids []task.ID) (map[task.ID]task.Task, error)
- func (s *Service) Sync(ctx context.Context, units []unit.Unit) error
- func (s *Service) Task(ctx context.Context, id task.ID) (task.Task, error)
- func (s *Service) Tasks(ctx context.Context, q task.Query) ([]task.Task, error)
- func (s *Service) TasksOf(ctx context.Context, u unit.Unit) ([]task.Task, error)
- func (s *Service) TasksSince(ctx context.Context, q task.Query, since Since, units []unit.Unit) (Page, error)
- func (s *Service) UnitClosed(ctx context.Context, u unit.Unit) error
- func (s *Service) WakeOf(ctx context.Context, id task.ID) (wake.Wake, bool, error)
- type Since
- type Snapshot
- type States
- type Store
- type Survives
- type TakenApart
- type UnitTasks
- type UnitsFacts
- type UnitsItems
- type VerbHandler
- type ViewEval
- type ViewSort
- type ViewSource
- type ViewSpec
- type Views
- type Wakes
Constants ¶
const ( HandlerMerge = "merge" HandlerSplit = "split" HandlerRelate = "relate" HandlerUnrelate = "unrelate" )
The handlers that fold a task into another, give it back, and link two tasks: each takes the other task in the argument task.ArgTask.
const ( // HandlerFinish and HandlerDrop are a move and nothing else, unless a kind registers its own handler of // them. HandlerFinish = "finish" HandlerDrop = "drop" )
The handlers the service runs itself as part of a verb's move; a verb with another handler moves nothing on its own: a registered handler or the daemon runs it.
const EveryKind = "*"
EveryKind registers a handler for the stored tasks no class-specific handler serves.
const ItemsKey = "items"
ItemsKey is the Once key of the items of every unit of a pass, a map[unit.Unit][]items.Item, which the facts and the draft step share.
Variables ¶
var ( ErrNoTask = errors.New("no such task") ErrVerb = errors.New("the task's state refuses the verb") // ErrArgs is a request the service cannot read: an unknown verb or view, or a missing or bad argument. ErrArgs = errors.New("bad task request") // ErrPluginDisabled refuses a change to a task whose unit's plugin is disabled. ErrPluginDisabled = errors.New("the unit's plugin is disabled") // ErrMerged refuses a verb sent to the id of a task merged into another, which reads as that one. ErrMerged = errors.New("the task was merged into another") // ErrForbidden refuses a verb its actor may not run on the task, as the profile's by says. ErrForbidden = errors.New("the actor may not run the verb") )
var ErrNoView = fmt.Errorf("%w: no such view", ErrArgs)
ErrNoView is a view the profile does not serve.
Functions ¶
func Ended ¶ added in v0.4.0
Ended says whether e, as a read of it returned it with err, is done or dropped; a task no longer stored has ended too.
func Lookup ¶ added in v0.4.0
func Lookup[K comparable, V any](ctx context.Context, key string, k K, all func() (map[K]V, error), one func() (V, bool, error)) (V, bool, error)
Lookup is the value of k, held or not: in a pass, when all is not nil, every value is loaded once under key with all; one reads k alone otherwise.
func Once ¶
Once is what load returns under key, once per the pass ctx carries; load's result each time outside a pass.
func PairsTasks ¶ added in v0.4.0
PairsTasks says whether a verb of handler pairs its task with the other one, merging or relating them.
func ProposalFrom ¶ added in v0.4.0
ProposalFrom is the workflow that asked for the verb gate g proposes, "" when a person or an agent did or no verb opened g.
func UnitLookup ¶ added in v0.4.0
func UnitLookup[V any](ctx context.Context, key string, u unit.Unit, all func(units []unit.Unit) (map[unit.Unit]V, error), one func() (V, bool, error)) (V, bool, error)
UnitLookup is Lookup over the units of the pass: when the pass holds u, the values of all its units are loaded once under key with all.
Types ¶
type AllWakes ¶ added in v0.4.0
AllWakes is an optional capability of Wakes: every task's wake, which a pass reads once for all.
type Authority ¶
type Authority func(ctx context.Context, verb string, a task.Actor, t task.Task) (allow, gate bool, err error)
Authority says whether actor a may run verb on task t (allow), and whether running it opens the verb's gate instead (gate).
type CardFacts ¶
type CardFacts struct {
Cards card.Store
// Enabled says whether a provider's plugin is enabled; nil: every one is.
Enabled func(unit.ProviderID) bool
// Me is the user's identity now; nil: nobody.
Me func() task.Me
// Kind is the value of the kind property a provider's plugin gives the tasks of its units; nil: none.
Kind func(unit.ProviderID) string
}
CardFacts reads a unit's facts from its stored card (#unit-card).
type Deps ¶
type Deps struct {
Store Store
Items Items
Facts Facts
Me task.Me
Clock port.Clock
// States are the profile's states and verbs; the service reads a task's category from its state.
States States
// Disabled are the providers whose plugin is disabled now; nil: none is.
Disabled func() []unit.ProviderID
// Authority says who may run each verb, as the profile's by does; nil, with no profile at hand: a person
// may run every verb and no other actor any.
Authority Authority
// Gates opens the gate a gated verb opens; nil: a gated verb fails.
Gates Gates
// Ending settles what a task that ends holds; nil settles nothing.
Ending Ending
// Wakes are the tasks' wakes, which schedule puts and wake reads; nil: schedule fails and no task has one.
Wakes Wakes
// Baseline fills a wake Sleep puts on task t: a When that asks to wake once a fact of t changes becomes the
// condition over the value t has now; nil leaves every When as it is.
Baseline func(ctx context.Context, t task.Task, when string) (string, error)
// Views are the profile's views as it loads now; nil lists none.
Views func() Views
// ViewEval places a stored task in the profile's views; nil places none.
ViewEval ViewEval
// ViewSort orders a view's tasks as the profile sorts it; nil keeps their base order.
ViewSort ViewSort
// Activity is told each task Sync finds asleep with a person's activity on its unit since the user saw it,
// for a wake on activity; nil: none is told.
Activity func(ctx context.Context, id task.ID) error
// Survives picks the task a merge keeps, as the merge verb's survivor says; nil: the older stays.
Survives Survives
// GateText words the gate a gated verb opens; nil writes none.
GateText GateText
// TakenApart holds the pairs the user took apart; nil holds none.
TakenApart TakenApart
// Gen is the store's change generation; with it, the reads that start while it holds share one pass for
// up to passReuse. nil: every read has a pass of its own.
Gen func() port.Generation
}
Deps is what the service runs on.
type Ending ¶ added in v0.4.0
type Ending interface {
Ended(ctx context.Context, e task.Task, v task.Verb, by task.Actor, session string)
}
Ending settles what a task that ended still holds, its drafts and gates: e as it was left, done or dropped, by verb v of by, through session when by is an agent, or by no verb when the source ended it. The end stands whatever happens to them, so Ended reports its own failures.
type GateSweeper ¶ added in v0.4.0
type GateSweeper interface {
// ActingFor are the open gates that would act in task id's name: those of kind proposal, plan or step on
// its own unit, and the proposals on any task whose proposed verb names id in task.ArgTask.
ActingFor(ctx context.Context, id task.ID) ([]gate.Gate, error)
// Supersede resolves each open gate of ids as superseded; a gate no longer open is left as it is.
Supersede(ctx context.Context, ids ...int64) error
}
GateSweeper is the Gates' capability a merge and a split need, served by the gates service, the only code that resolves a gate; Gates without it refuse both.
type GateText ¶ added in v0.4.0
GateText is the words of gate g a gated verb opens, the gate's text of gates.toml over the proposal facts of w; "" for a gate with none.
type GateWords ¶ added in v0.4.0
GateWords are what the words of a gated verb's gate read: the verb, the task it runs on, the other task task.ArgTask names, zero when none, and the task a merge keeps and the one it folds, zero but for a merge.
type Gates ¶
type Gates interface {
// Open opens g under the approval that decides it, or waiting for a person whatever that decides when wait.
Open(ctx context.Context, g gate.Gate, wait bool) (gate.Gate, error)
Get(ctx context.Context, id int64) (gate.Gate, error)
OfTask(ctx context.Context, id task.ID) ([]gate.Gate, error)
// HoldsTask says whether an open gate of task id holds it open until a person settles it or its unit ends.
HoldsTask(ctx context.Context, id task.ID) (bool, error)
}
Gates are the gates a gated verb opens and reads back: one open gate per proposal.
type Keep ¶ added in v0.4.0
Keep says whether a task stays in a set; it reads the task inside the pass its ctx carries.
type Merger ¶ added in v0.4.0
type Merger interface {
// Merge writes into as r's fold left it, drops task r.From and aliases it to r.Into, points the gates,
// drafts and messages that name r.From at r.Into, and keeps r, completed with their ids, r.From's wake and
// its unit's marks, as r.From's merge record; evs are written with it, and port.TopicTasks notes both
// tasks' units. r.Superseded are gates the caller superseded already. ErrNoTask when either is not stored.
Merge(ctx context.Context, r merge.Record, into task.Task, evs ...port.Event) error
// Split undoes the merge r records as sp, merge.Unfold's, says: writes sp.From back with r's wake and marks,
// points at r.From the gates, drafts and messages of sp.Units and of r's ids but those another record of
// sp.Others lists, keeps sp.Heirs as their tasks' merge records, drops the alias, and writes sp.Rest, with
// evs. ErrVerb when sp names another pair than r, r.From is stored, r is not its latest record, or r.Into
// is not stored.
Split(ctx context.Context, r merge.Record, sp merge.Split, evs ...port.Event) error
// MergeOf is the record of the merge that took task id; false when id is stored or was never merged.
MergeOf(ctx context.Context, id task.ID) (merge.Record, bool, error)
}
Merger is a Store that folds one task into another and gives it back, each in one transaction; a Store without it serves no merge and no split. Both start a new epoch of the tasks' position, so a page since an older one is Full and no client keeps the task that went.
type OpenRequest ¶
type OwedBy ¶
OwedBy is who owes task t's next step, as tasks.toml's owed_by says: "me", a person's key, or "" when nobody does.
type Pass ¶
Pass is one evaluation of the views over the tasks: every task it ranges over, so a fact over a task's parent or children reads them here rather than in the store, and what an evaluator read of each task, kept for the pass.
func (*Pass) Once ¶
Once is what load returns under key, loaded once per pass and shared by every task of it: what a fact reads of the store as a whole, such as the open sessions, rather than once per task. A load that fails is loaded again by the next reader.
type ProjectDeps ¶
type ProjectDeps struct {
Store ProjectStore
}
type ProjectState ¶
type ProjectState struct {
Due bool // past its review interval
}
ProjectState is a project's status at the service's now.
type ProjectStore ¶
type ProjectStore interface {
// CurrentRun is the Review run with a step still open.
CurrentRun(ctx context.Context) (task.ReviewRun, bool, error)
PutRun(ctx context.Context, r task.ReviewRun) error
}
ProjectStore keeps what the projects need beyond their tasks: the Review's runs.
type PropStore ¶
type PropStore interface {
SetProp(ctx context.Context, id task.ID, name string, v task.Value, w task.Writer) error
PropsOf(ctx context.Context, id task.ID) (task.Props, error)
}
PropStore keeps the tasks' properties. SetProp replaces the property's value and records its writer; a zero Value deletes the property, which PropsOf then leaves out. ErrNoTask when the task does not exist. It checks no type and no writer: the caller holds the profile that declares them. PropsOf are a task's properties, empty for one with none.
type Reader ¶
type Reader interface {
Tasks(ctx context.Context, q task.Query) ([]task.Task, error)
// TasksSince is the page after position since: Full, with q's tasks, when since is from another epoch or
// ahead of the store; else the tasks written after since's Rev, whatever their category. Removed is empty
// and Counters zero: the service fills them.
TasksSince(ctx context.Context, q task.Query, since Since) (Page, error)
// Task reads task id, else follows the aliases of id, hop by hop, to the stored task they lead to: at each
// hop, the alias to the task the hop's latest merge record (merge.RecordKind) names when it has one, else a
// stored task first, an open one before a closed one, then the oldest. A task merged into one merged in
// turn reads as the last. ErrNoTask when none leads to a stored task, a cycle included; a merge record it
// cannot read fails the read.
Task(ctx context.Context, id task.ID) (task.Task, error)
TasksOf(ctx context.Context, u unit.Unit) ([]task.Task, error)
}
Reader is the read half of Store. Its lists read q.All only: every task, or the open ones; the views over them are the service's.
type Recategorizer ¶
type Recategorizer interface {
Recategorize(ctx context.Context, of func(state string) (task.Category, bool), at time.Time) (unknown []string, err error)
}
Recategorizer rewrites the stored tasks' categories from their states, as of reads them, at at, noting the tasks it moved. Unknown are the states tasks hold that of does not know; their tasks keep their category.
type Request ¶
type Request struct {
Verb task.Verb
Args map[string]string
Source string
// Actor is who runs the verb: an agent only through a session the user drives, which the daemon checks
// before it asks.
Actor task.Actor
// Session is the session an agent's request came through, "" for any other actor.
Session string
Chain workflow.Chain
Approved int64
}
Request is a verb to run. Actor is who runs it, required; Source where it came from (the cockpit, a workflow's name). Chain is the chain of workflows that led to it, which its event carries on. Approved is the approved gate a gated run of the verb opened, which ProposedVerb sets and no route copies: the person's approval stands for the verb's by.
func ProposedVerb ¶
ProposedVerb is the request a gate a gated verb opened proposes: Do runs it once the gate is approved, without the verb's by, as the person who approved it, or as the workflow that asked for it when a rule or a window released the gate; false for a gate no verb opened.
type Review ¶
type Review struct {
ID string
StartedAt time.Time
Steps []ReviewStep
Done bool
}
Review is the review as it stands: its steps in order, each with its count. ID is empty while nothing was left to review when it started, so nothing was recorded.
type ReviewStep ¶
ReviewStep is a step of the review: the view it walks, how many it lists, and whether it is done.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Accepts ¶
Accepts says whether actor a may run verb v on t as its move: ErrArgs for a verb the profile does not declare, ErrVerb naming the verb and the state for one t's state refuses or one whose handler the service does not run, ErrForbidden for one the profile's by does not let a run. A verb whose by opens a gate for a is accepted: running it opens the gate.
func (*Service) Addressed ¶ added in v0.4.0
func (s *Service) Addressed(ctx context.Context, id task.ID, e task.Task, req Request) (Request, error)
Addressed is req as it may run on e, the task id reads as: a verb sent to the id of a task merged into e is refused with ErrMerged, but split, which splits that task out when it names no other task; a verb sent to e's own id, or to an id an older alias leads to, runs as sent.
func (*Service) Allowed ¶
Allowed says whether req's actor may run req's verb on t, and whether running it opens the verb's gate instead, as the profile's authority says: ErrForbidden for a request with no actor or one the verb's by leaves out. A request an approved gate of t proposed (ProposedVerb) is allowed without the by.
func (*Service) Attach ¶
Attach adds u to task id's units, after those it holds; a unit it holds already changes nothing.
func (*Service) Capture ¶
func (s *Service) Capture(ctx context.Context, title, notes string, u *unit.Unit) (task.Task, error)
Capture files a new task in the Inbox.
func (*Service) Children ¶
Children are the open children of every parent, in sibling order: by Position, then id.
func (*Service) Close ¶
Close moves a task opened by Open or Capture into the done or the dropped category; a derived task, or one whose unit's plugin is disabled, refuses it.
func (*Service) CountsWhere ¶
func (s *Service) CountsWhere(ctx context.Context, area string, keep func(context.Context, task.Task) (bool, error)) (task.Counters, error)
CountsWhere is Counts over the tasks keep takes, every task when keep is nil. Each view, area and context counts only the tasks of its list that keep takes, so a client's filter narrows the counters as it narrows the lists; keep reads a task inside the pass its ctx carries.
func (*Service) Do ¶
Do runs req.Verb on task id: a registered handler first, else the state change. A task of a unit whose plugin is disabled refuses every verb with ErrPluginDisabled but one whose handler is drop, which moves a derived task, or one whose units are all of disabled plugins, to the Trash whole, and detaches a disabled plugin's units from any other.
func (*Service) EndHeld ¶ added in v0.4.0
EndHeld closes task id, held only for gates (heldOnly), into category c; any other task is left as it is.
func (*Service) HeldOpen ¶ added in v0.4.0
HeldOpen are the open tasks held only for gates (heldOnly).
func (*Service) HoldersOf ¶ added in v0.4.0
HoldersOf are the tasks, open or closed, that hold u or one of its items, held or resolved, but those a view hides for a disabled plugin, the open ones first.
func (*Service) Linked ¶ added in v0.4.0
Linked records task.EventLinked on the own unit of each task holding, open or resolved, the item a link of ls names, once per link; its data is the unit the link targets. A link that names no item records nothing.
func (*Service) Match ¶ added in v0.4.0
Match is every open task whose title holds text, case and the spaces around text aside, the newest change first: the tasks a person picks another task from for task except, which is left out as it reads. Draft and message tasks are left out too, as no verb takes them as the other task.
func (*Service) Me ¶ added in v0.4.0
Me is the user's identity Sync reconciles with; it never waits on a verb or a sync.
func (*Service) MergeOf ¶ added in v0.4.0
MergeOf is the record of the merge that took task id, as the store keeps it; false when id is stored, was never merged, or the store keeps no merges.
func (*Service) Nudged ¶
func (s *Service) Nudged(ctx context.Context, id task.ID, u unit.Unit, its []string, at time.Time) error
Nudged records a nudge sent at at on u about the items its draft listed: it writes the last_nudge property on the task id names and on every open task that holds one of the items on u, as the workflow that nudged. It reads them under the service's lock, so it never writes back a copy older than a concurrent Sync's, and it never moves last_nudge back.
func (*Service) Open ¶
Open creates a task another service owns the content of, such as a gate's: Inbox, random id. A task on a unit takes the kind its plugin gives its units' tasks (UnitFacts.Kind), as the plugin writes it, so the profile's rules for that kind apply to it; any other's kind is left to the profile.
func (*Service) OpenTasksOf ¶ added in v0.4.0
OpenTasksOf are the open tasks that hold u or one of its items, but those a view hides for a disabled plugin, in the order a view lists them before its sort.
func (*Service) ProjectsStatus ¶
ProjectsStatus is each live project's review mark, over one read of the open set.
func (*Service) Recategorize ¶
Recategorize gives every stored task the category of its state as the profile declares it now, and returns the states stored tasks hold that the profile does not declare; those tasks keep their category. A store that keeps no categories recategorizes nothing.
func (*Service) RecordVerb ¶
RecordVerb records that req's actor ran req's verb on e, once the handler or the service that runs it succeeded.
func (*Service) Register ¶
func (s *Service) Register(class, handler string, h VerbHandler)
Register makes h run, before any state change, on the tasks of class the verbs whose profile handler is handler. A class is a value of the kind property, the origin task.OriginDraft or task.OriginMessage of a task another service serves, or EveryKind.
func (*Service) RegisterView ¶
func (s *Service) RegisterView(over, prefix string, src ViewSource)
RegisterView serves the views over over from src; task ids starting with prefix are read from it.
func (*Service) Rejected ¶ added in v0.4.0
Rejected supersedes the open proposals of the pair rejected gate g proposed, a merge or a relation, the user having kept the two apart; a gate that proposes no pair, or was not rejected, supersedes nothing.
func (*Service) ReopenOwn ¶
ReopenOwn is u's own task when u's items key on u (task.UnitTask), moved back into the ready category, Changed, when it is done; ok is false when u's items key on no unit task or no task holds it. A dropped task stays dropped.
func (*Service) Retitle ¶
Retitle renames a task opened by Open or Capture, as one change; a derived task refuses it.
func (*Service) Review ¶
Review is the current review, or a new one: a step whose count is 0 at its start starts done, and a new review is recorded once a step is left to do.
func (*Service) ReviewStepDone ¶
ReviewStepDone marks step, the view it walks, done in the current review, recording the review once every step is.
func (*Service) Rouse ¶
Rouse drops task id's wake and returns the task where the wake said, as the wake verb does; a task with no wake is left as it is.
func (*Service) ServeProjects ¶
func (s *Service) ServeProjects(d ProjectDeps)
ServeProjects runs the project verbs on s (project with its position, sequential, reviewed) and serves the review.
func (*Service) ServesReview ¶
ServesReview says whether the review is served: ServeProjects gave it a store for its runs.
func (*Service) SetProp ¶
func (s *Service) SetProp(ctx context.Context, id task.ID, name string, v task.Value, w task.Writer) error
SetProp sets task id's property name to v as w wrote it, under the lock every other write of the service takes, so no write built from an older copy of the task undoes it; a zero v unsets it. It checks no type and no writer: the caller holds the profile that declares them.
func (*Service) Sets ¶ added in v0.4.0
func (s *Service) Sets(ctx context.Context, views []task.View, keep Keep) (map[task.View][]task.Task, error)
Sets are the tasks of each of views, read in one pass over the stored tasks: each view's tasks as it lists them, in its order, that keep takes (every one when keep is nil); keep is called at most once per task.
func (*Service) Sleep ¶
Sleep defers open task id under w: a task not deferred moves to the first deferred state, and w returns it where it was; one deferred already keeps where its wake returned it, else its state. It is how a plugin's wake, such as a mute, holds a task.
func (*Service) Stored ¶ added in v0.4.0
Stored are the stored tasks of ids, from the pass ctx carries, else the pass every reader shares; an id no stored task holds is left out.
func (*Service) Sync ¶
Sync reconciles the units named by a TopicItems, TopicSourceEvents or TopicCards note, in one Apply, then tells Activity the asleep tasks of those units a person's activity reached. A unit whose plugin is disabled keeps its tasks as they are.
func (*Service) Tasks ¶
Tasks is q's view: its tasks in the view's order, narrowed to q's area and contexts.
func (*Service) TasksSince ¶
func (s *Service) TasksSince(ctx context.Context, q task.Query, since Since, units []unit.Unit) (Page, error)
TasksSince is q's page after since with the counters of q's area. A paged view's page from the same epoch lists the tasks written after since and the tasks holding one of units that are in the view, and removes those that are not; any other view's page is Full, at the store's position.
func (*Service) UnitClosed ¶
UnitClosed ends the open tasks that hold u, its closure posted: each moves into the done category.
type Snapshot ¶ added in v0.4.0
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is the stored tasks read once, for the calls that must agree on them, such as the tasks feed's publish of the units they hold and the counters.
func (Snapshot) Counts ¶ added in v0.4.0
Counts are the counters of the profile's views over area, over the tasks of n.
type States ¶
type States interface {
task.Profile
// Move is the states verb moves a task from (every state when empty) and the state it moves it to ("" for
// none); false when the profile declares no such verb.
Move(verb string) (from []string, to string, ok bool)
// Handler is the handler verb runs besides its move, "" for none.
Handler(verb string) string
// Gate is the gate a by.<actor> of "gate" on verb opens, as the profile declares it: its Name, Kind and
// Intents; false when the verb names none.
Gate(verb string) (gate.Gate, bool)
}
States are the profile's states (tasks.toml), the properties its roles act on and the transitions of its verbs.
type Store ¶
type Store interface {
Reader
// Apply writes cs and evs in one transaction, bumps Rev and notes port.TopicTasks; when cs change
// nothing it writes and notes nothing, and with no cs it writes evs alone. It refuses, with ErrNoTask, an
// update of an id an alias names and no row holds, as a sync that read a task before its merge writes.
Apply(ctx context.Context, cs []task.Change, evs ...port.Event) error
}
type Survives ¶ added in v0.4.0
Survives says whether the predicate verb's survivor names (tasks.toml) holds on task t, over its facts: the task it holds on alone is the one a merge keeps.
type TakenApart ¶ added in v0.4.0
TakenApart says whether the user took task t and other apart (task.undone), so a pair a workflow asked for runs only once they decide.
type UnitTasks ¶ added in v0.7.0
type UnitTasks interface {
// TasksOfUnits is TasksOf of each of units; a unit no task names is absent.
TasksOfUnits(ctx context.Context, units []unit.Unit) (map[unit.Unit][]task.Task, error)
}
UnitTasks is a Reader that reads the tasks of many units at once.
type UnitsFacts ¶ added in v0.7.0
type UnitsFacts interface {
// UnitsFacts is UnitFacts of each of units; a unit whose plugin is disabled is absent.
UnitsFacts(ctx context.Context, units []unit.Unit) (map[unit.Unit]task.UnitFacts, error)
}
UnitsFacts is a Facts that reads the facts of many units at once.
type UnitsItems ¶ added in v0.7.0
type UnitsItems interface {
// Load are the items of units; a unit with none is absent.
Load(ctx context.Context, units []unit.Unit) (map[unit.Unit][]items.Item, error)
}
UnitsItems is an Items that reads the items of many units at once.
type VerbHandler ¶
VerbHandler runs a verb another service owns (answer/approve/dismiss on messages, approve/dismiss on drafts); one on a stored task records the verb with Service.RecordVerb once it succeeded.
type ViewEval ¶
ViewEval says whether task t is in the profile's view; the service calls it inside a Pass, which ctx carries.
type ViewSort ¶
ViewSort orders a view's tasks in place as the profile sorts the view; they come in their base order: the oldest first, a parent's children in their sibling order.
type ViewSource ¶
type ViewSource interface {
Tasks(ctx context.Context, q task.Query) ([]task.Task, error)
Task(ctx context.Context, id task.ID) (task.Task, bool, error)
}
ViewSource serves the views over another thing than the stored tasks, such as the gates: Tasks are view q.View's, each what the view lists stands for, and Task reads a task of its own, whose id carries the prefix it is registered with; false for none.
type ViewSpec ¶
type ViewSpec struct {
ID task.View
Over string
Paged bool
HideDisabled bool
// Uncounted leaves the view out of the counters, unless the badge or a review step names it: a view off
// the rail, which the home and the queues read with Sets when they need it.
Uncounted bool
}
ViewSpec is a view of the profile as the service lists it. Over is what it lists: task.OverTasks, the stored tasks ViewEval places in it, or another, which the ViewSource registered for it serves. Paged says its predicate reads only what a write of the task itself moves, and not the time, so a page since a position lists only the tasks written after it; any other view is served Full. HideDisabled leaves out the tasks whose units are all of a disabled plugin.
type Views ¶
Views are the profile's views that list something, in its order, and the views its badge and its review name.
type Wakes ¶
type Wakes interface {
Put(ctx context.Context, w wake.Wake) error
Drop(ctx context.Context, id task.ID) error
Of(ctx context.Context, id task.ID) (wake.Wake, bool, error)
}
Wakes keeps the tasks' wakes, one per task: Put replaces a task's, Drop removes it, dropping none is no error, and Of is false for a task with none.