Can now |hi to King Haskell over Ames! (and merged Master)

This commit is contained in:
Benjamin Summers 2019-07-31 22:16:02 -07:00
parent 94b5b57faa
commit 6302d5fb90
76 changed files with 705 additions and 134875 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ cross/
release/ release/
.stack-work .stack-work
\#*\# \#*\#
s/*

3
.ignore Normal file
View File

@ -0,0 +1,3 @@
.stack-work
./pkg/hs-vere/.stack-work
./pkg/hs-urbit/.stack-work

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e534cb57dc8b2bee35004d843c7e0b2d028ba699e86d47a58efac4b065ce2f1b oid sha256:8f6e93cb3ee5fcb0970851bd10d2d2a640ff968292d147c35385623b86570296
size 6047224 size 6662042

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:96b1f1ad730789b1d557aac66b847047c98341bcf436e1927f40f082a728d641 oid sha256:0e520b9ab0232d1765e1dacde96a1210845768e7334a334b5705d1c40348c82b
size 3816083 size 4464201

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:e4a4f8f86b18de5e410caeb491eecf8cf4fe24fbaba03ad8183b55a13eee154a oid sha256:a4a8e1daf0bfe86d5fc4ef7060b0c6a6c2678a344787926f14bb4b8cfabe8752
size 9108350 size 9549390

View File

@ -48,4 +48,9 @@ rec {
pier = zod; pier = zod;
}; };
ivory = import ./ivory {
inherit arvo pkgs tlon deps debug;
pier = zod;
};
} }

22
nix/ops/ivory/builder.sh Executable file
View File

@ -0,0 +1,22 @@
source $stdenv/setup
set -ex
cp -r $PIER ./pier
chmod -R u+rw ./pier
$URBIT -d ./pier
cleanup () {
if [ -e ./pier/.vere.lock ]
then kill $(< ./pier/.vere.lock) || true;
fi
}
trap cleanup EXIT
herb ./pier -P ivory.pill -d '+ivory'
mv ivory.pill $out
set +x

19
nix/ops/ivory/default.nix Normal file
View File

@ -0,0 +1,19 @@
{ pkgs, tlon, deps, pier, arvo, debug }:
let
urbitExe = if debug
then "${tlon.urbit-debug}/bin/urbit-debug -g"
else "${tlon.urbit}/bin/urbit";
in
pkgs.stdenv.mkDerivation rec {
name = "ivory";
builder = ./builder.sh;
buildInputs = [ tlon.herb pkgs.coreutils ];
URBIT = urbitExe;
PIER = pier;
ARVO = arvo;
}

View File

@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
debug, debug,
ivory ? ../../../bin/ivory.pill,
argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv argon2, ed25519, ent, ge-additions, h2o, murmur3, scrypt, secp256k1, sni, softfloat3, uv
}: }:
@ -30,6 +31,7 @@ pkgs.stdenv.mkDerivation {
hardeningDisable = if debug then [ "all" ] else []; hardeningDisable = if debug then [ "all" ] else [];
CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror"; CFLAGS = if debug then "-O3 -g -Werror" else "-O3 -Werror";
IVORY = ivory;
MEMORY_DEBUG = debug; MEMORY_DEBUG = debug;
CPU_DEBUG = debug; CPU_DEBUG = debug;
EVENT_TIME_DEBUG = false; EVENT_TIME_DEBUG = false;

View File

@ -1,6 +1,12 @@
{ env_name, env, deps }: { env_name, env, deps }:
{ ent, ge-additions, cacert, xxd, name ? "urbit", debug ? false }: {
ent,
name ? "urbit",
debug ? false,
ivory ? ../../../bin/ivory.pill,
ge-additions, cacert, xxd
}:
let let
@ -22,6 +28,7 @@ env.make_derivation {
EVENT_TIME_DEBUG = false; EVENT_TIME_DEBUG = false;
NCURSES = env.ncurses; NCURSES = env.ncurses;
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
IVORY = ivory;
name = "${name}-${env_name}"; name = "${name}-${env_name}";
exename = name; exename = name;

View File

@ -1,37 +0,0 @@
{ pkgs ? import ../../nixpkgs.nix }:
let
compiler = "default";
doBenchmark = false;
run-hpack =
"${pkgs.haskellPackages.hpack}/bin/hpack";
f = { mkDerivation, stdenv,
base, classy-prelude, lens, hpack, megaparsec }:
mkDerivation {
pname = "uterm";
version = "0.1.0.0";
src = ../../../pkg/uterm;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [
base classy-prelude lens hpack megaparsec
];
license = stdenv.lib.licenses.lgpl3;
preConfigure = ''
${run-hpack}
'';
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
drv = variant (haskellPackages.callPackage f {});
in
if pkgs.lib.inNixShell then drv.env else drv

View File

@ -6,12 +6,19 @@
$: url=@ta $: url=@ta
from-number=number:block from-number=number:block
== ==
+$ app-state ~ +$ app-state
$: url=@ta
=number:block
=pending-udiffs
blocks=(list block)
==
+$ peek-data ~ +$ peek-data ~
+$ in-poke-data +$ in-poke-data
$% [%watch =config] $: %azimuth-tracker-poke
[%clear ~] $% [%init ~]
[%noun *] [%listen whos=(set ship) =source:kale]
[%watch =config]
==
== ==
+$ out-poke-data ~ +$ out-poke-data ~
+$ in-peer-data ~ +$ in-peer-data ~
@ -183,40 +190,62 @@
== ==
=/ event-logs=(list event-log:rpc:ethereum) =/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json) (parse-event-logs:rpc:ethereum json)
=/ =udiffs:point =/ =udiffs:point (event-logs-to-udiffs event-logs)
%+ murn event-logs
|= =event-log:rpc:ethereum
^- (unit [=ship =udiff:point])
?~ mined.event-log
~
?: removed.u.mined.event-log
~& [%removed-log event-log]
~
=/ =id:block [block-hash block-number]:u.mined.event-log
=, azimuth-events:azimuth
=, abi:ethereum
?: =(broke-continuity i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=/ num=@ (decode-results data.event-log ~[%uint])
`[who id %rift num]
?: =(changed-keys i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=+ ^- [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.event-log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who id %keys rev sut (pass-from-eth:azimuth enc aut sut)]
?: =(lost-sponsor i.topics.event-log)
=+ ^- [who=@ pos=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon ~]
?: =(escape-accepted i.topics.event-log)
=+ ^- [who=@ wer=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon `wer]
~& [%bad-topic event-log]
~
(pure:m udiffs) (pure:m udiffs)
:: ::
++ get-logs-by-range
|= [url=@ta =from=number:block =to=number:block]
=/ m (async:stdio udiffs:point)
^- form:m
;< =json bind:m
%+ request-rpc url
:* `'logs by range'
%eth-get-logs
`number+from-number
`number+to-number
~[azimuth:contracts:azimuth]
topics
==
=/ event-logs=(list event-log:rpc:ethereum)
(parse-event-logs:rpc:ethereum json)
=/ =udiffs:point (event-logs-to-udiffs event-logs)
(pure:m udiffs)
::
++ event-logs-to-udiffs
|= event-logs=(list =event-log:rpc:ethereum)
^- =udiffs:point
%+ murn event-logs
|= =event-log:rpc:ethereum
^- (unit [=ship =udiff:point])
?~ mined.event-log
~
?: removed.u.mined.event-log
~& [%removed-log event-log]
~
=/ =id:block [block-hash block-number]:u.mined.event-log
=, azimuth-events:azimuth
=, abi:ethereum
?: =(broke-continuity i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=/ num=@ (decode-results data.event-log ~[%uint])
`[who id %rift num]
?: =(changed-keys i.topics.event-log)
=/ who=@ (decode-topics t.topics.event-log ~[%uint])
=+ ^- [enc=octs aut=octs sut=@ud rev=@ud]
%+ decode-results data.event-log
~[[%bytes-n 32] [%bytes-n 32] %uint %uint]
`[who id %keys rev sut (pass-from-eth:azimuth enc aut sut)]
?: =(lost-sponsor i.topics.event-log)
=+ ^- [who=@ pos=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon ~]
?: =(escape-accepted i.topics.event-log)
=+ ^- [who=@ wer=@]
(decode-topics t.topics.event-log ~[%uint %uint])
`[who id %spon `wer]
~& [%bad-topic event-log]
~
::
++ jael-update ++ jael-update
|= =udiffs:point |= =udiffs:point
=/ m (async:stdio ,~) =/ m (async:stdio ,~)
@ -224,41 +253,86 @@
=* loop $ =* loop $
?~ udiffs ?~ udiffs
(pure:m ~) (pure:m ~)
~& > [%update block i.udiffs] ~& [%sending-event i.udiffs]
:: ;< ~ bind:m (send-effect [%vent-update i.udiffs]) ;< ~ bind:m (send-effect:stdio %new-event /ne i.udiffs)
loop(udiffs t.udiffs) loop(udiffs t.udiffs)
-- --
:: ::
:: Main loop :: Main loop
:: ::
=> |% => |%
++ watch ::
|= =config :: Subscribe to %sources from kale
=/ m (async:stdio ,~) ::
++ init
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m ^- form:m
=/ =number:block from-number.config ;< ~ bind:m (send-effect:stdio %sources /se ~)
=| =pending-udiffs (pure:m state)
=| blocks=(list block) ::
|- ^- form:m :: Send %listen to kale
=* poll-loop $ ::
~& [%poll-loop number] ++ listen
;< =latest=block bind:m (get-latest-block url.config) |= [state=app-state whos=(set ship) =source:kale]
=/ m (async:stdio ,app-state)
^- form:m
;< ~ bind:m (send-effect:stdio %listen /lo whos source)
(pure:m state)
::
:: Take %source from kale
::
++ take-source
|= [state=app-state whos=(set ship) =source:kale]
=/ m (async:stdio ,app-state)
^- form:m
?: ?=(%& -.source)
(pure:m state)
=/ a-purl=purl:eyre node.p.source
=. url.state (crip (en-purl:html a-purl))
(watch state url.state launch:contracts:azimuth)
::
:: Start watching a node
::
++ watch
|= [state=app-state =config]
=/ m (async:stdio ,app-state)
^- form:m
=: url.state url.config
number.state from-number.config
pending-udiffs.state *pending-udiffs
blocks.state *(list block)
==
(get-updates state)
::
:: Get updates since last checked
::
++ get-updates
|= state=app-state
=/ m (async:stdio ,app-state)
^- form:m
~& [%get-updates number.state]
;< =latest=block bind:m (get-latest-block url.state)
;< =new=number:block bind:m (zoom state number.id.latest-block)
=. number.state new-number
|- ^- form:m |- ^- form:m
=* walk-loop $ =* walk-loop $
~& [%walk-loop number] ~& [%walk-loop number.state]
?: (gth number number.id.latest-block) ?: (gth number.state number.id.latest-block)
;< now=@da bind:m get-time:stdio ;< now=@da bind:m get-time:stdio
;< ~ bind:m (wait:stdio (add now ~s10)) ;< ~ bind:m (wait-effect:stdio (add now ~s10))
poll-loop (pure:m state)
;< =block bind:m (get-block-by-number url.config number) ;< =block bind:m (get-block-by-number url.state number.state)
;< [=new=^pending-udiffs new-blocks=(lest ^block)] bind:m ;< [=new=pending-udiffs new-blocks=(lest ^block)] bind:m
(take-block url.config pending-udiffs block blocks) (take-block url.state pending-udiffs.state block blocks.state)
=: pending-udiffs new-pending-udiffs =: pending-udiffs.state new-pending-udiffs
blocks new-blocks blocks.state new-blocks
number +(number.id.i.new-blocks) number.state +(number.id.i.new-blocks)
== ==
walk-loop walk-loop
:: ::
:: Process a block, detecting and handling reorgs
::
++ take-block ++ take-block
|= [url=@ta =a=pending-udiffs =block blocks=(list block)] |= [url=@ta =a=pending-udiffs =block blocks=(list block)]
=/ m (async:stdio ,[pending-udiffs (lest ^block)]) =/ m (async:stdio ,[pending-udiffs (lest ^block)])
@ -274,6 +348,8 @@
=. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs) =. b-pending-udiffs (~(put by b-pending-udiffs) number.id.block new-udiffs)
(pure:m b-pending-udiffs block blocks) (pure:m b-pending-udiffs block blocks)
:: ::
:: Release events if they're more than 30 blocks ago
::
++ release-old-events ++ release-old-events
|= [=pending-udiffs =number:block] |= [=pending-udiffs =number:block]
=/ m (async:stdio ,^pending-udiffs) =/ m (async:stdio ,^pending-udiffs)
@ -283,6 +359,8 @@
;< ~ bind:m (jael-update udiffs) ;< ~ bind:m (jael-update udiffs)
(pure:m (~(del by pending-udiffs) rel-number)) (pure:m (~(del by pending-udiffs) rel-number))
:: ::
:: Reorg detected, so rewind until we're back in sync
::
++ rewind ++ rewind
|= [url=@ta =pending-udiffs =block blocks=(list block)] |= [url=@ta =pending-udiffs =block blocks=(list block)]
=/ m (async:stdio ,[^pending-udiffs (lest ^block)]) =/ m (async:stdio ,[^pending-udiffs (lest ^block)])
@ -300,11 +378,31 @@
=. pending-udiffs (~(del by pending-udiffs) number.id.block) =. pending-udiffs (~(del by pending-udiffs) number.id.block)
loop(block next-block, blocks t.blocks) loop(block next-block, blocks t.blocks)
:: ::
:: Tell subscribers there was a deep reorg
::
++ disavow ++ disavow
|= =block |= =block
=/ m (async:stdio ,~) =/ m (async:stdio ,~)
^- form:m ^- form:m
(jael-update [*ship id.block %disavow ~]~) (jael-update [*ship id.block %disavow ~]~)
::
:: Zoom forward to near a given block number.
::
:: Zooming doesn't go forward one block at a time. As a
:: consequence, it cannot detect and handle reorgs. Only use it
:: at a safe distance -- 500 blocks ago is probably sufficient.
::
++ zoom
|= [state=app-state =latest=number:block]
=/ m (async:stdio ,number:block)
^- form:m
?: (lth latest-number (add number.state 500))
(pure:m latest-number)
=/ to-number=number:block (sub latest-number 500)
;< =udiffs:point bind:m
(get-logs-by-range url.state number.state to-number)
;< ~ bind:m (jael-update udiffs)
(pure:m to-number)
-- --
:: ::
:: Main :: Main
@ -316,17 +414,20 @@
|= =in-poke-data |= =in-poke-data
=/ m tapp-async =/ m tapp-async
^- form:m ^- form:m
?- -.in-poke-data ?- +<.in-poke-data
%noun (watch (config +.in-poke-data)) %init (init state)
%watch (watch +.in-poke-data) %listen (listen state +>.in-poke-data)
%clear !! %watch (watch state +>.in-poke-data)
== ==
:: ::
++ handle-take ++ handle-take
|= =sign:tapp |= =sign:tapp
!! =/ m tapp-async
:: ?> ?=(%sources -.sign) ^- form:m
:: (handle-poke %watch +.sign) ?+ -.sign ~|([%strange-sign -.sign] !!)
%source (take-source state +.sign)
%wake (get-updates state)
==
:: ::
++ handle-peer ~(handle-peer default-tapp bowl state) ++ handle-peer ~(handle-peer default-tapp bowl state)
-- --

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -5,7 +5,8 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" <meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"/> content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" href="/~chat/css/index.css" /> <link rel="stylesheet" href="/~chat/css/index.css" />
<link rel="icon" type="image/png" href="/~launch/img/Favicon.png">
</head> </head>
<body> <body>
<div id="root" /> <div id="root" />

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@
$% [%dns-authority =authority] $% [%dns-authority =authority]
[%dns-bind =ship =target] [%dns-bind =ship =target]
[%handle-http-request =inbound-request:eyre] [%handle-http-request =inbound-request:eyre]
[%noun noun=*]
== ==
+$ out-poke-data +$ out-poke-data
$% [%dns-bind =ship =target] $% [%dns-bind =ship =target]
@ -612,6 +613,14 @@
:: XX retryable? :: XX retryable?
:: ::
?. &(?=(^ rep) =(200 p.u.rep)) ?. &(?=(^ rep) =(200 p.u.rep))
?: &(?=(^ rep) =(401 p.u.rep))
:: XX automate
::
~& %authentication-failure
~& (skim q.u.rep |=((pair @t @t) ?=(%www-authenticate p)))
(pure:m ~)
::
~& [%create-bind-failed rep]
(pure:m ~) (pure:m ~)
:: ::
=* httr u.rep =* httr u.rep
@ -623,12 +632,7 @@
(json-octs u.r.httr parse-record:(provider authority)) (json-octs u.r.httr parse-record:(provider authority))
?~(dat ~. id.u.dat) ?~(dat ~. id.u.dat)
:: ::
=/ =address:dns ;< now=@da bind:m get-time:stdio
?>(?=(%direct -.target) +.target)
=/ =turf
(weld dom.authority /(crip +:(scow %p ship)))
;< ~ bind:m (poke-app:stdio collector-app [%dns-complete ship address turf])
;< now=@da bind:m get-time:stdio
=/ =bound =/ =bound
[now id target ?~(existing ~ [[wen cur] hit]:u.existing)] [now id target ?~(existing ~ [[wen cur] hit]:u.existing)]
(pure:m (some bound)) (pure:m (some bound))
@ -699,6 +703,23 @@
?. (team:title [our src]:bowl) ?. (team:title [our src]:bowl)
~| %bind-yoself !! ~| %bind-yoself !!
?- -.in-poke-data ?- -.in-poke-data
%noun
?: ?=(%debug noun.in-poke-data)
~& bowl
:: XX redact secrets
::
~& state
(pure:m state)
::
:: XX heavy-handed, will duplicate subscriptions
:: should track bones
::
?: ?=(%resubscribe noun.in-poke-data)
;< ~ bind:m (peer-app:stdio collector-app /requests)
(pure:m state)
::
~& %poke-unknown
(pure:m state)
:: ::
%dns-authority %dns-authority
?. =(~ nem.state) ?. =(~ nem.state)
@ -738,6 +759,10 @@
?~ new ?~ new
~& [%bind-failed in-poke-data] ~& [%bind-failed in-poke-data]
(pure:m state) (pure:m state)
=/ =turf
(weld dom.aut.nam /(crip +:(scow %p who)))
;< ~ bind:m
(poke-app:stdio collector-app [%dns-complete who +.tar turf])
=. bon.nam (~(put by bon.nam) who u.new) =. bon.nam (~(put by bon.nam) who u.new)
=. nem.state (some nam) =. nem.state (some nam)
:: ::

View File

@ -8,10 +8,14 @@
requested=(map ship address:dns) requested=(map ship address:dns)
completed=(map ship binding:dns) completed=(map ship binding:dns)
== ==
+$ peek-data [%noun (list (pair ship address:dns))] +$ peek-data
$% [%requested (list (pair ship address:dns))]
[%completed (list (pair ship binding:dns))]
==
+$ in-poke-data +$ in-poke-data
$% [%dns-address =address:dns] $% [%dns-address =address:dns]
[%dns-complete =ship =binding:dns] [%dns-complete =ship =binding:dns]
[%noun noun=*]
== ==
+$ out-poke-data +$ out-poke-data
$% [%drum-unlink =dock] $% [%drum-unlink =dock]
@ -78,6 +82,15 @@
^- (quip move _this) ^- (quip move _this)
=< abet =< abet
?- -.in-poke-data ?- -.in-poke-data
%noun
?: ?=(%debug noun.in-poke-data)
~& bowl
~& state
this
::
~& %poke-unknown
this
::
%dns-address %dns-address
=* who src.bowl =* who src.bowl
=* adr address.in-poke-data =* adr address.in-poke-data
@ -111,9 +124,10 @@
=/ req=(unit address:dns) (~(get by requested.state) who) =/ req=(unit address:dns) (~(get by requested.state) who)
:: ignore established bindings that don't match requested :: ignore established bindings that don't match requested
:: ::
?: ?& ?=(^ req) ?: ?| ?=(~ req)
!=(adr u.req) !=(adr u.req)
== ==
~& %unknown-complete
this this
=: requested.state (~(del by requested.state) who) =: requested.state (~(del by requested.state) who)
completed.state (~(put by completed.state) who [adr tuf]) completed.state (~(put by completed.state) who [adr tuf])
@ -124,10 +138,12 @@
++ peek ++ peek
|= =path |= =path
^- (unit (unit peek-data)) ^- (unit (unit peek-data))
~& path
?+ path [~ ~] ?+ path [~ ~]
[%x %requested ~] [%x %requested ~]
[~ ~ %noun ~(tap by requested.state)] [~ ~ %requested ~(tap by requested.state)]
::
[%x %completed ~]
[~ ~ %completed ~(tap by completed.state)]
== ==
:: ::
++ peer ++ peer
@ -149,10 +165,10 @@
=. ..this (give-result path %dns-request i.requests) =. ..this (give-result path %dns-request i.requests)
loop(requests t.requests) loop(requests t.requests)
:: ::
=/ who (slaw %p i.path) =/ who=(unit @p) (slaw %p i.path)
?~ who ?~ who
~| %invalid-path !! ~| %invalid-path !!
?~ dun=(~(get by completed.state) who) ?~ dun=(~(get by completed.state) u.who)
this this
(give-result path %dns-binding u.dun) (give-result path %dns-binding u.dun)
-- --

View File

@ -211,6 +211,9 @@
~| [%dns-collector-reserved-address if.adr] !! ~| [%dns-collector-reserved-address if.adr] !!
;< requested=? bind:m (request-by-ip if.adr) ;< requested=? bind:m (request-by-ip if.adr)
:: XX save failure? :: XX save failure?
::
~? =(requested.state (some address.in-poke-data))
%re-requesting
=? requested.state requested =? requested.state requested
(some address.in-poke-data) (some address.in-poke-data)
(pure:m state) (pure:m state)

View File

@ -3293,7 +3293,7 @@
|= {t/telegram c/@ud k/(map serial @ud) s/(map circle (list @ud))} |= {t/telegram c/@ud k/(map serial @ud) s/(map circle (list @ud))}
:+ +(c) (~(put by k) uid.t c) :+ +(c) (~(put by k) uid.t c)
=/ src/circle =/ src/circle
?: (~(has by aud.t) [our.bol nom]) [our.bol nom] ?: (~(has in aud.t) [our.bol nom]) [our.bol nom]
?~ aud.t ~&(%strange-aud [our.bol %inbox]) ?~ aud.t ~&(%strange-aud [our.bol %inbox])
n.aud.t n.aud.t
%+ ~(put by s) src %+ ~(put by s) src

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -7,6 +7,7 @@
=name "viewport" =name "viewport"
=content "width=device-width, initial-scale=1, shrink-to-fit=no"; =content "width=device-width, initial-scale=1, shrink-to-fit=no";
;link(rel "stylesheet", href "/~launch/css/index.css"); ;link(rel "stylesheet", href "/~launch/css/index.css");
;link(rel "icon", type "image/png", href "/~launch/img/Favicon.png");
== ==
;body ;body
;div#root; ;div#root;

View File

@ -1,18 +0,0 @@
|= scripts=marl
<!doctype html>
<html>
<head>
<title>Home</title>
<meta charset="utf-8" />
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<link rel="stylesheet" href="/~launch/css/index.css" />
</head>
<body>
<div id="root" />
<script src="/~/channel/channel.js"></script>
<script src="/~modulo/session.js"></script>
<script src="/~launch/js/tiles.js"></script>
<script src="/~launch/js/index.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -348,7 +348,9 @@
[~ da-this] [~ da-this]
=. subs.sat (~(del by subs.sat) who.del col.del) =. subs.sat (~(del by subs.sat) who.del col.del)
:- ~(tap in ~(key by pos.u.old)) :- ~(tap in ~(key by pos.u.old))
(da-emit [ost.bol %pull /collection/[col.del] [who.del %publish] ~]) %- da-emil
:- [ost.bol %pull /collection/[col.del] [who.del %publish] ~]
(affection-primary del)
:: iterate through post ids collected before, removing each from :: iterate through post ids collected before, removing each from
:: secondary indices in state :: secondary indices in state
:: ::
@ -382,7 +384,8 @@
=. da-this (da-remove who.del col.del u.pos.del) =. da-this (da-remove who.del col.del u.pos.del)
(da-emil (affection del)) (da-emil (affection del))
=. subs.sat (~(put by subs.sat) [who.del col.del] new) =. subs.sat (~(put by subs.sat) [who.del col.del] new)
(da-remove who.del col.del u.pos.del) =. da-this (da-remove who.del col.del u.pos.del)
(da-emil (affection-primary del))
:: ::
== ==
:: ::
@ -527,6 +530,15 @@
|= del=delta |= del=delta
^- (quip move _this) ^- (quip move _this)
da-done:(da-change:da del) da-done:(da-change:da del)
:: +affection: rumors to primary
::
++ affection-primary
|= del=delta
^- (list move)
%+ turn (prey:pubsub:userlib /primary bol)
|= [b=bone *]
^- move
[b %diff %publish-rumor del]
:: +affection: rumors to interested :: +affection: rumors to interested
:: ::
++ affection ++ affection
@ -1023,7 +1035,15 @@
%edit-collection %edit-collection
?. =(src.bol our.bol) ?. =(src.bol our.bol)
[~ this] [~ this]
[~ this] =/ pax=path /web/publish/[name.act]/publish-info
=/ col=(unit collection) (~(get by pubs.sat) name.act)
?~ col
[~ this]
?: ?=(%.n -.dat.col.u.col)
[~ this]
=/ out=collection-info p.dat.col.u.col(title title.act)
:_ this
[(write-file pax %publish-info !>(out))]~
:: ::
%edit-post %edit-post
?. =(who.act our.bol) ?. =(who.act our.bol)

Binary file not shown.

View File

@ -9,6 +9,7 @@
=name "viewport" =name "viewport"
=content "width=device-width, initial-scale=1, shrink-to-fit=no"; =content "width=device-width, initial-scale=1, shrink-to-fit=no";
;link(rel "stylesheet", href "/~publish/index.css"); ;link(rel "stylesheet", href "/~publish/index.css");
;link(rel "icon", type "image/png", href "/~launch/img/Favicon.png");
;script@"/~/channel/channel.js"; ;script@"/~/channel/channel.js";
;script@"/~modulo/session.js"; ;script@"/~modulo/session.js";
;script: window.injectedState = {(en-json:html inject)} ;script: window.injectedState = {(en-json:html inject)}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1391,13 +1391,15 @@
:: ::
:: prints binding details. goes both ways. :: prints binding details. goes both ways.
:: ::
:: XX this type is a misjunction, audience can be ~
::
|= qur/(unit $@(char audience)) |= qur/(unit $@(char audience))
^+ ..sh-work ^+ ..sh-work
?^ qur ?^ qur
?^ u.qur ?^ u.qur
=+ cha=(~(get by bound) u.qur) =+ cha=(~(get by bound) u.qur)
(sh-fact %txt ?~(cha "none" [u.cha]~)) (sh-fact %txt ?~(cha "none" [u.cha]~))
=+ pan=~(tap in (~(get ju binds) u.qur)) =+ pan=~(tap in (~(get ju binds) `@t`u.qur))
?: =(~ pan) (sh-fact %txt "~") ?: =(~ pan) (sh-fact %txt "~")
=< (sh-fact %mor (turn pan .)) =< (sh-fact %mor (turn pan .))
|=(a/audience [%txt ~(ar-phat ar a)]) |=(a/audience [%txt ~(ar-phat ar a)])

View File

@ -1,125 +0,0 @@
/+ *server
/= tile-js
/^ octs
/; as-octs:mimes:html
/: /===/app/timer/js/tile
/| /js/
/~ ~
==
/= timer-png
/^ (map knot @)
/: /===/app/timer/img /_ /png/
=, format
::
|%
:: +move: output effect
::
+$ move [bone card]
:: +card: output effect payload
::
+$ poke
$% [%launch-action [@tas path @t]]
==
::
+$ card
$% [%poke wire dock poke]
[%http-response =http-event:http]
[%connect wire binding:eyre term]
[%diff %json json]
[%wait wire @da]
[%rest wire @da]
==
::
--
::
|_ [bol=bowl:gall tim=@da]
::
++ this .
::
++ bound
|= [wir=wire success=? binding=binding:eyre]
^- (quip move _this)
[~ this]
::
++ prep
|= old=(unit tim=@da)
^- (quip move _this)
=/ launcha [%launch-action [%timer /tile '/~timer/js/tile.js']]
:-
:~
[ost.bol %connect / [~ /'~timer'] %timer]
[ost.bol %poke /timer [our.bol %launch] launcha]
==
?~ old
this
%= this
tim tim.u.old
==
::
++ peer-tile
|= pax=path
^- (quip move _this)
?: =(tim *@da)
[[ost.bol %diff %json [%s '']]~ this]
[[ost.bol %diff %json [%s (scot %da tim)]]~ this]
::
++ send-tile-diff
|= jon=json
^- (list move)
%+ turn (prey:pubsub:userlib /tile bol)
|= [=bone ^]
[bone %diff %json jon]
::
++ poke-json
|= jon=json
^- (quip move _this)
?. ?=(%s -.jon)
[~ this]
=/ str/@t +.jon
?: =(str 'start')
=/ data/@da (add now.bol ~m20)
:_ this(tim data)
[[ost.bol %wait /timer data] (send-tile-diff [%s (scot %da data)])]
?: =(str 'stop')
:_ this(tim *@da)
[[ost.bol %rest /timer tim] (send-tile-diff [%s ''])]
[~ this]
::
++ poke-handle-http-request
%- (require-authorization:app ost.bol move this)
|= =inbound-request:eyre
^- (quip move _this)
=/ request-line (parse-request-line url.request.inbound-request)
=/ back-path (flop site.request-line)
=/ name=@t
=/ back-path (flop site.request-line)
?~ back-path
''
i.back-path
::
?+ site.request-line
[[ost.bol %http-response not-found:app]~ this]
::
:: tile
::
[%'~timer' %js %tile ~]
[[ost.bol %http-response (js-response:app tile-js)]~ this]
::
:: images
::
[%'~timer' %img *]
=/ img (as-octs:mimes:html (~(got by timer-png) `@ta`name))
:_ this
[ost.bol %http-response (png-response:app img)]~
==
::
++ wake
|= [wir=wire err=(unit tang)]
^- (quip move _this)
?~ err
:- (send-tile-diff [%s 'alarm'])
this(tim *@da)
~& err
[~ this]
::
--

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

View File

@ -158,12 +158,11 @@
?~ err ?~ err
=/ req/request:http (request-darksky location) =/ req/request:http (request-darksky location)
=/ out *outbound-config:iris =/ out *outbound-config:iris
=/ lismov/(list move) :_ this(timer `(add now.bol ~h3))
[ost.bol %request /[(scot %da now.bol)] req out]~ :~
?~ timer [ost.bol %request /[(scot %da now.bol)] req out]
:- [[ost.bol %wait /timer (add now.bol ~h3)] lismov] [ost.bol %wait /timer (add now.bol ~h3)]
this(timer `(add now.bol ~h3)) ==
[lismov this]
~& err ~& err
[~ this] [~ this]
:: ::

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,3 @@
:- %say
|= [* ~ ~]
[%azimuth-tracker-poke %init ~]

View File

@ -0,0 +1,14 @@
=> |%
+$ src
$% [%ship =ship ~]
[%node url=@t ~]
==
--
:- %say
|= [* [whos=(set ship) =src] ~]
=/ =source:kale
?- -.src
%ship [%& ship.src]
%node [%| ~|(%parsing-url (need (de-purl:html url.src))) *@ud *@da]
==
[%azimuth-tracker-poke %listen whos source]

View File

@ -0,0 +1,7 @@
=> |%
+$ config
[url=@ta =from=number:block:able:kale]
--
:- %say
|= [* config ~]
[%azimuth-tracker-poke %watch config]

View File

@ -0,0 +1,14 @@
:: :dns-collector: manually "complete" (fulfill) requests
::
:::: /hoon/complete/dns-collector/gen
::
/- *dns, *sole
/+ *generators
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[who=@p addr=@if =turf ~]
~
==
:- %dns-complete
^- [ship binding]
[who [%if addr] turf]

View File

@ -0,0 +1,26 @@
:: Produce a raw event to reload a vane
::
:: Try: .event/ovo +reload-event %c, then restart urbit with
:: -I pier/.urb/put/event.ovo
::
:- %say
|= $: [now=@da eny=@uvJ bek=beak]
[[tam=term ~] ~]
==
:- %ovo
=/ top `path`/(scot %p p.bek)/[q.bek]/(scot r.bek)
=/ nam
=/ van=(list [term ~])
:- zus=[%zuse ~]
~(tap by dir:.^(arch %cy (welp top /sys/vane)))
?. =(1 (met 3 tam))
tam
=+ ^- zaz=(list [p=knot ~])
(skim van |=([a=term ~] =(tam (end 3 1 a))))
?> ?=([[@ ~] ~] zaz)
`term`p.i.zaz
=/ tip (end 3 1 nam)
=/ bip ?:(=('z' tip) %$ tip)
=/ way ?:(=('z' tip) (welp top /sys/[nam]) (welp top /sys/vane/[nam]))
=/ fil .^(@ %cx (welp way /hoon))
[//arvo %veer bip way fil]

View File

@ -95,7 +95,6 @@
[%home %launch] [%home %launch]
[%home %chat] [%home %chat]
[%home %publish] [%home %publish]
[%home %timer]
[%home %clock] [%home %clock]
[%home %weather] [%home %weather]
== ==

View File

@ -251,11 +251,13 @@
:: ::
=/ old ((soft tapp-state) u.old-state) =/ old ((soft tapp-state) u.old-state)
?~ old ?~ old
~& [%tapp-reset dap.bowl] :: XX use only for development may break contracts!
:: XX may break contracts!
:: XX if active clam contracts only to abort transaction? :: XX if active clam contracts only to abort transaction?
:: ::
`this-tapp :: ~& [%tapp-reset dap.bowl]
:: `this-tapp
~| [%tapp-load-incompatible dap.bowl]
!!
:: ::
:: because the clam replaces the active continuation with :: because the clam replaces the active continuation with
:: the bunt of its mold, we must fail the transaction :: the bunt of its mold, we must fail the transaction
@ -410,6 +412,16 @@
^- (quip move _this-tapp) ^- (quip move _this-tapp)
(take-async bowl `[wire %bound success binding]) (take-async bowl `[wire %bound success binding])
:: ::
:: Receive source update from kale
::
++ source
|= [=wire whos=(set ship) =source:kale]
^- (quip move _this-tapp)
=. waiting (~(put to waiting) ost.bowl [%take %source whos source])
?^ active
`this-tapp
start-async
::
:: Continue computing async :: Continue computing async
:: ::
++ take-async ++ take-async

View File

@ -73,7 +73,10 @@
content+so:dejs content+so:dejs
== ==
:: ::
++ delete-collection (of:dejs coll+(su:dejs sym) ~) ++ delete-collection
%- ot:dejs
:~ coll+(su:dejs sym)
==
:: ::
++ delete-post ++ delete-post
%- ot:dejs %- ot:dejs
@ -92,9 +95,6 @@
%- ot:dejs %- ot:dejs
:~ name+(su:dejs sym) :~ name+(su:dejs sym)
title+so:dejs title+so:dejs
comments+comment-config
allow-edit+edit-config
perm+perm-config
== ==
:: ::
++ edit-post ++ edit-post

View File

@ -8,7 +8,7 @@
%+ sort ~(val by comments) %+ sort ~(val by comments)
|= [a=comment:publish b=comment:publish] |= [a=comment:publish b=comment:publish]
^- ? ^- ?
(lte date-created.info.a date-created.info.b) (gte date-created.info.a date-created.info.b)
:: ::
/_ /publish-comment/ /_ /publish-comment/
result result

View File

@ -25,13 +25,7 @@
[%delete-post coll=@tas post=@tas] [%delete-post coll=@tas post=@tas]
[%delete-comment coll=@tas post=@tas comment=@tas] [%delete-comment coll=@tas post=@tas comment=@tas]
:: ::
$: %edit-collection [%edit-collection name=@tas title=@t]
name=@tas
title=@t
com=comment-config
edit=edit-config
perm=perm-config
==
:: ::
$: %edit-post $: %edit-post
who=@p who=@p

View File

@ -15,6 +15,10 @@
[%connect wire binding:eyre term] [%connect wire binding:eyre term]
[%http-response =http-event:http] [%http-response =http-event:http]
[%rule wire %turf %put turf] [%rule wire %turf %put turf]
[%source wire whos=(set ship) src=source:kale]
[%sources wire ~]
[%new-event wire =ship =udiff:point:able:kale]
[%listen wire whos=(set ship) =source:kale]
== ==
:: ::
:: Possible async responses :: Possible async responses
@ -26,6 +30,7 @@
[%reap =dock =path error=(unit tang)] [%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre] [%bound success=? =binding:eyre]
[%http-response response=client-response:iris] [%http-response response=client-response:iris]
[%source whos=(set ship) =source:kale]
== ==
:: ::
:: Outstanding contracts :: Outstanding contracts

View File

@ -1,4 +1,3 @@
!:
:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::: :::::: Postface :::::: :::::: :::::: Postface ::::::
:::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::

View File

@ -1479,13 +1479,13 @@
:: ::
++ get :: grab value by key ++ get :: grab value by key
~/ %get ~/ %get
|= b/* |* b=*
^- {$@(~ {~ u/_?>(?=(^ a) q.n.a)})} => .(b `_?>(?=(^ a) p.n.a)`b)
=+ 42 |- ^- (unit _?>(?=(^ a) q.n.a))
?~ a ?~ a
~ ~
?: =(b p.n.a) ?: =(b p.n.a)
[~ u=q.n.a] (some q.n.a)
?: (gor b p.n.a) ?: (gor b p.n.a)
$(a l.a) $(a l.a)
$(a r.a) $(a r.a)
@ -10400,6 +10400,11 @@
{$tsbn *} {$tsbn *}
=+ lem=$(gen p.gen, gol %noun) =+ lem=$(gen p.gen, gol %noun)
$(gen q.gen, sut p.lem, dox q.lem) $(gen q.gen, sut p.lem, dox q.lem)
::
{$tscm *}
=/ boc (busk p.gen)
=/ nuf (busk(sut dox) p.gen)
$(gen q.gen, sut boc, dox nuf)
:: ::
{$wtcl *} {$wtcl *}
=+ nor=$(gen p.gen, gol bool) =+ nor=$(gen p.gen, gol bool)
@ -10727,11 +10732,11 @@
{$rock *} |- ^- type {$rock *} |- ^- type
?@ q.gen [%atom p.gen `q.gen] ?@ q.gen [%atom p.gen `q.gen]
[%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] [%cell $(q.gen -.q.gen) $(q.gen +.q.gen)]
{$sand *} |- ^- type {$sand *} ?@ q.gen
?@ q.gen ?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen `q.gen])
?: =(%n p.gen) ?>(=(0 q.gen) [%atom p.gen ~ q.gen]) ?: =(%f p.gen) ?>((lte q.gen 1) bool)
?:(=(%f p.gen) ?>((lte q.gen 1) bool) [%atom p.gen ~]) [%atom p.gen ~]
[%cell $(q.gen -.q.gen) $(q.gen +.q.gen)] $(-.gen %rock)
{$tune *} (face p.gen sut) {$tune *} (face p.gen sut)
{$dttr *} %noun {$dttr *} %noun
{$dtts *} bool {$dtts *} bool
@ -10746,6 +10751,7 @@
{$sgzp *} ~_(duck(sut ^$(gen p.gen)) $(gen q.gen)) {$sgzp *} ~_(duck(sut ^$(gen p.gen)) $(gen q.gen))
{$sgbn *} $(gen q.gen) {$sgbn *} $(gen q.gen)
{$tsbn *} $(gen q.gen, sut $(gen p.gen)) {$tsbn *} $(gen q.gen, sut $(gen p.gen))
{$tscm *} $(gen q.gen, sut (busk p.gen))
{$wtcl *} =+ [fex=(gain p.gen) wux=(lose p.gen)] {$wtcl *} =+ [fex=(gain p.gen) wux=(lose p.gen)]
%- fork :~ %- fork :~
?:(=(%void fex) %void $(sut fex, gen q.gen)) ?:(=(%void fex) %void $(sut fex, gen q.gen))
@ -10754,7 +10760,7 @@
{$fits *} bool {$fits *} bool
{$wthx *} bool {$wthx *} bool
{$dbug *} ~_((show %o p.gen) $(gen q.gen)) {$dbug *} ~_((show %o p.gen) $(gen q.gen))
{$zpcm *} (play p.gen) {$zpcm *} $(gen p.gen)
{$lost *} %void {$lost *} %void
{$zpmc *} (cell $(gen p.gen) $(gen q.gen)) {$zpmc *} (cell $(gen p.gen) $(gen q.gen))
{$zpts *} %noun {$zpts *} %noun

View File

@ -2271,7 +2271,7 @@
:: ::
u.existing u.existing
:: ::
=/ already-heard=? (~(has by fragments.partial-rcv-message) seq) =/ already-heard=? (~(has by fragments.partial-rcv-message) `^fragment-num``@`seq)
:: ack dupes except for the last fragment, in which case drop :: ack dupes except for the last fragment, in which case drop
:: ::
?: already-heard ?: already-heard

View File

@ -580,8 +580,8 @@
[~ ~ %wait ~] [~ ~ %wait ~]
?: ?=(%writ +<.sign) ?: ?=(%writ +<.sign)
=/ uni-rang=rang =/ uni-rang=rang
:- (~(uni by hut.ran) hut.new-rang) :- (~(uni by hut.new-rang) hut.ran)
(~(uni by lat.ran) lat.new-rang) (~(uni by lat.new-rang) lat.ran)
[~ ~ %done p.sign uni-rang] [~ ~ %done p.sign uni-rang]
~| [%expected-writ got=+<.sign] ~| [%expected-writ got=+<.sign]
!! !!
@ -1611,7 +1611,10 @@
(page-to-lobe:sutil [p q.q]:(~(got by both-patched) pax)) (page-to-lobe:sutil [p q.q]:(~(got by both-patched) pax))
[(lobe-to-mark:sutil u.-) u.-] [(lobe-to-mark:sutil u.-) u.-]
[p q.q]:cay [p q.q]:cay
[(~(put by hat) pax p.bol) (~(put by lat) p.bol bol)] :- (~(put by hat) pax p.bol)
?: (~(has by lat) p.bol)
lat
(~(put by lat) p.bol bol)
:: ~& old=(~(run by old) mug) :: ~& old=(~(run by old) mug)
:: ~& newdal=(~(run by new.dal) mug) :: ~& newdal=(~(run by new.dal) mug)
:: ~& newdob=(~(run by new.dob) mug) :: ~& newdob=(~(run by new.dob) mug)
@ -2047,14 +2050,14 @@
(turn ~(tap in lar.nako) |=(=yaki [r.yaki yaki])) (turn ~(tap in lar.nako) |=(=yaki [r.yaki yaki]))
:: hut: updated commits by hash :: hut: updated commits by hash
:: ::
=/ hut (~(gas by hut.ran) nut) =/ hut (~(uni by (malt nut)) hut.ran)
:: nat: new blob-hash/blob pairs :: nat: new blob-hash/blob pairs
:: ::
=/ nat =/ nat
(turn ~(tap in bar.nako) |=(=blob [p.blob blob])) (turn ~(tap in bar.nako) |=(=blob [p.blob blob]))
:: lat: updated blobs by hash :: lat: updated blobs by hash
:: ::
=/ lat (~(gas by lat.ran) nat) =/ lat (~(uni by (malt nat)) lat.ran)
:: traverse updated state and sanity check :: traverse updated state and sanity check
:: ::
=+ ~| :* %bad-foreign-update =+ ~| :* %bad-foreign-update
@ -2264,7 +2267,7 @@
:: These convert between aeon (version number), tako (commit hash), yaki :: These convert between aeon (version number), tako (commit hash), yaki
:: (commit data structure), lobe (content hash), and blob (content). :: (commit data structure), lobe (content hash), and blob (content).
++ aeon-to-tako ~(got by hit.dom) ++ aeon-to-tako ~(got by hit.dom)
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki) ++ aeon-to-yaki |=(=aeon (tako-to-yaki (aeon-to-tako aeon)))
++ lobe-to-blob ~(got by lat.ran) ++ lobe-to-blob ~(got by lat.ran)
++ tako-to-yaki ~(got by hut.ran) ++ tako-to-yaki ~(got by hut.ran)
++ lobe-to-mark ++ lobe-to-mark
@ -2396,15 +2399,20 @@
:: ::
:: Update the object store with new blobs. :: Update the object store with new blobs.
:: ::
:: Must uni the old-lat into the new-lat so that if we recreate
:: the same blob hash, we use the old blob not the new one. Else
:: you get mutually recurring %delta blobs.
::
++ add-blobs ++ add-blobs
|= [new-blobs=(map path blob) old-lat=(map lobe blob)] |= [new-blobs=(map path blob) old-lat=(map lobe blob)]
^- (map lobe blob) ^- (map lobe blob)
%- ~(uni by old-lat) =/ new-lat=(map lobe blob)
%- malt %- malt
%+ turn %+ turn
~(tap by new-blobs) ~(tap by new-blobs)
|= [=path =blob] |= [=path =blob]
[p.blob blob] [p.blob blob]
(~(uni by new-lat) old-lat)
:: ::
:: Apply a change list, creating the commit and applying it to :: Apply a change list, creating the commit and applying it to
:: the current state. :: the current state.
@ -3029,8 +3037,8 @@
|= [=dome =rang] |= [=dome =rang]
^+ +> ^+ +>
=: dom dome =: dom dome
hut.ran (~(uni by hut.ran) hut.rang) hut.ran (~(uni by hut.rang) hut.ran)
lat.ran (~(uni by lat.ran) lat.rang) lat.ran (~(uni by lat.rang) lat.ran)
== ==
=. +>.$ wake =. +>.$ wake
finish-write finish-write
@ -3070,8 +3078,8 @@
^+ +> ^+ +>
=. +>.$ (emit [hen %give %mere %& conflicts]) =. +>.$ (emit [hen %give %mere %& conflicts])
=: dom dome =: dom dome
hut.ran (~(uni by hut.ran) hut.rang) hut.ran (~(uni by hut.rang) hut.ran)
lat.ran (~(uni by lat.ran) lat.rang) lat.ran (~(uni by lat.rang) lat.ran)
== ==
=. +>.$ wake =. +>.$ wake
finish-write finish-write
@ -3670,8 +3678,11 @@
|% |%
:: These convert between aeon (version number), tako (commit hash), yaki :: These convert between aeon (version number), tako (commit hash), yaki
:: (commit data structure), lobe (content hash), and blob (content). :: (commit data structure), lobe (content hash), and blob (content).
::
:: XX the following are duplicated from the +state core
::
++ aeon-to-tako ~(got by hit.dom) ++ aeon-to-tako ~(got by hit.dom)
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki) ++ aeon-to-yaki |=(=aeon (tako-to-yaki (aeon-to-tako aeon)))
++ lobe-to-blob ~(got by lat.ran) ++ lobe-to-blob ~(got by lat.ran)
++ tako-to-yaki ~(got by hut.ran) ++ tako-to-yaki ~(got by hut.ran)
++ page-to-lobe page-to-lobe:util ++ page-to-lobe page-to-lobe:util
@ -4140,10 +4151,17 @@
[[[hen %slip %d %flog req] ~] ..^$] [[[hen %slip %d %flog req] ~] ..^$]
:: ::
%drop %drop
=^ mos ruf ?: =(~ act.ruf)
=/ den ((de our now ski hen ruf) our des.req) ~& %clay-idle
abet:drop-me:den [~ ..^$]
[mos ..^$] ~& :- %clay-cancelling
?> ?=(^ act.ruf)
[hen -.req -.eval-data]:u.act.ruf
=. act.ruf ~
?~ cue.ruf
[~ ..^$]
=/ =duct duct:(need ~(top to cue.ruf))
[[duct %pass /queued-request %b %wait now]~ ..^$]
:: ::
%info %info
?: =(%$ des.req) ?: =(%$ des.req)

View File

@ -424,7 +424,7 @@
;body ;body
;div#main ;div#main
;div#inner ;div#inner
;h1#topborder:"Modulo" ;h1#topborder:"Welcome"
;h1:"{(scow %p our)}" ;h1:"{(scow %p our)}"
;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded") ;form(action "/~/login", method "post", enctype "application/x-www-form-urlencoded")
;input(type "password", name "password", placeholder "passcode", autofocus "true"); ;input(type "password", name "password", placeholder "passcode", autofocus "true");
@ -1042,7 +1042,7 @@
%.n %.n
:: is this a session that we know about? :: is this a session that we know about?
:: ::
?~ session=(~(get by sessions.authentication-state.state) u.session-id) ?~ session=(~(get by sessions.authentication-state.state) `@uv`u.session-id)
%.n %.n
:: is this session still valid? :: is this session still valid?
:: ::
@ -1382,8 +1382,10 @@
=/ channel-wire=path =/ channel-wire=path
/channel/subscription/[channel-id]/(scot %ud subscription-id.i.requests) /channel/subscription/[channel-id]/(scot %ud subscription-id.i.requests)
:: ::
=/ subscriptions =/ usession (~(get by session.channel-state.state) channel-id)
subscriptions:(~(got by session.channel-state.state) channel-id) ?~ usession
$(requests t.requests)
=/ subscriptions subscriptions:u.usession
:: ::
?~ maybe-subscription=(~(get by subscriptions) channel-wire) ?~ maybe-subscription=(~(get by subscriptions) channel-wire)
:: the client sent us a weird request referring to a subscription :: the client sent us a weird request referring to a subscription
@ -1567,8 +1569,11 @@
|= channel-id=@t |= channel-id=@t
^- [(list move) server-state] ^- [(list move) server-state]
:: ::
=/ session =/ usession=(unit channel)
(~(got by session.channel-state.state) channel-id) (~(get by session.channel-state.state) channel-id)
?~ usession
[~ state]
=/ session=channel u.usession
:: ::
:_ %_ state :_ %_ state
session.channel-state session.channel-state

View File

@ -1334,14 +1334,17 @@
%keep `%f %keep `%f
%kill `%f %kill `%f
%look `%j %look `%j
%listen `%k
%merg `%c %merg `%c
%mint `%j %mint `%j
%mont `%c %mont `%c
%new-event `%k
%nuke `%a %nuke `%a
%ogre `%c %ogre `%c
%perm `%c %perm `%c
%rest `%b %rest `%b
%snap `%j %snap `%j
%sources `%k
%wait `%b %wait `%b
%want `%a %want `%a
%warp `%c %warp `%c

View File

@ -52,7 +52,7 @@
lyf=life :: version lyf=life :: version
jaw=(map life ring) :: private keys jaw=(map life ring) :: private keys
== :: == ::
$= zim :: ethereum (vent) $= zim :: public
$: yen=(jug duct ship) :: trackers $: yen=(jug duct ship) :: trackers
ney=(jug ship duct) :: reverse trackers ney=(jug ship duct) :: reverse trackers
dns=dnses :: on-chain dns state dns=dnses :: on-chain dns state
@ -69,7 +69,7 @@
+$ message :: message to her kale +$ message :: message to her kale
$% [%nuke whos=(set ship)] :: cancel trackers $% [%nuke whos=(set ship)] :: cancel trackers
[%public-keys whos=(set ship)] :: view ethereum events [%public-keys whos=(set ship)] :: view ethereum events
[%public-keys-result who=ship =vent-result] :: tmp workaround [%public-keys-result =public-keys-result] :: tmp workaround
== :: == ::
+$ card :: i/o action +$ card :: i/o action
(wind note gift) :: (wind note gift) ::
@ -83,7 +83,7 @@
$>(%want task:able:ames) :: send message $>(%want task:able:ames) :: send message
== :: == ::
$: %k :: to self $: %k :: to self
$>(%look task) :: set ethereum source $>(%listen task) :: set ethereum source
== :: == ::
$: @tas :: $: @tas ::
$% $>(%init vane-task) :: report install $% $>(%init vane-task) :: report install
@ -246,19 +246,21 @@
=. tuf.own.pki turf.tac =. tuf.own.pki turf.tac
:: our initial galaxy table as a +map from +life to +public :: our initial galaxy table as a +map from +life to +public
:: ::
=/ =udiffs:point =/ diffs=(list [=ship =diff:point])
%~ tap by %~ tap by
%- ~(run by czar.tac) %- ~(run by czar.tac)
|=([=life =pass] `udiff:point`[*[@ @] %keys life 1 pass]) |= [=a=life =a=pass]
^- diff:point
[%keys [*life 0 *pass] [a-life 1 a-pass]]
=. +>.$ =. +>.$
|- ^+ +>.^$ |- ^+ +>.^$
?~ udiffs ?~ diffs
+>.^$ +>.^$
=. +>.^$ =. +>.^$
%- curd =< abet %- curd =< abet
%- public-keys:~(feel su hen our pki etn sap) %- public-keys:~(feel su hen our pki etn sap)
[%diff ship udiff]:i.udiffs [%diff ship diff]:i.diffs
$(udiffs t.udiffs) $(diffs t.diffs)
:: ::
=. moz =. moz
%+ weld moz %+ weld moz
@ -330,9 +332,10 @@
+>.$ +>.$
:: ::
:: set ethereum source :: set ethereum source
:: [%look p=(each ship purl)] :: [%listen whos=(set ship) =source]
:: ::
%look %listen
~& [%kale-listen whos source]:tac
%- curd =< abet %- curd =< abet
(sources:~(feel su hen our pki etn sap) [whos source]:tac) (sources:~(feel su hen our pki etn sap) [whos source]:tac)
:: ::
@ -385,6 +388,7 @@
:: [%sources ~] :: [%sources ~]
:: ::
%sources %sources
~& [%kale-sources]
(curd abet:~(sources ~(feed su hen our pki etn sap) hen)) (curd abet:~(sources ~(feed su hen our pki etn sap) hen))
:: ::
:: XX should be a subscription :: XX should be a subscription
@ -400,11 +404,12 @@
+>.$(moz [[hen %give %turf tuf.own.pki] moz]) +>.$(moz [[hen %give %turf tuf.own.pki] moz])
:: ::
:: Update from app :: Update from app
:: [%vent-update =vent-result] :: [%new-event =ship =udiff:point]
:: ::
%vent-update %new-event
~& [%kale-new-event ship udiff]:tac
%- curd =< abet %- curd =< abet
(public-keys:~(feel su hen our pki etn sap) vent-result.tac) (~(new-event su hen our pki etn sap) ship.tac udiff.tac)
:: ::
:: learn of kernel upgrade :: learn of kernel upgrade
:: [%vega ~] :: [%vega ~]
@ -456,11 +461,12 @@
$(tac mes) $(tac mes)
:: ::
:: receive keys result :: receive keys result
:: [%public-keys-result =vent-result] :: [%public-keys-result =public-keys-result]
:: ::
%public-keys-result %public-keys-result
=. moz [[hen %give %mack ~] moz] =. moz [[hen %give %mack ~] moz]
$(tac [%vent-update vent-result.mes]) %- curd =< abet
(public-keys:~(feel su hen our pki etn sap) public-keys-result.mes)
== ==
:: ::
:: rewind to snapshot :: rewind to snapshot
@ -527,8 +533,8 @@
:: any subscribers. :: any subscribers.
:: ::
=| moz=(list move) =| moz=(list move)
=| $: hen/duct =| $: hen=duct
our/ship our=ship
state-pki state-pki
state-eth-node state-eth-node
state-snapshots state-snapshots
@ -556,8 +562,8 @@
?~ noy this-su ?~ noy this-su
$(noy t.noy, moz [[i.noy cad] moz]) $(noy t.noy, moz [[i.noy cad] moz])
:: ::
++ vent-give ++ public-keys-give
|= [yen=(set duct) =vent-result] |= [yen=(set duct) =public-keys-result]
=+ yez=~(tap in yen) =+ yez=~(tap in yen)
|- ^+ this-su |- ^+ this-su
?~ yez this-su ?~ yez this-su
@ -565,10 +571,10 @@
=. this-su =. this-su
?. ?=([[%a @ @ *] *] d) ?. ?=([[%a @ @ *] *] d)
%- emit %- emit
[d %give %public-keys vent-result] [d %give %public-keys public-keys-result]
=/ our (slav %p i.t.i.d) =/ our (slav %p i.t.i.d)
=/ who (slav %p i.t.t.i.d) =/ who (slav %p i.t.t.i.d)
=/ =message [%public-keys-result who vent-result] =/ =message [%public-keys-result public-keys-result]
%- emit %- emit
:^ d :^ d
%pass %pass
@ -600,7 +606,14 @@
sources-reverse.etn (~(put by sources-reverse) source top-source-id.etn) sources-reverse.etn (~(put by sources-reverse) source top-source-id.etn)
== ==
:: ::
++ extract-snap :: extract rewind point ++ new-event
|= [=a=ship =a=udiff:point]
^+ this-su
=/ a-point=point (~(gut by pos.zim.pki) a-ship *point)
=/ a-diff=diff:point (udiff-to-diff:point a-udiff a-point)
(public-keys:feel %diff a-ship a-diff)
::
++ extract-snap :: extract rewind point
^- snapshot ^- snapshot
~ ~
:: :: ++feed:su :: :: ++feed:su
@ -619,7 +632,7 @@
?~ whol ?~ whol
ney.zim ney.zim
(~(put ju $(whol t.whol)) i.whol hen) (~(put ju $(whol t.whol)) i.whol hen)
=/ =vent-result =/ =public-keys-result
:- %full :- %full
?: =(~ whos) ?: =(~ whos)
pos.zim pos.zim
@ -637,7 +650,7 @@
%+ turn ~(tap in whos) %+ turn ~(tap in whos)
|= who=ship |= who=ship
[hen who] [hen who]
=. ..feed (vent-give (sy hen ~) vent-result) =. ..feed (public-keys-give (sy hen ~) public-keys-result)
..feed ..feed
:: ::
++ private-keys :: private keys ++ private-keys :: private keys
@ -676,13 +689,7 @@
^- [who=ship =point] ^- [who=ship =point]
[who [rift=1 life=1 (my [1 1 pass] ~) `(^sein:title who)]] [who [rift=1 life=1 (my [1 1 pass] ~) `(^sein:title who)]]
=. moz [[hen %give %public-keys %full (my points)] moz] =. moz [[hen %give %public-keys %full (my points)] moz]
|- ^+ ..feel ..feel
?~ passes
..feel
=. ..feel
%- public-keys:feel
[%diff who.i.passes *[@ @] %keys 1 1 pass.i.passes]
$(passes t.passes)
-- --
-- --
:: :: ++feel:su :: :: ++feel:su
@ -690,49 +697,45 @@
|% |%
:: :: ++pubs:feel:su :: :: ++pubs:feel:su
++ public-keys ++ public-keys
|= =vent-result |= =public-keys-result
^+ ..feel ^+ ..feel
?: ?=(%full -.vent-result) ?: ?=(%full -.public-keys-result)
=. pos.zim (~(uni by pos.zim) points.vent-result) =. pos.zim (~(uni by pos.zim) points.public-keys-result)
=/ pointl=(list [who=ship =point]) =/ pointl=(list [who=ship =point])
~(tap by points.vent-result) ~(tap by points.public-keys-result)
|- ^+ ..feel |- ^+ ..feel
?~ pointl ?~ pointl
..feel ..feel
%+ vent-give %+ public-keys-give
(~(get ju ney.zim) who.i.pointl) (~(get ju ney.zim) who.i.pointl)
[%full (my i.pointl ~)] [%full (my i.pointl ~)]
=* who who.vent-result =* who who.public-keys-result
=* udiff udiff.vent-result =/ a-diff=diff:point diff.public-keys-result
=/ maybe-point (~(get by pos.zim) who) =/ maybe-point (~(get by pos.zim) who)
=/ =point (fall maybe-point *point) =/ =point (fall maybe-point *point)
:: XX don't do max etc, just do the thing
=. point =. point
?- +<.udiff ?- -.a-diff
%spon %spon
point(sponsor sponsor.udiff) point(sponsor to.a-diff)
:: ::
%rift %rift
point(rift (max rift.udiff rift.point)) point(rift to.a-diff)
:: ::
%keys %keys
%_ point %_ point
life (max life.udiff life.point) life life.to.a-diff
keys keys
%+ ~(put by keys.point) %+ ~(put by keys.point)
life.udiff life.to.a-diff
[crypto-suite pass]:udiff [crypto-suite pass]:to.a-diff
== ==
::
%disavow
~| %not-implemented !!
== ==
=. pos.zim (~(put by pos.zim) who point) =. pos.zim (~(put by pos.zim) who point)
%+ vent-give %+ public-keys-give
(~(get ju ney.zim) who) (~(get ju ney.zim) who)
?~ maybe-point ?~ maybe-point
[%full (my [who point]~)] [%full (my [who point]~)]
[%diff who udiff] [%diff who a-diff]
:: :: ++vein:feel:su :: :: ++vein:feel:su
++ private-keys :: kick private keys ++ private-keys :: kick private keys
|= [=life =ring] |= [=life =ring]

View File

@ -2327,19 +2327,22 @@
:: of (list point-diff). Composition of arrows is concatenation, :: of (list point-diff). Composition of arrows is concatenation,
:: and you can apply the diffs to a +point with +apply. :: and you can apply the diffs to a +point with +apply.
:: ::
:: It's simplest to consider +point as the product of three :: It's simplest to consider +point as the coproduct of three
:: groupoids, Rift, Keys, and Sponsor. The objects of the product :: groupoids, Rift, Keys, and Sponsor. Recall that the coproduct
:: are the product of the objects of the underlying groupoids. The :: of monoids is the free monoid (Kleene star) of the coproduct of
:: the underlying sets of the monoids. The construction for
:: groupoids is similar. Thus, the objects of the coproduct are
:: the product of the objects of the underlying groupoids. The
:: arrows are a list of a sum of the diff types of the underlying :: arrows are a list of a sum of the diff types of the underlying
:: groupoids. Given an arrow=(list diff), you can project to the :: groupoids. Given an arrow=(list diff), you can project to the
:: underlying arrows with +skim filtering on the head of each :: underlying arrows with +skim filtering on the head of each diff.
:: diff.
:: ::
:: The identity element is ~. Clearly, composing this with any +diff :: The identity element is ~. Clearly, composing this with any
:: gives the original +diff. Since this is a category, +compose must :: +diff gives the original +diff. Since this is a category,
:: be associative (true, because concatenation is associative). This :: +compose must be associative (true, because concatenation is
:: is a groupoid, so we must further have that every +point-diff has an :: associative). This is a groupoid, so we must further have that
:: inverse. These are given by the +inverse operation. :: every +point-diff has an inverse. These are given by the
:: +inverse operation.
:: ::
++ point ++ point
=< point =< point
@ -2373,6 +2376,19 @@
[%disavow ~] [%disavow ~]
== == == ==
:: ::
++ udiff-to-diff
|= [=a=udiff =a=point]
^- diff
?- +<.a-udiff
%disavow ~|(%udiff-to-diff-disavow !!)
%rift [%rift rift.a-point rift.a-udiff]
%spon [%spon sponsor.a-point sponsor.a-udiff]
%keys
:+ %keys
[life.a-point (~(gut by keys.a-point) life.a-point *[@ud pass])]
[life crypto-suite pass]:a-udiff
==
::
++ inverse ++ inverse
|= diffs=(list diff) |= diffs=(list diff)
^- (list diff) ^- (list diff)
@ -2381,44 +2397,44 @@
|= =diff |= =diff
^- ^diff ^- ^diff
?- -.diff ?- -.diff
%rift [%rift &2 |2]:diff %rift [%rift to from]:diff
%keys [%keys &2 |2]:diff %keys [%keys to from]:diff
%spon [%spon &2 |2]:diff %spon [%spon to from]:diff
== ==
:: ::
++ compose ++ compose
(bake weld ,[(list diff) (list diff)]) (bake weld ,[(list diff) (list diff)])
:: ::
++ apply ++ apply
|= [diffs=(list diff) =point] |= [diffs=(list diff) =a=point]
(roll diffs (apply-diff point)) (roll diffs (apply-diff a-point))
:: ::
++ apply-diff ++ apply-diff
|= =point |= a=point
|: [*=diff point] |: [*=diff a-point=a]
^- ^point ^- point
?- -.diff ?- -.diff
%rift %rift
?> =(rift.point from.diff) ?> =(rift.a-point from.diff)
point(rift to.diff) a-point(rift to.diff)
:: ::
%keys %keys
?> =(life.point life.from.diff) ?> =(life.a-point life.from.diff)
?> =((~(get by keys.point) life.point) `+.from.diff) ?> =((~(get by keys.a-point) life.a-point) `+.from.diff)
%_ point %_ a-point
life life.to.diff life life.to.diff
keys (~(put by keys.point) life.to.diff +.to.diff) keys (~(put by keys.a-point) life.to.diff +.to.diff)
== ==
:: ::
%spon %spon
?> =(sponsor.point from.diff) ?> =(sponsor.a-point from.diff)
point(sponsor to.diff) a-point(sponsor to.diff)
== ==
-- --
:: ::
+$ vent-result +$ public-keys-result
$% [%full points=(map ship point)] $% [%full points=(map ship point)]
[%diff who=ship =udiff:point] [%diff who=ship =diff:point]
== ==
:: :: :: ::
++ gift :: out result <-$ ++ gift :: out result <-$
@ -2428,7 +2444,7 @@
[%source whos=(set ship) src=source] :: [%source whos=(set ship) src=source] ::
[%turf turf=(list turf)] :: domains [%turf turf=(list turf)] :: domains
[%private-keys =life vein=(map life ring)] :: private keys [%private-keys =life vein=(map life ring)] :: private keys
[%public-keys p=vent-result] :: ethereum changes [%public-keys =public-keys-result] :: ethereum changes
== :: == ::
:: +seed: private boot parameters :: +seed: private boot parameters
:: ::
@ -2446,7 +2462,7 @@
snap=(unit snapshot) :: head start snap=(unit snapshot) :: head start
== :: == ::
[%fake =ship] :: fake boot [%fake =ship] :: fake boot
[%look whos=(set ship) =source] :: set ethereum source [%listen whos=(set ship) =source] :: set ethereum source
::TODO %next for generating/putting new private key ::TODO %next for generating/putting new private key
[%nuke whos=(set ship)] :: cancel tracker from [%nuke whos=(set ship)] :: cancel tracker from
[%private-keys ~] :: sub to privates [%private-keys ~] :: sub to privates
@ -2455,7 +2471,7 @@
[%meet =ship =life =pass] :: met after breach [%meet =ship =life =pass] :: met after breach
[%snap snap=snapshot kick=?] :: load snapshot [%snap snap=snapshot kick=?] :: load snapshot
[%turf ~] :: view domains [%turf ~] :: view domains
[%vent-update =vent-result] :: update from app [%new-event =ship =udiff:point] :: update from app
$>(%vega vane-task) :: report upgrade $>(%vega vane-task) :: report upgrade
$>(%wegh vane-task) :: memory usage request $>(%wegh vane-task) :: memory usage request
$>(%west vane-task) :: remote request $>(%west vane-task) :: remote request
@ -7712,6 +7728,7 @@
{$g gift:able:gall} {$g gift:able:gall}
[%i gift:able:iris] [%i gift:able:iris]
{$j gift:able:jael} {$j gift:able:jael}
{$k gift:able:kale}
== ==
:: ::
+$ unix-task :: input from unix +$ unix-task :: input from unix

View File

@ -2033,7 +2033,7 @@
%start %start
:- 200 :- 200
:~ ['content-type' 'text/html'] :~ ['content-type' 'text/html']
['content-length' '1751'] ['content-length' '1752']
== ==
[~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)] [~ (login-page:http-server-gate `'/~landscape/inner-path' ~nul)]
complete=%.y complete=%.y

View File

@ -8,5 +8,6 @@ module Arvo
import Arvo.Common import Arvo.Common
import Arvo.Effect import Arvo.Effect
import Arvo.Event import Arvo.Event
import Noun.Conversions (Lenient)
type FX = [Ef] type FX = [Lenient Ef]

View File

@ -120,11 +120,11 @@ deriveNoun ''BehnEf
%url -- TODO %url -- TODO
-} -}
data Blit data Blit
= Bel = Bel ()
| Clr | Clr ()
| Hop Word64 | Hop Word64
| Lin [Char] | Lin [Char]
| Mor | Mor ()
| Sag Path Noun | Sag Path Noun
| Sav Path Atom | Sav Path Atom
| Url Cord | Url Cord
@ -140,7 +140,7 @@ data Blit
-} -}
data TermEf data TermEf
= TermEfBbye Path () = TermEfBbye Path ()
| TermEfBlit Path [Blit] | TermEfBlit (Decimal, ()) [Blit]
| TermEfInit (Decimal, ()) () | TermEfInit (Decimal, ()) ()
| TermEfLogo Path () | TermEfLogo Path ()
| TermEfMass Path Noun -- Irrelevant | TermEfMass Path Noun -- Irrelevant

View File

@ -1,6 +1,6 @@
{-# OPTIONS_GHC -Wwarn #-} {-# OPTIONS_GHC -Wwarn #-}
module Vere.Pier (booted, resumed, runPersist, runCompute) where module Vere.Pier (booted, resumed, pier, runPersist, runCompute) where
import UrbitPrelude import UrbitPrelude
@ -108,7 +108,7 @@ resumed top flags = do
pier :: Maybe Port pier :: Maybe Port
-> (Serf, EventLog, SerfState) -> (Serf, EventLog, SerfState)
-> Acquire Int -> Acquire ()
pier mPort (serf, log, ss) = do pier mPort (serf, log, ss) = do
computeQ <- newTQueueIO :: Acquire (TQueue Ev) computeQ <- newTQueueIO :: Acquire (TQueue Ev)
persistQ <- newTQueueIO :: Acquire (TQueue (Job, FX)) persistQ <- newTQueueIO :: Acquire (TQueue (Job, FX))
@ -122,12 +122,26 @@ pier mPort (serf, log, ss) = do
liftIO $ atomically $ for_ bootEvents (writeTQueue computeQ) liftIO $ atomically $ for_ bootEvents (writeTQueue computeQ)
dExe <- startDrivers >>= router (readTQueue executeQ) tExe <- startDrivers >>= router (readTQueue executeQ)
tDisk <- runPersist log persistQ (writeTQueue executeQ) tDisk <- runPersist log persistQ (writeTQueue executeQ)
tCpu <- runCompute serf ss (readTQueue computeQ) (writeTQueue persistQ) tCpu <- runCompute serf ss (readTQueue computeQ) (writeTQueue persistQ)
undefined [dExe, tDisk, tCpu] -- Wait for something to die.
let ded = asum [ death "effect thread" tExe
, death "persist thread" tDisk
, death "compute thread" tCpu
]
atomically ded >>= \case
Left (txt, exn) -> print ("Somthing died", txt, exn)
Right tag -> print ("something simply exited", tag)
death :: Text -> Async () -> STM (Either (Text, SomeException) Text)
death tag tid = do
waitCatchSTM tid <&> \case
Left exn -> Left (tag, exn)
Right () -> Right tag
-- Start All Drivers ----------------------------------------------------------- -- Start All Drivers -----------------------------------------------------------
@ -155,11 +169,11 @@ drivers inst who mPort plan =
runDrivers = do runDrivers = do
dNewt <- runAmes dNewt <- runAmes
dBehn <- runBehn dBehn <- runBehn
dAmes <- pure undefined dAmes <- pure $ const $ pure ()
dHttpClient <- pure undefined dHttpClient <- pure $ const $ pure ()
dHttpServer <- pure undefined dHttpServer <- pure $ const $ pure ()
dSync <- pure undefined dSync <- pure $ const $ pure ()
dTerm <- pure undefined dTerm <- pure $ const $ pure ()
pure (Drivers{..}) pure (Drivers{..})
@ -170,18 +184,21 @@ router waitFx Drivers{..} = mkAcquire start cancel
where where
start = async $ forever $ do start = async $ forever $ do
fx <- atomically waitFx fx <- atomically waitFx
for_ fx $ \case for_ fx $ \ef -> do
EfVega _ _ -> error "TODO" putStrLn ("[EFFECT]\n" <> pack (ppShow ef) <> "\n\n")
EfExit _ _ -> error "TODO" case ef of
EfVane (VEAmes ef) -> dAmes ef GoodParse (EfVega _ _) -> error "TODO"
EfVane (VEBehn ef) -> dBehn ef GoodParse (EfExit _ _) -> error "TODO"
EfVane (VEBoat ef) -> dSync ef GoodParse (EfVane (VEAmes ef)) -> dAmes ef
EfVane (VEClay ef) -> dSync ef GoodParse (EfVane (VEBehn ef)) -> dBehn ef
EfVane (VEHttpClient ef) -> dHttpClient ef GoodParse (EfVane (VEBoat ef)) -> dSync ef
EfVane (VEHttpServer ef) -> dHttpServer ef GoodParse (EfVane (VEClay ef)) -> dSync ef
EfVane (VENewt ef) -> dNewt ef GoodParse (EfVane (VEHttpClient ef)) -> dHttpClient ef
EfVane (VESync ef) -> dSync ef GoodParse (EfVane (VEHttpServer ef)) -> dHttpServer ef
EfVane (VETerm ef) -> dTerm ef GoodParse (EfVane (VENewt ef)) -> dNewt ef
GoodParse (EfVane (VESync ef)) -> dSync ef
GoodParse (EfVane (VETerm ef)) -> dTerm ef
FailParse n -> pPrint n
-- Compute Thread -------------------------------------------------------------- -- Compute Thread --------------------------------------------------------------
@ -194,6 +211,7 @@ runCompute serf ss getEvent putResult =
go :: SerfState -> IO () go :: SerfState -> IO ()
go ss = do go ss = do
ev <- atomically getEvent ev <- atomically getEvent
putStrLn ("[EVENT]\n" <> pack (ppShow ev) <> "\n\n")
wen <- Time.now wen <- Time.now
eId <- pure (ssNextEv ss) eId <- pure (ssNextEv ss)
mug <- pure (ssLastMug ss) mug <- pure (ssLastMug ss)

View File

@ -61,9 +61,9 @@ compileFlags = foldl' (\acc flag -> setBit acc (fromEnum flag)) 0
data Config = Config FilePath [Flag] data Config = Config FilePath [Flag]
deriving (Show) deriving (Show)
debug msg = putStrLn ("[DEBUG]\t" <> msg) debug _msg = pure () -- putStrLn ("[DEBUG]\t" <> msg)
serf msg = putStrLn ("[SERF]\t" <> msg) serf _msg = pure () -- putStrLn ("[SERF]\t" <> msg)
-- Types ----------------------------------------------------------------------- -- Types -----------------------------------------------------------------------

View File

@ -23,9 +23,6 @@ import qualified Vere.Log as Log
import qualified Vere.Pier as Pier import qualified Vere.Pier as Pier
import qualified Vere.Serf as Serf import qualified Vere.Serf as Serf
main = putStrLn ""
{-
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
zod :: Ship zod :: Ship
@ -61,6 +58,14 @@ tryBootFromPill pillPath shipPath ship = do
shutdown serf 0 >>= print shutdown serf 0 >>= print
putStrLn "[tryBootFromPill] Booted!" putStrLn "[tryBootFromPill] Booted!"
runAcquire act = with act pure
tryPlayShip :: FilePath -> IO ()
tryPlayShip shipPath = do
runAcquire $ do
sls <- Pier.resumed shipPath serfFlags
Pier.pier Nothing sls
tryResume :: FilePath -> IO () tryResume :: FilePath -> IO ()
tryResume shipPath = do tryResume shipPath = do
with (Pier.resumed shipPath serfFlags) $ \(serf, log, ss) -> do with (Pier.resumed shipPath serfFlags) $ \(serf, log, ss) -> do
@ -151,19 +156,20 @@ collectAllFx top = do
main :: IO () main :: IO ()
main = runInBoundThread $ do main = runInBoundThread $ do
let pillPath = "/home/benjamin/r/urbit/bin/solid.pill" let pillPath = "/home/benjamin/r/urbit/bin/solid.pill"
shipPath = "/home/benjamin/r/urbit/zod/" shipPath = "/home/benjamin/r/urbit/s/zod/"
ship = zod ship = zod
-- collectAllFx "/home/benjamin/r/urbit/testnet-zod/" -- collectAllFx "/home/benjamin/r/urbit/s/testnet-zod/"
tryParseEvents "/home/benjamin/r/urbit/zod/.urb/log" 1 -- tryParseEvents "/home/benjamin/r/urbit/s/zod/.urb/log" 1
tryParseEvents "/home/benjamin/r/urbit/testnet-zod/.urb/log" 1 -- tryParseEvents "/home/benjamin/r/urbit/s/testnet-zod/.urb/log" 1
tryParseFX "/home/benjamin/zod-fx" 1 100000000 -- tryParseFX "/home/benjamin/zod-fx" 1 100000000
tryParseFX "/home/benjamin/testnet-zod-fx" 1 100000000 -- tryParseFX "/home/benjamin/testnet-zod-fx" 1 100000000
-- tryBootFromPill pillPath shipPath ship -- tryBootFromPill pillPath shipPath ship
-- tryResume shipPath -- tryResume shipPath
tryPlayShip shipPath
-- tryFullReplay shipPath -- tryFullReplay shipPath
pure () pure ()
@ -213,6 +219,8 @@ tryParseFXStream = loop 0 (mempty :: Set (Text, Noun))
-- A _ -> maybe "ERR" unCord (fromNoun n) -- A _ -> maybe "ERR" unCord (fromNoun n)
-- C h _ -> maybe "ERR" unCord (fromNoun h) -- C h _ -> maybe "ERR" unCord (fromNoun h)
{-
tryCopyLog :: IO () tryCopyLog :: IO ()
tryCopyLog = do tryCopyLog = do
let logPath = "/Users/erg/src/urbit/zod/.urb/falselog/" let logPath = "/Users/erg/src/urbit/zod/.urb/falselog/"

View File

@ -4,6 +4,7 @@
/config.mk /config.mk
include/config.h include/config.h
include/ca-bundle.h include/ca-bundle.h
include/ivory.h
# #
# Build Outputs # Build Outputs
# #

View File

@ -7,7 +7,7 @@ daemon = $(wildcard daemon/*.c)
worker = $(wildcard worker/*.c) worker = $(wildcard worker/*.c)
common = $(jets) $(noun) $(vere) common = $(jets) $(noun) $(vere)
headers = $(shell find include -type f) include/ca-bundle.h headers = $(shell find include -type f) include/ca-bundle.h include/ivory.h
common_objs = $(shell echo $(common) | sed 's/\.c/.o/g') common_objs = $(shell echo $(common) | sed 's/\.c/.o/g')
daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g') daemon_objs = $(shell echo $(daemon) | sed 's/\.c/.o/g')
@ -27,6 +27,10 @@ ifeq ($(SSL_CERT_FILE),)
$(error SSL_CERT_FILE is undefined) $(error SSL_CERT_FILE is undefined)
endif endif
ifeq ($(IVORY),)
$(error IVORY is undefined)
endif
################################################################################ ################################################################################
.PHONY: all test clean mkproper .PHONY: all test clean mkproper
@ -44,7 +48,7 @@ clean:
rm -f ./tags $(all_objs) $(all_exes) rm -f ./tags $(all_objs) $(all_exes)
mrproper: clean mrproper: clean
rm -f config.mk include/config.h include/ca-bundle.h rm -f config.mk include/config.h include/ca-bundle.h include/ivory.h
################################################################################ ################################################################################
@ -54,6 +58,12 @@ include/ca-bundle.h:
@xxd -i include/ca-bundle.crt > include/ca-bundle.h @xxd -i include/ca-bundle.crt > include/ca-bundle.h
@rm include/ca-bundle.crt @rm include/ca-bundle.crt
include/ivory.h:
@echo XXD -i $(IVORY)
@cat $(IVORY) > u3_Ivory.pill
@xxd -i u3_Ivory.pill > include/ivory.h
@rm u3_Ivory.pill
build/hashtable_tests: $(common_objs) tests/hashtable_tests.o build/hashtable_tests: $(common_objs) tests/hashtable_tests.o
@echo CC -o $@ @echo CC -o $@
@mkdir -p ./build @mkdir -p ./build

View File

@ -95,7 +95,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.kno_w = DefaultKernel; u3_Host.ops_u.kno_w = DefaultKernel;
while ( -1 != (ch_i=getopt(argc, argv, while ( -1 != (ch_i=getopt(argc, argv,
"G:J:B:K:A:H:w:u:e:E:f:F:k:m:p:LjabcCdgqstvxPDRS")) ) "G:J:B:K:A:H:I:w:u:e:E:f:F:k:m:p:LjabcCdgqstvxPDRS")) )
{ {
switch ( ch_i ) { switch ( ch_i ) {
case 'J': { case 'J': {
@ -118,6 +118,10 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.dns_c = strdup(optarg); u3_Host.ops_u.dns_c = strdup(optarg);
break; break;
} }
case 'I': {
u3_Host.ops_u.jin_c = strdup(optarg);
break;
}
case 'e': { case 'e': {
u3_Host.ops_u.eth_c = strdup(optarg); u3_Host.ops_u.eth_c = strdup(optarg);
break; break;

View File

@ -556,6 +556,7 @@
c3_c* gen_c; // -G, czar generator c3_c* gen_c; // -G, czar generator
c3_o gab; // -g, test garbage collection c3_o gab; // -g, test garbage collection
c3_c* dns_c; // -H, ames bootstrap domain c3_c* dns_c; // -H, ames bootstrap domain
c3_c* jin_c; // -I, inject raw event
c3_c* lit_c; // -J, ivory (fastboot) kernel c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_o tra; // -j, json trace c3_o tra; // -j, json trace
c3_w kno_w; // -K, kernel version c3_w kno_w; // -K, kernel version

View File

@ -8,6 +8,8 @@
#include "all.h" #include "all.h"
#include "vere/vere.h" #include "vere/vere.h"
#include "ivory.h"
// stash config flags for worker // stash config flags for worker
// //
static c3_w sag_w; static c3_w sag_w;
@ -873,10 +875,7 @@ u3_daemon_commence()
lit = u3m_file(u3_Host.ops_u.lit_c); lit = u3m_file(u3_Host.ops_u.lit_c);
} }
else { else {
extern c3_w u3_Ivory_length_w; lit = u3i_bytes(u3_Ivory_pill_len, u3_Ivory_pill);
extern c3_y u3_Ivory_pill_y[];
lit = u3i_bytes(u3_Ivory_length_w, u3_Ivory_pill_y);
} }
if ( c3n == u3v_boot_lite(lit)) { if ( c3n == u3v_boot_lite(lit)) {

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,6 @@
static void static void
_newt_consume(u3_moat* mot_u) _newt_consume(u3_moat* mot_u)
{ {
fprintf(stderr, "\n_newt_consume\n");
/* process stray bytes, trying to create a new message /* process stray bytes, trying to create a new message
** or add a block to an existing one. ** or add a block to an existing one.
*/ */
@ -191,8 +190,6 @@ _newt_consume(u3_moat* mot_u)
{ {
u3_noun mat = u3i_bytes((c3_w) len_d, buf_y); u3_noun mat = u3i_bytes((c3_w) len_d, buf_y);
fprintf(stderr, "\n_newt_consume: poking\n");
mot_u->pok_f(mot_u->vod_p, mat); mot_u->pok_f(mot_u->vod_p, mat);
} }

