mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 17:41:33 +03:00
ames: state adapter
This commit is contained in:
parent
900d923ccc
commit
0a8b12c882
@ -788,6 +788,40 @@
|
|||||||
$% [%memo =message-num message=*]
|
$% [%memo =message-num message=*]
|
||||||
[%send =message-num =ack-meat]
|
[%send =message-num =ack-meat]
|
||||||
==
|
==
|
||||||
|
:: previous state versions, for +stay/+load migrations
|
||||||
|
::
|
||||||
|
+| %plasmodics
|
||||||
|
::
|
||||||
|
+$ ames-state-1
|
||||||
|
$: peers=(map ship ship-state-1)
|
||||||
|
=unix=duct
|
||||||
|
=life
|
||||||
|
crypto-core=acru:ames
|
||||||
|
==
|
||||||
|
+$ ship-state-1
|
||||||
|
$% [%alien alien-agenda]
|
||||||
|
[%known peer-state-1]
|
||||||
|
==
|
||||||
|
+$ peer-state-1
|
||||||
|
$: $: =symmetric-key
|
||||||
|
=life
|
||||||
|
=public-key
|
||||||
|
sponsor=ship
|
||||||
|
==
|
||||||
|
route=(unit [direct=? =lane])
|
||||||
|
qos=qos-1
|
||||||
|
=ossuary
|
||||||
|
snd=(map bone message-pump-state)
|
||||||
|
rcv=(map bone message-sink-state)
|
||||||
|
nax=(set [=bone =message-num])
|
||||||
|
heeds=(set duct)
|
||||||
|
==
|
||||||
|
+$ qos-1
|
||||||
|
$~ [%unborn ~]
|
||||||
|
$% [%live last-contact=@da]
|
||||||
|
[%dead last-contact=@da]
|
||||||
|
[%unborn ~]
|
||||||
|
==
|
||||||
--
|
--
|
||||||
:: external vane interface
|
:: external vane interface
|
||||||
::
|
::
|
||||||
@ -863,21 +897,34 @@
|
|||||||
:: lifecycle arms; mostly pass-throughs to the contained adult ames
|
:: lifecycle arms; mostly pass-throughs to the contained adult ames
|
||||||
::
|
::
|
||||||
++ scry scry:adult-core
|
++ scry scry:adult-core
|
||||||
++ stay [%larva queued-events ames-state.adult-gate]
|
++ stay [%2 %larva queued-events ames-state.adult-gate]
|
||||||
++ load
|
++ load
|
||||||
|= $= old
|
|= $= old
|
||||||
$% [%larva events=_queued-events state=_ames-state.adult-gate]
|
$% $: %2
|
||||||
[%adult state=_ames-state.adult-gate]
|
$% [%larva events=_queued-events state=_ames-state.adult-gate]
|
||||||
==
|
[%adult state=_ames-state.adult-gate]
|
||||||
|
== ==
|
||||||
|
::
|
||||||
|
$% [%larva events=_queued-events state=ames-state-1]
|
||||||
|
[%adult state=ames-state-1]
|
||||||
|
== ==
|
||||||
|
?- old
|
||||||
|
[%2 %adult *]
|
||||||
|
(load:adult-core %2 state.old)
|
||||||
::
|
::
|
||||||
?- -.old
|
[%2 %larva *]
|
||||||
%adult
|
~> %slog.1^leaf/"ames: larva: load"
|
||||||
(load:adult-core state.old)
|
=. queued-events events.old
|
||||||
|
=. adult-gate (load:adult-core %2 state.old)
|
||||||
|
larval-gate
|
||||||
::
|
::
|
||||||
%larva
|
[%adult *]
|
||||||
|
(load:adult-core %1 state.old)
|
||||||
|
::
|
||||||
|
[%larva *]
|
||||||
~> %slog.0^leaf/"ames: larva: load"
|
~> %slog.0^leaf/"ames: larva: load"
|
||||||
=. queued-events events.old
|
=. queued-events events.old
|
||||||
=. adult-gate (load:adult-core state.old)
|
=. adult-gate (load:adult-core %1 state.old)
|
||||||
larval-gate
|
larval-gate
|
||||||
==
|
==
|
||||||
--
|
--
|
||||||
@ -942,13 +989,38 @@
|
|||||||
[moves ames-gate]
|
[moves ames-gate]
|
||||||
:: +stay: extract state before reload
|
:: +stay: extract state before reload
|
||||||
::
|
::
|
||||||
++ stay [%adult ames-state]
|
++ stay [%2 %adult ames-state]
|
||||||
:: +load: load in old state after reload
|
:: +load: load in old state after reload
|
||||||
::
|
::
|
||||||
++ load
|
++ load
|
||||||
|= old-state=_ames-state
|
|= $= old-state
|
||||||
|
$% [%1 ames-state-1]
|
||||||
|
[%2 ^ames-state]
|
||||||
|
==
|
||||||
^+ ames-gate
|
^+ ames-gate
|
||||||
ames-gate(ames-state old-state)
|
?- -.old-state
|
||||||
|
%2
|
||||||
|
ames-gate(ames-state +.old-state)
|
||||||
|
::
|
||||||
|
%1
|
||||||
|
=> .(old-state +.old-state)
|
||||||
|
=. +.ames-state +.old-state
|
||||||
|
=. peers.ames-state
|
||||||
|
%- ~(gas by *(map ship ship-state))
|
||||||
|
%+ turn ~(tap by peers.old-state)
|
||||||
|
|= [peer=ship old-ship-state=ship-state-1]
|
||||||
|
^- [ship ship-state]
|
||||||
|
?: ?=(%alien -.old-ship-state)
|
||||||
|
[peer old-ship-state]
|
||||||
|
:+ peer %known
|
||||||
|
%= +.old-ship-state
|
||||||
|
qos
|
||||||
|
?+ -.qos.old-ship-state qos.old-ship-state
|
||||||
|
%unborn [%unborn now]
|
||||||
|
==
|
||||||
|
==
|
||||||
|
ames-gate
|
||||||
|
==
|
||||||
:: +scry: dereference namespace
|
:: +scry: dereference namespace
|
||||||
::
|
::
|
||||||
++ scry
|
++ scry
|
||||||
|
Loading…
Reference in New Issue
Block a user