Documentation
¶
Overview ¶
Package service implements Taskronin's authorization and transactional rules.
Index ¶
- Constants
- func CheckAll(ctx context.Context, q store.Q, now time.Time, z civil.Zone) error
- func CheckStructural(ctx context.Context, q store.Q) error
- func CheckTimeDependent(ctx context.Context, q store.Q, now time.Time, z civil.Zone) error
- type AIChanges
- type AcceptItem
- type AcceptNewIn
- type AddEntryIn
- type AddPlacement
- type AddTaskIn
- type BackupHealth
- type BackupStatusView
- type Banner
- type BlockIn
- type BlockRef
- type ChangePasswordIn
- type ClockView
- type CompleteIn
- type CreateTokenIn
- type DayView
- type DeferIn
- type Effect
- type EffectKind
- type EntryRef
- type EventView
- type HistoryIn
- type Idem
- type ListAIChangesIn
- type ListBlocksIn
- type ListEntriesIn
- type ListOpsIn
- type ListTasksIn
- type LoginIn
- type MarkAIReviewedIn
- type MarkManualIn
- type Meta
- type OpDetail
- type OpResult
- type OpSummary
- type Options
- type Page
- type PlaceIn
- type PurgeLiveIn
- type PurgeLiveResult
- type ReblockIn
- type RelinkEntryIn
- type ReopenIn
- type ReplayMode
- type Report
- type ReportDay
- type ReportIn
- type ReportLine
- type ReportTask
- type ReportTodo
- type ResetPasswordIn
- type RevertIn
- type RevokeTokenIn
- type SearchHit
- type SearchIn
- type Service
- func (s *Service) AcceptNew(ctx context.Context, m Meta, in AcceptNewIn) (*OpResult, error)
- func (s *Service) AddEntry(ctx context.Context, m Meta, in AddEntryIn) (*OpResult, error)
- func (s *Service) AddTask(ctx context.Context, m Meta, in AddTaskIn) (*OpResult, error)
- func (s *Service) Authenticate(ctx context.Context, cookie string) (WebAuth, error)
- func (s *Service) AuthenticateToken(ctx context.Context, bearer string, verifiedSocket bool, ch domain.Channel, ...) (domain.Actor, error)
- func (s *Service) BackupStatus(ctx context.Context, a domain.Actor) (BackupStatusView, error)
- func (s *Service) BeginShutdown()
- func (s *Service) Block(ctx context.Context, m Meta, in BlockIn) (*OpResult, error)
- func (s *Service) ChangePassword(ctx context.Context, m Meta, in ChangePasswordIn) error
- func (s *Service) Clock(ctx context.Context, a domain.Actor) (ClockView, error)
- func (s *Service) Complete(ctx context.Context, m Meta, in CompleteIn) (*OpResult, error)
- func (s *Service) CreateToken(ctx context.Context, m Meta, in CreateTokenIn) (TokenCreated, error)
- func (s *Service) Day(ctx context.Context, a domain.Actor, d civil.Date) (DayView, error)
- func (s *Service) Defer(ctx context.Context, m Meta, in DeferIn) (*OpResult, error)
- func (s *Service) Delete(ctx context.Context, m Meta, in TaskRef) (*OpResult, error)
- func (s *Service) DeleteEntry(ctx context.Context, m Meta, in EntryRef) (*OpResult, error)
- func (s *Service) Drain(ctx context.Context) error
- func (s *Service) Drop(ctx context.Context, m Meta, in TaskRef) (*OpResult, error)
- func (s *Service) ExpireIdempotency(ctx context.Context) (int, error)
- func (s *Service) ExpireSessions(ctx context.Context) (int, error)
- func (s *Service) Export(ctx context.Context, a domain.Actor, w io.Writer) error
- func (s *Service) FlushUsage(ctx context.Context) error
- func (s *Service) Generation() domain.Generation
- func (s *Service) GetBlock(ctx context.Context, a domain.Actor, id domain.BlockID) (domain.BlockView, error)
- func (s *Service) GetEntry(ctx context.Context, a domain.Actor, id domain.EntryID) (domain.EntryView, error)
- func (s *Service) GetOp(ctx context.Context, a domain.Actor, id domain.OpID) (OpDetail, error)
- func (s *Service) GetTask(ctx context.Context, a domain.Actor, id domain.TaskID) (domain.TaskDetail, error)
- func (s *Service) History(ctx context.Context, a domain.Actor, in HistoryIn) (Page[EventView], error)
- func (s *Service) ListAIChanges(ctx context.Context, a domain.Actor, in ListAIChangesIn) (AIChanges, error)
- func (s *Service) ListBlocks(ctx context.Context, a domain.Actor, in ListBlocksIn) ([]domain.BlockView, error)
- func (s *Service) ListEntries(ctx context.Context, a domain.Actor, in ListEntriesIn) (Page[domain.EntryView], error)
- func (s *Service) ListOps(ctx context.Context, a domain.Actor, in ListOpsIn) (Page[OpSummary], error)
- func (s *Service) ListTags(ctx context.Context, a domain.Actor) ([]TagCount, error)
- func (s *Service) ListTasks(ctx context.Context, a domain.Actor, in ListTasksIn) (Page[domain.TaskView], error)
- func (s *Service) ListTokens(ctx context.Context, a domain.Actor) ([]domain.Token, error)
- func (s *Service) Login(ctx context.Context, in LoginIn) (Session, error)
- func (s *Service) Logout(ctx context.Context, cookie string) error
- func (s *Service) MarkAIReviewed(ctx context.Context, m Meta, in MarkAIReviewedIn) (*OpResult, error)
- func (s *Service) MarkManual(ctx context.Context, m Meta, in MarkManualIn) (*OpResult, error)
- func (s *Service) Place(ctx context.Context, m Meta, in PlaceIn) (*OpResult, error)
- func (s *Service) PurgeLive(ctx context.Context, m Meta, in PurgeLiveIn) (PurgeLiveResult, error)
- func (s *Service) ReapplyLedger(ctx context.Context) error
- func (s *Service) Reblock(ctx context.Context, m Meta, in ReblockIn) (*OpResult, error)
- func (s *Service) Reconcile(ctx context.Context) error
- func (s *Service) RecordSystemOp(ctx context.Context, kind domain.OpKind, after json.RawMessage) (*OpResult, error)
- func (s *Service) Redo(ctx context.Context, m Meta) (*OpResult, error)
- func (s *Service) RelinkEntry(ctx context.Context, m Meta, in RelinkEntryIn) (*OpResult, error)
- func (s *Service) Reopen(ctx context.Context, m Meta, in ReopenIn) (*OpResult, error)
- func (s *Service) ReplayLedger(ctx context.Context, recs []backup.LedgerRecord, mode ReplayMode) (*OpResult, error)
- func (s *Service) Report(ctx context.Context, a domain.Actor, in ReportIn) (Report, error)
- func (s *Service) ResetPasswordOffline(ctx context.Context, in ResetPasswordIn) (domain.TokenID, error)
- func (s *Service) Revert(ctx context.Context, m Meta, in RevertIn) (*OpResult, error)
- func (s *Service) RevokeToken(ctx context.Context, m Meta, in RevokeTokenIn) (domain.Token, error)
- func (s *Service) RunBackup(ctx context.Context, a domain.Actor, kind backup.Kind) (backup.SnapshotInfo, error)
- func (s *Service) Search(ctx context.Context, a domain.Actor, in SearchIn) (Page[SearchHit], error)
- func (s *Service) SetDue(ctx context.Context, m Meta, in SetDueIn) (*OpResult, error)
- func (s *Service) SetFocus(ctx context.Context, m Meta, in SetFocusIn) (*OpResult, error)
- func (s *Service) SetOutcome(ctx context.Context, m Meta, in SetOutcomeIn) (*OpResult, error)
- func (s *Service) Settings(ctx context.Context, a domain.Actor) (SettingsView, error)
- func (s *Service) Status(ctx context.Context, a domain.Actor) (StatusView, error)
- func (s *Service) Stopping() <-chan struct{}
- func (s *Service) SyncTimezone(ctx context.Context, name string) (previous string, changed bool, err error)
- func (s *Service) Today(ctx context.Context, a domain.Actor) (TodayView, error)
- func (s *Service) Unblock(ctx context.Context, m Meta, in BlockRef) (*OpResult, error)
- func (s *Service) Undelete(ctx context.Context, m Meta, in TaskRef) (*OpResult, error)
- func (s *Service) UndeleteEntry(ctx context.Context, m Meta, in EntryRef) (*OpResult, error)
- func (s *Service) Undo(ctx context.Context, m Meta) (*OpResult, error)
- func (s *Service) Upcoming(ctx context.Context, a domain.Actor) (UpcomingView, error)
- func (s *Service) UpdateEntry(ctx context.Context, m Meta, in UpdateEntryIn) (*OpResult, error)
- func (s *Service) UpdateSettings(ctx context.Context, m Meta, in UpdateSettingsIn) (SettingsView, error)
- func (s *Service) UpdateTask(ctx context.Context, m Meta, in UpdateTaskIn) (*OpResult, error)
- func (s *Service) WhoAmI(ctx context.Context, a domain.Actor) (WhoAmIView, error)
- func (s *Service) Zone() civil.Zone
- type Session
- type SetDueIn
- type SetFocusIn
- type SetOutcomeIn
- type SettingsView
- type StatusBlock
- type StatusTask
- type StatusView
- type TagCount
- type TaskRef
- type TodayView
- type TokenCreated
- type UpcomingView
- type UpdateEntryIn
- type UpdateSettingsIn
- type UpdateTaskIn
- type WebAuth
- type WhoAmIView
Constants ¶
const ( // MaxSearchQueryBytes bounds the raw input before FTS tokenization. MaxSearchQueryBytes = 1024 // MaxSearchQueryTerms bounds the whitespace-separated terms before quoting. MaxSearchQueryTerms = 64 )
AIDEV-NOTE: DF30: every client reaches FTS through ftsQuery, so these caps bound query cost for the API, MCP, CLI, TUI and web alike.
const ( // SessionIdle is the maximum time a web session may remain inactive. SessionIdle = 7 * 24 * time.Hour // SessionMax is the absolute lifetime of a web session. SessionMax = 30 * 24 * time.Hour )
const Gap int64 = 1 << 16
Gap is the default spacing between task ranks.
const IdemTTL = 7 * 24 * time.Hour
IdemTTL is the retention period for an idempotency record.
const LongOpBudget = 10 * time.Minute
LongOpBudget bounds backups and exports, which also abort on caller cancellation or shutdown.
const OpBudget = 15 * time.Second
OpBudget bounds an ordinary operation, including writer admission and views.
Variables ¶
This section is empty.
Functions ¶
func CheckStructural ¶
CheckStructural checks I1a, I2, I3, I4, I5, I7 and I8 across the whole store. It resolves moments in the database's persisted tz_last_seen zone.
Types ¶
type AIChanges ¶
type AIChanges struct {
ReviewedThrough domain.OpSeq
Unreviewed int
Ops []OpSummary
NextCursor string
}
AIChanges contains review progress and a page of token or retention-lowering operations.
type AcceptItem ¶
AcceptItem identifies a new task and the version seen by the caller.
type AcceptNewIn ¶
type AcceptNewIn struct{ Items []AcceptItem }
AcceptNewIn supplies the tasks to accept atomically from triage.
type AddEntryIn ¶
type AddEntryIn struct {
TaskID sql.Null[domain.TaskID] // Invalid means standalone.
Title string
Notes string
WorkDate civil.Date // Zero means today.
At sql.Null[civil.Minute] // Optional display/sort minute, 0..1439.
}
AddEntryIn supplies work to log against an explicit task or standalone.
type AddPlacement ¶
type AddPlacement struct {
How string // top|bottom|before|after|defer|block|now
Ref domain.TaskID
Defer domain.Moment
Block domain.BlockSpan
}
AddPlacement describes a placement to apply while creating a task.
type AddTaskIn ¶
type AddTaskIn struct {
Title, Notes string
Due *domain.Moment
Tags []string
Project string
Priority domain.Priority
Place *AddPlacement
}
AddTaskIn supplies a new task's content and optional placement.
type BackupHealth ¶
BackupHealth describes the last backup and whether it is recent and successful.
type BackupStatusView ¶
type BackupStatusView struct {
Dir string
Snapshots []backup.SnapshotInfo
BackupHealth
Warning string
}
BackupStatusView describes the configured snapshots and the latest backup health.
type Banner ¶
type Banner struct{ Kind, Message string }
Banner is a dashboard notice with a stable machine-readable kind.
type ChangePasswordIn ¶
type ChangePasswordIn struct{ Current, New string }
ChangePasswordIn supplies the current and replacement owner passwords.
type ClockView ¶
type ClockView struct {
Now time.Time
Today civil.Date
Zone string
WeekStart time.Weekday
DueSoonDays int
Generation domain.Generation
}
ClockView supplies the server's civil-time reference and database generation.
type CompleteIn ¶
type CompleteIn struct {
ID domain.TaskID
Expect domain.Expect
As *string
Date civil.Date // Zero means today; never future.
LogTitle string // Empty means the final task title.
LogNotes string
}
CompleteIn supplies a task completion, optional retitle and completion log text.
type CreateTokenIn ¶
type CreateTokenIn struct {
Name string
Scopes domain.Scopes
ExpiresAt sql.Null[time.Time]
MutationsPerHour int
}
CreateTokenIn describes a named non-owner token and its limits.
type DayView ¶
type DayView struct {
Date civil.Date
Blocks []domain.BlockView
Entries, Unlinked []domain.EntryView
Interruptions []domain.Interruption
}
DayView contains a day's blocks and live entries, including its standalone subset.
type Effect ¶
type Effect struct {
Kind EffectKind
TaskID domain.TaskID
BlockID domain.BlockID
EntryID domain.EntryID
Reason domain.TriageReason
Via string
From, To string
}
Effect is a user-visible consequence reconstructed from persisted events.
type EffectKind ¶
type EffectKind string
EffectKind names a user-visible consequence of an operation.
const ( // EffCreated denotes a new task. EffCreated EffectKind = "created" // EffUpdated denotes a task field or tag change. EffUpdated EffectKind = "updated" // EffRetitled denotes a task title change. EffRetitled EffectKind = "retitled" // EffPlaced denotes task placement. EffPlaced EffectKind = "placed" // EffMoved denotes task reordering. EffMoved EffectKind = "moved" // EffDeferred denotes a task deferral. EffDeferred EffectKind = "deferred" // EffUndeferred denotes a cleared deferral. EffUndeferred EffectKind = "undeferred" // EffDueSet denotes a due moment change. EffDueSet EffectKind = "due_set" // EffDueCleared denotes a cleared due moment. EffDueCleared EffectKind = "due_cleared" // EffBlocked denotes a new scheduled block. EffBlocked EffectKind = "blocked" // EffBlockMoved denotes a rescheduled block. EffBlockMoved EffectKind = "block_moved" // EffBlockCancelled denotes a cancelled or deleted block. EffBlockCancelled EffectKind = "block_cancelled" // EffBlockResolved denotes an automatically resolved block. EffBlockResolved EffectKind = "block_resolved" // EffBlockRestored denotes a block returned to planned status or undeleted. EffBlockRestored EffectKind = "block_restored" // EffOutcomeSet denotes an explicit block outcome. EffOutcomeSet EffectKind = "outcome_set" // EffSlipped denotes a newly slipped block. EffSlipped EffectKind = "slipped" // EffUnslipped denotes a cleared slip. EffUnslipped EffectKind = "unslipped" // EffReasonAdded denotes a new triage reason. EffReasonAdded EffectKind = "reason_added" // EffReasonRemoved denotes a removed triage reason. EffReasonRemoved EffectKind = "reason_removed" // EffFocusSet denotes a focused task. EffFocusSet EffectKind = "focus_set" // EffFocusCleared denotes cleared focus. EffFocusCleared EffectKind = "focus_cleared" // EffInterrupted denotes a focus interruption. EffInterrupted EffectKind = "interrupted" // EffEntryLogged denotes a new log entry. EffEntryLogged EffectKind = "entry_logged" // EffEntryUpdated denotes edited log content. EffEntryUpdated EffectKind = "entry_updated" // EffEntryRelinked denotes a changed task link. EffEntryRelinked EffectKind = "entry_relinked" // EffEntryDeleted denotes a tombstoned entry. EffEntryDeleted EffectKind = "entry_deleted" // EffEntryRestored denotes a restored entry. EffEntryRestored EffectKind = "entry_restored" // EffCompleted denotes a completed task. EffCompleted EffectKind = "completed" // EffReopened denotes a reopened task. EffReopened EffectKind = "reopened" // EffDropped denotes a dropped task. EffDropped EffectKind = "dropped" // EffDeleted denotes a tombstoned task. EffDeleted EffectKind = "deleted" // EffUndeleted denotes a restored task. EffUndeleted EffectKind = "undeleted" // EffReverted denotes a revert, undo or redo operation. EffReverted EffectKind = "reverted" // EffReviewed denotes acknowledged AI changes. EffReviewed EffectKind = "reviewed" // EffPurged denotes permanently scrubbed content. EffPurged EffectKind = "purged" )
func EffectKinds ¶
func EffectKinds() []EffectKind
EffectKinds returns every defined operation effect kind.
type EventView ¶
type EventView struct {
ID domain.EventID
Op OpSummary
Entity domain.EntityKind
EntityID int64
Action domain.Action
Before, After json.RawMessage
}
EventView pairs an audit event with its operation, omitting operation effects.
type ListAIChangesIn ¶
ListAIChangesIn selects unreviewed operations, or all matching operations when requested.
type ListBlocksIn ¶
ListBlocksIn selects live blocks by date and optionally by task.
type ListEntriesIn ¶
type ListEntriesIn struct {
From, To civil.Date
TaskID *sql.Null[domain.TaskID]
IncludeDeleted bool
Limit int
Cursor string
}
ListEntriesIn selects entries by date and task, with optional tombstones and paging.
type ListOpsIn ¶
type ListOpsIn struct {
Actor string
OpPrefix string // 1 to 32 lowercase hex characters; empty means any.
SinceSeq domain.OpSeq
Limit int
Cursor string
}
ListOpsIn filters operations by actor, op ID prefix and exclusive lower sequence bound.
type ListTasksIn ¶
ListTasksIn selects a task classification, optional filters and a keyset page.
type LoginIn ¶
type LoginIn struct{ RemoteKey, Password, OldCookie string }
LoginIn supplies the password, password-gate key and session to replace.
type MarkAIReviewedIn ¶
MarkAIReviewedIn acknowledges AI changes through an inclusive operation sequence.
type MarkManualIn ¶
MarkManualIn identifies a task and its expected version.
type Meta ¶
type Meta struct {
Actor domain.Actor
Idem Idem
Gen domain.Generation
}
Meta accompanies each mutation with its caller and request identity.
type OpResult ¶
type OpResult struct {
OpID domain.OpID
Created, Replayed, NoChange bool
Refs []domain.EntityRef
Task *domain.TaskView
Entry *domain.EntryView
Block *domain.BlockView
Token *domain.Token
Tasks []domain.TaskView
Effects []Effect
Warnings []string
}
OpResult describes a committed operation and its current entity representations.
type OpSummary ¶
type OpSummary struct {
Seq domain.OpSeq
OpID domain.OpID
Kind domain.OpKind
Actor string
Channel domain.Channel
At time.Time
State domain.OpState
Revertible bool
Via string
TaskIDs []domain.TaskID
Effects []Effect
}
OpSummary describes a persisted operation and its user-visible consequences.
type Options ¶
type Options struct {
Store *store.Store
Clock clock.Clock
Zone civil.Zone
WeekStart time.Weekday
DueSoonDays int
SlipGrace time.Duration
UndoDepth int
Backups *backup.Manager
Ledger *backup.Ledger
Passwords *auth.PasswordGate
Logger *slog.Logger
// OpBudget overrides the ordinary runner budget; zero uses the default OpBudget.
OpBudget time.Duration
}
Options supplies the service's dependencies and policy settings.
type PurgeLiveIn ¶
PurgeLiveIn identifies an offline purge target and whether to include all linked entries.
type PurgeLiveResult ¶
PurgeLiveResult reports the selected set, excluded linked entries and any committed change.
type ReblockIn ¶
type ReblockIn struct {
BlockID domain.BlockID
Expect, TaskExpect domain.Expect
Span domain.BlockSpan
}
ReblockIn supplies a new span and preconditions for both the block and its task.
type RelinkEntryIn ¶
RelinkEntryIn identifies an entry and its new task; invalid TaskID means standalone.
type ReplayMode ¶
type ReplayMode uint8
ReplayMode selects whether ledger replay reconciles time-dependent state.
const ( // ReplayLive reconciles the live database before replaying purge intents. ReplayLive ReplayMode = iota + 1 // ReplayHistorical preserves a snapshot's point-in-time state. ReplayHistorical ReplayMode = iota + 1 )
type Report ¶
type Report struct {
From, To civil.Date
Tag, Project string
Days []ReportDay
Tasks map[domain.TaskID]ReportTask
Todo *ReportTodo
Upcoming []domain.TaskView
}
Report contains ascending nonempty days and optional current task sections.
type ReportDay ¶
type ReportDay struct {
Date civil.Date
Lines []ReportLine
}
ReportDay groups entries by work date in display order.
type ReportLine ¶
type ReportLine struct {
EntryID domain.EntryID
Kind domain.EntryKind
Title string
Notes string
TaskID sql.Null[domain.TaskID]
Time sql.Null[civil.Minute]
Reopened bool
}
ReportLine is a live work or completion entry within a report day.
type ReportTask ¶
type ReportTask struct {
Title string
Status domain.TaskStatus
Deleted bool
}
ReportTask supplies the current task annotation for historical entries.
type ReportTodo ¶
ReportTodo contains current triage and backlog tasks in their view order.
type ResetPasswordIn ¶
ResetPasswordIn supplies a replacement password and a freshly minted owner secret.
type RevokeTokenIn ¶
RevokeTokenIn identifies a non-owner token to revoke.
type SearchHit ¶
type SearchHit struct {
Kind string
ID int64
TaskID sql.Null[domain.TaskID]
Title string
Snippet string
Status domain.TaskStatus
WorkDate sql.Null[civil.Date]
}
SearchHit is a live task or entry ranked by full-text relevance.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates operations on a single database.
func (*Service) AcceptNew ¶
AcceptNew places tasks whose only triage reason is new at the bottom in new-sequence order.
func (*Service) AddTask ¶
AddTask captures a task in triage, or applies an owner-requested placement.
func (*Service) Authenticate ¶
Authenticate checks session lifetimes and queues successful activity in memory.
func (*Service) AuthenticateToken ¶
func (s *Service) AuthenticateToken(ctx context.Context, bearer string, verifiedSocket bool, ch domain.Channel, remoteKey string) (domain.Actor, error)
AuthenticateToken checks a bearer and records successful use in memory.
func (*Service) BackupStatus ¶
BackupStatus returns the snapshot inventory and the same backup warning used by Today.
func (*Service) BeginShutdown ¶
func (s *Service) BeginShutdown()
BeginShutdown closes admission and cancels long operations observing stopCtx.
func (*Service) ChangePassword ¶
ChangePassword verifies the owner password and invalidates all web sessions.
func (*Service) Clock ¶
Clock returns the time reference for any authenticated actor, regardless of scopes.
func (*Service) CreateToken ¶
func (s *Service) CreateToken(ctx context.Context, m Meta, in CreateTokenIn) (TokenCreated, error)
CreateToken creates a non-revertible token; retries cannot retrieve its secret.
func (*Service) Delete ¶
Delete tombstones a task, closing planned blocks and clearing triage and focus.
func (*Service) DeleteEntry ¶
DeleteEntry tombstones an entry unless it completes a currently done task.
func (*Service) Drain ¶
Drain waits for accepted operations and jobs, or ctx. BeginShutdown closes admission before draining; a canceled drain never cancels accepted operations.
func (*Service) ExpireIdempotency ¶
ExpireIdempotency removes records strictly older than IdemTTL without events.
func (*Service) ExpireSessions ¶
ExpireSessions persists pending activity and deletes sessions at absolute or idle expiry.
func (*Service) Export ¶
Export streams a portable JSON export from one reader transaction for an administrator. It checks cancellation between rows but cannot interrupt a blocked Write. Callers with blocking writers must interrupt them when Stopping closes or their context is canceled. Writer errors are returned unchanged.
func (*Service) FlushUsage ¶
FlushUsage persists coalesced token and session activity, including after Drain.
func (*Service) Generation ¶
func (s *Service) Generation() domain.Generation
Generation returns the cached database generation without authorization.
func (*Service) GetBlock ¶
func (s *Service) GetBlock(ctx context.Context, a domain.Actor, id domain.BlockID) (domain.BlockView, error)
GetBlock returns a block, including a tombstone, with its task and interval state.
func (*Service) GetEntry ¶
func (s *Service) GetEntry(ctx context.Context, a domain.Actor, id domain.EntryID) (domain.EntryView, error)
GetEntry returns an entry, including a tombstone, with its linked task's title.
func (*Service) GetTask ¶
func (s *Service) GetTask(ctx context.Context, a domain.Actor, id domain.TaskID) (domain.TaskDetail, error)
GetTask returns a task, including a tombstone, and its non-deleted related records.
func (*Service) History ¶
func (s *Service) History(ctx context.Context, a domain.Actor, in HistoryIn) (Page[EventView], error)
History returns a task's audit events, including derived events, newest first.
func (*Service) ListAIChanges ¶
func (s *Service) ListAIChanges(ctx context.Context, a domain.Actor, in ListAIChangesIn) (AIChanges, error)
ListAIChanges returns AI changes newest first, with the total unreviewed count.
func (*Service) ListBlocks ¶
func (s *Service) ListBlocks(ctx context.Context, a domain.Actor, in ListBlocksIn) ([]domain.BlockView, error)
ListBlocks returns live blocks ordered by date, start minute and ID.
func (*Service) ListEntries ¶
func (s *Service) ListEntries(ctx context.Context, a domain.Actor, in ListEntriesIn) (Page[domain.EntryView], error)
ListEntries returns a page of entries, newest days and timed entries first.
func (*Service) ListOps ¶
func (s *Service) ListOps(ctx context.Context, a domain.Actor, in ListOpsIn) (Page[OpSummary], error)
ListOps returns matching operations in descending sequence order.
func (*Service) ListTags ¶
ListTags returns positive open-task counts in case-insensitive tag order.
func (*Service) ListTasks ¶
func (s *Service) ListTasks(ctx context.Context, a domain.Actor, in ListTasksIn) (Page[domain.TaskView], error)
ListTasks returns one filtered page, reconciling the time-dependent views first.
func (*Service) ListTokens ¶
ListTokens returns all token metadata with secret hashes removed.
func (*Service) Login ¶
Login verifies the owner password and atomically replaces any presented session.
func (*Service) MarkAIReviewed ¶
func (s *Service) MarkAIReviewed(ctx context.Context, m Meta, in MarkAIReviewedIn) (*OpResult, error)
MarkAIReviewed advances the owner's review watermark without permitting reversal.
func (*Service) MarkManual ¶
MarkManual adds an explicit triage reason, preserving an existing reason.
func (*Service) PurgeLive ¶
func (s *Service) PurgeLive(ctx context.Context, m Meta, in PurgeLiveIn) (PurgeLiveResult, error)
PurgeLive durably records an intent and scrubs its exact set in one writer transaction. The offline caller holds the instance lock and verifies the owner's password; it must finish checkpointing, backup scrubbing and recovery-file cleanup afterwards.
func (*Service) ReapplyLedger ¶
ReapplyLedger replays the configured ledger in live mode without appending records.
func (*Service) Reconcile ¶
Reconcile performs time-dependent maintenance only when the reader finds work.
func (*Service) RecordSystemOp ¶
func (s *Service) RecordSystemOp(ctx context.Context, kind domain.OpKind, after json.RawMessage) (*OpResult, error)
RecordSystemOp records an offline restore or import without reconciling historical state. The caller supplies a content-free JSON object describing the operation.
func (*Service) RelinkEntry ¶
RelinkEntry attaches a work entry to a task or makes it standalone.
func (*Service) Reopen ¶
Reopen opens a done or dropped task without restoring blocks or placing it.
func (*Service) ReplayLedger ¶
func (s *Service) ReplayLedger(ctx context.Context, recs []backup.LedgerRecord, mode ReplayMode) (*OpResult, error)
ReplayLedger applies the union of valid ledger records as one system operation. Missing IDs are skipped. Historical replay cancels target tasks' planned blocks without deriving outcomes or reconciling unrelated historical state.
func (*Service) Report ¶
Report reads work history, reconciling first only when current views are requested.
func (*Service) ResetPasswordOffline ¶
func (s *Service) ResetPasswordOffline(ctx context.Context, in ResetPasswordIn) (domain.TokenID, error)
ResetPasswordOffline rotates all credentials atomically; callers must hold the offline instance lock.
func (*Service) RevokeToken ¶
RevokeToken revokes a non-owner token, or returns its unchanged revoked metadata.
func (*Service) RunBackup ¶
func (s *Service) RunBackup(ctx context.Context, a domain.Actor, kind backup.Kind) (backup.SnapshotInfo, error)
RunBackup takes a snapshot for an administrator or the system scheduler, then rotates it. Backup bookkeeping is maintenance: it creates no events or idempotency records.
func (*Service) Search ¶
Search returns matching live rows without reconciling time-dependent state.
func (*Service) SetFocus ¶
SetFocus changes or clears today's focus without placing the target task.
func (*Service) SetOutcome ¶
SetOutcome overrides a block's outcome or restores automatic resolution.
func (*Service) Status ¶
Status reconciles state and reads compact focus, due, triage and warning data.
func (*Service) Stopping ¶
func (s *Service) Stopping() <-chan struct{}
Stopping closes when shutdown begins so callers can interrupt blocking I/O.
func (*Service) SyncTimezone ¶
func (s *Service) SyncTimezone(ctx context.Context, name string) (previous string, changed bool, err error)
SyncTimezone persists the configured zone without an operation or event and remembers a change for dashboard notices throughout this service's lifetime.
func (*Service) Today ¶
Today reconciles time-dependent state and reads a consistent dashboard snapshot.
func (*Service) Unblock ¶
Unblock ends a planned block without acknowledging the task's triage reasons.
func (*Service) Undelete ¶
Undelete restores a tombstoned task and requests manual triage if it is open.
func (*Service) UndeleteEntry ¶
UndeleteEntry restores a tombstoned entry, leaving live entries unchanged.
func (*Service) Upcoming ¶
Upcoming returns reconciled deferred tasks and non-overdue tasks due soon.
func (*Service) UpdateEntry ¶
UpdateEntry edits work entries, or just the notes of completion entries.
func (*Service) UpdateSettings ¶
func (s *Service) UpdateSettings(ctx context.Context, m Meta, in UpdateSettingsIn) (SettingsView, error)
UpdateSettings applies retention floors and records password-authorized reductions.
func (*Service) UpdateTask ¶
UpdateTask edits a task's content and tags without placing it.
type SetFocusIn ¶
SetFocusIn supplies an optional focus target and an explicit interruption request.
type SetOutcomeIn ¶
SetOutcomeIn identifies a block, its expected version, and an outcome policy.
type SettingsView ¶
type SettingsView struct{ KeepDaily, KeepWeekly int }
SettingsView contains the configurable backup retention counts.
type StatusBlock ¶
StatusBlock is a compact reference to the current block and its end time.
type StatusTask ¶
StatusTask is a compact task reference for the status line.
type StatusView ¶
type StatusView struct {
Focus *StatusTask
CurrentBlock *StatusBlock
Triage, Due, AI int
BackupWarn, PurgeWarning bool
}
StatusView contains the task, counts and warnings shown in a status line.
type TodayView ¶
type TodayView struct {
Clock ClockView
Focus *domain.TaskView
CurrentBlock *domain.BlockView
Blocks []domain.BlockView
TriageCount int
TriageTop []domain.TaskView
Overdue []domain.TaskView
DueSoon []domain.TaskView
Entries []domain.EntryView
Interruptions []domain.Interruption
AIChanges int
Backup BackupHealth
Banners []Banner
}
TodayView collects the current day's planning, work and service notices.
type TokenCreated ¶
TokenCreated returns public metadata and the bearer secret shown only once.
type UpcomingView ¶
UpcomingView contains future deferrals and non-deferred tasks due soon.
type UpdateEntryIn ¶
type UpdateEntryIn struct {
ID domain.EntryID
Expect domain.Expect
Title *string
Notes *string
WorkDate *civil.Date
At *sql.Null[civil.Minute] // Non-nil invalid Null clears the time.
}
UpdateEntryIn supplies optional changes to an entry's content and work date.
type UpdateSettingsIn ¶
UpdateSettingsIn changes optional retention counts, requiring a password to lower either.
type UpdateTaskIn ¶
type UpdateTaskIn struct {
ID domain.TaskID
Expect domain.Expect
Title, Notes, Project *string // Nil leaves unchanged; empty Project clears.
Priority *domain.Priority // PriorityNone clears.
TagsAdd, TagsRemove []string
}
UpdateTaskIn supplies optional task fields and case-insensitive tag changes.
type WhoAmIView ¶
type WhoAmIView struct {
Actor domain.Actor
Generation domain.Generation
}
WhoAmIView identifies the authenticated caller and current database generation.
Source Files
¶
- aichanges.go
- backup.go
- blocks.go
- columns.go
- derive.go
- effects.go
- entries.go
- events.go
- export.go
- focus.go
- history.go
- idem.go
- invariants.go
- lifecycle.go
- lifecycle_ops.go
- op.go
- password.go
- place.go
- purge.go
- rank.go
- reconcile.go
- report.go
- revert.go
- search.go
- service.go
- sessions.go
- settings.go
- slip.go
- system.go
- tasks.go
- tokens.go
- undo.go
- usage.go
- views.go