mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 16:05:27 +03:00
dill: reify sessions interface
Implements tasks for creating and deleting new sessions, and allows terminal handler agents to distinguish between sessions. Includes bits of preparation in drum to more fully support multiple distinct sessions, but doesn't get it all the way there just yet.
This commit is contained in:
parent
5ef68d38c7
commit
91f32ee098
@ -81,8 +81,7 @@
|
||||
::
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%atom poke-helm(mark %helm-atom)
|
||||
%dill-belt poke-drum(mark %drum-dill-belt)
|
||||
%dill-blit poke-drum(mark %drum-dill-blit)
|
||||
%dill-poke poke-drum
|
||||
%hood-sync poke-kiln(mark %kiln-sync)
|
||||
%write-sec-atom poke-helm(mark %helm-write-sec-atom)
|
||||
==
|
||||
@ -95,7 +94,7 @@
|
||||
|= =path
|
||||
^- step:agent:gall
|
||||
?+ path (on-watch:def +<)
|
||||
[%drum *] =^(c drum.state (peer:drum-core +<) [c this])
|
||||
[%dill *] =^(c drum.state (peer:drum-core +<) [c this])
|
||||
==
|
||||
::
|
||||
++ on-agent
|
||||
|
@ -8,7 +8,7 @@
|
||||
$: eel=(set gill:gall) :: connect to
|
||||
ray=(set well:gall) ::
|
||||
fur=(map dude:gall (unit server)) :: servers
|
||||
bin=(map bone source) :: terminals
|
||||
bin=(map @ source) :: terminals
|
||||
== ::
|
||||
:: ::
|
||||
++ server :: running server
|
||||
@ -155,18 +155,18 @@
|
||||
++ en-gill :: gill to wire
|
||||
|= gyl=gill:gall
|
||||
^- wire
|
||||
::TODO include session?
|
||||
[%drum %phat (scot %p p.gyl) q.gyl ~]
|
||||
::
|
||||
++ de-gill :: gill from wire
|
||||
|= way=wire ^- gill:gall
|
||||
?>(?=([@ @ ~] way) [(slav %p i.way) i.t.way])
|
||||
--
|
||||
:: TODO: remove .ost
|
||||
::
|
||||
|= [hid=bowl:gall state]
|
||||
=* sat +<+
|
||||
=/ ost 0
|
||||
=+ (~(gut by bin) ost *source)
|
||||
=/ ses=@tas %$
|
||||
=+ (~(gut by bin) ses *source)
|
||||
=* dev -
|
||||
=| moz=(list card:agent:gall)
|
||||
=| biz=(list dill-blit:dill)
|
||||
@ -176,6 +176,13 @@
|
||||
+$ state ^state :: proxy
|
||||
+$ any-state ^any-state :: proxy
|
||||
++ on-init se-abet:this(eel (deft-fish our.hid))
|
||||
::
|
||||
++ prep
|
||||
|= s=@tas
|
||||
=. ses ses
|
||||
=. dev (~(gut by bin) ses *source)
|
||||
this
|
||||
::
|
||||
++ diff-sole-effect-phat :: app event
|
||||
|= [way=wire fec=sole-effect]
|
||||
=< se-abet =< se-view
|
||||
@ -185,6 +192,8 @@
|
||||
::
|
||||
++ peer ::
|
||||
|= pax=path
|
||||
=? this ?=([%dill @ ~] pax)
|
||||
(prep i.t.pax)
|
||||
~| [%drum-unauthorized our+our.hid src+src.hid] :: ourself
|
||||
?> (team:title our.hid src.hid) :: or our own moon
|
||||
=< se-abet =< se-view
|
||||
@ -201,15 +210,15 @@
|
||||
=. ray (deft-apes our.hid lit)
|
||||
[~ sat]
|
||||
::
|
||||
++ poke-dill
|
||||
|= [ses=@tas bet=dill-belt:dill]
|
||||
(poke-dill-belt:(prep ses) bet)
|
||||
::
|
||||
++ poke-dill-belt :: terminal event
|
||||
|= bet=dill-belt:dill
|
||||
=< se-abet =< se-view
|
||||
(se-belt bet)
|
||||
::
|
||||
++ poke-dill-blit :: terminal output
|
||||
|= bit=dill-blit:dill
|
||||
se-abet:(se-blit-sys bit)
|
||||
::
|
||||
++ poke-start :: start app
|
||||
|= wel=well:gall
|
||||
=< se-abet =< se-view
|
||||
@ -241,8 +250,7 @@
|
||||
++ poke
|
||||
|= [=mark =vase]
|
||||
?+ mark ~|([%poke-drum-bad-mark mark] !!)
|
||||
%drum-dill-belt =;(f (f !<(_+<.f vase)) poke-dill-belt)
|
||||
%drum-dill-blit =;(f (f !<(_+<.f vase)) poke-dill-blit)
|
||||
%dill-poke =;(f (f !<(_+<.f vase)) poke-dill)
|
||||
%drum-exit =;(f (f !<(_+<.f vase)) poke-exit)
|
||||
%drum-link =;(f (f !<(_+<.f vase)) poke-link)
|
||||
%drum-put =;(f (f !<(_+<.f vase)) poke-put)
|
||||
@ -256,7 +264,7 @@
|
||||
|^ |= [hood-version=@ud old=any-state]
|
||||
=< se-abet =< se-view
|
||||
=. sat (load-state old)
|
||||
=. dev (~(gut by bin) ost *source)
|
||||
=. dev (~(gut by bin) ses *source)
|
||||
(load-apps hood-version)
|
||||
::
|
||||
++ load-state
|
||||
@ -381,12 +389,13 @@
|
||||
++ se-abet :: resolve
|
||||
^- (quip card:agent:gall state)
|
||||
=. . se-subze:se-adze:se-subit:se-adit
|
||||
:_ sat(bin (~(put by bin) ost dev))
|
||||
:_ sat(bin (~(put by bin) ses dev))
|
||||
^- (list card:agent:gall)
|
||||
?~ biz (flop moz)
|
||||
:_ (flop moz)
|
||||
=/ =dill-blit:dill ?~(t.biz i.biz [%mor (flop biz)])
|
||||
[%give %fact ~[/drum] %dill-blit !>(dill-blit)]
|
||||
::TODO remove /drum after dill cleans up
|
||||
[%give %fact ~[/drum /dill/[ses]] %dill-blit !>(dill-blit)]
|
||||
::
|
||||
++ se-adit :: update servers
|
||||
^+ this
|
||||
@ -471,14 +480,14 @@
|
||||
(se-peer gil)
|
||||
::
|
||||
++ se-subze :: downdate connections
|
||||
=< .(dev (~(got by bin) ost))
|
||||
=. bin (~(put by bin) ost dev)
|
||||
=< .(dev (~(got by bin) ses))
|
||||
=. bin (~(put by bin) ses dev)
|
||||
^+ .
|
||||
%- ~(rep by bin)
|
||||
=< .(con +>)
|
||||
|: $:,[[ost=bone dev=source] con=_.] ^+ con
|
||||
=+ xeno=se-subze-local:%_(con ost ost, dev dev)
|
||||
xeno(ost ost.con, dev dev.con, bin (~(put by bin) ost dev.xeno))
|
||||
|: $:,[[ses=@tas dev=source] con=_.] ^+ con
|
||||
=+ xeno=se-subze-local:%_(con ses ses, dev dev)
|
||||
xeno(ses ses.con, dev dev.con, bin (~(put by bin) ses dev.xeno))
|
||||
::
|
||||
++ se-subze-local
|
||||
^+ .
|
||||
@ -493,7 +502,7 @@
|
||||
++ se-aint :: ignore result
|
||||
|= gyl=gill:gall
|
||||
^- ?
|
||||
?. (~(has by bin) ost) &
|
||||
?. (~(has by bin) ses) &
|
||||
=+ gyr=(~(get by fug) gyl)
|
||||
|(?=(~ gyr) ?=(~ u.gyr))
|
||||
::
|
||||
@ -660,7 +669,8 @@
|
||||
::
|
||||
++ se-blit-sys :: output to system
|
||||
|= bil=dill-blit:dill ^+ +>
|
||||
(se-emit %give %fact ~[/drum] %dill-blit !>(bil))
|
||||
::TODO remove /drum after dill cleans up
|
||||
(se-emit %give %fact ~[/drum /dill/[ses]] %dill-blit !>(bil))
|
||||
::
|
||||
++ se-show :: show buffer, raw
|
||||
|= lin=(pair @ud stub)
|
||||
@ -714,6 +724,7 @@
|
||||
::
|
||||
++ se-peer :: send a peer
|
||||
|= gyl=gill:gall
|
||||
::TODO include session
|
||||
=/ =path /sole/(cat 3 'drum_' (scot %p our.hid))
|
||||
%- se-emit(fug (~(put by fug) gyl ~))
|
||||
[%pass (en-gill gyl) %agent gyl %watch path]
|
||||
|
@ -1055,9 +1055,9 @@
|
||||
$% [%belt p=belt] :: terminal input
|
||||
[%blew p=blew] :: terminal config
|
||||
[%flee ~] :: unwatch session
|
||||
[%flow p=@tas q=(list gill:gall)] :: terminal config
|
||||
[%hail ~] :: terminal refresh
|
||||
[%hook ~] :: this term hung up
|
||||
[%open p=dude:gall q=(list gill:gall)] :: setup session
|
||||
[%shut ~] :: close session
|
||||
[%view ~] :: watch session blits
|
||||
== ::
|
||||
::
|
||||
@ -1111,6 +1111,11 @@
|
||||
[%text p=tape] ::
|
||||
[%verb ~] :: verbose mode
|
||||
== ::
|
||||
:: ::
|
||||
+$ poke :: dill to userspace
|
||||
$: ses=@tas :: target session
|
||||
dill-belt :: input
|
||||
== ::
|
||||
-- ::dill
|
||||
:: ::::
|
||||
:::: ++eyre :: (1e) http-server
|
||||
@ -2133,9 +2138,6 @@
|
||||
:: %ames: hear packet
|
||||
::
|
||||
$>(%hear task:ames)
|
||||
:: %dill: hangup
|
||||
::
|
||||
$>(%hook task:dill)
|
||||
:: %clay: external edit
|
||||
::
|
||||
$>(%into task:clay)
|
||||
@ -2151,6 +2153,9 @@
|
||||
:: %eyre: starts handling an backdoor http request
|
||||
::
|
||||
$>(%request-local task:eyre)
|
||||
:: %dill: close session
|
||||
::
|
||||
$>(%shut task:dill)
|
||||
:: %behn: wakeup
|
||||
::
|
||||
$>(%wake task:behn)
|
||||
|
@ -26,7 +26,7 @@
|
||||
-- => ::
|
||||
|% :: protocol outward
|
||||
+$ mess ::
|
||||
$% [%dill-belt p=(hypo dill-belt)] ::
|
||||
$% [%dill-poke p=(hypo poke)] ::
|
||||
== ::
|
||||
+$ move [p=duct q=(wind note gift)] :: local move
|
||||
+$ note :: out request $->
|
||||
@ -97,7 +97,6 @@
|
||||
|= kyz=task
|
||||
^+ +>
|
||||
?+ -.kyz ~& [%strange-kiss -.kyz] +>
|
||||
%flow +>
|
||||
%hail (send %hey ~)
|
||||
%belt (send `dill-belt`p.kyz)
|
||||
%talk (talk p.kyz)
|
||||
@ -220,18 +219,32 @@
|
||||
=. tem `(turn gyl |=(a=gill [%yow a]))
|
||||
(pass / [%c %warp our %home `[%sing %y [%ud 1] /]])
|
||||
::
|
||||
++ open
|
||||
|= gyl=(list gill)
|
||||
=. +> peer
|
||||
%+ roll gyl
|
||||
|= [g=gill _..open]
|
||||
(send [%yow g])
|
||||
::
|
||||
++ shut
|
||||
::TODO send a %bye blit?
|
||||
pull
|
||||
::
|
||||
++ send :: send action
|
||||
|= bet=dill-belt
|
||||
^+ +>
|
||||
?^ tem
|
||||
+>(tem `[bet u.tem])
|
||||
(deal /send/[ses] [%poke [%dill-belt -:!>(bet) bet]])
|
||||
(deal /send/[ses] [%poke [%dill-poke !>([ses bet])]])
|
||||
::
|
||||
++ hood-set-boot-apps
|
||||
(deal / [%poke %drum-set-boot-apps !>(lit.all)])
|
||||
::
|
||||
++ peer
|
||||
(deal /peer/[ses] [%watch /drum]) ::TODO rename subscription path
|
||||
(deal /peer/[ses] %watch /dill/[ses])
|
||||
::
|
||||
++ pull
|
||||
(deal /peer/[ses] %leave ~)
|
||||
::
|
||||
++ show :: permit reads on desk
|
||||
|= des=desk
|
||||
@ -352,6 +365,31 @@
|
||||
?: ?=(%knob -.task)
|
||||
=. veb.all (~(put by veb.all) tag.task level.task)
|
||||
[~ ..^$]
|
||||
:: %open opens a new dill session
|
||||
::
|
||||
?: ?=(%open -.task)
|
||||
?: (~(has by dug.all) ses)
|
||||
::TODO should we allow, and just send the %yow blits?
|
||||
~| [%cannot-open-existing ses]
|
||||
!!
|
||||
=/ zon=axon [p.task ~ width=80]
|
||||
=^ moz all abet:(~(open as hen ses zon) q.task)
|
||||
::REVIEW we might want a separate, explicit %view,
|
||||
:: but then we could miss some initial blits...
|
||||
:: do we care about that?
|
||||
=. eye.all (~(put ju eye.all) ses hen)
|
||||
[moz ..^$]
|
||||
:: %shut closes an existing dill session
|
||||
::
|
||||
?: ?=(%shut -.task)
|
||||
?: =(%$ ses)
|
||||
~| %cannot-shut-default-session
|
||||
!!
|
||||
=/ nus
|
||||
~| [%no-session ses]
|
||||
(need (ax hen ses))
|
||||
=^ moz all abet:shut:nus
|
||||
[moz ..^$]
|
||||
:: %view opens a subscription to the target session, on the current duct
|
||||
::
|
||||
?: ?=(%view -.task)
|
||||
|
Loading…
Reference in New Issue
Block a user