Update for latest preserves/syndicate changes
This commit is contained in:
parent
c88d08bdda
commit
a1b11c85f5
|
@ -5,10 +5,10 @@ set -euo pipefail
|
|||
. $(dirname "$0")/../lib/syndicate.sh
|
||||
|
||||
demo_ds_resolved() {
|
||||
local oid="$(ds_project "$ds_event" '^ assert . 0 ^ accepted . 0 .embedded . 1')"
|
||||
local oid="$(ds_project "$ds_event" '^ A . 0 ^ accepted . 0 .embedded . 1')"
|
||||
if [ -n "$oid" ]
|
||||
then
|
||||
ds_ref="#![1 $oid]"
|
||||
ds_ref="#:[1 $oid]"
|
||||
echo "Dataspace: $ds_ref"
|
||||
|
||||
username="user$$"
|
||||
|
@ -16,13 +16,13 @@ demo_ds_resolved() {
|
|||
declare -A demo_user_presence
|
||||
demo_presence() {
|
||||
case $(ds_project "$ds_event" .^) in
|
||||
assert)
|
||||
A)
|
||||
local h="$(ds_project "$ds_event" '. 1')"
|
||||
local who="$(ds_project "$ds_event" '. 0 . 0')"
|
||||
demo_user_presence[$h]="$who"
|
||||
echo "JOIN: $who"
|
||||
;;
|
||||
retract)
|
||||
R)
|
||||
local h="$(ds_project "$ds_event" '. 0')"
|
||||
local who="${demo_user_presence[$h]}"
|
||||
echo "PART: $who"
|
||||
|
@ -35,8 +35,8 @@ demo_ds_resolved() {
|
|||
ds_assert "$ds_ref" "<Present \"$username\">"
|
||||
|
||||
demo_utterance() {
|
||||
local who="$(ds_project "$ds_event" '^ message . 0 . 0')"
|
||||
local what="$(ds_project "$ds_event" '^ message . 0 . 1')"
|
||||
local who="$(ds_project "$ds_event" '^ M . 0 . 0')"
|
||||
local what="$(ds_project "$ds_event" '^ M . 0 . 1')"
|
||||
echo "$who: $what"
|
||||
}
|
||||
ds_object utterance demo_utterance
|
||||
|
@ -58,4 +58,4 @@ demo_ds_resolved() {
|
|||
ds_object bootk demo_ds_resolved
|
||||
ds_connect \
|
||||
'<unix "./sock">' \
|
||||
'ds_assert "#![1 0]" "<resolve <ref {oid: \"syndicate\" sig: #x\"69ca300c1dbfa08fba692102dd82311a\"}> $bootk>"'
|
||||
'ds_assert "#:[1 0]" "<resolve <ref {oid: \"syndicate\" sig: #x\"69ca300c1dbfa08fba692102dd82311a\"}> $bootk>"'
|
||||
|
|
|
@ -153,7 +153,7 @@ ds_flush() {
|
|||
ds_assert() {
|
||||
local h="$ds_handle"
|
||||
ds_handle=$(($ds_handle + 1))
|
||||
ds_action "$1" "<assert $2 $h>"
|
||||
ds_action "$1" "<A $2 $h>"
|
||||
if [ -n "${3:-}" ]
|
||||
then
|
||||
ds_handle_oids[$3]="$1"
|
||||
|
@ -167,7 +167,7 @@ ds_assert() {
|
|||
# `ds_assert`.
|
||||
#
|
||||
ds_retract() {
|
||||
ds_action "${ds_handle_oids[$1]}" "<retract ${ds_handles[$1]}>"
|
||||
ds_action "${ds_handle_oids[$1]}" "<R ${ds_handles[$1]}>"
|
||||
}
|
||||
|
||||
# ds_message <wireref> <term>
|
||||
|
@ -175,7 +175,7 @@ ds_retract() {
|
|||
# Sends `term` to `wireref`.
|
||||
#
|
||||
ds_message() {
|
||||
ds_action "$1" "<message $2>"
|
||||
ds_action "$1" "<M $2>"
|
||||
}
|
||||
|
||||
# ds_object <varname> <code>
|
||||
|
@ -188,5 +188,5 @@ ds_object() {
|
|||
local oid="$ds_handle"
|
||||
ds_handle=$(($ds_handle + 1))
|
||||
ds_object_map[$oid]="$2"
|
||||
printf -v $1 '%s' "#![0,$oid]"
|
||||
printf -v $1 '%s' "#:[0,$oid]"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue