Moved remotes and mirrors out of stories/tales and into global state.

This commit is contained in:
Fang 2017-04-04 00:14:06 +02:00
parent 0d41537f91
commit 3350be68d5
3 changed files with 65 additions and 62 deletions

View File

@ -23,6 +23,8 @@
=> |% :: data structures => |% :: data structures
++ chattel :: full state ++ chattel :: full state
$: tales/(map knot tale) :: conversations $: tales/(map knot tale) :: conversations
remotes/(map partner atlas) :: remote presences
mirrors/(map station config) :: remote configs
folks/(map ship human) :: human identities folks/(map ship human) :: human identities
nik/(map (set partner) char) :: bound station glyphs nik/(map (set partner) char) :: bound station glyphs
nak/(jug char (set partner)) :: station glyph lookup nak/(jug char (set partner)) :: station glyph lookup
@ -31,10 +33,9 @@
++ tale :: user-facing story ++ tale :: user-facing story
$: count/@ud :: (lent grams) $: count/@ud :: (lent grams)
grams/(list telegram) :: all history grams/(list telegram) :: all history
::TODO given remotes and mirrors, do we still need locals and shape?
locals/atlas :: presence locals/atlas :: presence
remotes/(map partner atlas) :: remote presences
shape/config :: configuration shape/config :: configuration
mirrors/(map station config) :: remote configs
known/(map serial @ud) :: messages heard known/(map serial @ud) :: messages heard
== :: == ::
++ shell :: console session ++ shell :: console session
@ -146,7 +147,9 @@
$glyph (ra-diff-talk-lowdown-glyph +.low) $glyph (ra-diff-talk-lowdown-glyph +.low)
$names (ra-diff-talk-lowdown-names +.low) $names (ra-diff-talk-lowdown-names +.low)
$tales (ra-diff-talk-lowdown-tales +.low) $tales (ra-diff-talk-lowdown-tales +.low)
$remco (ra-diff-talk-lowdown-remco +.low)
$precs (ra-diff-talk-lowdown-precs +.low) $precs (ra-diff-talk-lowdown-precs +.low)
$rempe (ra-diff-talk-lowdown-rempe +.low)
$grams (ra-diff-talk-lowdown-grams +.low) $grams (ra-diff-talk-lowdown-grams +.low)
== ==
:: ::
@ -183,41 +186,45 @@
?~ h ~ ?~ h ~
(some [s u.h]) (some [s u.h])
== ==
:: :: ::
++ ra-diff-talk-lowdown-tales ++ ra-diff-talk-lowdown-tales
::x apply tale configs. ::x apply tale configs.
:: ::
|= tals/(map knot (unit cabal)) |= {man/knot cof/(unit config)}
^+ +> ^+ +>
::TODO for every changed config, (sh-low-config oldconfig newconfig) ::TODO for changed configs, (sh-low-config oldconfig newconfig)
:: maybe something else for new/removed tales? :: maybe something else for new/removed tales?
%= +> tales ~& [%r-new-config-for man]
%+ roll (~(tap by tals)) ?~ cof +>(tales (~(del by tales) man))
|= {t/(pair knot (unit cabal)) tas/_tales} =+ tal=(fall (~(get by tales) man) *tale)
~& [%r-new-config-for p.t] +>.$(tales (~(put by tales) man tal(shape u.cof)))
=. tas ?~(tas tales tas) ::x start with our current tales. ::
=+ tal=(fall (~(get by tas) p.t) *tale) ++ ra-diff-talk-lowdown-remco
?~ q.t (~(del by tas) p.t) |= cofs/(map station config)
(~(put by tas) p.t tal(shape loc.u.q.t, mirrors ham.u.q.t)) ^+ +>
== ::TODO ++sh arm for printing of remote configs.
+>(mirrors (~(uni by cofs) mirrors))
:: ::
++ ra-diff-talk-lowdown-precs ++ ra-diff-talk-lowdown-precs
::x apply new presence. ::x apply new presence.
:: ::
|= {man/knot pes/atlas pas/(map partner atlas)} |= {man/knot pes/atlas}
^+ +> ^+ +>
=+ tal=(~(get by tales) man) =+ tal=(~(get by tales) man)
?~ tal ~&([%low-precs-know-no-tale man] +>.$) ?~ tal ~&([%low-precs-know-no-tale man] +>.$)
=+ nel=(~(uni by pes) locals.u.tal) =+ nel=(~(uni by pes) locals.u.tal)
::TODO make better ++sh arms for this.
=. +>.$ =. +>.$
?: =(locals.u.tal nel) +>.$ ?: =(locals.u.tal nel) +>.$
sh-abet:(~(sh-low-precs sh ~ cli man) [locals.u.tal ~] [nel ~]) sh-abet:(~(sh-low-precs sh ~ cli man) locals.u.tal nel)
=+ ner=(~(uni by pas) remotes.u.tal) ::TODO better uni. +>.$(tales (~(put by tales) man u.tal(locals nel)))
=. +>.$ ::
?: =(remotes.u.tal ner) +>.$ ++ ra-diff-talk-lowdown-rempe
sh-abet:(~(sh-low-precs sh ~ cli man) [~ remotes.u.tal] [~ ner]) |= pas/(map partner atlas)
+>.$(tales (~(put by tales) man u.tal(locals nel, remotes ner))) ^+ +>
=+ ner=(~(uni by pas) remotes) ::TODO better uni.
?: =(remotes ner) +>.$
=. remotes ner
sh-abet:(~(sh-repo-group-there sh ~ cli (main our.hid)) remotes ner)
:: ::
++ ra-diff-talk-lowdown-grams ++ ra-diff-talk-lowdown-grams
::x apply new grams ::x apply new grams
@ -368,13 +375,6 @@
=. l ?~(l loc l) ::TODO =? =. l ?~(l loc l) ::TODO =?
(~(uni by l) q.r) (~(uni by l) q.r)
+>.$(locals pres) +>.$(locals pres)
::
++ pa-cabal
::x update the tale's config.
::
|= {cuz/station con/config ham/(map station config)}
^+ +>
+>(shape con)
-- --
:: ::
++ sh :: per console ++ sh :: per console
@ -912,13 +912,10 @@
++ sh-low-precs ++ sh-low-precs
::x print presence changes ::x print presence changes
:: ::
|= $: old/(pair atlas (map partner atlas)) |= {old/atlas new/atlas}
new/(pair atlas (map partner atlas))
==
^+ +> ^+ +>
=+ dif=(sh-repo-atlas-diff p.old p.new) =+ dif=(sh-repo-atlas-diff old new)
=. +>.$ (sh-repo-group-diff-here "" dif) (sh-repo-group-diff-here "" dif)
(sh-repo-group-there q.old q.new)
:: ::
++ sh-low-gram ++ sh-low-gram
::x renders telegram: increase gram count and print the gram. ::x renders telegram: increase gram count and print the gram.
@ -1155,7 +1152,7 @@
::TODO clever use of =< and . take note! ::TODO clever use of =< and . take note!
~& [%who-ing pan] ~& [%who-ing pan]
=+ tal=(~(got by tales) man) =+ tal=(~(got by tales) man)
=< (sh-fact %mor (murn (sort (~(tap by remotes.tal) ~) aor) .)) =< (sh-fact %mor (murn (sort (~(tap by remotes) ~) aor) .))
|= {pon/partner alt/atlas} ^- (unit sole-effect) |= {pon/partner alt/atlas} ^- (unit sole-effect)
?. |(=(~ pan) (~(has in pan) pon)) ~ ?. |(=(~ pan) (~(has in pan) pon)) ~
=- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~] =- `[%tan rose+[", " `~]^- leaf+~(ta-full ta man pon) ~]

