gleamunison/agent_read_model
Durable branch definitions and explicit source overlays share a read model. Stored entries retain their AST and content identity; surface projections are for elaboration only and are never presented as the original source.
Types
pub type Entry {
Source(
name: String,
definition: elab_types.SurfaceDef,
origin: Origin,
)
Stored(
name: String,
ref: identity.DefinitionRef,
definition: ast.Definition,
branch: String,
)
}
Constructors
-
Source( name: String, definition: elab_types.SurfaceDef, origin: Origin, ) -
Stored( name: String, ref: identity.DefinitionRef, definition: ast.Definition, branch: String, )
pub type Origin {
Bootstrap
Scratch
Branch(String)
}
Constructors
-
Bootstrap -
Scratch -
Branch(String)
pub type Selection {
Selection(
adapter: storage.StorageAdapter,
branch: String,
names: dict.Dict(
identity.DefinitionRef,
identity.DefinitionRef,
),
)
}
Constructors
-
Selection( adapter: storage.StorageAdapter, branch: String, names: dict.Dict(identity.DefinitionRef, identity.DefinitionRef), )
Values
pub fn cache(
entries: List(Entry),
baseline: types.TypeCache,
) -> types.TypeCache
pub fn definitions(
entries: List(Entry),
) -> List(#(String, elab_types.SurfaceDef))
pub fn load(
adapter: storage.StorageAdapter,
branch: String,
) -> Result(#(List(Entry), Selection), String)
pub fn projection(
entry: Entry,
) -> Result(#(String, elab_types.SurfaceDef), Nil)
pub fn stored_ref(
entry: Entry,
) -> option.Option(identity.DefinitionRef)