memory

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 9 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 memory is what the turns of a task learned, across every unit the task holds and the tasks merged into it, and, once the task reopened, how it had ended.

Index

Constants

View Source
const Recent = 3

Recent is how many learned entries a turn's instructions carry; task_read lists them all.

Variables

This section is empty.

Functions

This section is empty.

Types

type Books

type Books interface {
	Books(ctx context.Context, units ...unit.Unit) (map[unit.Unit]turn.Book, error)
}

type Entry

type Entry struct {
	Unit unit.Unit
	At   time.Time
	Text string
}

Entry is what one turn record learned, on the unit it ran on.

type Items

type Items interface {
	Items(ctx context.Context, u unit.Unit) ([]items.Item, error)
	Log(ctx context.Context, u unit.Unit, since time.Time) ([]coreitems.LogEntry, error)
}

Items are the items ledger's items and the outcomes of its ops.

type Memory

type Memory struct {
	// Task is the task whose memory it is; "" for a unit no task holds.
	Task task.ID
	// Outcome is nil unless the task reopened.
	Outcome *Outcome
	// Learned are the turns' entries, newest first.
	Learned []Entry
}

type Merges

type Merges interface {
	// MergedInto are the tasks merged into task id, transitively.
	MergedInto(ctx context.Context, id task.ID) ([]task.ID, error)
}

type Outcome

type Outcome struct {
	ReopenedAt time.Time
	Summary    string
	Items      []Resolved
}

Outcome is how a reopened task had ended: the summary of its last turn and the resolutions of its items, as they stood when it reopened at ReopenedAt.

type Resolved

type Resolved struct {
	Unit       unit.Unit
	Item       string
	Summary    string
	Resolution items.Resolution
}

Resolved is an item the task held and how it was resolved.

type Service

type Service struct {
	Tasks Tasks
	// Merges nil merges no task into another.
	Merges Merges
	Books  Books
	// Items nil derives no item of an outcome.
	Items Items
}

func (*Service) LearnedOf

func (s *Service) LearnedOf(ctx context.Context, e task.Task) ([]Entry, error)

LearnedOf is what e's turns learned, newest first, without the outcome OfTask derives.

func (*Service) Of

func (s *Service) Of(ctx context.Context, u unit.Unit) (Memory, error)

Of is the memory of the task that holds u, an open one first, then the oldest; u's own when no task holds it.

func (*Service) OfTask

func (s *Service) OfTask(ctx context.Context, e task.Task) (Memory, error)

OfTask is e's memory.

type Tasks

type Tasks interface {
	Task(ctx context.Context, id task.ID) (task.Task, error)
	// TasksOf are the tasks that hold u.
	TasksOf(ctx context.Context, u unit.Unit) ([]task.Task, error)
}

Jump to

Keyboard shortcuts

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