View File

@ -31,6 +31,8 @@
=> |% :: data structures => |% :: data structures
++ house :: ++ house ::
$: stories/(map knot story) :: conversations $: stories/(map knot story) :: conversations
remotes/(map partner atlas) :: remote presence
mirrors/(map station config) :: remote config
::TODO rename to readers? ::TODO rename to readers?
general/(set bone) :: our message readers general/(set bone) :: our message readers
outbox/(pair @ud (map @ud thought)) :: urbit outbox outbox/(pair @ud (map @ud thought)) :: urbit outbox
@ -43,8 +45,6 @@
$: count/@ud :: (lent grams) $: count/@ud :: (lent grams)
grams/(list telegram) :: all history grams/(list telegram) :: all history
locals/atlas :: local presence locals/atlas :: local presence
remotes/(map partner atlas) :: remote presence
mirrors/(map station config) :: remote config
sequence/(map partner @ud) :: partners heard sequence/(map partner @ud) :: partners heard
shape/config :: configuration shape/config :: configuration
known/(map serial @ud) :: messages heard known/(map serial @ud) :: messages heard
@ -458,20 +458,30 @@
++ ra-welcome ++ ra-welcome
::x brings reader new up to date. ::x brings reader new up to date.
:: ::
::TODO just like weld somehow
|= new/bone |= new/bone
=. +> %- ra-emil :~ =. +> %- ra-emil
:* new %diff %talk-lowdown %tales %- zing
%- ~(gas in *(map knot (unit cabal)))
%+ turn (~(tap by stories))
|=({a/knot b/story} [a `[shape.b mirrors.b]])
==
[new %diff %talk-lowdown %glyph nak]
[new %diff %talk-lowdown %names (~(run by folks) some)]
==
%- ra-emil
%+ turn (~(tap by stories)) %+ turn (~(tap by stories))
|= {k/knot s/story} |= {k/knot s/story}
[new %diff %talk-lowdown %grams k count.s grams.s] ^- (list move)
:~ ::x story configurations
[new %diff %talk-lowdown %tales k `shape.s]
::x local presences
[new %diff %talk-lowdown %precs k locals.s]
::x telegrams
[new %diff %talk-lowdown %grams k count.s grams.s]
==
%- ra-emil
:~ ::x remote configurations
[new %diff %talk-lowdown %remco mirrors]
::x remote presences
[new %diff %talk-lowdown %rempe remotes]
::x bound glyphs
[new %diff %talk-lowdown %glyph nak]
::x nicknames
[new %diff %talk-lowdown %names (~(run by folks) some)]
==
:: ::
++ ra-think :: publish+review ++ ra-think :: publish+review
::x consumes each thought. ::x consumes each thought.
@ -643,11 +653,6 @@
|= vew/(set bone) |= vew/(set bone)
(pa-report vew %group locals pa-remotes) (pa-report vew %group locals pa-remotes)
:: ::
++ pa-lowdown-precs
::x build a presence lowdown, containing our different presence maps.
::
(pa-inform %precs man locals pa-remotes)
::
++ pa-report-cabal :: update config ++ pa-report-cabal :: update config
::x a cabal report, containing our and remote configs, to all bones. ::x a cabal report, containing our and remote configs, to all bones.
:: ::
@ -663,9 +668,8 @@
=+ old=mirrors =+ old=mirrors
=. mirrors (~(put by mirrors) cuz con) =. mirrors (~(put by mirrors) cuz con)
?: =(mirrors old) +>.$ ?: =(mirrors old) +>.$
=. +>.$ (pa-inform %tales (strap man `[con ham])) =. +>.$ (pa-inform %remco mirrors)
(pa-report-cabal pa-followers) (pa-report-cabal pa-followers)
:: ::
++ pa-diff-talk-report :: subscribed update ++ pa-diff-talk-report :: subscribed update
::x process a talk report from cuz. ::x process a talk report from cuz.
@ -689,7 +693,7 @@
=. +> =. +>
%. pa-followers %. pa-followers
pa-report-cabal(sources.shape (~(del in sources.shape) tay)) pa-report-cabal(sources.shape (~(del in sources.shape) tay))
(pa-inform %tales (strap man `[shape mirrors])) (pa-inform %tales man `shape)
:: ::
++ pa-sauce :: send backward ++ pa-sauce :: send backward
::x turns cards into moves, reverse order, prepend to existing moves. ::x turns cards into moves, reverse order, prepend to existing moves.
@ -753,7 +757,7 @@
::x partners we gained/lost, and send out an updated cabal report. ::x partners we gained/lost, and send out an updated cabal report.
:: ::
|= cof/config |= cof/config
=. +>.$ (pa-inform %tales (strap man `[cof mirrors])) =. +>.$ (pa-inform %tales man `cof)
=+ ^= dif ^- (pair (list partner) (list partner)) =+ ^= dif ^- (pair (list partner) (list partner))
=+ old=`(list partner)`(~(tap in sources.shape) ~) =+ old=`(list partner)`(~(tap in sources.shape) ~)
=+ new=`(list partner)`(~(tap in sources.cof) ~) =+ new=`(list partner)`(~(tap in sources.cof) ~)
@ -777,7 +781,7 @@
^+ +> ^+ +>
=/ nol (~(put by locals) her saz) =/ nol (~(put by locals) her saz)
?: =(nol locals) +>.$ ?: =(nol locals) +>.$
=< pa-lowdown-precs =. +>.$ (pa-inform %precs man nol)
(pa-report-group(locals nol) pa-followers) (pa-report-group(locals nol) pa-followers)
:: ::
++ pa-remind :: remote presence ++ pa-remind :: remote presence
@ -790,7 +794,7 @@
=/ buk (~(uni by remotes) rem) ::TODO drop? =/ buk (~(uni by remotes) rem) ::TODO drop?
=. buk (~(put by buk) tay loc) =. buk (~(put by buk) tay loc)
?: =(buk remotes) +>.$ ?: =(buk remotes) +>.$
=< pa-lowdown-precs =. +>.$ (pa-inform %rempe buk)
(pa-report-group(remotes buk) pa-followers) (pa-report-group(remotes buk) pa-followers)
:: ::
++ pa-start :: start stream ++ pa-start :: start stream

View File

@ -63,9 +63,11 @@
{$names (map ship (unit human))} :: new identities {$names (map ship (unit human))} :: new identities
::TODO cabal, or merge its contents into tale's config ::TODO cabal, or merge its contents into tale's config
:: basically we just want to merge the ship sets, right? :: basically we just want to merge the ship sets, right?
{$tales (map knot (unit cabal))} :: changed config {$tales (pair knot (unit config))} :: changed config
{$remco (map station config)} :: remote configs
::TODO merge remote and local presences. ::TODO merge remote and local presences.
{$precs (pair knot register)} :: changed presence {$precs (pair knot atlas)} :: changed presence
{$rempe (map partner atlas)} :: remote presences
{$grams (pair knot (pair @ud (list telegram)))} :: new grams {$grams (pair knot (pair @ud (list telegram)))} :: new grams
== :: == ::
++ speech :: narrative action ++ speech :: narrative action