View File

@ -69,6 +69,7 @@ static void _pier_boot_complete(u3_pier* pir_u);
static void _pier_boot_ready(u3_pier* pir_u); static void _pier_boot_ready(u3_pier* pir_u);
static void _pier_boot_set_ship(u3_pier* pir_u, u3_noun who, u3_noun fak); static void _pier_boot_set_ship(u3_pier* pir_u, u3_noun who, u3_noun fak);
static void _pier_exit_done(u3_pier* pir_u); static void _pier_exit_done(u3_pier* pir_u);
static void _pier_inject(u3_pier* pir_u, c3_c* pax_c);
static void _pier_loop_resume(u3_pier* pir_u); static void _pier_loop_resume(u3_pier* pir_u);
/* _pier_db_bail(): bail from disk i/o. /* _pier_db_bail(): bail from disk i/o.
@ -1531,6 +1532,12 @@ _pier_boot_complete(u3_pier* pir_u)
u3_term_ef_verb(); u3_term_ef_verb();
} }
} }
{
if ( 0 != u3_Host.ops_u.jin_c ) {
_pier_inject(pir_u, u3_Host.ops_u.jin_c);
}
}
} }
/* _pier_boot_ready(): /* _pier_boot_ready():
@ -1772,6 +1779,17 @@ _pier_create(c3_w wag_w, c3_c* pax_c)
return pir_u; return pir_u;
} }
/* _pier_inject(): inject raw event at filename
*/
static void
_pier_inject(u3_pier* pir_u, c3_c* pax_c)
{
u3_noun ovo = u3ke_cue(u3m_file(pax_c));
u3m_p("injecting event", u3h(ovo));
u3_pier_work(pir_u, u3k(u3h(ovo)), u3k(u3t(ovo)));
u3z(ovo);
}
/* u3_pier_interrupt(): interrupt running process. /* u3_pier_interrupt(): interrupt running process.
*/ */
void void

