necoherence/core
Types
pub type Basis {
Basis(resource: ResourceId, revision: Revision)
}
Constructors
-
Basis(resource: ResourceId, revision: Revision)
pub type Lookup {
Found(Revision)
Unknown(UnknownResource)
}
Constructors
-
Found(Revision) -
Unknown(UnknownResource)
Closed four-branch outcome: applied, rejected, conflicted, or a boundary failure translated from an external touchpoint.
pub type Outcome(applied, rejected, conflicted, boundary) {
Applied(applied)
Rejected(rejected)
Conflicted(conflicted)
BoundaryFailed(boundary)
}
Constructors
-
Applied(applied) -
Rejected(rejected) -
Conflicted(conflicted) -
BoundaryFailed(boundary)
pub type ResourceId {
ResourceId(kind: String, name: String)
}
Constructors
-
ResourceId(kind: String, name: String)
pub type Revision {
Revision(value: Int)
}
Constructors
-
Revision(value: Int)
pub type UnknownResource {
UnknownResource(resource: ResourceId)
}
Constructors
-
UnknownResource(resource: ResourceId)
pub type World {
World(entries: List(#(ResourceId, Revision)))
}
Constructors
-
World(entries: List(#(ResourceId, Revision)))
Values
pub fn apply(
world: World,
command: Command(intent),
) -> Outcome(
#(intent, World),
UnknownResource,
StaleBasis,
boundary,
)
Apply a command against world. boundary never occurs here: the
four-branch outcome type is shared with the other feature families
(Store.apply, file effect) that do produce boundary failures.
pub fn bump(world: World, resource: ResourceId) -> World
pub fn command_of(
observation: Observation(payload),
intent: intent,
) -> Command(intent)
pub fn lookup(world: World, resource: ResourceId) -> Lookup
pub fn resource(kind: String, name: String) -> ResourceId
pub fn revision_value(value: Revision) -> Int
pub fn world(entries: List(#(ResourceId, Revision))) -> World
pub fn world_entries(
value: World,
) -> List(#(ResourceId, Revision))