Documentation
¶
Overview ¶
Package lineage stores portable causal history beside native agent transcripts. Native files stay vendor-owned; receipts describe their exact logical coverage.
Index ¶
- Constants
- Variables
- func PathFor(main string) string
- func Subset(a, b map[ir.NodeID]bool) bool
- type Branch
- type CodeHop
- type Compensation
- type Hop
- type Journey
- type Manifest
- func (m *Manifest) ActiveHops() []Hop
- func (m *Manifest) AdoptNativeFork(parent ReplicaID, child Replica, proof []agent.NativeInheritance, ...) (*Manifest, error)
- func (m *Manifest) AppendHop(h Hop) error
- func (m *Manifest) Clone() *Manifest
- func (m *Manifest) Covered(heads []ir.NodeID) map[ir.NodeID]bool
- func (m *Manifest) Deliver(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, ...) State
- func (m *Manifest) Departed(current ReplicaID) (Hop, bool)
- func (m *Manifest) Departure(current ReplicaID) (Hop, bool)
- func (m *Manifest) Encode() []byte
- func (m *Manifest) Find(key agent.SessionKey, location string) (Replica, ReplicaID, bool)
- func (m *Manifest) FindBinding(key agent.SessionKey, endpoint, binding string) (Replica, ReplicaID, bool)
- func (m *Manifest) FindEndpoint(key agent.SessionKey, endpoint string) (Replica, ReplicaID, bool)
- func (m *Manifest) FindOnBranch(key agent.SessionKey, location, line string) (Replica, ReplicaID, bool)
- func (m *Manifest) ForBranch(branch string) *Manifest
- func (m *Manifest) Fork(id string, heads []ir.NodeID) string
- func (m *Manifest) HasReplica(id ReplicaID) bool
- func (m *Manifest) Heads(ids []ir.NodeID) []ir.NodeID
- func (m *Manifest) Journey() Journey
- func (m *Manifest) LastHopTo(id ReplicaID) (Hop, bool)
- func (m *Manifest) LatestState(id ReplicaID) (State, bool)
- func (m *Manifest) Merge(o *Manifest) error
- func (m *Manifest) Observe(replica ReplicaID, seg *ir.Segment) (State, error)
- func (m *Manifest) ObserveBinding(r Replica, seg *ir.Segment) (ReplicaID, State, error)
- func (m *Manifest) OrderedHops() []Hop
- func (m *Manifest) Outline() *Manifest
- func (m *Manifest) ReplaceProjection(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, ...) State
- func (m *Manifest) Replica(id ReplicaID) Replica
- func (m *Manifest) ReturnReplicas(current ReplicaID) []Replica
- func (m *Manifest) SetLimits(l ir.Limits)
- func (m *Manifest) State(id StateID) State
- func (m *Manifest) UndoOperation(id string) error
- func (m *Manifest) Upsert(r Replica) ReplicaID
- func (m *Manifest) Validate() error
- func (m *Manifest) Writable() error
- type Range
- type Replica
- type ReplicaID
- type Revision
- type Rollover
- type State
- type StateID
Constants ¶
const ( HopMove = "move" HopContinue = "continue" HopHandoff = "handoff" HopFetch = "fetch" )
const FileFormat = "lineage/6"
FileFormat is how a lineage file holds a Format manifest: its records with each value written once. A revision is [replica, anchor, hash] or [replica, anchor, hash, parents]: the replica's and the parents' places in their lists, the parents only when they are not just the revision before, and no id (it is the hash of the rest, worked out again on read). A native projection, the anchor and hash of its one revision, is that revision's place. Everything else is as in Format. In memory, and between machines, a manifest is always Format; a manifest that cannot be packed is written as Format.
Most of a long session's lineage was these repeats: its ids are 64 hex digits, each revision's written three times and its anchor and hash twice.
const FirstFileFormatVersion = "0.6.0"
FirstFileFormatVersion is the first hopsesh that reads FileFormat: an older one shows such a session's lineage as unsupported (and cannot block a moved session's original).
const Format = "lineage/5"
const Suffix = ".hopsesh.json"
Variables ¶
var ErrTooLarge = errors.New("movement ledger exceeds its size limit")
ErrTooLarge is a lineage that cannot be written (Read refuses more than maxSize).
Functions ¶
Types ¶
type CodeHop ¶ added in v0.4.0
type CodeHop struct {
Way agent.CodeWay `json:"way"`
Remote string `json:"remote,omitempty"`
Branch string `json:"branch,omitempty"`
Base string `json:"base,omitempty"`
Snapshot string `json:"snapshot,omitempty"`
Withheld []string `json:"withheld,omitempty"`
Redactions int `json:"redactions,omitempty"`
}
type Compensation ¶ added in v0.4.0
type Hop ¶
type Hop struct {
Notify bool `json:"notify,omitempty"` // optional source notice; never conversation work
Rollover *Rollover `json:"rollover,omitempty"`
ID string `json:"id"`
Parents []string `json:"parents,omitempty"`
Line string `json:"line"`
Time time.Time `json:"time"`
From ReplicaID `json:"from"`
To ReplicaID `json:"to"`
Source StateID `json:"source,omitempty"`
Target StateID `json:"target,omitempty"`
Kind string `json:"kind"`
Fork bool `json:"fork,omitempty"`
Backup bool `json:"backup,omitempty"`
Fidelity string `json:"fidelity,omitempty"`
Written *Range `json:"written,omitempty"`
Code *CodeHop `json:"code,omitempty"`
}
type Journey ¶ added in v0.4.0
type Journey struct {
MachineTransfers int `json:"machineTransfers"`
MachineRoundTrips int `json:"machineRoundTrips"`
MachineReturns int `json:"machineReturns"`
OriginProfile string `json:"originProfile,omitempty"`
ParentBranch string `json:"parentBranch,omitempty"`
Origin string `json:"origin,omitempty"`
Transfers int `json:"transfers"`
RoundTrips int `json:"roundTrips"`
Returns int `json:"returns"`
Fork bool `json:"fork"`
Branch string `json:"branch"`
Family string `json:"family"`
}
type Manifest ¶
type Manifest struct {
Format string `json:"hopsesh"`
Family string `json:"family"`
Branch string `json:"branch"` // branch of the native session beside this manifest
Branches []Branch `json:"branches"`
Replicas []Replica `json:"replicas"`
Revisions []Revision `json:"revisions"`
States []State `json:"states"`
Hops []Hop `json:"hops"`
Compensations []Compensation `json:"compensations,omitempty"`
// contains filtered or unexported fields
}
func (*Manifest) ActiveHops ¶ added in v0.4.0
ActiveHops excludes undone operations and implementation-only native backups. OrderedHops supplies causal ordering; wall-clock timestamps are not authorities.
func (*Manifest) AdoptNativeFork ¶ added in v0.4.0
func (m *Manifest) AdoptNativeFork(parent ReplicaID, child Replica, proof []agent.NativeInheritance, seg *ir.Segment) (*Manifest, error)
AdoptNativeFork requires module-verified native inheritance. It returns a new branch view without modifying the parent's manifest or its native session.
func (*Manifest) Deliver ¶ added in v0.4.0
func (m *Manifest) Deliver(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, heads []ir.NodeID, loss []string) State
Deliver records the destination's own receipt. It acknowledges only this replica, keeping all provenance and losses; another destination's receipt is unaffected.
func (*Manifest) Departed ¶ added in v0.4.2
Departed returns where a replica's branch went after it: the latest hop on its line, when the replica left that line and has not been returned to since. It is the committed movement record, whether or not the move asked for a notice; a fork leaves its parent current and is not a departure.
func (*Manifest) Departure ¶ added in v0.4.0
Departure returns the latest unambiguous route away from a replica. A return clears it. Fork notices describe a separate branch and never retire the parent, so a move away from this copy decides its notice whatever separate copies were made from it: they sit on other branches and are never ordered against the move (a real move after an earlier separate copy was once called ambiguous, and the original was left unblocked while hopsesh showed it blocked).
func (*Manifest) Encode ¶
Encode is the manifest as its file holds it: FileFormat, compact, one line (indenting a large graph's revisions made about a fifth of the file whitespace, read on every scan).
func (*Manifest) FindBinding ¶ added in v0.4.2
func (m *Manifest) FindBinding(key agent.SessionKey, endpoint, binding string) (Replica, ReplicaID, bool)
FindBinding selects the current segment of one physical session without confusing it with its retained historical login segments.
func (*Manifest) FindEndpoint ¶ added in v0.4.0
func (*Manifest) FindOnBranch ¶ added in v0.4.0
func (*Manifest) HasReplica ¶ added in v0.4.0
func (*Manifest) Heads ¶ added in v0.4.0
Heads keeps the ids no other id descends from. One walk over the ancestors of the whole set (it was one graph walk per id, quadratic for a long native fork).
func (*Manifest) LatestState ¶ added in v0.4.0
func (*Manifest) Observe ¶ added in v0.4.0
Observe validates previously delivered native anchors, then registers only newly authored records. Imported nodes retain their logical origins through every hop.
func (*Manifest) ObserveBinding ¶ added in v0.4.0
ObserveBinding starts a new replica segment when the login bound to a root changes. Native anchors verify inherited history; old revisions retain their original author. This never grants permission to replay protected native data across accounts.
func (*Manifest) OrderedHops ¶ added in v0.4.0
func (*Manifest) Outline ¶ added in v0.4.4
Outline is what browsing shows (family, branches, replicas, hops and the losses their states record) without the revision graph, which can run to many megabytes per session. It is for display only: it does not validate, and transfers read the full manifest.
func (*Manifest) ReplaceProjection ¶ added in v0.4.0
func (m *Manifest) ReplaceProjection(replica ReplicaID, cursor ir.Cursor, projection []ir.Projection, heads []ir.NodeID, loss []string) State
ReplaceProjection is a verified native replacement, not an append receipt.
func (*Manifest) ReturnReplicas ¶ added in v0.4.0
ReturnReplicas lists destinations actually visited by this branch before the selected replica's latest arrival. A sibling's or parent's history is not a return.
func (*Manifest) UndoOperation ¶ added in v0.4.0
type Replica ¶
type Replica struct {
Binding string `json:"binding,omitempty"`
ID ReplicaID `json:"id"`
Key agent.SessionKey `json:"key"`
Endpoint string `json:"endpoint"`
Location string `json:"location"`
Line string `json:"line"`
AgentVersion string `json:"agentVersion,omitempty"`
// Native checkpoints are derived from immutable states, never merge authorities.
Head ir.NodeID `json:"-"`
Offset int64 `json:"-"`
Time time.Time `json:"time"`
URL string `json:"url,omitempty"`
Branch string `json:"branch,omitempty"` // code branch, independent of conversation Line
}
type Rollover ¶ added in v0.4.0
Rollover records the unchanged replica retained when its active context was full.
type State ¶ added in v0.4.0
type State struct {
ID StateID `json:"id"`
Replica ReplicaID `json:"replica"`
Parents []StateID `json:"parents,omitempty"`
Head ir.NodeID `json:"head,omitempty"`
Offset int64 `json:"offset"`
Heads []ir.NodeID `json:"heads,omitempty"`
Projection []ir.Projection `json:"projection,omitempty"`
Loss []string `json:"loss,omitempty"`
}