View File

@ -784,11 +784,15 @@ _term_read_cb(uv_stream_t* tcp_u,
*/ */
static void static void
_term_try_write_str(u3_utty* uty_u, _term_try_write_str(u3_utty* uty_u,
const c3_c* hun_y) const c3_c* str_c)
{ {
// c3_i fid_i = uv_fileno(&uty_u->pop_u); // c3_i fid_i = uv_fileno(&uty_u->pop_u);
c3_i fid_i = uty_u->pop_u.io_watcher.fd; // XX old libuv c3_i fid_i = uty_u->pop_u.io_watcher.fd; // XX old libuv
_write(fid_i, hun_y, strlen(hun_y)); c3_w len_w = strlen(str_c);
if ( len_w != write(fid_i, str_c, len_w) ) {
// ignore, we just tryin
}
} }
/* _term_try_move_left(): move the cursor left (off-thread). /* _term_try_move_left(): move the cursor left (off-thread).

View File

@ -363,7 +363,6 @@ _worker_send_complete(u3_noun vir)
static void static void
_worker_send_stdr(c3_c* str_c) _worker_send_stdr(c3_c* str_c)
{ {
fprintf(stderr, "_worker_send_stdr: %s\n", str_c);
_worker_send(u3nt(c3__stdr, u3i_chubs(1, &u3V.sen_d), u3i_string(str_c))); _worker_send(u3nt(c3__stdr, u3i_chubs(1, &u3V.sen_d), u3i_string(str_c)));
} }
@ -682,7 +681,6 @@ _worker_poke_work(c3_d evt_d, // event number
u3m_pretty_path(wir), u3m_pretty(cad)); u3m_pretty_path(wir), u3m_pretty(cad));
u3t_event_trace(lab_c, 'B'); u3t_event_trace(lab_c, 'B');
_worker_send_stdr("WORK SO GOOD. thank for work");
_worker_work_live(evt_d, job); _worker_work_live(evt_d, job);
u3t_event_trace(lab_c, 'E'); u3t_event_trace(lab_c, 'E');
} }
@ -757,8 +755,6 @@ _worker_poke(void* vod_p, u3_noun mat)
c3_d evt_d; c3_d evt_d;
c3_l mug_l; c3_l mug_l;
_worker_send_stdr("GOT WORK\n");
if ( (c3n == u3r_trel(jar, 0, &evt, &jammed_entry)) || if ( (c3n == u3r_trel(jar, 0, &evt, &jammed_entry)) ||
(c3n == u3ud(evt)) || (c3n == u3ud(evt)) ||
(1 != u3r_met(6, evt)) ) (1 != u3r_met(6, evt)) )
@ -780,8 +776,6 @@ _worker_poke(void* vod_p, u3_noun mat)
u3z(entry); u3z(entry);
u3z(jar); u3z(jar);
_worker_send_stdr("WORK GOOD\n");
return _worker_poke_work(evt_d, mug_l, job); return _worker_poke_work(evt_d, mug_l, job);
} }

View File

@ -3,8 +3,8 @@
set -e set -e
case $# in case $# in
0) ship=zod; target=./zod;; 0) ship=zod; target=./s/zod;;
1) ship=$1; target=./$1;; 1) ship=$1; target=./s/$1;;
2) ship=$1; target=$2;; 2) ship=$1; target=$2;;
*) echo "Usage: $0 [ship] [target-dir]" >&2 *) echo "Usage: $0 [ship] [target-dir]" >&2
exit 1;; exit 1;;