Documentation
¶
Overview ¶
Package diff computes minimal deltas between the current enriched AST and a previous snapshot.
Index ¶
- func CursorHash(roots []*parser.ContextNode) string
- func CursorHashFlat(flat []*parser.ContextNode) string
- func CursorHashForChange(prevHeadID int64, deltas []Delta) string
- func CursorHashForCompile(prevHeadID int64, flat []*parser.ContextNode) string
- func CursorHashForRollback(prevHeadID, targetID int64, deltas []Delta) string
- func SnapshotFromNodes(roots []*parser.ContextNode) map[string]NodeState
- type Delta
- type NodeState
- type Op
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CursorHash ¶
func CursorHash(roots []*parser.ContextNode) string
func CursorHashFlat ¶
func CursorHashFlat(flat []*parser.ContextNode) string
func CursorHashForChange ¶ added in v0.3.12
Hash a change against its parent snapshot so reverting to a prior post-state still yields a unique digest. prevHeadID is the HEAD snapshot id (monotonic, never reused), so the result is unique per snapshot even when the deltas repeat.
func CursorHashForCompile ¶ added in v0.3.12
func CursorHashForCompile(prevHeadID int64, flat []*parser.ContextNode) string
Hash a compiled post-state against its parent snapshot so a compile that lands on a prior content state (edit, compile, revert, compile) still yields a unique digest. prevHeadID is the HEAD snapshot id (monotonic, never reused).
func CursorHashForRollback ¶ added in v0.3.1
func SnapshotFromNodes ¶
func SnapshotFromNodes(roots []*parser.ContextNode) map[string]NodeState
Build a NodeState map from enriched nodes.
Types ¶
type Delta ¶
type Delta struct {
NodeID string
OldHash string
NewHash string
OldContent string
NewContent string
Op
}
Click to show internal directories.
Click to hide internal directories.