Qualify collection compare-and-swap and explicit ensure mutations
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
type Replacement = record { expected: list<string>; targets: list<atom-ref<Node>>; };
|
||||
type Seed = record { label: string; };
|
||||
external atom Node id "collection:node";
|
||||
package CollectionRuntime id "collection:runtime" revision "collection:runtime@1" {
|
||||
operation version id "collection:runtime:version" : unit -> list<string>
|
||||
mode call execution snapshot targets [browser, server] receiver atom Node requires {
|
||||
edge items id "collection:version:items" : many atom Node [resolve];
|
||||
};
|
||||
operation replace id "collection:runtime:replace" : Replacement -> unit
|
||||
mode call execution transaction targets [browser, server] receiver atom Node requires {
|
||||
edge items id "collection:replace:items" : many atom Node [resolve, connect, disconnect];
|
||||
};
|
||||
operation ensure id "collection:runtime:ensure" : unit -> atom-ref<Node>
|
||||
mode call execution transaction targets [browser, server] receiver atom Node requires {
|
||||
edge detail id "collection:ensure:detail" : optional-one atom Node [resolve, connect];
|
||||
creation node id "collection:ensure:node" : Node input Seed;
|
||||
};
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
type Replacement = record { expected: list<string>; targets: list<atom-ref<Node>>; };
|
||||
external atom Node id "collection:node";
|
||||
interface NodeData id "collection:data" revision "collection:data@1" {
|
||||
queryable portable value version id "collection:version" : list<string> {
|
||||
get id "collection:version:get" execution snapshot targets [browser, server];
|
||||
}
|
||||
operation replace id "collection:replace" : Replacement -> unit {
|
||||
call id "collection:replace:call" execution transaction targets [browser, server];
|
||||
}
|
||||
operation ensure id "collection:ensure" : unit -> atom-ref<Node> {
|
||||
call id "collection:ensure:call" execution transaction targets [browser, server];
|
||||
}
|
||||
queryable value label id "collection:label" : string {
|
||||
get id "collection:label:get" execution snapshot targets [browser, server];
|
||||
set id "collection:label:set" execution transaction targets [browser, server];
|
||||
}
|
||||
queryable relation items id "collection:items" : many atom Node {
|
||||
resolve id "collection:items:resolve" execution snapshot targets [browser, server];
|
||||
}
|
||||
queryable relation containers id "collection:containers" : many atom Node {
|
||||
resolve id "collection:containers:resolve" execution snapshot targets [browser, server];
|
||||
}
|
||||
queryable relation detail id "collection:detail" : optional-one atom Node {
|
||||
resolve id "collection:detail:resolve" execution snapshot targets [browser, server];
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
workspace Collections id "workspace:collections" revision "workspace:collections@1" commit "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" {
|
||||
import interface NodeData;
|
||||
import package CollectionRuntime;
|
||||
atom Node id "collection:node";
|
||||
conform Node as NodeData id "collection:node:data" {
|
||||
private state Label id "collection:label-slot" on Node : string policy register;
|
||||
private edge Items id "collection:items-edge" {
|
||||
atom Node projection items id "collection:items-projection" many;
|
||||
atom Node projection containers id "collection:containers-projection" many;
|
||||
}
|
||||
private edge Detail id "collection:detail-edge" {
|
||||
atom Node projection detail id "collection:detail-projection" optional-one;
|
||||
atom Node projection owner id "collection:owner-projection" optional-one;
|
||||
}
|
||||
initialize { label to state Label; };
|
||||
bind label.get to state Label.read;
|
||||
bind label.set to state Label.write;
|
||||
bind items.resolve to edge Items.items.resolve;
|
||||
bind containers.resolve to edge Items.containers.resolve;
|
||||
bind detail.resolve to edge Detail.detail.resolve;
|
||||
bind version.get to package CollectionRuntime.version with { items to edge Items.items; };
|
||||
bind replace.call to package CollectionRuntime.replace with { items to edge Items.items; };
|
||||
bind ensure.call to package CollectionRuntime.ensure with {
|
||||
detail to edge Detail.detail;
|
||||
node to creation Node with { NodeData from input; };
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user