2016-11-24 07:25:07 +03:00
|
|
|
:: clay (4c), revision control
|
2019-02-02 00:46:09 +03:00
|
|
|
!:
|
2016-11-24 07:25:07 +03:00
|
|
|
:: This is split in three top-level sections: structure definitions, main
|
|
|
|
:: logic, and arvo interface.
|
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
::
|
|
|
|
:: Here are the structures. `++raft` is the formal arvo state. It's also
|
|
|
|
:: worth noting that many of the clay-related structures are defined in zuse.
|
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
|= pit/vase
|
2016-12-07 06:13:33 +03:00
|
|
|
=, clay
|
2016-11-24 07:25:07 +03:00
|
|
|
=> |%
|
2018-08-16 02:48:37 +03:00
|
|
|
+$ aeon @ud :: version number
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Recursive structure of a desk's data.
|
|
|
|
::
|
|
|
|
:: We keep an ankh only for the current version of local desks. Everywhere
|
|
|
|
:: else we store it as (map path lobe).
|
|
|
|
::
|
2018-08-16 02:48:37 +03:00
|
|
|
+$ ankh :: expanded node
|
2018-02-11 08:24:22 +03:00
|
|
|
$~ [~ ~]
|
2016-11-24 07:25:07 +03:00
|
|
|
$: fil/(unit {p/lobe q/cage}) :: file
|
|
|
|
dir/(map @ta ankh) :: folders
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Part of ++mery, representing the set of changes between the mergebase and
|
|
|
|
:: one of the desks being merged.
|
|
|
|
::
|
|
|
|
:: -- `new` is the set of files in the new desk and not in the mergebase.
|
|
|
|
:: -- `cal` is the set of changes in the new desk from the mergebase except
|
|
|
|
:: for any that are also in the other new desk.
|
|
|
|
:: -- `can` is the set of changes in the new desk from the mergebase and that
|
|
|
|
:: are also in the other new desk (potential conflicts).
|
|
|
|
:: -- `old` is the set of files in the mergebase and not in the new desk.
|
|
|
|
::
|
2018-08-16 02:48:37 +03:00
|
|
|
+$ cane
|
2016-11-24 07:25:07 +03:00
|
|
|
$: new/(map path lobe)
|
|
|
|
cal/(map path lobe)
|
|
|
|
can/(map path cage)
|
2018-03-19 07:18:20 +03:00
|
|
|
old/(map path ~)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Type of request.
|
|
|
|
::
|
2018-01-24 00:52:31 +03:00
|
|
|
:: %d produces a set of desks, %p gets file permissions, %u checks for
|
2018-08-16 02:48:37 +03:00
|
|
|
:: existence, %v produces a ++dome of all desk data, %w gets @ud and @da
|
|
|
|
:: variants for the given case, %x gets file contents, %y gets a directory
|
|
|
|
:: listing, and %z gets a recursive hash of the file contents and children.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-01-24 00:52:31 +03:00
|
|
|
:: ++ care ?($d $p $u $v $w $x $y $z)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Keeps track of subscribers.
|
|
|
|
::
|
|
|
|
:: A map of requests to a set of all the subscribers who should be notified
|
|
|
|
:: when the request is filled/updated.
|
|
|
|
::
|
2018-08-16 02:48:37 +03:00
|
|
|
+$ cult (jug wove duct)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Domestic desk state.
|
|
|
|
::
|
|
|
|
:: Includes subscriber list, dome (desk content), possible commit state (for
|
2018-01-25 18:15:01 +03:00
|
|
|
:: local changes), possible merge state (for incoming merges), and permissions.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
++ dojo
|
|
|
|
$: qyx/cult :: subscribers
|
|
|
|
dom/dome :: desk state
|
2018-02-12 19:56:48 +03:00
|
|
|
per/regs :: read perms per path
|
|
|
|
pew/regs :: write perms per path
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Desk state.
|
|
|
|
::
|
|
|
|
:: Includes a checked-out ankh with current content, most recent version, map
|
|
|
|
:: of all version numbers to commit hashes (commits are in hut.rang), and map
|
|
|
|
:: of labels to version numbers.
|
|
|
|
::
|
2018-10-04 21:37:42 +03:00
|
|
|
:: `mim` is a cache of all new content that came with a mime mark. Often,
|
|
|
|
:: we need to convert to mime anyway to send to unix, so we just keep it
|
|
|
|
:: around. If you try to perform more than one commit at a time on a desk,
|
|
|
|
:: this will break, but so will lots of other things.
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
++ dome
|
|
|
|
$: ank/ankh :: state
|
|
|
|
let/aeon :: top id
|
|
|
|
hit/(map aeon tako) :: versions by id
|
|
|
|
lab/(map @tas aeon) :: labels
|
2018-10-04 21:37:42 +03:00
|
|
|
mim/(map path mime) :: mime cache
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Commit state.
|
|
|
|
::
|
|
|
|
:: -- `del` is the paths we're deleting.
|
|
|
|
:: -- `ink` is the insertions of hoon files (short-circuited for
|
|
|
|
:: bootstrapping).
|
|
|
|
:: -- `ins` is all the other insertions.
|
|
|
|
:: -- `dif` is the diffs in `dig` applied to their files.
|
|
|
|
:: -- `mut` is the diffs between `muc` and the original files.
|
|
|
|
::
|
|
|
|
++ dork :: diff work
|
|
|
|
$: del/(list path) :: deletes
|
|
|
|
ink/(list (pair path cage)) :: hoon inserts
|
2019-05-02 04:21:32 +03:00
|
|
|
ins/(list (pair path cage)) :: inserts
|
|
|
|
dif/(list (trel path lobe cage)) :: changes
|
|
|
|
mut/(list (trel path lobe cage)) :: mutations
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Hash of a blob, for lookup in the object store (lat.ran)
|
|
|
|
::
|
|
|
|
++ lobe @uvI :: blob ref
|
|
|
|
::
|
|
|
|
:: New desk data.
|
|
|
|
::
|
|
|
|
:: Sent to other ships to update them about a particular desk. Includes a map
|
|
|
|
:: of all new aeons to hashes of their commits, the most recent aeon, and sets
|
|
|
|
:: of all new commits and data.
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
++ nako :: subscription state
|
2016-11-24 07:25:07 +03:00
|
|
|
$: gar/(map aeon tako) :: new ids
|
|
|
|
let/aeon :: next id
|
|
|
|
lar/(set yaki) :: new commits
|
|
|
|
bar/(set plop) :: new content
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Formal vane state.
|
|
|
|
::
|
2018-12-13 10:42:15 +03:00
|
|
|
:: -- `rom` is our domestic state.
|
2016-11-24 07:25:07 +03:00
|
|
|
:: -- `hoy` is a collection of foreign ships where we know something about
|
|
|
|
:: their clay.
|
|
|
|
:: -- `ran` is the object store.
|
|
|
|
:: -- `mon` is a collection of mount points (mount point name to urbit
|
|
|
|
:: location).
|
|
|
|
:: -- `hez` is the unix duct that %ergo's should be sent to.
|
2018-01-24 00:52:31 +03:00
|
|
|
:: -- `cez` is a collection of named permission groups.
|
2018-09-06 02:05:23 +03:00
|
|
|
:: -- `cue` is a queue of requests to perform in later events.
|
|
|
|
:: -- `tip` is the date of the last write; if now, enqueue incoming requests.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
++ raft :: filesystem
|
2019-05-02 04:21:32 +03:00
|
|
|
$: rom=room :: domestic
|
|
|
|
hoy=(map ship rung) :: foreign
|
|
|
|
ran=rang :: hashes
|
|
|
|
mon=(map term beam) :: mount points
|
|
|
|
hez=(unit duct) :: sync duct
|
|
|
|
cez=(map @ta crew) :: permission groups
|
|
|
|
cue=(qeu [duct task:able]) :: queued requests
|
2019-05-10 04:06:18 +03:00
|
|
|
act=active-write :: active write
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
::
|
2019-05-10 04:06:18 +03:00
|
|
|
:: Currently active write
|
|
|
|
::
|
|
|
|
++ active-write
|
|
|
|
%- unit
|
|
|
|
$: hen=duct
|
|
|
|
req=task:able
|
|
|
|
mos=(list move)
|
|
|
|
$= cad
|
|
|
|
$% [%commit com=form:commit-clad]
|
|
|
|
[%merge mer=form:merge-clad]
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: The clad monad for commits.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
|
|
|
:: -- `dome` is the new dome -- each writer has a lock on the dome for
|
|
|
|
:: that desk
|
|
|
|
:: -- `rang` is a superset of the global rang, but we uni:by it into
|
|
|
|
:: the global rang because other things might add stuff to it.
|
|
|
|
:: Thus, writers do *not* have a lock on the global rang.
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ commit-clad (clad ,[dome rang])
|
|
|
|
::
|
|
|
|
:: The clad monad for merges.
|
|
|
|
::
|
|
|
|
:: Same as +commit-clad, except includes a set of paths documenting the
|
|
|
|
:: conflicts encountered in the merge.
|
|
|
|
::
|
|
|
|
++ merge-clad (clad ,[(set path) dome rang])
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: Object store.
|
|
|
|
::
|
|
|
|
:: Maps of commit hashes to commits and content hashes to content.
|
|
|
|
::
|
2016-12-16 09:34:01 +03:00
|
|
|
++ rang ::
|
2016-11-24 07:25:07 +03:00
|
|
|
$: hut/(map tako yaki) ::
|
|
|
|
lat/(map lobe blob) ::
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Unvalidated response to a request.
|
|
|
|
::
|
|
|
|
:: Like a ++rant, but with a page of data rather than a cage of it.
|
|
|
|
::
|
|
|
|
++ rand :: unvalidated rant
|
|
|
|
$: p/{p/care q/case r/@tas} :: clade release book
|
|
|
|
q/path :: spur
|
|
|
|
r/page :: data
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Generic desk state.
|
|
|
|
::
|
|
|
|
:: -- `lim` is the most recent date we're confident we have all the
|
|
|
|
:: information for. For local desks, this is always `now`. For foreign
|
|
|
|
:: desks, this is the last time we got a full update from the foreign
|
|
|
|
:: urbit.
|
|
|
|
:: -- `ref` is a possible request manager. For local desks, this is null.
|
|
|
|
:: For foreign desks, this keeps track of all pending foreign requests
|
|
|
|
:: plus a cache of the responses to previous requests.
|
|
|
|
:: -- `qyx` is the set of subscriptions, with listening ducts. These
|
|
|
|
:: subscriptions exist only until they've been filled.
|
|
|
|
:: -- `dom` is the actual state of the filetree. Since this is used almost
|
|
|
|
:: exclusively in `++ze`, we describe it there.
|
|
|
|
:: -- `dok` is a possible set of outstanding requests to ford to perform
|
|
|
|
:: various tasks on commit. This is null iff we're not in the middle of
|
|
|
|
:: a commit.
|
|
|
|
::
|
|
|
|
++ rede :: universal project
|
|
|
|
$: lim/@da :: complete to
|
|
|
|
ref/(unit rind) :: outgoing requests
|
|
|
|
qyx/cult :: subscribers
|
|
|
|
dom/dome :: revision state
|
2018-02-12 19:56:48 +03:00
|
|
|
per/regs :: read perms per path
|
|
|
|
pew/regs :: write perms per path
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Foreign request manager.
|
|
|
|
::
|
|
|
|
:: When we send a request to a foreign ship, we keep track of it in here. This
|
|
|
|
:: includes a request counter, a map of request numbers to requests, a reverse
|
|
|
|
:: map of requesters to request numbers, a simple cache of common %sing
|
|
|
|
:: requests, and a possible nako if we've received data from the other ship and
|
|
|
|
:: are in the process of validating it.
|
|
|
|
::
|
|
|
|
++ rind :: request manager
|
|
|
|
$: nix/@ud :: request index
|
|
|
|
bom/(map @ud {p/duct q/rave}) :: outstanding
|
|
|
|
fod/(map duct @ud) :: current requests
|
|
|
|
haw/(map mood (unit cage)) :: simple cache
|
|
|
|
nak/(unit nako) :: pending validation
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Domestic ship.
|
|
|
|
::
|
|
|
|
:: `hun` is the duct to dill, and `dos` is a collection of our desks.
|
|
|
|
::
|
|
|
|
++ room :: fs per ship
|
|
|
|
$: hun/duct :: terminal duct
|
|
|
|
dos/(map desk dojo) :: native desk
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Stored request.
|
|
|
|
::
|
|
|
|
:: Like a ++rave but with caches of current versions for %next and %many.
|
|
|
|
:: Generally used when we store a request in our state somewhere.
|
|
|
|
::
|
2018-01-22 18:01:00 +03:00
|
|
|
++ cach (unit (unit (each cage lobe))) :: cached result
|
2018-02-07 03:34:09 +03:00
|
|
|
++ wove {p/(unit ship) q/rove} :: stored source + req
|
2016-11-24 07:25:07 +03:00
|
|
|
++ rove :: stored request
|
|
|
|
$% {$sing p/mood} :: single request
|
2018-04-30 23:28:57 +03:00
|
|
|
{$next p/mood q/(unit aeon) r/cach} :: next version of one
|
2018-01-15 22:09:38 +03:00
|
|
|
$: $mult :: next version of any
|
2018-01-18 01:55:12 +03:00
|
|
|
p/mool :: original request
|
|
|
|
q/(unit aeon) :: checking for change
|
2018-01-23 19:35:12 +03:00
|
|
|
r/(map (pair care path) cach) :: old version
|
|
|
|
s/(map (pair care path) cach) :: new version
|
|
|
|
== ::
|
2018-01-04 03:29:59 +03:00
|
|
|
{$many p/? q/moat r/(map path lobe)} :: change range
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Foreign desk data.
|
|
|
|
::
|
2019-02-02 00:46:09 +03:00
|
|
|
++ rung
|
|
|
|
$: rit=rift :: lyfe of 1st contact
|
|
|
|
rus=(map desk rede) :: neighbor desks
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Hash of a commit, for lookup in the object store (hut.ran)
|
|
|
|
::
|
|
|
|
++ tako @ :: yaki ref
|
|
|
|
::
|
|
|
|
:: Merge state.
|
|
|
|
::
|
|
|
|
++ wait $? $null $ali $diff-ali $diff-bob :: what are we
|
|
|
|
$merge $build $checkout $ergo :: waiting for?
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Commit.
|
|
|
|
::
|
|
|
|
:: List of parents, content, hash of self, and time commited.
|
|
|
|
::
|
|
|
|
++ yaki :: snapshot
|
|
|
|
$: p/(list tako) :: parents
|
|
|
|
q/(map path lobe) :: fileset
|
2016-12-16 09:34:01 +03:00
|
|
|
r/tako ::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: :: XX s?
|
|
|
|
t/@da :: date
|
|
|
|
== ::
|
|
|
|
::
|
|
|
|
:: Unvalidated blob
|
|
|
|
::
|
|
|
|
++ plop blob :: unvalidated blob
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
|
|
|
:: The clay monad, for easier-to-follow state machines
|
|
|
|
::
|
2019-05-03 04:06:31 +03:00
|
|
|
+$ clad-input [now=@da new-rang=rang =sign]
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
|
|
|
:: notes: notes to send immediately. These will go out even if a
|
|
|
|
:: later stage of the process fails, so they shouldn't have any
|
|
|
|
:: semantic effect on the rest of the system.
|
|
|
|
:: effects: moves to send after the process ends.
|
|
|
|
:: wait: don't done
|
|
|
|
:: cont: continue process with new thunk
|
|
|
|
:: fail: abort process; don't send effects
|
|
|
|
:: done: finish process; send effects
|
|
|
|
::
|
|
|
|
++ clad-output-raw
|
|
|
|
|* a=mold
|
|
|
|
$~ [~ ~ %done *a]
|
|
|
|
$: notes=(list note)
|
|
|
|
effects=(list move)
|
|
|
|
$= next
|
|
|
|
$% [%wait ~]
|
|
|
|
[%cont self=(clad-form-raw a)]
|
2019-05-04 05:24:24 +03:00
|
|
|
[%fail err=(pair term tang)]
|
2019-05-02 04:21:32 +03:00
|
|
|
[%done value=a]
|
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ clad-form-raw
|
|
|
|
|* a=mold
|
|
|
|
$-(clad-input (clad-output-raw a))
|
|
|
|
::
|
|
|
|
++ clad-fail
|
2019-05-04 05:24:24 +03:00
|
|
|
|= err=(pair term tang)
|
2019-05-02 04:21:32 +03:00
|
|
|
|= clad-input
|
|
|
|
[~ ~ %fail err]
|
|
|
|
::
|
|
|
|
++ clad
|
|
|
|
|* a=mold
|
|
|
|
|%
|
|
|
|
++ output (clad-output-raw a)
|
|
|
|
++ form (clad-form-raw a)
|
|
|
|
++ pure
|
|
|
|
|= [arg=a]
|
|
|
|
^- form
|
|
|
|
|= clad-input
|
|
|
|
[~ ~ %done arg]
|
|
|
|
::
|
|
|
|
++ bind
|
|
|
|
|* b=mold
|
|
|
|
|= [m-b=(clad-form-raw b) fun=$-(b form)]
|
|
|
|
^- form
|
|
|
|
|= input=clad-input
|
|
|
|
=/ b-res=(clad-output-raw b)
|
|
|
|
(m-b input)
|
|
|
|
^- output
|
|
|
|
:+ notes.b-res effects.b-res
|
|
|
|
?- -.next.b-res
|
|
|
|
%wait [%wait ~]
|
|
|
|
%cont [%cont ..$(m-b self.next.b-res)]
|
2019-05-04 05:24:24 +03:00
|
|
|
%fail [%fail err.next.b-res]
|
2019-05-02 04:21:32 +03:00
|
|
|
%done [%cont (fun value.next.b-res)]
|
|
|
|
==
|
|
|
|
--
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
++ move {p/duct q/(wind note gift:able)} :: local move
|
|
|
|
++ note :: out request $->
|
|
|
|
$% $: $a :: to %ames
|
2018-12-12 23:34:18 +03:00
|
|
|
$% {$want p/ship q/path r/*} ::
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
|
|
|
$: $c :: to %clay
|
2018-12-13 10:59:53 +03:00
|
|
|
$% {$info q/@tas r/nori} :: internal edit
|
2018-12-13 18:37:01 +03:00
|
|
|
{$merg p/@tas q/@p r/@tas s/case t/germ:clay} :: merge desks
|
2018-12-13 21:23:26 +03:00
|
|
|
{$warp p/ship q/riff} ::
|
|
|
|
{$werp p/ship q/ship r/riff} ::
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
2019-04-12 08:55:40 +03:00
|
|
|
$: $d :: to %dill
|
|
|
|
$% $: $flog ::
|
|
|
|
$% {$crud p/@tas q/(list tank)} ::
|
|
|
|
{$text p/tape} ::
|
|
|
|
== == ::
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
2018-08-09 00:47:01 +03:00
|
|
|
$: $f ::
|
2018-12-13 09:34:12 +03:00
|
|
|
$% [%build live=? schematic=schematic:ford] ::
|
2019-01-31 05:48:30 +03:00
|
|
|
[%keep compiler-cache=@ud build-cache=@ud] ::
|
|
|
|
[%wipe percent-to-remove=@ud] ::
|
|
|
|
== == ::
|
2018-06-01 03:14:39 +03:00
|
|
|
$: $b ::
|
2016-11-24 07:25:07 +03:00
|
|
|
$% {$wait p/@da} ::
|
|
|
|
{$rest p/@da} ::
|
2019-05-02 04:21:32 +03:00
|
|
|
{$drip p/vase} ::
|
2016-11-24 07:25:07 +03:00
|
|
|
== == == ::
|
|
|
|
++ riot (unit rant) :: response+complete
|
|
|
|
++ sign :: in result $<-
|
2019-05-11 00:51:37 +03:00
|
|
|
$% $: %y
|
2019-05-02 04:21:32 +03:00
|
|
|
$% {$init-clad ~}
|
|
|
|
== ==
|
|
|
|
$: $a :: by %ames
|
2016-11-24 07:25:07 +03:00
|
|
|
$% {$woot p/ship q/coop} ::
|
2017-06-13 04:04:38 +03:00
|
|
|
{$send p/lane:ames q/@} :: transmit packet
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
2019-05-02 04:21:32 +03:00
|
|
|
$: %b
|
|
|
|
$% {$writ p/riot} ::
|
|
|
|
== ==
|
2016-11-24 07:25:07 +03:00
|
|
|
$: $c :: by %clay
|
|
|
|
$% {$note p/@tD q/tank} ::
|
|
|
|
{$mere p/(each (set path) (pair term tang))}
|
|
|
|
{$writ p/riot} ::
|
|
|
|
== == ::
|
2018-08-09 00:47:01 +03:00
|
|
|
$: $f ::
|
|
|
|
$% [%made date=@da result=made-result:ford] ::
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
2018-06-01 03:14:39 +03:00
|
|
|
$: $b ::
|
2019-04-10 06:15:37 +03:00
|
|
|
$% {$wake error=(unit tang)} :: timer activate
|
2016-11-24 07:25:07 +03:00
|
|
|
== == ::
|
|
|
|
$: @tas :: by any
|
|
|
|
$% {$crud p/@tas q/(list tank)} ::
|
|
|
|
== == == ::
|
2019-02-02 00:46:09 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
:: Old state types for ++load
|
|
|
|
::
|
|
|
|
=> |%
|
2019-05-11 00:51:37 +03:00
|
|
|
+$ raft-1 raft
|
2016-11-24 07:25:07 +03:00
|
|
|
-- =>
|
2018-10-04 21:37:42 +03:00
|
|
|
:: %utilities
|
|
|
|
::
|
|
|
|
|%
|
|
|
|
:: +sort-by-head: sorts alphabetically using the head of each element
|
|
|
|
::
|
|
|
|
++ sort-by-head
|
|
|
|
|=([a=(pair path *) b=(pair path *)] (aor p.a p.b))
|
|
|
|
::
|
2019-05-02 04:21:32 +03:00
|
|
|
:: Just send a note.
|
|
|
|
::
|
|
|
|
++ just-do
|
|
|
|
|= note=note
|
|
|
|
=/ m (clad ,~)
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
[[note]~ ~ %done ~]
|
|
|
|
::
|
|
|
|
:: Wait for ford to respond
|
|
|
|
::
|
|
|
|
++ expect-ford
|
|
|
|
=/ m (clad ,made-result:ford)
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
?: ?=(%init-clad +<.sign)
|
|
|
|
[~ ~ %wait ~]
|
|
|
|
?: ?=(%made +<.sign)
|
|
|
|
[~ ~ %done result.sign]
|
|
|
|
~| [%expected-made got=+<.sign]
|
|
|
|
!!
|
2019-05-03 04:06:31 +03:00
|
|
|
::
|
|
|
|
:: Wait for clay to respond
|
|
|
|
::
|
|
|
|
:: This setup where we take in a new-rang in +clad-input but only
|
|
|
|
:: apply it when calling +expect-clay is suspicious. I'm not sure
|
|
|
|
:: what's the best approach to reading in potentially new state that
|
|
|
|
:: we also may have changed but haven't committed.
|
|
|
|
::
|
|
|
|
++ expect-clay
|
|
|
|
|= ran=rang
|
|
|
|
=/ m (clad ,[riot rang])
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
?: ?=(%init-clad +<.sign)
|
|
|
|
[~ ~ %wait ~]
|
|
|
|
?: ?=(%writ +<.sign)
|
|
|
|
=/ uni-rang=rang
|
|
|
|
:- (~(uni by hut.ran) hut.new-rang)
|
|
|
|
(~(uni by lat.ran) lat.new-rang)
|
|
|
|
[~ ~ %done p.sign uni-rang]
|
|
|
|
~| [%expected-writ got=+<.sign]
|
|
|
|
!!
|
2018-10-04 21:37:42 +03:00
|
|
|
-- =>
|
2019-05-03 04:50:20 +03:00
|
|
|
|%
|
|
|
|
::
|
|
|
|
:: This is the entry point to the commit flow. It deserves some
|
|
|
|
:: explaining, since it's rather long and convoluted.
|
|
|
|
::
|
|
|
|
:: In short, ++edit takes a ++nori and turns it into a ++nuri, which is the
|
|
|
|
:: same thing except that every change is a misu instead of a miso. Thus,
|
|
|
|
:: insertions are converted to the correct mark, diffs are applied, and
|
|
|
|
:: mutations (change content by replacement) are diffed. It also fills out
|
|
|
|
:: the other fields in `++dork`. We run `++apply-edit` to create the final
|
|
|
|
:: nuri and execute the changes.
|
|
|
|
::
|
|
|
|
:: We take a `++nori`, which is either a label-add request or a `++soba`,
|
|
|
|
:: which is a list of changes. If it's a label, it's easy and we just pass
|
|
|
|
:: it to `++execute-changes:ze`.
|
|
|
|
::
|
|
|
|
:: If the given `++nori` is a list of file changes, then we our goal is to
|
|
|
|
:: convert the list of `++miso` changes to `++misu` changes. In other
|
|
|
|
:: words, turn the `++nori` into a `++nuri`. Then, we pass it to
|
|
|
|
:: `++execute-changes:ze`, which applies the changes to our state, and then
|
|
|
|
:: we check out the new revision. XX reword
|
|
|
|
::
|
|
|
|
:: Anyhow, enough of high-level talk. It's time to get down to the
|
|
|
|
:: nitty-gritty.
|
|
|
|
::
|
|
|
|
:: When we get a list of `++miso` changes, we split them into four types:
|
|
|
|
:: deletions, insertions, diffs (i.e. change from diff), and mutations
|
|
|
|
:: (i.e. change from new data). We do four different things with them.
|
|
|
|
::
|
|
|
|
:: For deletions, we just fill in `del` in `++dork` with a list of the
|
|
|
|
:: deleted files.
|
|
|
|
::
|
|
|
|
:: For insertions, we distinguish bewtween `%hoon` files and all other
|
|
|
|
:: files. For `%hoon` files, we just store them to `ink` in `++dork` so
|
|
|
|
:: that we add diff them directly. `%hoon` files have to be treated
|
|
|
|
:: specially to make the bootstrapping sequence work, since the mark
|
|
|
|
:: definitions are themselves `%hoon` files.
|
|
|
|
::
|
|
|
|
:: For the other files, we make a `%tabl` compound ford request to convert
|
|
|
|
:: the data for the new file to the the mark indicated by the last knot in
|
|
|
|
:: the path.
|
|
|
|
::
|
|
|
|
:: For diffs, we make a `%tabl` compound ford request to apply the diff to
|
|
|
|
:: the existing content. We also store the diffs in `dig` in `++dork`.
|
|
|
|
::
|
|
|
|
:: For mutations, we make a `%tabl` compound ford request to convert the
|
|
|
|
:: given new data to the mark of the already-existing file. Later on in
|
|
|
|
:: `++take-castify` we'll create the ford request to actually perform the
|
|
|
|
:: diff. We also store the mutations in `muc` in `++dork`. I'm pretty
|
|
|
|
:: sure that's useless because who cares about the original data.
|
|
|
|
:: XX delete `muc`.
|
|
|
|
::
|
|
|
|
:: Finally, for performance reasons we cache any of the data that came in
|
|
|
|
:: as a `%mime` cage. We do this because many commits come from unix,
|
|
|
|
:: where they're passed in as `%mime` and need to be turned back into it
|
|
|
|
:: for the ergo. We cache both `%hoon` and non-`%hoon` inserts and
|
|
|
|
:: mutations.
|
|
|
|
::
|
|
|
|
:: At this point, the flow of control goes through the three ford requests
|
|
|
|
:: back to `++take-inserting`, `++take-diffing`, and `++take-castifying`,
|
|
|
|
:: which itself leads to `++take-mutating`. Once each of those has
|
|
|
|
:: completed, we end up at `++apply-edit`, where our unified story picks up
|
|
|
|
:: again.
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
++ commit
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Global constants. These do not change during an edit.
|
|
|
|
::
|
|
|
|
|= $: our=ship
|
|
|
|
syd=desk
|
|
|
|
wen=@da
|
|
|
|
mon=(map term beam)
|
|
|
|
hez=(unit duct)
|
2019-05-10 04:06:18 +03:00
|
|
|
hun=duct
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
|^
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Initial arguments
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [lem=nori original-dome=dome ran=rang]
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ m commit-clad
|
2019-05-03 04:50:20 +03:00
|
|
|
^- form:m
|
|
|
|
?: ?=(%| -.lem)
|
2019-05-11 00:51:37 +03:00
|
|
|
=. original-dome
|
|
|
|
(execute-label:(state:util original-dome original-dome ran) p.lem)
|
|
|
|
=/ e (cor original-dome ran)
|
2019-05-04 05:24:24 +03:00
|
|
|
;< ~ bind:m (print-changes:e %| p.lem)
|
2019-05-10 04:06:18 +03:00
|
|
|
(pure:m dom:e ran:e)
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ e (cor original-dome ran)
|
|
|
|
;< [=dork e=_*cor] bind:m (fill-dork:e wen p.lem)
|
|
|
|
;< [=suba e=_*cor] bind:m (apply-dork:e wen dork)
|
|
|
|
;< e=_*cor bind:m checkout-new-state:e
|
|
|
|
;< ~ bind:m (ergo-changes:e suba)
|
|
|
|
;< ~ bind:m (print-changes:e %& suba)
|
2019-05-10 04:06:18 +03:00
|
|
|
(pure:m dom:e ran:e)
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: A stateful core, where the global state is a dome and a rang.
|
|
|
|
::
|
|
|
|
:: These are the global state variables that an edit may change.
|
|
|
|
::
|
|
|
|
++ cor
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [dom=dome ran=rang]
|
|
|
|
=/ original-dome dom
|
|
|
|
|%
|
2019-05-04 05:24:24 +03:00
|
|
|
++ this-cor .
|
2019-05-11 00:51:37 +03:00
|
|
|
++ sutil (state:util original-dome dom ran)
|
2019-05-04 05:24:24 +03:00
|
|
|
++ fill-dork
|
|
|
|
|= [wen=@da =soba]
|
|
|
|
=/ m (clad ,[dork _this-cor])
|
|
|
|
^- form:m
|
|
|
|
=| $= nuz
|
|
|
|
$: del=(list (pair path miso))
|
|
|
|
ins=(list (pair path miso))
|
|
|
|
dif=(list (pair path miso))
|
|
|
|
mut=(list (pair path miso))
|
|
|
|
ink=(list (pair path miso))
|
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
=. nuz
|
|
|
|
|- ^+ nuz
|
|
|
|
?~ soba nuz
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
?- -.q.i.soba
|
|
|
|
%del $(soba t.soba, del.nuz [i.soba del.nuz])
|
|
|
|
%dif $(soba t.soba, dif.nuz [i.soba dif.nuz])
|
|
|
|
%ins
|
|
|
|
=/ pax=path p.i.soba
|
|
|
|
=/ mar=mark p.p.q.i.soba
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?& ?=([%hoon *] (flop pax))
|
|
|
|
?=(%mime mar)
|
|
|
|
==
|
|
|
|
$(soba t.soba, ink.nuz [i.soba ink.nuz])
|
|
|
|
$(soba t.soba, ins.nuz [i.soba ins.nuz])
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
%mut
|
|
|
|
=/ pax=path p.i.soba
|
|
|
|
=/ mis=miso q.i.soba
|
|
|
|
?> ?=(%mut -.mis)
|
|
|
|
=/ cag=cage p.mis
|
|
|
|
:: if :mis has the %mime mark and it's the same as cached, no-op
|
|
|
|
::
|
|
|
|
?: ?. =(%mime p.cag)
|
|
|
|
%.n
|
|
|
|
?~ cached=(~(get by mim.dom) pax)
|
|
|
|
%.n
|
|
|
|
=(((hard mime) q.q.cag) u.cached)
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
$(soba t.soba)
|
|
|
|
:: if the :mis mark is the target mark and the value is the same, no-op
|
|
|
|
::
|
|
|
|
?: =/ target-mark=mark =+(spur=(flop pax) ?~(spur !! i.spur))
|
|
|
|
?. =(target-mark p.cag)
|
|
|
|
%.n
|
|
|
|
::
|
|
|
|
=/ stored (need (need (read-x:sutil & let.dom pax)))
|
|
|
|
=/ stored-cage=cage ?>(?=(%& -.stored) p.stored)
|
|
|
|
::
|
|
|
|
=(q.q.stored-cage q.q.cag)
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
$(soba t.soba)
|
|
|
|
:: the value differs from what's stored, so register mutation
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
$(soba t.soba, mut.nuz [i.soba mut.nuz])
|
|
|
|
==
|
|
|
|
:: sort each section alphabetically for determinism
|
|
|
|
::
|
|
|
|
=. nuz :*
|
|
|
|
(sort del.nuz sort-by-head)
|
|
|
|
(sort ins.nuz sort-by-head)
|
|
|
|
(sort dif.nuz sort-by-head)
|
|
|
|
(sort mut.nuz sort-by-head)
|
|
|
|
(sort ink.nuz sort-by-head)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ ink
|
|
|
|
%+ turn ink.nuz
|
|
|
|
|= {pax/path mis/miso}
|
|
|
|
^- (pair path cage)
|
|
|
|
?> ?=($ins -.mis)
|
|
|
|
=+ =>((flop pax) ?~(. %$ i))
|
|
|
|
[pax - [%atom %t ~] ((hard @t) +>.q.q.p.mis)]
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
|
|
|
=. mim.dom
|
2019-05-04 05:24:24 +03:00
|
|
|
:: remove all deleted files from the new mime cache
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
=. mim.dom
|
|
|
|
|- ^+ mim.dom
|
|
|
|
?~ del.nuz mim.dom
|
|
|
|
::
|
|
|
|
=. mim.dom (~(del by mim.dom) `path`p.i.del.nuz)
|
|
|
|
::
|
|
|
|
$(del.nuz t.del.nuz)
|
|
|
|
:: add or overwrite the new files to the new mime cache
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
%- ~(gas by mim.dom)
|
2019-05-03 04:50:20 +03:00
|
|
|
^- (list (pair path mime))
|
2019-05-04 05:24:24 +03:00
|
|
|
;: weld
|
|
|
|
^- (list (pair path mime))
|
|
|
|
%+ murn ins.nuz
|
2019-05-03 04:50:20 +03:00
|
|
|
|= {pax/path mis/miso}
|
2019-05-04 05:24:24 +03:00
|
|
|
^- (unit (pair path mime))
|
2019-05-03 04:50:20 +03:00
|
|
|
?> ?=($ins -.mis)
|
2019-05-04 05:24:24 +03:00
|
|
|
?. ?=($mime p.p.mis)
|
|
|
|
~
|
|
|
|
`[pax ((hard mime) q.q.p.mis)]
|
|
|
|
::
|
|
|
|
^- (list (pair path mime))
|
|
|
|
%+ murn ink.nuz
|
2019-05-03 04:50:20 +03:00
|
|
|
|= {pax/path mis/miso}
|
2019-05-04 05:24:24 +03:00
|
|
|
^- (unit (pair path mime))
|
|
|
|
?> ?=($ins -.mis)
|
|
|
|
?> ?=($mime p.p.mis)
|
|
|
|
`[pax ((hard mime) q.q.p.mis)]
|
|
|
|
::
|
|
|
|
^- (list (pair path mime))
|
|
|
|
%+ murn mut.nuz
|
2019-05-03 04:50:20 +03:00
|
|
|
|= {pax/path mis/miso}
|
2019-05-04 05:24:24 +03:00
|
|
|
^- (unit (pair path mime))
|
2019-05-03 04:50:20 +03:00
|
|
|
?> ?=($mut -.mis)
|
2019-05-04 05:24:24 +03:00
|
|
|
?. ?=($mime p.p.mis)
|
|
|
|
~
|
|
|
|
`[pax ((hard mime) q.q.p.mis)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
;< ins=(list (pair path cage)) bind:m (send-inserting wen ins.nuz)
|
|
|
|
;< dif=(list (trel path lobe cage)) bind:m (send-diffing wen dif.nuz)
|
|
|
|
;< mut=(list (trel path lobe cage)) bind:m (send-mutating wen mut.nuz)
|
|
|
|
%+ pure:m
|
|
|
|
^- dork
|
|
|
|
[del=(turn del.nuz head) ink ins dif mut]
|
|
|
|
this-cor
|
|
|
|
::
|
|
|
|
++ send-inserting
|
|
|
|
|= [wen=@da ins=(list (pair path miso))]
|
|
|
|
=/ m (clad (list (pair path cage)))
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %pin wen %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn ins
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [pax=path mis=miso]
|
2019-05-04 05:24:24 +03:00
|
|
|
?> ?=($ins -.mis)
|
|
|
|
:- [%$ %path -:!>(*path) pax]
|
|
|
|
=+ =>((flop pax) ?~(. %$ i))
|
2019-05-11 00:51:37 +03:00
|
|
|
[%cast [our syd] - [%$ p.mis]]
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
^- form:m
|
2019-05-03 04:50:20 +03:00
|
|
|
|= clad-input
|
2019-05-04 05:24:24 +03:00
|
|
|
:^ ~ ~ %done
|
|
|
|
^- (list (pair path cage))
|
|
|
|
%+ turn (made-result-to-success-cages:util res)
|
|
|
|
|= {pax/cage cay/cage}
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%clay-take-inserting-strange-path-mark !!)
|
|
|
|
[((hard path) q.q.pax) cay]
|
|
|
|
::
|
|
|
|
++ send-diffing
|
|
|
|
|= [wen=@da dif=(list (pair path miso))]
|
|
|
|
=/ m (clad (list (trel path lobe cage)))
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %pin wen %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn dif
|
|
|
|
|= {pax/path mis/miso}
|
|
|
|
?> ?=($dif -.mis)
|
|
|
|
=+ (need (need (read-x:sutil & let.dom pax)))
|
|
|
|
?> ?=(%& -<)
|
|
|
|
:- [%$ %path -:!>(*path) pax]
|
2019-05-11 00:51:37 +03:00
|
|
|
[%pact [our syd] [%$ p.-] [%$ p.mis]]
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
:^ ~ ~ %done
|
|
|
|
^- (list (trel path lobe cage))
|
|
|
|
=/ dig=(map path cage)
|
|
|
|
%- malt
|
|
|
|
(turn dif |=({pax/path mis/miso} ?>(?=($dif -.mis) [pax p.mis])))
|
|
|
|
%+ turn (made-result-to-cages:util res)
|
|
|
|
|= {pax/cage cay/cage}
|
|
|
|
^- (pair path (pair lobe cage))
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%clay-take-diffing-strange-path-mark !!)
|
|
|
|
=+ paf=((hard path) q.q.pax)
|
|
|
|
[paf (page-to-lobe:sutil [p q.q]:cay) (~(got by dig) paf)]
|
|
|
|
::
|
|
|
|
++ send-mutating
|
|
|
|
|= [wen=@da mut=(list (pair path miso))]
|
|
|
|
=/ m (clad (list (trel path lobe cage)))
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %pin wen %list
|
|
|
|
::~ [her syd %da wen] %tabl
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn mut
|
|
|
|
|= {pax/path mis/miso}
|
|
|
|
?> ?=($mut -.mis)
|
|
|
|
:- [%$ %path -:!>(*path) pax]
|
|
|
|
=/ mar
|
|
|
|
%- lobe-to-mark:sutil
|
|
|
|
(~(got by q:(aeon-to-yaki:sutil let.dom)) pax)
|
2019-05-11 00:51:37 +03:00
|
|
|
[%cast [our syd] mar [%$ p.mis]]
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
;< hashes=(map path lobe) bind:m
|
|
|
|
|= clad-input
|
|
|
|
=+ ^- cat/(list (pair path cage))
|
|
|
|
%+ turn (made-result-to-cages:util res)
|
|
|
|
|= {pax/cage cay/cage}
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%castify-bad-path-mark !!)
|
|
|
|
[((hard path) q.q.pax) cay]
|
|
|
|
:_ :+ ~ %done
|
|
|
|
^- (map path lobe)
|
|
|
|
%- malt
|
|
|
|
%+ turn cat
|
|
|
|
|= {pax/path cay/cage}
|
|
|
|
[pax (page-to-lobe:sutil [p q.q]:cay)]
|
|
|
|
^- (list note)
|
|
|
|
:_ ~
|
|
|
|
:* %f %build live=%.n %pin wen %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn cat
|
|
|
|
|= {pax/path cay/cage}
|
|
|
|
:- [%$ %path -:!>(*path) pax]
|
|
|
|
=/ scheme
|
2019-05-11 00:51:37 +03:00
|
|
|
%^ lobe-to-schematic:sutil [our syd] pax
|
2019-05-04 05:24:24 +03:00
|
|
|
(~(got by q:(aeon-to-yaki:sutil let.dom)) pax)
|
2019-05-11 00:51:37 +03:00
|
|
|
[%diff [our syd] scheme [%$ cay]]
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
%- pure:m
|
|
|
|
^- (list (trel path lobe cage))
|
|
|
|
%+ murn (made-result-to-cages:util res)
|
|
|
|
|= {pax/cage cay/cage}
|
|
|
|
^- (unit (pair path (pair lobe cage)))
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%clay-take-mutating-strange-path-mark !!)
|
|
|
|
?: ?=($null p.cay)
|
|
|
|
~
|
|
|
|
=+ paf=((hard path) q.q.pax)
|
|
|
|
`[paf (~(got by hashes) paf) cay]
|
|
|
|
::
|
|
|
|
:: Handle result of insertion.
|
|
|
|
::
|
|
|
|
:: For commit flow overview, see ++edit.
|
|
|
|
::
|
|
|
|
:: Insertions are cast to the correct mark, and here we put the result in
|
|
|
|
:: ins.dok. If dif and mut are full in dok (i.e. we've already processed
|
|
|
|
:: diffs and mutations), then we go ahead and run ++apply-edit.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
|
|
|
:: Handle result of diffing.
|
|
|
|
::
|
|
|
|
:: For commit flow overview, see ++edit.
|
|
|
|
::
|
|
|
|
:: Diffs are applied to the original data, and here we put the result in
|
|
|
|
:: dif.dok. If ins and mut are full in dok (i.e. we've already processed
|
|
|
|
:: insertions and mutations), then we go ahead and run ++apply-edit.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
|
|
|
:: Handle result of casting mutations.
|
|
|
|
::
|
|
|
|
:: For commit flow overview, see ++edit.
|
|
|
|
::
|
|
|
|
:: The new content from a mutation is first casted to the correct mark, and
|
|
|
|
:: here we hash the correctly-marked content and put the result in muh.dok.
|
|
|
|
:: Then we diff the new content against the original content. The result of
|
|
|
|
:: this is handled in ++take-mutating.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
|
|
|
:: Handle result of diffing mutations.
|
|
|
|
::
|
|
|
|
:: For commit flow overview, see ++edit.
|
|
|
|
::
|
|
|
|
:: We put the calculated diffs of the new content vs the old content (from
|
|
|
|
:: ++take-castify) in mut.dok. If ins and mut are full in dok (i.e. we've
|
|
|
|
:: already processed insertions and diffs), then we go ahead and run
|
|
|
|
:: ++apply-edit.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
|
|
|
:: Now that dok is completely filled, we can apply the changes in the commit.
|
|
|
|
::
|
|
|
|
:: We collect the relevant data from dok and run ++execute-changes to apply
|
|
|
|
:: them to our state. Then we run ++checkout-ankh to update our ankh (cache
|
|
|
|
:: of the content at the current aeon).
|
|
|
|
::
|
|
|
|
++ apply-dork
|
|
|
|
|= [wen=@da =dork]
|
|
|
|
=/ m (clad ,[=suba _this-cor])
|
|
|
|
^- form:m
|
|
|
|
=+ ^- sim=(list (pair path misu))
|
|
|
|
;: weld
|
|
|
|
^- (list (pair path misu))
|
|
|
|
(turn del.dork |=(pax/path [pax %del ~]))
|
|
|
|
::
|
|
|
|
^- (list (pair path misu))
|
|
|
|
(turn ink.dork |=({pax/path cay/cage} [pax %ins cay]))
|
|
|
|
::
|
|
|
|
^- (list (pair path misu))
|
|
|
|
(turn ins.dork |=({pax/path cay/cage} [pax %ins cay]))
|
|
|
|
::
|
|
|
|
^- (list (pair path misu))
|
|
|
|
(turn dif.dork |=({pax/path cal/{lobe cage}} [pax %dif cal]))
|
|
|
|
::
|
|
|
|
^- (list (pair path misu))
|
|
|
|
(turn mut.dork |=({pax/path cal/{lobe cage}} [pax %dif cal]))
|
|
|
|
==
|
|
|
|
=/ res=(unit [=dome =rang])
|
|
|
|
(execute-changes:sutil wen sim)
|
|
|
|
?~ res
|
|
|
|
(clad-fail %dork-fail ~)
|
|
|
|
=: dom dome.u.res
|
|
|
|
ran rang.u.res
|
|
|
|
==
|
|
|
|
(pure:m sim this-cor)
|
|
|
|
::
|
|
|
|
:: Takes a map of paths to lobes and tells ford to convert to an ankh.
|
|
|
|
::
|
|
|
|
:: Specifically, we tell ford to convert each lobe into a blob, then we call
|
|
|
|
:: ++take-patch to apply the result to our current ankh and update unix.
|
|
|
|
::
|
|
|
|
++ checkout-new-state
|
|
|
|
=/ m (clad ,_this-cor)
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
=/ new-yaki (aeon-to-yaki:sutil let.dom)
|
|
|
|
:* %f %build live=%.n %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn (sort ~(tap by q.new-yaki) sort-by-head)
|
|
|
|
|= {a/path b/lobe}
|
|
|
|
^- schematic:ford
|
|
|
|
:- [%$ %path-hash !>([a b])]
|
2019-05-11 00:51:37 +03:00
|
|
|
(lobe-to-schematic:sutil [our syd] a b)
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
?. ?=([%complete %success *] res)
|
|
|
|
=/ message (made-result-as-error:ford res)
|
|
|
|
(clad-fail %checkout-fail leaf+"clay patch failed" message)
|
|
|
|
::
|
|
|
|
=+ ^- cat/(list (trel path lobe cage))
|
|
|
|
%+ turn (made-result-to-cages:util res)
|
2019-05-03 04:50:20 +03:00
|
|
|
|= {pax/cage cay/cage}
|
2019-05-04 05:24:24 +03:00
|
|
|
?. ?=($path-hash p.pax)
|
|
|
|
~|(%patch-bad-path-mark !!)
|
|
|
|
[-< -> +]:[((hard {path lobe}) q.q.pax) cay]
|
|
|
|
=. ank.dom (map-to-ankh:sutil (malt cat))
|
|
|
|
(pure:m this-cor)
|
|
|
|
::
|
|
|
|
:: XX doc
|
|
|
|
::
|
|
|
|
++ ergo-changes
|
|
|
|
|= =suba
|
|
|
|
=/ m (clad ,~)
|
|
|
|
^- form:m
|
|
|
|
?~ hez (pure:m ~)
|
|
|
|
=+ must=(must-ergo:util our syd mon (turn suba head))
|
|
|
|
?: =(~ must)
|
|
|
|
(pure:m ~)
|
|
|
|
=+ ^- all-paths/(set path)
|
|
|
|
%+ roll
|
|
|
|
(turn ~(tap by must) (corl tail tail))
|
|
|
|
|= {pak/(set path) acc/(set path)}
|
|
|
|
(~(uni in acc) pak)
|
|
|
|
=+ changes=(malt suba)
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn ~(tap in all-paths)
|
|
|
|
|= a/path
|
|
|
|
^- schematic:ford
|
|
|
|
:- [%$ %path !>(a)]
|
|
|
|
=+ b=(~(got by changes) a)
|
|
|
|
?: ?=($del -.b)
|
|
|
|
[%$ %null !>(~)]
|
|
|
|
=+ (~(get by mim.dom) a)
|
|
|
|
?^ - [%$ %mime !>(u.-)]
|
2019-05-11 00:51:37 +03:00
|
|
|
:^ %cast [our syd] %mime
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ x (need (need (read-x:sutil & let.dom a)))
|
|
|
|
?: ?=(%& -<)
|
|
|
|
[%$ p.x]
|
2019-05-11 00:51:37 +03:00
|
|
|
(lobe-to-schematic:sutil [our syd] a p.x)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
?: ?=([%incomplete *] res)
|
|
|
|
(clad-fail %ergo-fail-incomplete leaf+"clay ergo incomplete" tang.res)
|
|
|
|
?. ?=([%complete %success *] res)
|
|
|
|
(clad-fail %ergo-fail leaf+"clay ergo failed" message.build-result.res)
|
|
|
|
=+ ^- changes=(map path (unit mime))
|
|
|
|
%- malt ^- mode
|
|
|
|
%+ turn (made-result-to-cages:util res)
|
|
|
|
|= [pax=cage mim=cage]
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%ergo-bad-path-mark !!)
|
|
|
|
:- ((hard path) q.q.pax)
|
|
|
|
?. ?=($mime p.mim)
|
|
|
|
~
|
|
|
|
`((hard mime) q.q.mim)
|
|
|
|
=+ must=(must-ergo:util our syd mon (turn ~(tap by changes) head))
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
:- ~ :_ [%done ~]
|
|
|
|
%+ turn ~(tap by must)
|
|
|
|
|= {pot/term len/@ud pak/(set path)}
|
|
|
|
:* u.hez %give %ergo pot
|
|
|
|
%+ turn ~(tap in pak)
|
|
|
|
|= pax/path
|
|
|
|
[(slag len pax) (~(got by changes) pax)]
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Print a summary of changes to dill.
|
|
|
|
::
|
|
|
|
++ print-changes
|
|
|
|
|= lem=nuri
|
|
|
|
=/ m (clad ,~)
|
|
|
|
^- form:m
|
|
|
|
:: skip full change output for initial filesystem
|
|
|
|
::
|
|
|
|
?: ?& =(%base syd)
|
|
|
|
|(=(1 let.dom) =(2 let.dom))
|
|
|
|
?=([%& ^] lem)
|
|
|
|
==
|
|
|
|
=/ msg=tape
|
|
|
|
%+ weld
|
|
|
|
"clay: committed initial filesystem"
|
|
|
|
?:(=(1 let.dom) " (hoon)" " (all)")
|
|
|
|
|= clad-input
|
|
|
|
:- ~ :_ [%done ~]
|
2019-05-10 04:06:18 +03:00
|
|
|
[hun %pass / %d %flog %text msg]~
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
=+ pre=`path`~[(scot %p our) syd (scot %ud let.dom)]
|
|
|
|
?- -.lem
|
|
|
|
%| (print-to-dill '=' %leaf :(weld (trip p.lem) " " (spud pre)))
|
|
|
|
%&
|
|
|
|
|- ^- form:m
|
|
|
|
?~ p.lem (pure:m ~)
|
|
|
|
;< ~ bind:m
|
|
|
|
%+ print-to-dill
|
|
|
|
?-(-.q.i.p.lem $del '-', $ins '+', $dif ':')
|
|
|
|
:+ %rose ["/" "/" ~]
|
|
|
|
%+ turn (weld pre p.i.p.lem)
|
|
|
|
|= a/cord
|
|
|
|
?: ((sane %ta) a)
|
|
|
|
[%leaf (trip a)]
|
|
|
|
[%leaf (dash:us (trip a) '\'' ~)]
|
|
|
|
^$(p.lem t.p.lem)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Sends a tank straight to dill for printing.
|
|
|
|
::
|
|
|
|
++ print-to-dill
|
|
|
|
|= {car/@tD tan/tank}
|
|
|
|
=/ m (clad ,~)
|
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
:- ~ :_ [%done ~]
|
2019-05-10 04:06:18 +03:00
|
|
|
[hun %give %note car tan]~
|
2019-05-04 05:24:24 +03:00
|
|
|
--
|
2019-05-03 04:50:20 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
:: This thread respresents a currently running merge. We always
|
|
|
|
:: say we're merging from 'ali' to 'bob'. The basic steps, not all
|
|
|
|
:: of which are always needed, are:
|
|
|
|
::
|
|
|
|
:: -- fetch ali's desk
|
|
|
|
:: -- diff ali's desk against the mergebase
|
|
|
|
:: -- diff bob's desk against the mergebase
|
|
|
|
:: -- merge the diffs
|
|
|
|
:: -- build the new state
|
|
|
|
:: -- "checkout" (apply to actual `++dome`) the new state
|
|
|
|
:: -- "ergo" (tell unix about) any changes
|
|
|
|
::
|
|
|
|
++ merge
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Global constants. These do not change during a merge.
|
|
|
|
::
|
|
|
|
|= $: our=ship
|
2019-05-10 04:06:18 +03:00
|
|
|
wen=@da
|
2019-05-04 05:24:24 +03:00
|
|
|
ali-disc=(pair ship desk)
|
|
|
|
bob-disc=(pair ship desk)
|
|
|
|
cas=case
|
|
|
|
mon=(map term beam)
|
|
|
|
hez=(unit duct)
|
|
|
|
==
|
2019-05-11 00:51:37 +03:00
|
|
|
:: Run ford operations on ali unless it's a foreign desk
|
|
|
|
::
|
|
|
|
=/ ford-disc=disc:ford
|
|
|
|
?: =(p.ali-disc p.bob-disc)
|
|
|
|
ali-disc
|
|
|
|
bob-disc
|
2019-05-03 04:50:20 +03:00
|
|
|
|^
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Initial arguments
|
|
|
|
::
|
|
|
|
|= [gem=germ dom=dome ran=rang]
|
|
|
|
=/ m merge-clad
|
2019-05-03 04:50:20 +03:00
|
|
|
^- form:m
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ e (cor dom ran)
|
2019-05-04 05:24:24 +03:00
|
|
|
;< [bob=(unit yaki) gem=germ] bind:m (get-bob:e gem)
|
2019-05-11 00:51:37 +03:00
|
|
|
;< [ali=yaki e=_*cor] bind:m fetch-ali:e
|
2019-05-03 04:50:20 +03:00
|
|
|
;< $= res
|
|
|
|
%- unit
|
|
|
|
$: conflicts=(set path)
|
|
|
|
bop=(map path cage)
|
|
|
|
new=yaki
|
|
|
|
erg=(map path ?)
|
2019-05-11 00:51:37 +03:00
|
|
|
e=_*cor
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
|
|
|
bind:m
|
2019-05-04 05:24:24 +03:00
|
|
|
(merge:e gem cas ali bob)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ res
|
2019-05-10 04:06:18 +03:00
|
|
|
(pure:m ~ dom:e ran:e)
|
2019-05-04 05:24:24 +03:00
|
|
|
=. e e.u.res
|
2019-05-11 00:51:37 +03:00
|
|
|
;< e=_*cor bind:m (checkout:e gem cas bob new.u.res bop.u.res)
|
2019-05-10 04:06:18 +03:00
|
|
|
;< ~ bind:m (ergo:e gem cas mon erg.u.res new.u.res)
|
|
|
|
(pure:m conflicts.u.res dom:e ran:e)
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
2019-05-10 04:06:18 +03:00
|
|
|
:: A stateful core, where the global state is a dome and a rang.
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: These are the global state variables that a merge may change.
|
|
|
|
::
|
|
|
|
++ cor
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [dom=dome ran=rang]
|
|
|
|
=/ original-dome dom
|
|
|
|
|%
|
2019-05-04 05:24:24 +03:00
|
|
|
++ this-cor .
|
2019-05-11 00:51:37 +03:00
|
|
|
++ sutil (state:util original-dome dom ran)
|
2019-05-04 05:24:24 +03:00
|
|
|
++ get-bob
|
|
|
|
|= gem=germ
|
|
|
|
=/ m (clad ,[bob=(unit yaki) gem=germ])
|
|
|
|
^- form:m
|
|
|
|
?: &(=(0 let.dom) !?=(?(%init %that) gem))
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-bob-disc ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: =(0 let.dom)
|
|
|
|
(pure:m ~ %init)
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ tak (~(get by hit.dom) let.dom)
|
2019-05-04 05:24:24 +03:00
|
|
|
?~ tak
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-bob-version ~)
|
|
|
|
=/ bob (~(get by hut.ran) u.tak)
|
2019-05-04 05:24:24 +03:00
|
|
|
?~ bob
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-bob-commit ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
(pure:m `u.bob gem)
|
|
|
|
::
|
|
|
|
:: Tell clay to get the state at the requested case for ali's desk.
|
|
|
|
::
|
|
|
|
++ fetch-ali
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ m (clad ,[ali=yaki e=_this-cor])
|
2019-05-04 05:24:24 +03:00
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
2019-05-10 04:06:18 +03:00
|
|
|
[%c %warp p.ali-disc q.ali-disc `[%sing %v cas /]]
|
2019-05-04 05:24:24 +03:00
|
|
|
;< [rot=riot r=rang] bind:m (expect-clay ran)
|
|
|
|
=. ran r
|
|
|
|
?~ rot
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %bad-fetch-ali ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ ^= ali-dome
|
|
|
|
%. q.q.r.u.rot
|
|
|
|
%- hard
|
|
|
|
$: ank=*
|
|
|
|
let=@ud
|
|
|
|
hit=(map @ud tako)
|
|
|
|
lab=(map @tas @ud)
|
|
|
|
==
|
|
|
|
?: =(0 let.ali-dome)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-ali-disc ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ tak (~(get by hit.ali-dome) let.ali-dome)
|
|
|
|
?~ tak
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-ali-version ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ ali (~(get by hut.ran) u.tak)
|
|
|
|
?~ ali
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %no-ali-commit ~)
|
|
|
|
(pure:m u.ali this-cor)
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Produce null if nothing to do; else perform merge
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ merge
|
|
|
|
|= [gem=germ cas=case ali=yaki bob=(unit yaki)]
|
|
|
|
=/ m
|
|
|
|
%- clad
|
|
|
|
%- unit
|
|
|
|
$: conflicts=(set path)
|
|
|
|
bop=(map path cage)
|
|
|
|
new=yaki
|
|
|
|
erg=(map path ?)
|
2019-05-11 00:51:37 +03:00
|
|
|
e=_this-cor
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
^- form:m
|
|
|
|
?- gem
|
|
|
|
::
|
|
|
|
:: If this is an %init merge, we set the ali's commit to be bob's, and
|
|
|
|
:: we checkout the new state.
|
|
|
|
::
|
|
|
|
$init
|
|
|
|
%^ pure:m ~ ~
|
|
|
|
:^ ~
|
|
|
|
ali
|
|
|
|
(~(run by q.ali) |=(lobe %&))
|
|
|
|
this-cor(hut.ran (~(put by hut.ran) r.ali ali))
|
|
|
|
::
|
|
|
|
:: If this is a %this merge, we check to see if ali's and bob's commits
|
|
|
|
:: are the same, in which case we're done. Otherwise, we check to see
|
|
|
|
:: if ali's commit is in the ancestry of bob's, in which case we're
|
|
|
|
:: done. Otherwise, we create a new commit with bob's data plus ali
|
|
|
|
:: and bob as parents.
|
|
|
|
::
|
|
|
|
$this
|
|
|
|
=/ bob (need bob)
|
|
|
|
?: =(r.ali r.bob)
|
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
?: (~(has in (reachable-takos:sutil r.bob)) r.ali)
|
2019-05-04 05:24:24 +03:00
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ new (make-yaki:sutil [r.ali r.bob ~] q.bob wen)
|
2019-05-04 05:24:24 +03:00
|
|
|
%^ pure:m ~ ~
|
|
|
|
:^ ~
|
|
|
|
new
|
|
|
|
~
|
|
|
|
this-cor(hut.ran (~(put by hut.ran) r.new new))
|
|
|
|
::
|
|
|
|
:: If this is a %that merge, we check to see if ali's and bob's commits
|
|
|
|
:: are the same, in which case we're done. Otherwise, we create a new
|
|
|
|
:: commit with ali's data plus ali and bob as parents.
|
|
|
|
::
|
|
|
|
$that
|
|
|
|
=/ bob (need bob)
|
|
|
|
?: =(r.ali r.bob)
|
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ new (make-yaki:sutil [r.ali r.bob ~] q.ali wen)
|
2019-05-04 05:24:24 +03:00
|
|
|
%^ pure:m ~ ~
|
|
|
|
:^ ~
|
|
|
|
new
|
|
|
|
%- malt ^- (list {path ?})
|
|
|
|
%+ murn ~(tap by (~(uni by q.bob) q.ali))
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit {path ?})
|
|
|
|
=+ a=(~(get by q.ali) pax)
|
|
|
|
=+ b=(~(get by q.bob) pax)
|
|
|
|
?: =(a b)
|
|
|
|
~
|
|
|
|
`[pax !=(~ a)]
|
|
|
|
this-cor(hut.ran (~(put by hut.ran) r.new new))
|
|
|
|
::
|
|
|
|
:: If this is a %fine merge, we check to see if ali's and bob's commits
|
|
|
|
:: are the same, in which case we're done. Otherwise, we check to see
|
|
|
|
:: if ali's commit is in the ancestry of bob's, in which case we're
|
|
|
|
:: done. Otherwise, we check to see if bob's commit is in the ancestry
|
|
|
|
:: of ali's. If not, this is not a fast-forward merge, so we error
|
|
|
|
:: out. If it is, we add ali's commit to bob's desk and checkout.
|
|
|
|
::
|
|
|
|
$fine
|
|
|
|
=/ bob (need bob)
|
|
|
|
?: =(r.ali r.bob)
|
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
?: (~(has in (reachable-takos:sutil r.bob)) r.ali)
|
2019-05-04 05:24:24 +03:00
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
?. (~(has in (reachable-takos:sutil r.ali)) r.bob)
|
|
|
|
(error:he cas %bad-fine-merge ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
%^ pure:m ~ ~
|
|
|
|
:^ ~
|
|
|
|
ali
|
|
|
|
%- malt ^- (list {path ?})
|
|
|
|
%+ murn ~(tap by (~(uni by q.bob) q.ali))
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit {path ?})
|
|
|
|
=+ a=(~(get by q.ali) pax)
|
|
|
|
=+ b=(~(get by q.bob) pax)
|
|
|
|
?: =(a b)
|
|
|
|
~
|
|
|
|
`[pax !=(~ a)]
|
|
|
|
this-cor
|
|
|
|
::
|
|
|
|
:: If this is a %meet, %mate, or %meld merge, we may need to fetch
|
|
|
|
:: more data. If this merge is either trivial or a fast-forward, we
|
|
|
|
:: short-circuit to either ++done or the %fine case.
|
|
|
|
::
|
|
|
|
:: Otherwise, we find the best common ancestor(s) with
|
|
|
|
:: ++find-merge-points. If there's no common ancestor, we error out.
|
|
|
|
:: Additionally, if there's more than one common ancestor (i.e. this
|
|
|
|
:: is a criss-cross merge), we error out. Something akin to git's
|
|
|
|
:: recursive merge should probably be used here, but it isn't.
|
|
|
|
::
|
|
|
|
:: Once we have our single best common ancestor (merge base), we store
|
|
|
|
:: it in bas.dat. If this is a %mate or %meld merge, we need to diff
|
|
|
|
:: ali's commit against the merge base, so we pass control over to
|
|
|
|
:: ++diff-ali.
|
|
|
|
::
|
|
|
|
:: Otherwise (i.e. this is a %meet merge), we create a list of all the
|
|
|
|
:: changes between the mege base and ali's commit and store it in
|
|
|
|
:: dal.dat, and we put a similar list for bob's commit in dob.dat.
|
|
|
|
:: Then we create bof, which is the a set of changes in both ali and
|
|
|
|
:: bob's commits. If this has any members, we have conflicts, which is
|
|
|
|
:: an error in a %meet merge, so we error out.
|
|
|
|
::
|
|
|
|
:: Otherwise, we merge the merge base data with ali's data and bob's
|
|
|
|
:: data, which produces the data for the new commit, which we put in
|
|
|
|
:: new.dat. Then we checkout the new data.
|
|
|
|
::
|
|
|
|
?($meet $mate $meld)
|
|
|
|
=/ bob (need bob)
|
|
|
|
?: =(r.ali r.bob)
|
|
|
|
(pure:m ~)
|
|
|
|
?. (~(has by hut.ran) r.bob)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %bad-bob-tako >r.bob< ~)
|
|
|
|
?: (~(has in (reachable-takos:sutil r.bob)) r.ali)
|
2019-05-04 05:24:24 +03:00
|
|
|
(pure:m ~)
|
2019-05-10 04:06:18 +03:00
|
|
|
?: (~(has in (reachable-takos:sutil r.ali)) r.bob)
|
2019-05-04 05:24:24 +03:00
|
|
|
$(gem %fine)
|
|
|
|
=+ r=(find-merge-points:he ali bob)
|
|
|
|
?~ r
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %merge-no-merge-base ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
?. ?=({* ~ ~} r)
|
|
|
|
=+ (lent ~(tap in `(set yaki)`r))
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %merge-criss-cross >[-]< ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ bas n.r
|
2019-05-10 04:06:18 +03:00
|
|
|
?: ?=(?($mate $meld) gem)
|
|
|
|
;< ali-diffs=cane bind:m (diff-bas ali bob bas)
|
|
|
|
;< bob-diffs=cane bind:m (diff-bas bob ali bas)
|
2019-05-04 05:24:24 +03:00
|
|
|
;< bof=(map path (unit cage)) bind:m
|
2019-05-10 04:06:18 +03:00
|
|
|
(merge-conflicts can.ali-diffs can.bob-diffs)
|
2019-05-04 05:24:24 +03:00
|
|
|
;< $: conflicts=(set path)
|
|
|
|
bop=(map path cage)
|
|
|
|
new=yaki
|
|
|
|
erg=(map path ?)
|
|
|
|
e=_this-cor
|
|
|
|
==
|
|
|
|
bind:m
|
2019-05-10 04:06:18 +03:00
|
|
|
(build gem ali bob bas ali-diffs bob-diffs bof)
|
2019-05-04 05:24:24 +03:00
|
|
|
(pure:m `[conflicts bop new erg e])
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ ali-diffs=cane (calc-diffs:he ali bas)
|
|
|
|
=/ bob-diffs=cane (calc-diffs:he bob bas)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ bof=(map path *)
|
|
|
|
%- %~ int by
|
2019-05-10 04:06:18 +03:00
|
|
|
%- ~(uni by `(map path *)`new.ali-diffs)
|
|
|
|
%- ~(uni by `(map path *)`cal.ali-diffs)
|
|
|
|
%- ~(uni by `(map path *)`can.ali-diffs)
|
|
|
|
`(map path *)`old.ali-diffs
|
|
|
|
%- ~(uni by `(map path *)`new.bob-diffs)
|
|
|
|
%- ~(uni by `(map path *)`cal.bob-diffs)
|
|
|
|
%- ~(uni by `(map path *)`can.bob-diffs)
|
|
|
|
`(map path *)`old.bob-diffs
|
2019-05-04 05:24:24 +03:00
|
|
|
?^ bof
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %meet-conflict >(~(run by `(map path *)`bof) ,~)< ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ old=(map path lobe)
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ roll ~(tap by (~(uni by old.ali-diffs) old.bob-diffs))
|
|
|
|
=< .(old q.bas)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {{pax/path ~} old/(map path lobe)}
|
|
|
|
(~(del by old) pax)
|
|
|
|
=/ hat=(map path lobe)
|
|
|
|
%- ~(uni by old)
|
2019-05-10 04:06:18 +03:00
|
|
|
%- ~(uni by new.ali-diffs)
|
|
|
|
%- ~(uni by new.bob-diffs)
|
|
|
|
%- ~(uni by cal.ali-diffs)
|
|
|
|
cal.bob-diffs
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ del=(map path ?)
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(run by (~(uni by old.ali-diffs) old.bob-diffs)) |=(~ %|))
|
|
|
|
=/ new (make-yaki:sutil [r.ali r.bob ~] hat wen)
|
2019-05-04 05:24:24 +03:00
|
|
|
%^ pure:m ~ ~
|
|
|
|
:^ ~
|
|
|
|
new
|
|
|
|
%- ~(uni by del)
|
|
|
|
^- (map path ?)
|
|
|
|
%. |=(lobe %&)
|
2019-05-10 04:06:18 +03:00
|
|
|
~(run by (~(uni by new.ali-diffs) cal.ali-diffs))
|
|
|
|
this-cor(hut.ran (~(put by hut.ran) r.new new))
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Diff a commit against the mergebase.
|
|
|
|
::
|
|
|
|
++ diff-bas
|
2019-05-10 04:06:18 +03:00
|
|
|
|= [yak=yaki yuk=yaki bas=yaki]
|
|
|
|
=/ m (clad ,cane)
|
2019-05-04 05:24:24 +03:00
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
2019-05-10 04:06:18 +03:00
|
|
|
:* %f %build live=%.n %pin wen
|
2019-05-04 05:24:24 +03:00
|
|
|
%list
|
|
|
|
^- (list schematic:ford)
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ murn ~(tap by q.bas)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit schematic:ford)
|
|
|
|
=+ a=(~(get by q.yak) pax)
|
|
|
|
?~ a
|
|
|
|
~
|
|
|
|
?: =(lob u.a)
|
|
|
|
~
|
|
|
|
=+ (~(get by q.yuk) pax)
|
|
|
|
?~ -
|
|
|
|
~
|
|
|
|
?: =(u.a u.-)
|
|
|
|
~
|
|
|
|
:- ~
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ disc ford-disc
|
2019-05-04 05:24:24 +03:00
|
|
|
:- [%$ %path !>(pax)]
|
2019-05-11 00:51:37 +03:00
|
|
|
:^ %diff ford-disc
|
2019-05-10 04:06:18 +03:00
|
|
|
(lobe-to-schematic:sutil disc pax lob)
|
|
|
|
(lobe-to-schematic:sutil disc pax u.a)
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ tay=(made-result-to-cages-or-error:util res)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.tay)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %diff-ali-bad-made leaf+"merge diff ali failed" p.tay)
|
|
|
|
=+ can=(cages-to-map:util p.tay)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.can)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %diff-ali p.can)
|
2019-05-04 05:24:24 +03:00
|
|
|
%- pure:m
|
|
|
|
:* %- molt
|
|
|
|
%+ skip ~(tap by q.yak)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
(~(has by q.bas) pax)
|
|
|
|
::
|
|
|
|
%- molt ^- (list (pair path lobe))
|
|
|
|
%+ murn ~(tap by q.bas)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit (pair path lobe))
|
|
|
|
=+ a=(~(get by q.yak) pax)
|
|
|
|
=+ b=(~(get by q.yuk) pax)
|
|
|
|
?. ?& ?=(^ a)
|
|
|
|
!=([~ lob] a)
|
|
|
|
=([~ lob] b)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
~
|
|
|
|
`[pax +.a]
|
|
|
|
::
|
|
|
|
p.can
|
|
|
|
::
|
|
|
|
%- malt ^- (list {path ~})
|
|
|
|
%+ murn ~(tap by q.bas)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
?. =(~ (~(get by q.yak) pax))
|
|
|
|
~
|
|
|
|
(some pax ~)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Merge conflicting diffs
|
|
|
|
::
|
|
|
|
++ merge-conflicts
|
|
|
|
|= [conflicts-ali=(map path cage) conflicts-bob=(map path cage)]
|
|
|
|
=/ m (clad ,bof=(map path (unit cage)))
|
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn
|
|
|
|
~(tap by (~(int by conflicts-ali) conflicts-bob))
|
|
|
|
|= {pax/path *}
|
|
|
|
^- schematic:ford
|
|
|
|
=+ cal=(~(got by conflicts-ali) pax)
|
|
|
|
=+ cob=(~(got by conflicts-bob) pax)
|
|
|
|
=/ her
|
|
|
|
=+ (slag (dec (lent pax)) pax)
|
|
|
|
?~(- %$ i.-)
|
|
|
|
:- [%$ %path !>(pax)]
|
|
|
|
[%join [p.bob-disc q.bob-disc] her [%$ cal] [%$ cob]]
|
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
|
|
|
=+ tay=(made-result-to-cages-or-error:util res)
|
|
|
|
?: ?=(%| -.tay)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %merge-bad-made leaf+"merging failed" p.tay)
|
|
|
|
=+ can=(cages-to-map:util p.tay)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.can)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %merge p.can)
|
2019-05-04 05:24:24 +03:00
|
|
|
%- pure:m
|
|
|
|
(~(run by p.can) (flit |=({a/mark ^} !?=($null a))))
|
|
|
|
::
|
2019-05-10 04:06:18 +03:00
|
|
|
:: Apply the patches in bof to get the new merged content.
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Gather all the changes between ali's and bob's commits and the
|
2019-05-10 04:06:18 +03:00
|
|
|
:: mergebase. This is similar to the %meet of ++merge, except
|
|
|
|
:: where they touch the same file, we use the merged versions.
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
++ build
|
2019-05-10 04:06:18 +03:00
|
|
|
|= $: gem=germ
|
|
|
|
ali=yaki
|
|
|
|
bob=yaki
|
|
|
|
bas=yaki
|
|
|
|
dal=cane
|
|
|
|
dob=cane
|
|
|
|
bof=(map path (unit cage))
|
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ m
|
2019-05-10 04:06:18 +03:00
|
|
|
%- clad
|
|
|
|
$: conflicts=(set path)
|
|
|
|
bop=(map path cage)
|
|
|
|
new=yaki
|
|
|
|
erg=(map path ?)
|
|
|
|
e=_this-cor
|
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
|
|
|
:* %f %build live=%.n %list
|
|
|
|
^- (list schematic:ford)
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ murn ~(tap by bof)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path cay/(unit cage)}
|
|
|
|
^- (unit schematic:ford)
|
|
|
|
?~ cay
|
|
|
|
~
|
|
|
|
:- ~
|
|
|
|
:- [%$ %path !>(pax)]
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ (~(get by q.bas) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
?~ -
|
|
|
|
~| %mate-strange-diff-no-base
|
|
|
|
!!
|
|
|
|
:* %pact
|
|
|
|
[p.bob-disc q.bob-disc]
|
2019-05-11 00:51:37 +03:00
|
|
|
(lobe-to-schematic:sutil ford-disc pax u.-)
|
2019-05-04 05:24:24 +03:00
|
|
|
[%$ u.cay]
|
|
|
|
==
|
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ tay=(made-result-to-cages-or-error:util res)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.tay)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %build-bad-made leaf+"delta building failed" p.tay)
|
|
|
|
=/ bop (cages-to-map:util p.tay)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.bop)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %built p.bop)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ both-patched p.bop
|
|
|
|
=/ con=(map path *) :: 2-change conflict
|
|
|
|
%- molt
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ skim ~(tap by bof)
|
2019-05-04 05:24:24 +03:00
|
|
|
|=({pax/path cay/(unit cage)} ?=(~ cay))
|
2019-05-10 04:06:18 +03:00
|
|
|
=/ cab=(map path lobe) :: conflict base
|
2019-05-04 05:24:24 +03:00
|
|
|
%- ~(urn by con)
|
|
|
|
|= {pax/path *}
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(got by q.bas) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
=. con :: change+del conflict
|
|
|
|
%- ~(uni by con)
|
|
|
|
%- malt ^- (list {path *})
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ skim ~(tap by old.dal)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path ~}
|
2019-05-10 04:06:18 +03:00
|
|
|
?: (~(has by new.dob) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
~| %strange-add-and-del
|
|
|
|
!!
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(has by can.dob) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
=. con :: change+del conflict
|
|
|
|
%- ~(uni by con)
|
|
|
|
%- malt ^- (list {path *})
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ skim ~(tap by old.dob)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path ~}
|
2019-05-10 04:06:18 +03:00
|
|
|
?: (~(has by new.dal) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
~| %strange-del-and-add
|
|
|
|
!!
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(has by can.dal) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
=. con :: add+add conflict
|
|
|
|
%- ~(uni by con)
|
|
|
|
%- malt ^- (list {path *})
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ skip ~(tap by (~(int by new.dal) new.dob))
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path *}
|
2019-05-10 04:06:18 +03:00
|
|
|
=((~(got by new.dal) pax) (~(got by new.dob) pax))
|
|
|
|
?: &(?=($mate gem) ?=(^ con))
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ (turn ~(tap by `(map path *)`con) |=({path *} >[+<-]<))
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %mate-conflict -)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ old=(map path lobe) :: oldies but goodies
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ roll ~(tap by (~(uni by old.dal) old.dob))
|
|
|
|
=< .(old q.bas)
|
2019-05-03 04:50:20 +03:00
|
|
|
|= {{pax/path ~} old/(map path lobe)}
|
|
|
|
(~(del by old) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ can=(map path cage) :: content changes
|
|
|
|
%- molt
|
|
|
|
^- (list (pair path cage))
|
2019-05-10 04:06:18 +03:00
|
|
|
%+ murn ~(tap by bof)
|
2019-05-04 05:24:24 +03:00
|
|
|
|= {pax/path cay/(unit cage)}
|
|
|
|
^- (unit (pair path cage))
|
|
|
|
?~ cay
|
|
|
|
~
|
|
|
|
`[pax u.cay]
|
|
|
|
=^ hot lat.ran :: new content
|
|
|
|
^- {(map path lobe) (map lobe blob)}
|
|
|
|
%+ roll ~(tap by can)
|
|
|
|
=< .(lat lat.ran)
|
|
|
|
|= {{pax/path cay/cage} hat/(map path lobe) lat/(map lobe blob)}
|
|
|
|
=+ ^= bol
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ (~(get by q.bas) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
?~ -
|
|
|
|
~| %mate-strange-diff-no-base
|
|
|
|
!!
|
2019-05-10 04:06:18 +03:00
|
|
|
%^ make-delta-blob:sutil
|
|
|
|
(page-to-lobe:sutil [p q.q]:(~(got by both-patched) pax))
|
|
|
|
[(lobe-to-mark:sutil u.-) u.-]
|
2019-05-04 05:24:24 +03:00
|
|
|
[p q.q]:cay
|
|
|
|
[(~(put by hat) pax p.bol) (~(put by lat) p.bol bol)]
|
|
|
|
:: ~& old=(~(run by old) mug)
|
2019-05-10 04:06:18 +03:00
|
|
|
:: ~& newdal=(~(run by new.dal) mug)
|
|
|
|
:: ~& newdob=(~(run by new.dob) mug)
|
|
|
|
:: ~& caldal=(~(run by cal.dal) mug)
|
|
|
|
:: ~& caldob=(~(run by cal.dob) mug)
|
2019-05-04 05:24:24 +03:00
|
|
|
:: ~& hot=(~(run by hot) mug)
|
|
|
|
:: ~& cas=(~(run by cas) mug)
|
|
|
|
=/ hat=(map path lobe) :: all the content
|
2019-05-03 04:50:20 +03:00
|
|
|
%- ~(uni by old)
|
2019-05-10 04:06:18 +03:00
|
|
|
%- ~(uni by new.dal)
|
|
|
|
%- ~(uni by new.dob)
|
|
|
|
%- ~(uni by cal.dal)
|
|
|
|
%- ~(uni by cal.dob)
|
2019-05-04 05:24:24 +03:00
|
|
|
%- ~(uni by hot)
|
2019-05-10 04:06:18 +03:00
|
|
|
cab
|
2019-05-03 04:50:20 +03:00
|
|
|
=/ del=(map path ?)
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(run by (~(uni by old.dal) old.dob)) |=(~ %|))
|
|
|
|
=/ new (make-yaki:sutil [r.ali r.bob ~] hat wen)
|
2019-05-04 05:24:24 +03:00
|
|
|
%- pure:m
|
2019-05-10 04:06:18 +03:00
|
|
|
:* (silt (turn ~(tap by con) head))
|
|
|
|
both-patched
|
2019-05-03 04:50:20 +03:00
|
|
|
new
|
2019-05-10 04:06:18 +03:00
|
|
|
::
|
|
|
|
%- ~(uni by del)
|
|
|
|
^- (map path ?)
|
|
|
|
%. |=(lobe %&)
|
|
|
|
%~ run by
|
|
|
|
%- ~(uni by new.dal)
|
|
|
|
%- ~(uni by cal.dal)
|
|
|
|
%- ~(uni by cab)
|
|
|
|
hot
|
|
|
|
::
|
|
|
|
this-cor(hut.ran (~(put by hut.ran) r.new new))
|
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Convert new commit into actual data (i.e. blobs rather than lobes).
|
|
|
|
:: Apply the new commit to our state
|
|
|
|
::
|
|
|
|
++ checkout
|
2019-05-10 04:06:18 +03:00
|
|
|
|= [gem=germ cas=case bob=(unit yaki) new=yaki bop=(map path cage)]
|
|
|
|
=/ m (clad ,_this-cor)
|
2019-05-04 05:24:24 +03:00
|
|
|
^- form:m
|
|
|
|
;< ~ bind:m
|
|
|
|
=/ val=beak
|
|
|
|
?: ?=($init gem)
|
|
|
|
[p.ali-disc q.ali-disc cas]
|
2019-05-10 04:06:18 +03:00
|
|
|
[p.bob-disc q.bob-disc da+wen]
|
2019-05-04 05:24:24 +03:00
|
|
|
%- just-do
|
2019-05-10 04:06:18 +03:00
|
|
|
:* %f %build live=%.n %pin (case-to-date:sutil wen r.val) %list
|
2019-05-04 05:24:24 +03:00
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ murn ~(tap by q.new)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit schematic:ford)
|
|
|
|
?: (~(has by bop) pax)
|
|
|
|
~
|
|
|
|
:+ ~
|
|
|
|
[%$ %path !>(pax)]
|
2019-05-11 00:51:37 +03:00
|
|
|
(merge-lobe-to-schematic:he (fall bob *yaki) ford-disc pax lob)
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ tay=(made-result-to-cages-or-error:util res)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.tay)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %checkout-bad-made leaf+"merge checkout failed" p.tay)
|
|
|
|
=+ can=(cages-to-map:util p.tay)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.can)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %checkout p.can)
|
2019-05-04 05:24:24 +03:00
|
|
|
=. let.dom +(let.dom)
|
|
|
|
=. hit.dom (~(put by hit.dom) let.dom r.new)
|
|
|
|
=. ank.dom
|
|
|
|
%- map-to-ankh:sutil
|
|
|
|
%- ~(run by (~(uni by bop) p.can))
|
2019-05-10 04:06:18 +03:00
|
|
|
|=(cage [(page-to-lobe:sutil p q.q) +<])
|
|
|
|
(pure:m this-cor)
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Cast all the content that we're going to tell unix about to
|
|
|
|
:: %mime, then tell unix.
|
|
|
|
::
|
|
|
|
++ ergo
|
2019-05-10 04:06:18 +03:00
|
|
|
|= [gem=germ cas=case mon=(map term beam) erg=(map path ?) new=yaki]
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ m (clad ,~)
|
|
|
|
^- form:m
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ must=(must-ergo:util our q.bob-disc mon (turn ~(tap by erg) head))
|
2019-05-04 05:24:24 +03:00
|
|
|
?: =(~ must)
|
|
|
|
(pure:m ~)
|
|
|
|
=/ sum=(set path)
|
|
|
|
=+ (turn ~(tap by must) (corl tail tail))
|
|
|
|
%+ roll -
|
|
|
|
|= {pak/(set path) acc/(set path)}
|
|
|
|
(~(uni in acc) pak)
|
|
|
|
=/ val=beak
|
2019-05-10 04:06:18 +03:00
|
|
|
?: ?=($init gem)
|
|
|
|
[p.ali-disc q.ali-disc cas]
|
|
|
|
[p.bob-disc q.bob-disc da+wen]
|
2019-05-04 05:24:24 +03:00
|
|
|
;< ~ bind:m
|
|
|
|
%- just-do
|
2019-05-10 04:06:18 +03:00
|
|
|
:* %f %build live=%.n %pin (case-to-date:sutil wen r.val) %list
|
2019-05-04 05:24:24 +03:00
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn ~(tap in sum)
|
|
|
|
|= a/path
|
|
|
|
^- schematic:ford
|
|
|
|
:- [%$ %path !>(a)]
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ b=(~(got by erg) a)
|
2019-05-04 05:24:24 +03:00
|
|
|
?. b
|
|
|
|
[%$ %null !>(~)]
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ disc ford-disc :: [p q]:val
|
|
|
|
:^ %cast ford-disc %mime
|
2019-05-10 04:06:18 +03:00
|
|
|
(lobe-to-schematic:sutil disc a (~(got by q.new) a))
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
;< res=made-result:ford bind:m expect-ford
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ tay=(made-result-to-cages-or-error:util res)
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=(%| -.tay)
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %ergo-bad-made leaf+"merge ergo failed" p.tay)
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ =| nac=mode
|
|
|
|
|- ^- tan=$^(mode {p/term q/tang})
|
|
|
|
?~ p.tay nac
|
|
|
|
=* pax p.i.p.tay
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
[%ergo >[%expected-path got=p.pax]< ~]
|
|
|
|
=* mim q.i.p.tay
|
|
|
|
=+ mit=?.(?=($mime p.mim) ~ `((hard mime) q.q.mim))
|
|
|
|
$(p.tay t.p.tay, nac :_(nac [((hard path) q.q.pax) mit]))
|
2019-05-10 04:06:18 +03:00
|
|
|
?: ?=([@ *] tan) (error:he cas tan)
|
2019-05-04 05:24:24 +03:00
|
|
|
=/ can=(map path (unit mime)) (malt tan)
|
|
|
|
?~ hez
|
2019-05-10 04:06:18 +03:00
|
|
|
(error:he cas %ergo-no-hez ~)
|
2019-05-04 05:24:24 +03:00
|
|
|
^- form:m
|
|
|
|
|= clad-input
|
|
|
|
:- ~ :_ [%done ~]
|
|
|
|
%+ turn ~(tap by must)
|
|
|
|
|= {pot/term len/@ud pak/(set path)}
|
|
|
|
:* u.hez %give %ergo pot
|
|
|
|
%+ turn ~(tap in pak)
|
|
|
|
|= pax/path
|
|
|
|
[(slag len pax) (~(got by can) pax)]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: A small set of helper functions to assist in merging.
|
|
|
|
::
|
|
|
|
++ he
|
|
|
|
|%
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Cancel the merge gracefully and produce an error.
|
|
|
|
::
|
|
|
|
++ error
|
2019-05-10 04:06:18 +03:00
|
|
|
|= [cas=case err=term tan=(list tank)]
|
|
|
|
(clad-fail err >ali-disc< >bob-disc< >cas< tan)
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
++ calc-diffs
|
|
|
|
|= [hed=yaki bas=yaki]
|
|
|
|
^- cane
|
|
|
|
:* %- molt
|
|
|
|
%+ skip ~(tap by q.hed)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
(~(has by q.bas) pax)
|
|
|
|
::
|
|
|
|
%- molt
|
|
|
|
%+ skip ~(tap by q.hed)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
=+ (~(get by q.bas) pax)
|
|
|
|
|(=(~ -) =([~ lob] -))
|
|
|
|
::
|
|
|
|
~
|
|
|
|
::
|
|
|
|
%- malt ^- (list {path ~})
|
|
|
|
%+ murn ~(tap by q.bas)
|
|
|
|
|= {pax/path lob/lobe}
|
|
|
|
^- (unit (pair path ~))
|
|
|
|
?. =(~ (~(get by q.hed) pax))
|
|
|
|
~
|
|
|
|
`[pax ~]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Create a schematic to turn a lobe into a blob.
|
|
|
|
::
|
|
|
|
:: We short-circuit if we already have the content somewhere.
|
|
|
|
::
|
|
|
|
++ merge-lobe-to-schematic
|
2019-05-10 04:06:18 +03:00
|
|
|
|= [bob=yaki disc=disc:ford pax=path lob=lobe]
|
2019-05-04 05:24:24 +03:00
|
|
|
^- schematic:ford
|
2019-05-10 04:06:18 +03:00
|
|
|
:: XX we used to short-circuit if the result was already
|
|
|
|
:: calculated in ali's desk. This would be nice, but I don't
|
|
|
|
:: think it'll kill performance too bad.
|
|
|
|
:: =+ ^= lal
|
|
|
|
:: %+ biff alh
|
|
|
|
:: |= had/dome
|
|
|
|
:: (~(get by q:(tako-to-yaki:sutil (~(got by hit.had) let.had))) pax)
|
|
|
|
=+ lol=(~(get by q.bob) pax)
|
2019-05-04 05:24:24 +03:00
|
|
|
|- ^- schematic:ford
|
|
|
|
?: =([~ lob] lol)
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ (need (need (read-x:sutil & let.dom pax)))
|
2019-05-04 05:24:24 +03:00
|
|
|
?> ?=(%& -<)
|
|
|
|
[%$ p.-]
|
2019-05-10 04:06:18 +03:00
|
|
|
:: ?: =([~ lob] lal)
|
|
|
|
:: [%$ +:(need fil.ank:(descend-path:(zu:sutil ank:(need alh)) pax))]
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ bol=(~(got by lat.ran) lob)
|
|
|
|
?- -.bol
|
2019-05-10 04:06:18 +03:00
|
|
|
$direct (page-to-schematic:sutil disc q.bol)
|
2019-05-04 05:24:24 +03:00
|
|
|
$delta
|
2019-05-10 04:06:18 +03:00
|
|
|
[%pact disc $(lob q.q.bol) (page-to-schematic:sutil disc r.bol)]
|
2019-05-04 05:24:24 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Find the most recent common ancestor(s).
|
|
|
|
::
|
|
|
|
++ find-merge-points
|
|
|
|
|= {p/yaki q/yaki} :: maybe need jet
|
|
|
|
^- (set yaki)
|
|
|
|
%- reduce-merge-points
|
2019-05-10 04:06:18 +03:00
|
|
|
=+ r=(reachable-takos:sutil r.p)
|
2019-05-04 05:24:24 +03:00
|
|
|
|- ^- (set yaki)
|
|
|
|
?: (~(has in r) r.q) (~(put in *(set yaki)) q)
|
|
|
|
%+ roll p.q
|
|
|
|
|= {t/tako s/(set yaki)}
|
|
|
|
?: (~(has in r) t)
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(put in s) (tako-to-yaki:sutil t)) :: found
|
|
|
|
(~(uni in s) ^$(q (tako-to-yaki:sutil t))) :: traverse
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Helper for ++find-merge-points.
|
|
|
|
::
|
|
|
|
++ reduce-merge-points
|
|
|
|
|= unk/(set yaki) :: maybe need jet
|
|
|
|
=| gud/(set yaki)
|
|
|
|
=+ ^= zar
|
|
|
|
^- (map tako (set tako))
|
|
|
|
%+ roll ~(tap in unk)
|
|
|
|
|= {yak/yaki qar/(map tako (set tako))}
|
2019-05-10 04:06:18 +03:00
|
|
|
(~(put by qar) r.yak (reachable-takos:sutil r.yak))
|
2019-05-04 05:24:24 +03:00
|
|
|
|-
|
|
|
|
^- (set yaki)
|
|
|
|
?~ unk gud
|
|
|
|
=+ bun=(~(del in `(set yaki)`unk) n.unk)
|
|
|
|
?: %+ levy ~(tap by (~(uni in gud) bun))
|
|
|
|
|= yak/yaki
|
|
|
|
!(~(has in (~(got by zar) r.yak)) r.n.unk)
|
|
|
|
$(gud (~(put in gud) n.unk), unk bun)
|
|
|
|
$(unk bun)
|
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|
|
|
|
::
|
|
|
|
++ util
|
|
|
|
|%
|
|
|
|
:: Takes a list of changed paths and finds those paths that are inside a
|
|
|
|
:: mount point (listed in `mon`).
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Output is a map of mount points to {length-of-mounted-path set-of-paths}.
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ must-ergo
|
|
|
|
|= [our=ship syd=desk mon=(map term beam) can/(list path)]
|
|
|
|
^- (map term (pair @ud (set path)))
|
|
|
|
%- malt ^- (list (trel term @ud (set path)))
|
|
|
|
%+ murn ~(tap by mon)
|
|
|
|
|= {nam/term bem/beam}
|
|
|
|
^- (unit (trel term @ud (set path)))
|
|
|
|
=- ?~(- ~ `[nam (lent s.bem) (silt `(list path)`-)])
|
|
|
|
%+ skim can
|
|
|
|
|= pax/path
|
|
|
|
&(=(p.bem our) =(q.bem syd) =((flop s.bem) (scag (lent s.bem) pax)))
|
|
|
|
::
|
|
|
|
++ ford-fail |=(tan/tang ~|(%ford-fail (mean tan)))
|
|
|
|
::
|
|
|
|
:: Takes either a result or a stack trace. If it's a stack trace, we crash;
|
|
|
|
:: else, we produce the result.
|
|
|
|
::
|
|
|
|
++ unwrap-tang
|
|
|
|
|* res/(each * tang)
|
|
|
|
?:(?=(%& -.res) p.res (mean p.res))
|
|
|
|
::
|
|
|
|
:: Parse a gage to a list of pairs of cages, crashing on error.
|
|
|
|
::
|
|
|
|
:: Composition of ++gage-to-cages-or-error and ++unwrap-tang. Maybe same as
|
|
|
|
:: ++gage-to-success-cages?
|
|
|
|
::
|
|
|
|
++ made-result-to-cages
|
|
|
|
|= result=made-result:ford
|
|
|
|
^- (list (pair cage cage))
|
|
|
|
(unwrap-tang (made-result-to-cages-or-error result))
|
|
|
|
::
|
|
|
|
:: Same as ++gage-to-cages-or-error except crashes on error. Maybe same as
|
|
|
|
:: ++gage-to-cages?
|
|
|
|
::
|
|
|
|
++ made-result-to-success-cages
|
|
|
|
|= result=made-result:ford
|
|
|
|
^- (list (pair cage cage))
|
|
|
|
?. ?=([%complete %success %list *] result)
|
|
|
|
(ford-fail >%strange-ford-result< ~)
|
|
|
|
:: process each row in the list, filtering out errors
|
|
|
|
::
|
|
|
|
%+ murn results.build-result.result
|
|
|
|
|= row=build-result:ford
|
|
|
|
^- (unit [cage cage])
|
|
|
|
::
|
|
|
|
?: ?=([%error *] row)
|
|
|
|
~& [%clay-whole-build-failed message.row]
|
|
|
|
~
|
|
|
|
?: ?=([%success [%error *] *] row)
|
|
|
|
~& [%clay-first-failure message.head.row]
|
|
|
|
~
|
|
|
|
?: ?=([%success [%success *] [%error *]] row)
|
|
|
|
~& %clay-second-failure
|
|
|
|
%- (slog message.tail.row)
|
|
|
|
~
|
|
|
|
?. ?=([%success [%success *] [%success *]] row)
|
|
|
|
~
|
|
|
|
`[(result-to-cage:ford head.row) (result-to-cage:ford tail.row)]
|
|
|
|
::
|
|
|
|
:: Expects a single-level gage (i.e. a list of pairs of cages). If the
|
|
|
|
:: result is of a different form, or if some of the computations in the gage
|
|
|
|
:: failed, we produce a stack trace. Otherwise, we produce the list of pairs
|
|
|
|
:: of cages.
|
|
|
|
::
|
|
|
|
++ made-result-to-cages-or-error
|
|
|
|
|= result=made-result:ford
|
|
|
|
^- (each (list (pair cage cage)) tang)
|
|
|
|
::
|
|
|
|
?: ?=([%incomplete *] result)
|
|
|
|
(mule |.(`~`(ford-fail tang.result)))
|
|
|
|
?. ?=([%complete %success %list *] result)
|
|
|
|
(mule |.(`~`(ford-fail >%strange-ford-result -.build-result.result< ~)))
|
|
|
|
=/ results=(list build-result:ford)
|
|
|
|
results.build-result.result
|
|
|
|
=< ?+(. [%& .] {@ *} .)
|
|
|
|
|-
|
|
|
|
^- ?((list [cage cage]) (each ~ tang))
|
|
|
|
?~ results ~
|
|
|
|
::
|
|
|
|
?. ?=([%success ^ *] i.results)
|
|
|
|
(mule |.(`~`(ford-fail >%strange-ford-result< ~)))
|
|
|
|
?: ?=([%error *] head.i.results)
|
|
|
|
(mule |.(`~`(ford-fail message.head.i.results)))
|
|
|
|
?: ?=([%error *] tail.i.results)
|
|
|
|
(mule |.(`~`(ford-fail message.tail.i.results)))
|
|
|
|
::
|
|
|
|
=+ $(results t.results)
|
|
|
|
?: ?=([@ *] -) -
|
|
|
|
:_ -
|
|
|
|
[(result-to-cage:ford head.i.results) (result-to-cage:ford tail.i.results)]
|
|
|
|
::
|
|
|
|
:: Assumes the list of pairs of cages is actually a listified map of paths
|
|
|
|
:: to cages, and converts it to (map path cage) or a stack trace on error.
|
|
|
|
::
|
|
|
|
++ cages-to-map
|
|
|
|
|= tay/(list (pair cage cage))
|
|
|
|
=| can/(map path cage)
|
|
|
|
|- ^- (each (map path cage) tang)
|
|
|
|
?~ tay [%& can]
|
|
|
|
=* pax p.i.tay
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
(mule |.(`~`~|([%expected-path got=p.pax] !!)))
|
|
|
|
$(tay t.tay, can (~(put by can) ((hard path) q.q.pax) q.i.tay))
|
|
|
|
::
|
|
|
|
++ state
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [original-dome=dome dom=dome ran=rang]
|
2019-05-04 05:24:24 +03:00
|
|
|
|%
|
|
|
|
:: These convert between aeon (version number), tako (commit hash), yaki
|
|
|
|
:: (commit data structure), lobe (content hash), and blob (content).
|
|
|
|
++ aeon-to-tako ~(got by hit.dom)
|
|
|
|
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki)
|
|
|
|
++ lobe-to-blob ~(got by lat.ran)
|
|
|
|
++ tako-to-yaki ~(got by hut.ran)
|
|
|
|
++ lobe-to-mark
|
|
|
|
|= a/lobe
|
|
|
|
=> (lobe-to-blob a)
|
|
|
|
?- -
|
|
|
|
$delta p.q
|
|
|
|
$direct p.q
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
::
|
|
|
|
:: Creates a schematic out of a page (which is a [mark noun]).
|
|
|
|
::
|
|
|
|
++ page-to-schematic
|
|
|
|
|= [disc=disc:ford a=page]
|
|
|
|
^- schematic:ford
|
|
|
|
?. ?=($hoon p.a) [%volt disc a]
|
|
|
|
:: %hoon bootstrapping
|
|
|
|
[%$ p.a [%atom %t ~] q.a]
|
|
|
|
::
|
|
|
|
:: Creates a schematic out of a lobe (content hash).
|
|
|
|
::
|
|
|
|
++ lobe-to-schematic (cury lobe-to-schematic-p &)
|
|
|
|
++ lobe-to-schematic-p
|
2019-05-11 00:51:37 +03:00
|
|
|
=. dom original-dome
|
2019-05-04 05:24:24 +03:00
|
|
|
|= [local=? disc=disc:ford pax=path lob=lobe]
|
|
|
|
^- schematic:ford
|
|
|
|
::
|
|
|
|
=+ ^- hat/(map path lobe)
|
|
|
|
?: =(let.dom 0)
|
2019-05-03 04:50:20 +03:00
|
|
|
~
|
2019-05-04 05:24:24 +03:00
|
|
|
q:(aeon-to-yaki let.dom)
|
|
|
|
=+ lol=`(unit lobe)`?.(local `0vsen.tinel (~(get by hat) pax))
|
|
|
|
|- ^- schematic:ford
|
|
|
|
?: =([~ lob] lol)
|
|
|
|
=+ (need (need (read-x & let.dom pax)))
|
|
|
|
?> ?=(%& -<)
|
|
|
|
[%$ p.-]
|
|
|
|
=+ bol=(~(got by lat.ran) lob)
|
|
|
|
?- -.bol
|
|
|
|
$direct (page-to-schematic disc q.bol)
|
|
|
|
$delta ~| delta+q.q.bol
|
|
|
|
[%pact disc $(lob q.q.bol) (page-to-schematic disc r.bol)]
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
::
|
|
|
|
:: Hashes a page to get a lobe.
|
|
|
|
::
|
|
|
|
++ page-to-lobe |=(page (shax (jam +<)))
|
|
|
|
::
|
|
|
|
:: Make a direct blob out of a page.
|
|
|
|
::
|
|
|
|
++ make-direct-blob
|
|
|
|
|= p/page
|
|
|
|
^- blob
|
|
|
|
[%direct (page-to-lobe p) p]
|
|
|
|
::
|
|
|
|
:: Make a delta blob out of a lobe, mark, lobe of parent, and page of diff.
|
|
|
|
::
|
|
|
|
++ make-delta-blob
|
|
|
|
|= {p/lobe q/{p/mark q/lobe} r/page}
|
|
|
|
^- blob
|
|
|
|
[%delta p q r]
|
|
|
|
::
|
|
|
|
:: Make a commit out of a list of parents, content, and date.
|
|
|
|
::
|
|
|
|
++ make-yaki
|
|
|
|
|= {p/(list tako) q/(map path lobe) t/@da}
|
|
|
|
^- yaki
|
|
|
|
=+ ^= has
|
|
|
|
%^ cat 7 (sham [%yaki (roll p add) q t])
|
|
|
|
(sham [%tako (roll p add) q t])
|
|
|
|
[p q has t]
|
|
|
|
::
|
|
|
|
++ case-to-date
|
|
|
|
|= [now=@da =case]
|
|
|
|
^- @da
|
|
|
|
:: if the case is already a date, use it.
|
|
|
|
::
|
|
|
|
?: ?=([%da *] case)
|
|
|
|
p.case
|
|
|
|
:: translate other cases to dates
|
|
|
|
::
|
|
|
|
=/ aey (case-to-aeon-before now case)
|
|
|
|
?~ aey `@da`0
|
|
|
|
?: =(0 u.aey) `@da`0
|
|
|
|
t:(aeon-to-yaki u.aey)
|
|
|
|
::
|
|
|
|
:: Reduce a case to an aeon (version number)
|
|
|
|
::
|
|
|
|
:: We produce null if we can't yet reduce the case for whatever resaon
|
|
|
|
:: (usually either the time or aeon hasn't happened yet or the label hasn't
|
|
|
|
:: been created), we produce null.
|
|
|
|
::
|
|
|
|
++ case-to-aeon-before
|
|
|
|
|= [lim=@da lok=case]
|
|
|
|
^- (unit aeon)
|
|
|
|
?- -.lok
|
|
|
|
$da
|
|
|
|
?: (gth p.lok lim) ~
|
|
|
|
|- ^- (unit aeon)
|
|
|
|
?: =(0 let.dom) [~ 0] :: avoid underflow
|
|
|
|
?: %+ gte p.lok
|
|
|
|
=< t
|
|
|
|
~| [%letdom let=let.dom hit=hit.dom hut=(~(run by hut.ran) ,~)]
|
|
|
|
~| [%getdom (~(get by hit.dom) let.dom)]
|
|
|
|
%- aeon-to-yaki
|
|
|
|
let.dom
|
|
|
|
[~ let.dom]
|
|
|
|
$(let.dom (dec let.dom))
|
|
|
|
::
|
|
|
|
$tas (~(get by lab.dom) p.lok)
|
|
|
|
$ud ?:((gth p.lok let.dom) ~ [~ p.lok])
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Convert a map of paths to data into an ankh.
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ map-to-ankh
|
|
|
|
|= hat/(map path (pair lobe cage))
|
|
|
|
^- ankh
|
|
|
|
%+ roll ~(tap by hat)
|
|
|
|
|= {{pat/path lob/lobe zar/cage} ank/ankh}
|
|
|
|
^- ankh
|
|
|
|
?~ pat
|
|
|
|
ank(fil [~ lob zar])
|
|
|
|
=+ nak=(~(get by dir.ank) i.pat)
|
|
|
|
%= ank
|
|
|
|
dir %+ ~(put by dir.ank) i.pat
|
|
|
|
$(pat t.pat, ank (fall nak *ankh))
|
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Update the object store with new blobs.
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ add-blobs
|
|
|
|
|= [new-blobs=(map path blob) old-lat=(map lobe blob)]
|
|
|
|
^- (map lobe blob)
|
|
|
|
%- ~(uni by old-lat)
|
|
|
|
%- malt
|
|
|
|
%+ turn
|
|
|
|
~(tap by new-blobs)
|
|
|
|
|= [=path =blob]
|
|
|
|
[p.blob blob]
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Applies a change list, creating the commit and applying it to the
|
|
|
|
:: current state.
|
|
|
|
::
|
|
|
|
:: Also produces the new data from the commit for convenience.
|
|
|
|
::
|
|
|
|
++ execute-changes
|
|
|
|
|= [wen=@da lem=suba]
|
|
|
|
^- (unit [dome rang])
|
|
|
|
=/ parent
|
|
|
|
?: =(0 let.dom)
|
2019-05-03 04:50:20 +03:00
|
|
|
~
|
2019-05-04 05:24:24 +03:00
|
|
|
[(aeon-to-tako let.dom)]~
|
|
|
|
=/ new-blobs (apply-changes lem)
|
|
|
|
=. lat.ran (add-blobs new-blobs lat.ran)
|
|
|
|
=/ new-lobes (~(run by new-blobs) |=(=blob p.blob))
|
|
|
|
=/ new-yaki (make-yaki parent new-lobes wen)
|
|
|
|
:: if no changes and not first commit or merge, abort
|
|
|
|
?. ?| =(0 let.dom)
|
|
|
|
!=((lent p.new-yaki) 1)
|
|
|
|
!=(q.new-yaki q:(aeon-to-yaki let.dom))
|
|
|
|
==
|
|
|
|
~& %clay-silent
|
|
|
|
~
|
|
|
|
=: let.dom +(let.dom)
|
|
|
|
hit.dom (~(put by hit.dom) +(let.dom) r.new-yaki)
|
|
|
|
hut.ran (~(put by hut.ran) r.new-yaki new-yaki)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
`[dom ran]
|
|
|
|
:: +>.$(ank (map-to-ankh q.yak))
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Applies label to current revision
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ execute-label
|
|
|
|
|= lab=@tas
|
|
|
|
?< (~(has by lab.dom) lab)
|
|
|
|
dom(lab (~(put by lab.dom) lab let.dom))
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Apply a list of changes against the current state and produce the new
|
|
|
|
:: state.
|
|
|
|
::
|
|
|
|
++ apply-changes :: apply-changes
|
|
|
|
|= [change-files=(list [p=path q=misu])]
|
|
|
|
^- (map path blob)
|
|
|
|
=+ ^= old-files :: current state
|
|
|
|
?: =(let.dom 0) :: initial commit
|
|
|
|
~ :: has nothing
|
|
|
|
=< q
|
|
|
|
%- aeon-to-yaki
|
|
|
|
let.dom
|
|
|
|
=; new-files=(map path blob)
|
|
|
|
=+ sar=(silt (turn change-files head)) :: changed paths
|
|
|
|
%+ roll ~(tap by old-files) :: find unchanged
|
|
|
|
=< .(bat new-files)
|
|
|
|
|= [[pax=path gar=lobe] bat=(map path blob)]
|
|
|
|
?: (~(has in sar) pax) :: has update
|
|
|
|
bat
|
|
|
|
%+ ~(put by bat) pax
|
|
|
|
~| [pax gar (lent ~(tap by lat.ran))]
|
|
|
|
(lobe-to-blob gar) :: use original
|
|
|
|
%+ roll change-files
|
|
|
|
|= {{pax/path mys/misu} new-files/(map path blob)}
|
|
|
|
^+ new-files
|
|
|
|
?- -.mys
|
|
|
|
$ins :: insert if not exist
|
|
|
|
?: (~(has by new-files) pax)
|
|
|
|
~|([%ins-new-files pax] !!)
|
|
|
|
?: (~(has by old-files) pax)
|
|
|
|
~|([%ins-old-files pax] !!)
|
|
|
|
%+ ~(put by new-files) pax
|
|
|
|
%- make-direct-blob
|
|
|
|
?: &(?=($mime -.p.mys) =([%hoon ~] (slag (dec (lent pax)) pax)))
|
|
|
|
`page`[%hoon +.+.q.q.p.mys]
|
|
|
|
[p q.q]:p.mys
|
|
|
|
::
|
|
|
|
$del :: delete if exists
|
|
|
|
?> |((~(has by old-files) pax) (~(has by new-files) pax))
|
|
|
|
(~(del by new-files) pax)
|
|
|
|
::
|
|
|
|
$dif :: mutate, must exist
|
|
|
|
=+ ber=(~(get by new-files) pax) :: XX typed
|
|
|
|
=+ her==>((flop pax) ?~(. %$ i))
|
|
|
|
?~ ber
|
|
|
|
=+ har=(~(get by old-files) pax)
|
|
|
|
?~ har !!
|
|
|
|
%+ ~(put by new-files) pax
|
|
|
|
(make-delta-blob p.mys [(lobe-to-mark u.har) u.har] [p q.q]:q.mys)
|
|
|
|
:: XX check vase !evil
|
|
|
|
:: XX of course that's a problem, p.u.ber isn't in rang since it
|
|
|
|
:: was just created. We shouldn't be sending multiple
|
|
|
|
:: diffs
|
|
|
|
:: %+ ~(put by bar) pax
|
|
|
|
:: %^ make-delta-blob p.mys
|
|
|
|
:: [(lobe-to-mark p.u.ber) p.u.ber]
|
|
|
|
:: [p q.q]:q.mys
|
|
|
|
:: :: XX check vase !evil
|
|
|
|
~|([%two-diffs-for-same-file pax] !!)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Traverses parentage and finds all ancestor hashes
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ reachable-takos :: reachable
|
|
|
|
|= p/tako
|
|
|
|
^- (set tako)
|
|
|
|
=+ y=(tako-to-yaki p)
|
|
|
|
%+ roll p.y
|
|
|
|
=< .(s (~(put in *(set tako)) p))
|
|
|
|
|= {q/tako s/(set tako)}
|
|
|
|
?: (~(has in s) q) :: already done
|
|
|
|
s :: hence skip
|
|
|
|
(~(uni in s) ^$(p q)) :: otherwise traverse
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Gets the data at a node.
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: If it's in our ankh (current state cache), we can just produce the
|
|
|
|
:: result. Otherwise, we've got to look up the node at the aeon to get the
|
|
|
|
:: content hash, use that to find the blob, and use the blob to get the
|
|
|
|
:: data. We also special-case the hoon mark for bootstrapping purposes.
|
|
|
|
::
|
|
|
|
++ read-x
|
|
|
|
|= [local=? yon=aeon pax=path]
|
|
|
|
^- (unit (unit (each cage lobe)))
|
|
|
|
?: =(0 yon)
|
|
|
|
[~ ~]
|
|
|
|
=+ tak=(~(get by hit.dom) yon)
|
|
|
|
?~ tak
|
2019-05-03 04:50:20 +03:00
|
|
|
~
|
2019-05-04 05:24:24 +03:00
|
|
|
?: &(local =(yon let.dom))
|
|
|
|
:- ~
|
|
|
|
%+ bind
|
|
|
|
fil.ank:(descend-path:(zu ank.dom) pax)
|
|
|
|
|=(a/{p/lobe q/cage} [%& q.a])
|
|
|
|
=+ yak=(tako-to-yaki u.tak)
|
|
|
|
=+ lob=(~(get by q.yak) pax)
|
|
|
|
?~ lob
|
|
|
|
[~ ~]
|
|
|
|
=+ mar=(lobe-to-mark u.lob)
|
|
|
|
?. ?=($hoon mar)
|
|
|
|
[~ ~ %| u.lob]
|
|
|
|
:^ ~ ~ %&
|
|
|
|
:+ mar [%atom %t ~]
|
|
|
|
|- ^- @t :: (urge cord) would be faster
|
|
|
|
=+ bol=(lobe-to-blob u.lob)
|
|
|
|
?: ?=($direct -.bol)
|
|
|
|
((hard @t) q.q.bol)
|
|
|
|
?> ?=($delta -.bol)
|
|
|
|
=+ txt=$(u.lob q.q.bol)
|
|
|
|
?> ?=($txt-diff p.r.bol)
|
|
|
|
=+ dif=((hard (urge cord)) q.r.bol)
|
|
|
|
=, format
|
|
|
|
=+ pac=(of-wain (lurk:differ (to-wain (cat 3 txt '\0a')) dif))
|
|
|
|
(end 3 (dec (met 3 pac)) pac)
|
|
|
|
::
|
|
|
|
:: Traverse an ankh.
|
|
|
|
::
|
|
|
|
++ zu :: filesystem
|
|
|
|
|= ank/ankh :: filesystem state
|
|
|
|
=| ram/path :: reverse path into
|
|
|
|
|%
|
|
|
|
++ descend :: descend
|
|
|
|
|= lol/@ta
|
|
|
|
^+ +>
|
|
|
|
=+ you=(~(get by dir.ank) lol)
|
|
|
|
+>.$(ram [lol ram], ank ?~(you [~ ~] u.you))
|
|
|
|
::
|
|
|
|
++ descend-path :: descend recursively
|
|
|
|
|= way/path
|
|
|
|
^+ +>
|
|
|
|
?~(way +> $(way t.way, +> (descend i.way)))
|
|
|
|
--
|
2019-05-03 04:50:20 +03:00
|
|
|
--
|
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
:: section 4cA, filesystem logic
|
|
|
|
::
|
|
|
|
:: This core contains the main logic of clay. Besides `++ze`, this directly
|
|
|
|
:: contains the logic for commiting new revisions (local urbits), managing
|
|
|
|
:: and notifying subscribers (reactivity), and pulling and validating content
|
|
|
|
:: (remote urbits).
|
|
|
|
::
|
|
|
|
:: The state includes:
|
|
|
|
::
|
2018-12-13 10:42:15 +03:00
|
|
|
:: -- local urbit `our`
|
2016-11-24 07:25:07 +03:00
|
|
|
:: -- current time `now`
|
|
|
|
:: -- current duct `hen`
|
2019-02-02 00:46:09 +03:00
|
|
|
:: -- scry handler `ski`
|
2018-12-13 10:42:15 +03:00
|
|
|
:: -- all vane state `++raft` (rarely used, except for the object store)
|
2016-11-24 07:25:07 +03:00
|
|
|
:: -- target urbit `her`
|
|
|
|
:: -- target desk `syd`
|
|
|
|
::
|
|
|
|
:: For local desks, `our` == `her` is one of the urbits on our pier. For
|
|
|
|
:: foreign desks, `her` is the urbit the desk is on and `our` is the local
|
|
|
|
:: urbit that's managing the relationship with the foreign urbit. Don't mix
|
|
|
|
:: up those two, or there will be wailing and gnashing of teeth.
|
|
|
|
::
|
2018-12-13 10:42:15 +03:00
|
|
|
:: While setting up `++de`, we check if `our` == `her`. If so, we get
|
|
|
|
:: the desk information from `dos.rom`. Otherwise, we get the rung from
|
|
|
|
:: `hoy` and get the desk information from `rus` in there. In either case,
|
|
|
|
:: we normalize the desk information to a `++rede`, which is all the
|
|
|
|
:: desk-specific data that we utilize in `++de`. Because it's effectively
|
|
|
|
:: a part of the `++de` state, let's look at what we've got:
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: -- `lim` is the most recent date we're confident we have all the
|
|
|
|
:: information for. For local desks, this is always `now`. For foreign
|
|
|
|
:: desks, this is the last time we got a full update from the foreign
|
|
|
|
:: urbit.
|
|
|
|
:: -- `ref` is a possible request manager. For local desks, this is null.
|
|
|
|
:: For foreign desks, this keeps track of all pending foreign requests
|
|
|
|
:: plus a cache of the responses to previous requests.
|
|
|
|
:: -- `qyx` is the set of subscriptions, with listening ducts. These
|
|
|
|
:: subscriptions exist only until they've been filled.
|
|
|
|
:: -- `dom` is the actual state of the filetree. Since this is used almost
|
|
|
|
:: exclusively in `++ze`, we describe it there.
|
|
|
|
:: -- `dok` is a possible set of outstanding requests to ford to perform
|
|
|
|
:: various tasks on commit. This is null iff we're not in the middle of
|
|
|
|
:: a commit.
|
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
++ de :: per desk
|
2019-02-02 00:46:09 +03:00
|
|
|
|= [our=ship now=@da ski=sley hen=duct raft]
|
2018-12-13 10:42:15 +03:00
|
|
|
|= [her=ship syd=desk]
|
|
|
|
:: XX ruf=raft crashes in the compiler
|
|
|
|
::
|
2019-02-02 00:46:09 +03:00
|
|
|
=* ruf |4.+6.^$
|
2018-12-13 10:42:15 +03:00
|
|
|
::
|
|
|
|
=+ ^- [hun=(unit duct) rede]
|
|
|
|
?. =(our her)
|
|
|
|
:: no duct, foreign +rede or default
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:- ~
|
2018-12-13 10:42:15 +03:00
|
|
|
=/ rus rus:(fall (~(get by hoy.ruf) her) *rung)
|
|
|
|
%+ fall (~(get by rus) syd)
|
2019-05-04 05:24:24 +03:00
|
|
|
[lim=~2000.1.1 ref=`*rind qyx=~ dom=*dome per=~ pew=~]
|
2018-12-13 10:42:15 +03:00
|
|
|
:: administrative duct, domestic +rede
|
|
|
|
::
|
|
|
|
:- `hun.rom.ruf
|
|
|
|
=/ jod (fall (~(get by dos.rom.ruf) syd) *dojo)
|
2019-05-04 05:24:24 +03:00
|
|
|
[lim=now ref=~ [qyx dom per pew]:jod]
|
2018-12-13 10:42:15 +03:00
|
|
|
::
|
|
|
|
=* red=rede ->
|
2016-11-24 07:25:07 +03:00
|
|
|
=| mow/(list move)
|
|
|
|
|%
|
|
|
|
++ abet :: resolve
|
2018-12-13 10:42:15 +03:00
|
|
|
^- [(list move) raft]
|
|
|
|
:- (flop mow)
|
|
|
|
?. =(our her)
|
|
|
|
:: save foreign +rede
|
|
|
|
::
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ run (fall (~(get by hoy.ruf) her) *rung)
|
|
|
|
=? rit.run =(0 rit.run)
|
|
|
|
(fall (rift-scry her) *rift)
|
|
|
|
=/ rug (~(put by rus.run) syd red)
|
|
|
|
ruf(hoy (~(put by hoy.ruf) her run(rus rug)))
|
2018-12-13 10:42:15 +03:00
|
|
|
:: save domestic +room
|
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
%= ruf
|
|
|
|
hun.rom (need hun)
|
2019-05-04 05:24:24 +03:00
|
|
|
dos.rom (~(put by dos.rom.ruf) syd [qyx dom per pew]:red)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: +rift-scry: for a +rift
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ rift-scry
|
|
|
|
|= who=ship
|
|
|
|
^- (unit rift)
|
|
|
|
=; rit
|
|
|
|
?~(rit ~ u.rit)
|
|
|
|
;; (unit (unit rift))
|
|
|
|
%- (sloy-light ski)
|
|
|
|
=/ pur=spur
|
|
|
|
/(scot %p who)
|
|
|
|
[[151 %noun] %j our %rift da+now pur]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Handle `%sing` requests
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ aver
|
|
|
|
|= {for/(unit ship) mun/mood}
|
|
|
|
^- (unit (unit (each cage lobe)))
|
|
|
|
=+ ezy=?~(ref ~ (~(get by haw.u.ref) mun))
|
|
|
|
?^ ezy
|
|
|
|
`(bind u.ezy |=(a/cage [%& a]))
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ nao=(case-to-aeon q.mun)
|
2019-05-03 04:50:20 +03:00
|
|
|
:: ~& [%aver-mun nao [%from syd lim q.mun]]
|
|
|
|
?~(nao ~ (read-at-aeon:ze for u.nao mun))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Queue a move.
|
2018-02-12 18:02:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ emit
|
|
|
|
|= mof/move
|
|
|
|
%_(+> mow [mof mow])
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Queue a list of moves
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ emil
|
|
|
|
|= mof/(list move)
|
|
|
|
%_(+> mow (weld mof mow))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Produce either null or a result along a subscription.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Producing null means subscription has been completed or cancelled.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ balk
|
|
|
|
|= {hen/duct cay/(unit (each cage lobe)) mun/mood}
|
2016-11-24 07:25:07 +03:00
|
|
|
^+ +>
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ cay (blub hen)
|
|
|
|
(blab hen mun u.cay)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Set timer.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ bait
|
|
|
|
|= {hen/duct tym/@da}
|
|
|
|
(emit hen %pass /tyme %b %wait tym)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Cancel timer.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ best
|
|
|
|
|= {hen/duct tym/@da}
|
|
|
|
(emit hen %pass /tyme %b %rest tym)
|
|
|
|
::
|
|
|
|
:: Give subscription result.
|
|
|
|
::
|
|
|
|
:: Result can be either a direct result (cage) or a lobe of a result. In
|
|
|
|
:: the latter case we fetch the data at the lobe and produce that.
|
|
|
|
::
|
|
|
|
++ blab
|
|
|
|
|= {hen/duct mun/mood dat/(each cage lobe)}
|
|
|
|
^+ +>
|
|
|
|
?: ?=(%& -.dat)
|
|
|
|
(emit hen %slip %b %drip !>([%writ ~ [p.mun q.mun syd] r.mun p.dat]))
|
|
|
|
%- emit
|
|
|
|
:* hen %pass [%blab p.mun (scot q.mun) syd r.mun]
|
|
|
|
%f %build live=%.n %pin
|
|
|
|
(case-to-date q.mun)
|
2019-05-04 05:24:24 +03:00
|
|
|
(lobe-to-schematic [her syd] r.mun p.dat)
|
2019-05-02 04:21:32 +03:00
|
|
|
==
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ case-to-date (cury case-to-date:util lim)
|
|
|
|
++ case-to-aeon (cury case-to-aeon-before:util lim)
|
|
|
|
++ lobe-to-schematic (cury lobe-to-schematic-p:util ?=(~ ref))
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ blas
|
|
|
|
|= {hen/duct das/(set mood)}
|
2019-05-02 04:21:32 +03:00
|
|
|
^+ +>
|
2019-05-03 04:50:20 +03:00
|
|
|
?> ?=(^ das)
|
|
|
|
:: translate the case to a date
|
|
|
|
::
|
|
|
|
=/ cas [%da (case-to-date q.n.das)]
|
|
|
|
=- (emit hen %give %wris cas -)
|
|
|
|
(~(run in `(set mood)`das) |=(m/mood [p.m r.m]))
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Give next step in a subscription.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ bleb
|
|
|
|
|= {hen/duct ins/@ud hip/(unit (pair aeon aeon))}
|
2019-05-02 04:21:32 +03:00
|
|
|
^+ +>
|
2019-05-03 04:50:20 +03:00
|
|
|
%^ blab hen [%w [%ud ins] ~]
|
|
|
|
:- %&
|
|
|
|
?~ hip
|
|
|
|
[%null [%atom %n ~] ~]
|
|
|
|
[%nako !>((make-nako:ze u.hip))]
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Tell subscriber that subscription is done.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ blub
|
|
|
|
|= hen/duct
|
|
|
|
(emit hen %slip %b %drip !>([%writ ~]))
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Lifts a function so that a single result can be fanned out over a set of
|
|
|
|
:: subscriber ducts.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Thus, `((duct-lift func) subs arg)` runs `(func sub arg)` for each `sub`
|
|
|
|
:: in `subs`.
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ duct-lift
|
|
|
|
|* send/_|=({duct *} ..duct-lift)
|
|
|
|
|= {a/(set duct) arg/_+<+.send} ^+ ..duct-lift
|
|
|
|
=+ all=~(tap by a)
|
|
|
|
|- ^+ ..duct-lift
|
|
|
|
?~ all ..duct-lift
|
|
|
|
=. +>.send ..duct-lift
|
|
|
|
$(all t.all, duct-lift (send i.all arg))
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ blub-all (duct-lift |=({a/duct ~} (blub a))) :: lifted ++blub
|
|
|
|
++ blab-all (duct-lift blab) :: lifted ++blab
|
|
|
|
++ blas-all (duct-lift blas) :: lifted ++blas
|
|
|
|
++ balk-all (duct-lift balk) :: lifted ++balk
|
|
|
|
++ bleb-all (duct-lift bleb) :: lifted ++bleb
|
|
|
|
::
|
|
|
|
:: Transfer a request to another ship's clay.
|
|
|
|
::
|
|
|
|
++ send-over-ames
|
|
|
|
|= {a/duct b/path c/ship d/{p/@ud q/riff}}
|
|
|
|
(emit a %pass b %a %want c [%c %question p.q.d (scot %ud p.d) ~] q.d)
|
|
|
|
::
|
|
|
|
:: Create a request that cannot be filled immediately.
|
|
|
|
::
|
|
|
|
:: If it's a local request, we just put in in `qyx`, setting a timer if it's
|
|
|
|
:: waiting for a particular time. If it's a foreign request, we add it to
|
|
|
|
:: our request manager (ref, which is a ++rind) and make the request to the
|
|
|
|
:: foreign ship.
|
|
|
|
::
|
|
|
|
++ duce :: produce request
|
|
|
|
|= wov/wove
|
|
|
|
^+ +>
|
|
|
|
=. wov (dedupe wov)
|
|
|
|
=. qyx (~(put ju qyx) wov hen)
|
|
|
|
?~ ref
|
|
|
|
(mabe q.wov |=(@da (bait hen +<)))
|
|
|
|
|- ^+ +>+.$
|
|
|
|
=+ rav=(reve q.wov)
|
|
|
|
=+ ^= vaw ^- rave
|
|
|
|
?. ?=({$sing $v *} rav) rav
|
|
|
|
[%many %| [%ud let.dom] `case`q.p.rav r.p.rav]
|
|
|
|
=+ inx=nix.u.ref
|
|
|
|
=. +>+.$
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
(send-over-ames hen [(scot %ud inx) ~] her inx syd ~ vaw)
|
|
|
|
%= +>+.$
|
|
|
|
nix.u.ref +(nix.u.ref)
|
|
|
|
bom.u.ref (~(put by bom.u.ref) inx [hen vaw])
|
|
|
|
fod.u.ref (~(put by fod.u.ref) hen inx)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: If a similar request exists, switch to the existing request.
|
|
|
|
::
|
|
|
|
:: "Similar" requests are those %next and %many requests which are the same
|
|
|
|
:: up to starting case, but we're already after the starting case. This
|
|
|
|
:: stacks later requests for something onto the same request so that they
|
|
|
|
:: all get filled at once.
|
|
|
|
::
|
|
|
|
++ dedupe :: find existing alias
|
|
|
|
|= wov/wove
|
|
|
|
^- wove
|
|
|
|
=; won/(unit wove) (fall won wov)
|
|
|
|
=* rov q.wov
|
|
|
|
?- -.rov
|
|
|
|
$sing ~
|
|
|
|
$next
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon q.p.rov)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ aey ~
|
|
|
|
%- ~(rep in ~(key by qyx))
|
|
|
|
|= {haw/wove res/(unit wove)}
|
|
|
|
?^ res res
|
|
|
|
?. =(p.wov p.haw) ~
|
|
|
|
=* hav q.haw
|
|
|
|
=- ?:(- `haw ~)
|
|
|
|
?& ?=($next -.hav)
|
|
|
|
=(p.hav p.rov(q q.p.hav))
|
|
|
|
::
|
|
|
|
:: only a match if this request is before
|
|
|
|
:: or at our starting case.
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ hay=(case-to-aeon q.p.hav)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~(hay | (lte u.hay u.aey))
|
2019-05-02 04:21:32 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
|
|
|
$mult
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon p.p.rov)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ aey ~
|
|
|
|
%- ~(rep in ~(key by qyx))
|
|
|
|
|= {haw/wove res/(unit wove)}
|
|
|
|
?^ res res
|
|
|
|
?. =(p.wov p.haw) ~
|
|
|
|
=* hav q.haw
|
|
|
|
=- ?:(- `haw ~)
|
|
|
|
?& ?=($mult -.hav)
|
|
|
|
=(p.hav p.rov(p p.p.hav))
|
|
|
|
::
|
|
|
|
:: only a match if this request is before
|
|
|
|
:: or at our starting case, and it has been
|
|
|
|
:: tested at least that far.
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ hay=(case-to-aeon p.p.hav)
|
2019-05-03 04:50:20 +03:00
|
|
|
?& ?=(^ hay)
|
|
|
|
(lte u.hay u.aey)
|
|
|
|
?=(^ q.hav)
|
|
|
|
(gte u.q.hav u.aey)
|
|
|
|
==
|
2019-05-02 04:21:32 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
::
|
|
|
|
$many
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon p.q.rov)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ aey ~
|
|
|
|
%- ~(rep in ~(key by qyx))
|
|
|
|
|= {haw/wove res/(unit wove)}
|
|
|
|
?^ res res
|
|
|
|
?. =(p.wov p.haw) ~
|
|
|
|
=* hav q.haw
|
|
|
|
=- ?:(- `haw ~)
|
|
|
|
?& ?=($many -.hav)
|
|
|
|
=(hav rov(p.q p.q.hav))
|
|
|
|
::
|
|
|
|
:: only a match if this request is before
|
|
|
|
:: or at our starting case.
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ hay=(case-to-aeon p.q.hav)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~(hay | (lte u.hay u.aey))
|
|
|
|
==
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Initializes a new mount point.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ mont
|
|
|
|
|= {pot/term bem/beam}
|
|
|
|
^+ +>
|
|
|
|
=+ pax=s.bem
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ cas=(need (case-to-aeon r.bem))
|
2019-05-03 04:50:20 +03:00
|
|
|
=+ can=(turn ~(tap by q:(aeon-to-yaki:ze cas)) head)
|
|
|
|
=+ mus=(skim can |=(paf/path =(pax (scag (lent pax) paf))))
|
|
|
|
?~ mus
|
|
|
|
+>.$
|
|
|
|
%- emit
|
|
|
|
^- move
|
|
|
|
:* hen %pass [%ergoing (scot %p her) syd ~] %f
|
|
|
|
%build live=%.n %list
|
|
|
|
^- (list schematic:ford)
|
|
|
|
%+ turn `(list path)`mus
|
|
|
|
|= a/path
|
|
|
|
:- [%$ %path !>(a)]
|
|
|
|
:^ %cast [our %home] %mime
|
|
|
|
=+ (need (need (read-x:ze cas a)))
|
|
|
|
?: ?=(%& -<)
|
|
|
|
[%$ p.-]
|
2019-05-04 05:24:24 +03:00
|
|
|
(lobe-to-schematic [her syd] a p.-)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Set permissions for a node.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ perm
|
|
|
|
|= {pax/path rit/rite}
|
|
|
|
^+ +>
|
|
|
|
=/ mis/(set @ta)
|
|
|
|
%+ roll
|
|
|
|
=- ~(tap in -)
|
|
|
|
?- -.rit
|
|
|
|
$r who:(fall red.rit *rule)
|
|
|
|
$w who:(fall wit.rit *rule)
|
|
|
|
$rw (~(uni in who:(fall red.rit *rule)) who:(fall wit.rit *rule))
|
|
|
|
==
|
|
|
|
|= {w/whom s/(set @ta)}
|
|
|
|
?: |(?=(%& -.w) (~(has by cez) p.w)) s
|
|
|
|
(~(put in s) p.w)
|
|
|
|
?^ mis
|
|
|
|
=- (emit hen %give %mack `[%leaf "No such group(s): {-}"]~)
|
|
|
|
%+ roll ~(tap in `(set @ta)`mis)
|
|
|
|
|= {g/@ta t/tape}
|
|
|
|
?~ t (trip g)
|
|
|
|
:(weld t ", " (trip g))
|
|
|
|
=< (emit hen %give %mack ~)
|
|
|
|
?- -.rit
|
|
|
|
$r wake(per (put-perm per pax red.rit))
|
|
|
|
$w wake(pew (put-perm pew pax wit.rit))
|
|
|
|
$rw wake(per (put-perm per pax red.rit), pew (put-perm pew pax wit.rit))
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ put-perm
|
|
|
|
|= {pes/regs pax/path new/(unit rule)}
|
|
|
|
?~ new (~(del by pes) pax)
|
|
|
|
(~(put by pes) pax u.new)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Remove a group from all rules.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ forget-crew
|
|
|
|
|= nom/@ta
|
|
|
|
%= +>
|
|
|
|
per (forget-crew-in nom per)
|
|
|
|
pew (forget-crew-in nom pew)
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ forget-crew-in
|
|
|
|
|= {nom/@ta pes/regs}
|
|
|
|
%- ~(run by pes)
|
|
|
|
|= r/rule
|
|
|
|
r(who (~(del in who.r) |+nom))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Cancel a request.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: For local requests, we just remove it from `qyx`. For foreign requests,
|
|
|
|
:: we remove it from `ref` and tell the foreign ship to cancel as well.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ cancel-request :: release request
|
|
|
|
^+ .
|
|
|
|
=^ wos/(list wove) qyx
|
|
|
|
:_ (~(run by qyx) |=(a/(set duct) (~(del in a) hen)))
|
|
|
|
%- ~(rep by qyx)
|
|
|
|
|= {{a/wove b/(set duct)} c/(list wove)}
|
|
|
|
?.((~(has in b) hen) c [a c])
|
|
|
|
?~ ref
|
|
|
|
=> .(ref `(unit rind)`ref) :: XX TMI
|
|
|
|
?: =(~ wos) + :: XX handle?
|
|
|
|
|- ^+ +>
|
|
|
|
?~ wos +>
|
|
|
|
$(wos t.wos, +> (mabe q.i.wos |=(@da (best hen +<))))
|
|
|
|
^+ ..cancel-request
|
|
|
|
=+ nux=(~(get by fod.u.ref) hen)
|
|
|
|
?~ nux ..cancel-request
|
|
|
|
=: fod.u.ref (~(del by fod.u.ref) hen)
|
|
|
|
bom.u.ref (~(del by bom.u.ref) u.nux)
|
|
|
|
==
|
|
|
|
(send-over-ames hen [(scot %ud u.nux) ~] her u.nux syd ~)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Handles a request.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: `%sing` requests are handled by ++aver. `%next` requests are handled by
|
|
|
|
:: running ++aver at the given case, and then subsequent cases until we find
|
|
|
|
:: a case where the two results aren't equivalent. If it hasn't happened
|
|
|
|
:: yet, we wait. `%many` requests are handled by producing as much as we can
|
|
|
|
:: and then waiting if the subscription range extends into the future.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
++ start-request
|
|
|
|
|= {for/(unit ship) rav/rave}
|
|
|
|
^+ +>
|
|
|
|
?- -.rav
|
|
|
|
$sing
|
|
|
|
=+ ver=(aver for p.rav)
|
|
|
|
?~ ver
|
|
|
|
(duce for rav)
|
|
|
|
?~ u.ver
|
|
|
|
(blub hen)
|
|
|
|
(blab hen p.rav u.u.ver)
|
|
|
|
::
|
|
|
|
:: for %mult and %next, get the data at the specified case, then go forward
|
|
|
|
:: in time until we find a change (as long as we have no unknowns).
|
|
|
|
:: if we find no change, store request for later.
|
|
|
|
:: %next is just %mult with one path, so we pretend %next = %mult here.
|
|
|
|
?($next $mult)
|
|
|
|
|^
|
|
|
|
=+ cas=?:(?=($next -.rav) q.p.rav p.p.rav)
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon cas)
|
2019-05-03 04:50:20 +03:00
|
|
|
:: if the requested case is in the future, we can't know anything yet.
|
|
|
|
?~ aey (store ~ ~ ~)
|
|
|
|
=+ old=(read-all-at cas)
|
|
|
|
=+ yon=+(u.aey)
|
|
|
|
|- ^+ ..start-request
|
|
|
|
:: if we need future revisions to look for change, wait.
|
|
|
|
?: (gth yon let.dom)
|
|
|
|
(store `yon old ~)
|
|
|
|
=+ new=(read-all-at [%ud yon])
|
|
|
|
:: if we don't know everything now, store the request for later.
|
|
|
|
?. &((levy ~(tap by old) know) (levy ~(tap by new) know))
|
|
|
|
(store `yon old new)
|
|
|
|
:: if we do know everything now, compare old and new.
|
|
|
|
:: if there are differences, send response. if not, try next aeon.
|
|
|
|
=; res
|
|
|
|
?~ res $(yon +(yon))
|
|
|
|
(respond res)
|
|
|
|
%+ roll ~(tap by old)
|
|
|
|
|= $: {{car/care pax/path} ole/cach}
|
|
|
|
res/(map mood (each cage lobe))
|
|
|
|
==
|
|
|
|
=+ neu=(~(got by new) car pax)
|
|
|
|
?< |(?=(~ ole) ?=(~ neu))
|
|
|
|
=- ?~(- res (~(put by res) u.-))
|
|
|
|
^- (unit (pair mood (each cage lobe)))
|
|
|
|
=+ mod=[car [%ud yon] pax]
|
|
|
|
?~ u.ole
|
|
|
|
?~ u.neu ~ :: not added
|
|
|
|
`[mod u.u.neu] :: added
|
|
|
|
?~ u.neu
|
|
|
|
`[mod [%& %null [%atom %n ~] ~]] :: deleted
|
|
|
|
?: (equivalent-data:ze u.u.neu u.u.ole) ~ :: unchanged
|
|
|
|
`[mod u.u.neu] :: changed
|
|
|
|
::
|
|
|
|
++ store :: check again later
|
|
|
|
|= $: nex/(unit aeon)
|
|
|
|
old/(map (pair care path) cach)
|
|
|
|
new/(map (pair care path) cach)
|
|
|
|
==
|
|
|
|
^+ ..start-request
|
|
|
|
%+ duce for
|
|
|
|
^- rove
|
|
|
|
?: ?=($mult -.rav)
|
|
|
|
[-.rav p.rav nex old new]
|
|
|
|
:^ -.rav p.rav nex
|
|
|
|
=+ ole=~(tap by old)
|
|
|
|
?> (lte (lent ole) 1)
|
|
|
|
?~ ole ~
|
|
|
|
q:(snag 0 `(list (pair (pair care path) cach))`ole)
|
|
|
|
::
|
|
|
|
++ respond :: send changes
|
|
|
|
|= res/(map mood (each cage lobe))
|
|
|
|
^+ ..start-request
|
|
|
|
?: ?=($mult -.rav) (blas hen ~(key by res))
|
|
|
|
?> ?=({* ~ ~} res)
|
|
|
|
(blab hen n.res)
|
|
|
|
::
|
|
|
|
++ know |=({(pair care path) c/cach} ?=(^ c)) :: know about file
|
|
|
|
::
|
|
|
|
++ read-all-at :: files at case, maybe
|
|
|
|
|= cas/case
|
|
|
|
%- ~(gas by *(map (pair care path) cach))
|
|
|
|
=/ req/(set (pair care path))
|
|
|
|
?: ?=($mult -.rav) q.p.rav
|
|
|
|
[[p.p.rav r.p.rav] ~ ~]
|
|
|
|
%+ turn ~(tap by req)
|
|
|
|
|= {c/care p/path}
|
|
|
|
^- (pair (pair care path) cach)
|
|
|
|
[[c p] (aver for c cas p)]
|
|
|
|
--
|
|
|
|
::
|
|
|
|
$many
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ nab=(case-to-aeon p.q.rav)
|
2019-05-03 04:50:20 +03:00
|
|
|
?~ nab
|
2019-05-04 05:24:24 +03:00
|
|
|
?> =(~ (case-to-aeon q.q.rav))
|
2019-05-03 04:50:20 +03:00
|
|
|
(duce for [- p q ~]:rav)
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ huy=(case-to-aeon q.q.rav)
|
2019-05-03 04:50:20 +03:00
|
|
|
?: &(?=(^ huy) |((lth u.huy u.nab) &(=(0 u.huy) =(0 u.nab))))
|
|
|
|
(blub hen)
|
|
|
|
=+ top=?~(huy let.dom u.huy)
|
|
|
|
=+ ear=(lobes-at-path:ze for top r.q.rav)
|
|
|
|
=. +>.$
|
|
|
|
(bleb hen u.nab ?:(p.rav ~ `[u.nab top]))
|
|
|
|
?^ huy
|
|
|
|
(blub hen)
|
|
|
|
=+ ^= ptr ^- case
|
|
|
|
[%ud +(let.dom)]
|
|
|
|
(duce for `rove`[%many p.rav [ptr q.q.rav r.q.rav] ear])
|
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Continue committing
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ take-commit
|
2019-05-03 04:50:20 +03:00
|
|
|
|= =sign
|
|
|
|
^+ +>
|
|
|
|
?~ act
|
|
|
|
~|(%no-active-write !!)
|
2019-05-04 05:24:24 +03:00
|
|
|
?. ?=(%commit -.cad.u.act)
|
|
|
|
~|(%active-not-write !!)
|
|
|
|
=/ c-res (com.cad.u.act now ran sign)
|
2019-05-03 04:50:20 +03:00
|
|
|
=. +>.$
|
2019-05-04 05:24:24 +03:00
|
|
|
=< ?>(?=([~ * * * %commit *] act) .) :: TMI
|
2019-05-03 04:50:20 +03:00
|
|
|
%- emil
|
|
|
|
%+ turn notes.c-res
|
|
|
|
|= =note
|
2019-05-04 05:24:24 +03:00
|
|
|
[hen %pass /commit/[syd] note]
|
2019-05-03 04:50:20 +03:00
|
|
|
=. mos.u.act
|
|
|
|
(weld mos.u.act effects.c-res)
|
|
|
|
?- -.next.c-res
|
|
|
|
%wait +>.$
|
2019-05-11 00:51:37 +03:00
|
|
|
%cont $(com.cad.u.act self.next.c-res, sign [%y %init-clad ~])
|
2019-05-04 05:24:24 +03:00
|
|
|
%fail (fail-commit err.next.c-res)
|
|
|
|
%done (done-commit mos.u.act value.next.c-res)
|
2019-05-03 04:50:20 +03:00
|
|
|
==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Don't release effects or apply state changes; print error
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ fail-commit
|
|
|
|
|= err=(pair term tang)
|
2019-05-03 04:50:20 +03:00
|
|
|
^+ +>
|
2019-05-04 05:24:24 +03:00
|
|
|
=? +>.$ ?=(^ q.err)
|
2019-05-03 04:50:20 +03:00
|
|
|
%- emit
|
|
|
|
:* (need hun) %give %note
|
|
|
|
'!' %rose [" " "" ""]
|
2019-05-04 05:24:24 +03:00
|
|
|
leaf+"clay commit error"
|
|
|
|
leaf+(trip p.err)
|
|
|
|
q.err
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
finish-write
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Release effects and apply state changes
|
2019-05-02 04:21:32 +03:00
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ done-commit
|
2019-05-03 04:50:20 +03:00
|
|
|
|= [mos=(list move) =dome =rang]
|
|
|
|
^+ +>
|
|
|
|
=. +>.$ (emil mos)
|
|
|
|
=. +>.$ wake
|
|
|
|
=: dom dome
|
|
|
|
hut.ran (~(uni by hut.ran) hut.rang)
|
|
|
|
lat.ran (~(uni by lat.ran) lat.rang)
|
2019-05-02 04:21:32 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
finish-write
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
:: Continue merging
|
|
|
|
::
|
|
|
|
++ take-merge
|
|
|
|
|= =sign
|
|
|
|
^+ +>
|
|
|
|
?~ act
|
|
|
|
~|(%no-active-write !!)
|
|
|
|
?. ?=(%merge -.cad.u.act)
|
|
|
|
~|(%active-not-write !!)
|
|
|
|
=/ c-res (mer.cad.u.act now ran sign)
|
|
|
|
=. +>.$
|
|
|
|
=< ?>(?=([~ * * * %merge *] act) .) :: TMI
|
|
|
|
%- emil
|
|
|
|
%+ turn notes.c-res
|
|
|
|
|= =note
|
|
|
|
[hen %pass /merge/[syd] note]
|
|
|
|
=. mos.u.act
|
|
|
|
(weld mos.u.act effects.c-res)
|
|
|
|
?- -.next.c-res
|
|
|
|
%wait +>.$
|
2019-05-11 00:51:37 +03:00
|
|
|
%cont $(mer.cad.u.act self.next.c-res, sign [%y %init-clad ~])
|
2019-05-04 05:24:24 +03:00
|
|
|
%fail (fail-merge err.next.c-res)
|
|
|
|
%done (done-merge mos.u.act value.next.c-res)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Don't release effects or apply state changes; print error
|
|
|
|
::
|
|
|
|
++ fail-merge
|
|
|
|
|= err=(pair term tang)
|
|
|
|
^+ +>
|
|
|
|
=. +>.$
|
|
|
|
(emit [hen %give %mere %| err])
|
|
|
|
finish-write
|
|
|
|
::
|
|
|
|
:: Release effects and apply state changes
|
|
|
|
::
|
|
|
|
++ done-merge
|
|
|
|
|= [mos=(list move) conflicts=(set path) =dome =rang]
|
|
|
|
^+ +>
|
|
|
|
=. +>.$ (emil mos)
|
|
|
|
=. +>.$ (emit [hen %give %mere %& conflicts])
|
|
|
|
=. +>.$ wake
|
|
|
|
=: dom dome
|
|
|
|
hut.ran (~(uni by hut.ran) hut.rang)
|
|
|
|
lat.ran (~(uni by lat.ran) lat.rang)
|
|
|
|
==
|
|
|
|
finish-write
|
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
:: Start next item in write queue
|
|
|
|
::
|
|
|
|
++ finish-write
|
|
|
|
^+ .
|
|
|
|
=. act ~
|
|
|
|
?~ cue
|
|
|
|
.
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ =duct -:~(top to cue)
|
|
|
|
(emit [duct %pass /queued-request %b %wait now])
|
|
|
|
::
|
|
|
|
:: Send new data to unix.
|
|
|
|
::
|
|
|
|
:: Combine the paths in mim in dok and the result of the ford call in
|
|
|
|
:: ++take-patch to create a list of nodes that need to be sent to unix (in
|
|
|
|
:: an %ergo card) to keep unix up-to-date. Send this to unix.
|
|
|
|
::
|
|
|
|
++ take-ergo
|
|
|
|
|= res/made-result:ford
|
|
|
|
^+ +>
|
|
|
|
?: ?=([%incomplete *] res)
|
|
|
|
~& %bad-take-ergo
|
|
|
|
+>.$
|
|
|
|
:: (print-to-dill '!' %rose [" " "" ""] leaf+"clay ergo failed" tang.res)
|
|
|
|
?. ?=([%complete %success *] res)
|
|
|
|
~& %bad-take-ergo-2
|
|
|
|
+>.$
|
|
|
|
:: =* message message.build-result.res
|
|
|
|
:: (print-to-dill '!' %rose [" " "" ""] leaf+"clay ergo failed" message)
|
|
|
|
?~ hez ~|(%no-sync-duct !!)
|
|
|
|
=+ ^- can/(map path (unit mime))
|
|
|
|
%- malt ^- mode
|
|
|
|
%+ turn (made-result-to-cages:util res)
|
|
|
|
|= {pax/cage mim/cage}
|
|
|
|
?. ?=($path p.pax)
|
|
|
|
~|(%ergo-bad-path-mark !!)
|
|
|
|
:- ((hard path) q.q.pax)
|
|
|
|
?. ?=($mime p.mim)
|
|
|
|
~
|
|
|
|
`((hard mime) q.q.mim)
|
|
|
|
=+ mus=(must-ergo:util our syd mon (turn ~(tap by can) head))
|
|
|
|
%- emil
|
|
|
|
%+ turn ~(tap by mus)
|
|
|
|
|= {pot/term len/@ud pak/(set path)}
|
|
|
|
:* u.hez %give %ergo pot
|
|
|
|
%+ turn ~(tap in pak)
|
|
|
|
|= pax/path
|
|
|
|
[(slag len pax) (~(got by can) pax)]
|
|
|
|
==
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-02 04:21:32 +03:00
|
|
|
:: Handle the result of the ford call in ++checkout-ankh.
|
|
|
|
::
|
|
|
|
:: We apply the changes by calling ++execute-changes, then we convert the
|
|
|
|
:: result of the ford call from ++checkout-ankh into a map of paths to data
|
|
|
|
:: for the current aeon of this desk. We turn this into an ankh and store
|
|
|
|
:: it to our state. Finally, we choose which paths need to be synced to
|
|
|
|
:: unix, and convert the data at those paths to mime (except those paths
|
|
|
|
:: which were added originally as mime, because we still have that stored in
|
|
|
|
:: mim in dok). The result is handled in ++take-ergo.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
|
|
|
::
|
|
|
|
:: Send new data to unix.
|
|
|
|
::
|
|
|
|
:: Combine the paths in mim in dok and the result of the ford call in
|
|
|
|
:: ++take-patch to create a list of nodes that need to be sent to unix (in
|
|
|
|
:: an %ergo card) to keep unix up-to-date. Send this to unix.
|
|
|
|
::
|
|
|
|
:: XX move doc
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: Called when a foreign ship answers one of our requests.
|
|
|
|
::
|
|
|
|
:: After updating ref (our request manager), we handle %x, %w, and %y
|
|
|
|
:: responses. For %x, we call ++validate-x to validate the type of the
|
|
|
|
:: response. For %y, we coerce the result to an arch.
|
|
|
|
::
|
|
|
|
:: For %w, we check to see if it's a @ud response (e.g. for
|
|
|
|
:: cw+//~sampel-sipnym/desk/~time-or-label). If so, it's easy. Otherwise,
|
|
|
|
:: we look up our subscription request, then assert the response was a nako.
|
|
|
|
:: If this is the first update for a desk, we assume everything's well-typed
|
|
|
|
:: and call ++apply-foreign-update directly. Otherwise, we call
|
|
|
|
:: ++validate-plops to verify that the data we're getting is well typed.
|
|
|
|
::
|
|
|
|
:: Be careful to call ++wake if/when necessary (i.e. when the state changes
|
|
|
|
:: enough that a subscription could be filled). Every case must call it
|
|
|
|
:: individually.
|
|
|
|
::
|
|
|
|
++ take-foreign-update :: external change
|
|
|
|
|= {inx/@ud rut/(unit rand)}
|
|
|
|
^+ +>
|
|
|
|
?> ?=(^ ref)
|
|
|
|
|- ^+ +>+.$
|
|
|
|
=+ ruv=(~(get by bom.u.ref) inx)
|
|
|
|
?~ ruv +>+.$
|
2018-03-19 07:18:20 +03:00
|
|
|
=> ?. |(?=(~ rut) ?=($sing -.q.u.ruv)) .
|
2016-11-24 07:25:07 +03:00
|
|
|
%_ .
|
|
|
|
bom.u.ref (~(del by bom.u.ref) inx)
|
|
|
|
fod.u.ref (~(del by fod.u.ref) p.u.ruv)
|
|
|
|
==
|
|
|
|
?~ rut
|
|
|
|
=+ rav=`rave`q.u.ruv
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
%_ wake
|
|
|
|
lim
|
|
|
|
?.(&(?=($many -.rav) ?=($da -.q.q.rav)) lim `@da`p.q.q.rav)
|
|
|
|
::
|
|
|
|
haw.u.ref
|
|
|
|
?. ?=($sing -.rav) haw.u.ref
|
|
|
|
(~(put by haw.u.ref) p.rav ~)
|
|
|
|
==
|
|
|
|
?- p.p.u.rut
|
2017-01-04 10:08:40 +03:00
|
|
|
$d
|
|
|
|
~| %totally-temporary-error-please-replace-me
|
2018-02-07 23:11:25 +03:00
|
|
|
!!
|
|
|
|
$p
|
|
|
|
~| %requesting-foreign-permissions-is-invalid
|
2018-08-22 22:56:46 +03:00
|
|
|
!!
|
|
|
|
$t
|
|
|
|
~| %requesting-foreign-directory-is-vaporware
|
2017-01-04 10:08:40 +03:00
|
|
|
!!
|
2016-11-24 07:25:07 +03:00
|
|
|
$u
|
|
|
|
~| %im-thinkin-its-prolly-a-bad-idea-to-request-rang-over-the-network
|
|
|
|
!!
|
|
|
|
::
|
|
|
|
$v
|
|
|
|
~| %weird-we-shouldnt-get-a-dome-request-over-the-network
|
|
|
|
!!
|
|
|
|
::
|
|
|
|
$x
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
(validate-x p.p.u.rut q.p.u.rut q.u.rut r.u.rut)
|
|
|
|
::
|
|
|
|
$w
|
|
|
|
=. haw.u.ref
|
|
|
|
%+ ~(put by haw.u.ref)
|
|
|
|
[p.p.u.rut q.p.u.rut q.u.rut]
|
|
|
|
:+ ~
|
|
|
|
p.r.u.rut
|
|
|
|
?+ p.r.u.rut ~| %strange-w-over-nextwork !!
|
2018-05-03 00:37:03 +03:00
|
|
|
$cass !>(((hard cass) q.r.u.rut))
|
2016-11-24 07:25:07 +03:00
|
|
|
$null [[%atom %n ~] ~]
|
|
|
|
$nako !>(~|([%harding [&1 &2 &3]:q.r.u.rut] ((hard nako) q.r.u.rut)))
|
|
|
|
==
|
|
|
|
?. ?=($nako p.r.u.rut) [?>(?=(^ ref) .)]:wake
|
|
|
|
=+ rav=`rave`q.u.ruv
|
|
|
|
?> ?=($many -.rav)
|
|
|
|
|- ^+ +>+.^$
|
|
|
|
=+ nez=[%w [%ud let.dom] ~]
|
|
|
|
=+ nex=(~(get by haw.u.ref) nez)
|
|
|
|
?~ nex +>+.^$
|
|
|
|
?~ u.nex +>+.^$ :: should never happen
|
|
|
|
=. nak.u.ref `((hard nako) q.q.u.u.nex)
|
|
|
|
=. +>+.^$
|
|
|
|
?: =(0 let.dom)
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
%+ apply-foreign-update
|
|
|
|
?.(?=($da -.q.q.rav) ~ `p.q.q.rav)
|
|
|
|
(need nak.u.ref)
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
%^ validate-plops
|
|
|
|
[%ud let.dom]
|
|
|
|
?.(?=($da -.q.q.rav) ~ `p.q.q.rav)
|
|
|
|
bar:(need nak.u.ref)
|
|
|
|
%= $
|
|
|
|
haw.u.ref (~(del by haw.u.ref) nez)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
$y
|
|
|
|
=< ?>(?=(^ ref) .)
|
|
|
|
%_ wake
|
|
|
|
haw.u.ref
|
|
|
|
%+ ~(put by haw.u.ref)
|
|
|
|
[p.p.u.rut q.p.u.rut q.u.rut]
|
|
|
|
`[p.r.u.rut !>(((hard arch) q.r.u.rut))]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
$z
|
|
|
|
~| %its-prolly-not-reasonable-to-request-ankh-over-the-network-sorry
|
|
|
|
!!
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Check that given data is actually of the mark it claims to be.
|
|
|
|
::
|
|
|
|
:: Result is handled in ++take-foreign-x
|
|
|
|
::
|
|
|
|
++ validate-x
|
|
|
|
|= {car/care cas/case pax/path peg/page}
|
|
|
|
^+ +>
|
|
|
|
%- emit
|
|
|
|
:* hen %pass
|
|
|
|
[%foreign-x (scot %p our) (scot %p her) syd car (scot cas) pax]
|
2018-12-13 09:34:12 +03:00
|
|
|
%f %build live=%.n %pin
|
2019-02-17 09:10:45 +03:00
|
|
|
now
|
2018-06-16 01:36:41 +03:00
|
|
|
(vale-page [her syd] peg)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
::
|
2018-06-16 01:36:41 +03:00
|
|
|
:: Create a schematic to validate a page.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: If the mark is %hoon, we short-circuit the validation for bootstrapping
|
|
|
|
:: purposes.
|
|
|
|
::
|
|
|
|
++ vale-page
|
2018-08-09 00:47:01 +03:00
|
|
|
|= [disc=disc:ford a=page]
|
|
|
|
^- schematic:ford
|
2019-01-17 05:35:10 +03:00
|
|
|
?. ?=($hoon p.a) [%vale [our %home] a]
|
2019-02-05 03:58:22 +03:00
|
|
|
?. ?=(@t q.a) [%dude >%weird-hoon< %ride [%zpzp ~] %$ *cage]
|
2016-11-24 07:25:07 +03:00
|
|
|
[%$ p.a [%atom %t ~] q.a]
|
|
|
|
::
|
|
|
|
:: Verify the foreign data is of the the mark it claims to be.
|
|
|
|
::
|
|
|
|
:: This completes the receiving of %x foreign data.
|
|
|
|
::
|
|
|
|
++ take-foreign-x
|
2018-08-09 00:47:01 +03:00
|
|
|
|= {car/care cas/case pax/path res/made-result:ford}
|
2016-11-24 07:25:07 +03:00
|
|
|
^+ +>
|
|
|
|
?> ?=(^ ref)
|
2018-06-16 01:36:41 +03:00
|
|
|
?. ?=([%complete %success *] res)
|
2016-11-24 07:25:07 +03:00
|
|
|
~| "validate foreign x failed"
|
2018-08-09 00:47:01 +03:00
|
|
|
=+ why=(made-result-as-error:ford res)
|
2016-11-24 07:25:07 +03:00
|
|
|
~> %mean.|.(%*(. >[%plop-fail %why]< |1.+> why))
|
|
|
|
!!
|
2018-08-09 00:47:01 +03:00
|
|
|
=* as-cage `(result-to-cage:ford build-result.res)
|
2018-06-16 01:36:41 +03:00
|
|
|
wake(haw.u.ref (~(put by haw.u.ref) [car cas pax] as-cage))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: When we get a %w foreign update, store this in our state.
|
|
|
|
::
|
|
|
|
:: We get the commits and blobs from the nako and add them to our object
|
|
|
|
:: store, then we update the map of aeons to commits and the latest aeon.
|
|
|
|
::
|
|
|
|
:: We call ++wake at the end to update anyone whose subscription is fulfilled
|
|
|
|
:: by this state change.
|
|
|
|
::
|
|
|
|
++ apply-foreign-update :: apply subscription
|
|
|
|
|= $: lem/(unit @da) :: complete up to
|
|
|
|
gar/(map aeon tako) :: new ids
|
|
|
|
let/aeon :: next id
|
|
|
|
lar/(set yaki) :: new commits
|
|
|
|
bar/(set blob) :: new content
|
|
|
|
==
|
|
|
|
^+ +>
|
|
|
|
=< wake
|
2018-12-19 08:58:06 +03:00
|
|
|
:: hit: updated commit-hashes by @ud case
|
|
|
|
::
|
|
|
|
=/ hit (~(uni by hit.dom) gar)
|
|
|
|
:: nut: new commit-hash/commit pairs
|
|
|
|
::
|
|
|
|
=/ nut
|
|
|
|
(turn ~(tap in lar) |=(=yaki [r.yaki yaki]))
|
|
|
|
:: hut: updated commits by hash
|
|
|
|
::
|
|
|
|
=/ hut (~(gas by hut.ran) nut)
|
|
|
|
:: nat: new blob-hash/blob pairs
|
|
|
|
::
|
|
|
|
=/ nat
|
|
|
|
(turn ~(tap in bar) |=(=blob [p.blob blob]))
|
|
|
|
:: lat: updated blobs by hash
|
|
|
|
::
|
|
|
|
=/ lat (~(gas by lat.ran) nat)
|
|
|
|
:: traverse updated state and sanity check
|
|
|
|
::
|
|
|
|
=+ ~| :* %bad-foreign-update
|
|
|
|
[gar=gar let=let nut=(turn nut head) nat=(turn nat head)]
|
|
|
|
[hitdom=hit.dom letdom=let.dom]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2018-12-19 08:58:06 +03:00
|
|
|
?: =(0 let)
|
|
|
|
~
|
|
|
|
=/ =aeon 1
|
|
|
|
|- ^- ~
|
|
|
|
=/ =tako
|
|
|
|
~| [%missing-aeon aeon] (~(got by hit) aeon)
|
|
|
|
=/ =yaki
|
|
|
|
~| [%missing-tako tako] (~(got by hut) tako)
|
|
|
|
=+ %+ turn
|
|
|
|
~(tap by q.yaki)
|
|
|
|
|= [=path =lobe]
|
|
|
|
~| [%missing-blob path lobe]
|
|
|
|
?> (~(has by lat) lobe)
|
2016-11-24 07:25:07 +03:00
|
|
|
~
|
2018-12-19 08:58:06 +03:00
|
|
|
?: =(let aeon)
|
|
|
|
~
|
|
|
|
$(aeon +(aeon))
|
|
|
|
:: persist updated state
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
%= +>.$
|
2018-12-19 08:58:06 +03:00
|
|
|
let.dom (max let let.dom)
|
2016-11-24 07:25:07 +03:00
|
|
|
lim (max (fall lem lim) lim)
|
|
|
|
hit.dom hit
|
|
|
|
hut.ran hut
|
|
|
|
lat.ran lat
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Make sure that incoming data is of the correct type.
|
|
|
|
::
|
|
|
|
:: This is a ford call to make sure that incoming data is of the mark it
|
|
|
|
:: claims to be. The result is handled in ++take-foreign-plops.
|
|
|
|
::
|
|
|
|
++ validate-plops
|
|
|
|
|= {cas/case lem/(unit @da) pop/(set plop)}
|
|
|
|
^+ +>
|
|
|
|
=+ lum=(scot %da (fall lem *@da))
|
|
|
|
%- emit
|
|
|
|
:* hen %pass
|
|
|
|
[%foreign-plops (scot %p our) (scot %p her) syd lum ~]
|
2019-02-02 00:46:09 +03:00
|
|
|
%f %build live=%.n %pin
|
|
|
|
:: This corresponds to all the changes from [her syd]
|
|
|
|
:: to [our %home]. This should be (case-to-date cas)
|
|
|
|
:: in the context of the foreign desk, but since we're
|
|
|
|
:: getting everything from our own desk now we want to
|
|
|
|
:: use our most recent commit.
|
|
|
|
::
|
|
|
|
now
|
2018-06-16 01:36:41 +03:00
|
|
|
%list
|
2018-08-09 00:47:01 +03:00
|
|
|
^- (list schematic:ford)
|
2017-02-13 22:58:49 +03:00
|
|
|
%+ turn ~(tap in pop)
|
2016-11-24 07:25:07 +03:00
|
|
|
|= a/plop
|
|
|
|
?- -.a
|
2018-06-16 01:36:41 +03:00
|
|
|
$direct [[%$ %blob !>([%direct p.a *page])] (vale-page [her syd] p.q.a q.q.a)]
|
2016-11-24 07:25:07 +03:00
|
|
|
$delta
|
2018-06-16 01:36:41 +03:00
|
|
|
[[%$ %blob !>([%delta p.a q.a *page])] (vale-page [her syd] p.r.a q.r.a)]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Verify that foreign plops validated correctly. If so, apply them to our
|
|
|
|
:: state.
|
|
|
|
::
|
|
|
|
++ take-foreign-plops
|
2018-08-09 00:47:01 +03:00
|
|
|
|= {lem/(unit @da) res/made-result:ford}
|
2016-11-24 07:25:07 +03:00
|
|
|
^+ +>
|
|
|
|
?> ?=(^ ref)
|
|
|
|
?> ?=(^ nak.u.ref)
|
|
|
|
=+ ^- lat/(list blob)
|
2019-05-04 05:24:24 +03:00
|
|
|
%+ turn
|
|
|
|
~| "validate foreign plops failed"
|
|
|
|
(made-result-to-cages:[^util] res)
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {bob/cage cay/cage}
|
|
|
|
?. ?=($blob p.bob)
|
|
|
|
~| %plop-not-blob
|
|
|
|
!!
|
|
|
|
=+ bol=((hard blob) q.q.bob)
|
|
|
|
?- -.bol
|
|
|
|
$delta [-.bol p.bol q.bol p.cay q.q.cay]
|
|
|
|
$direct [-.bol p.bol p.cay q.q.cay]
|
|
|
|
==
|
|
|
|
%^ apply-foreign-update
|
|
|
|
lem
|
|
|
|
gar.u.nak.u.ref
|
|
|
|
:+ let.u.nak.u.ref
|
|
|
|
lar.u.nak.u.ref
|
|
|
|
(silt lat)
|
|
|
|
::
|
|
|
|
++ mabe :: maybe fire function
|
|
|
|
|= {rov/rove fun/$-(@da _.)}
|
|
|
|
^+ +>.$
|
|
|
|
%+ fall
|
|
|
|
%+ bind
|
|
|
|
^- (unit @da)
|
|
|
|
?- -.rov
|
|
|
|
$sing
|
|
|
|
?. ?=($da -.q.p.rov) ~
|
|
|
|
`p.q.p.rov
|
|
|
|
::
|
|
|
|
$next ~
|
2018-01-15 22:09:38 +03:00
|
|
|
::
|
|
|
|
$mult ~
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
$many
|
2016-12-02 22:34:07 +03:00
|
|
|
%^ hunt lth
|
2016-11-24 07:25:07 +03:00
|
|
|
?. ?=($da -.p.q.rov) ~
|
|
|
|
?.((lth now p.p.q.rov) ~ [~ p.p.q.rov])
|
|
|
|
?. ?=($da -.q.q.rov) ~
|
2016-12-02 22:34:07 +03:00
|
|
|
(hunt gth [~ now] [~ p.q.q.rov])
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
fun
|
|
|
|
+>.$
|
|
|
|
::
|
|
|
|
++ reve
|
|
|
|
|= rov/rove
|
|
|
|
^- rave
|
|
|
|
?- -.rov
|
|
|
|
$sing rov
|
|
|
|
$next [- p]:rov
|
2018-01-18 01:55:12 +03:00
|
|
|
$mult [- p]:rov
|
2018-01-04 03:29:59 +03:00
|
|
|
$many [- p q]:rov
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
:: Loop through open subscriptions and check if we can fill any of them.
|
|
|
|
::
|
|
|
|
++ wake :: update subscribers
|
|
|
|
^+ .
|
2018-01-17 17:57:25 +03:00
|
|
|
=+ xiq=~(tap by qyx)
|
2018-02-07 03:34:09 +03:00
|
|
|
=| xaq/(list {p/wove q/(set duct)})
|
2016-11-24 07:25:07 +03:00
|
|
|
|- ^+ ..wake
|
|
|
|
?~ xiq
|
|
|
|
..wake(qyx (~(gas by *cult) xaq))
|
|
|
|
?: =(~ q.i.xiq) $(xiq t.xiq, xaq xaq) :: drop forgotten
|
2018-02-07 03:34:09 +03:00
|
|
|
=* for p.p.i.xiq
|
|
|
|
=* rov q.p.i.xiq
|
|
|
|
?- -.rov
|
2016-11-24 07:25:07 +03:00
|
|
|
$sing
|
2018-02-07 03:34:09 +03:00
|
|
|
=+ cas=?~(ref ~ (~(get by haw.u.ref) `mood`p.rov))
|
2016-11-24 07:25:07 +03:00
|
|
|
?^ cas
|
|
|
|
%= $
|
|
|
|
xiq t.xiq
|
|
|
|
..wake ?~ u.cas (blub-all q.i.xiq ~)
|
2018-02-07 03:34:09 +03:00
|
|
|
(blab-all q.i.xiq p.rov %& u.u.cas)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ nao=(case-to-aeon q.p.rov)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ nao $(xiq t.xiq, xaq [i.xiq xaq])
|
|
|
|
:: ~& %reading-at-aeon
|
2018-02-07 03:34:09 +03:00
|
|
|
=+ vid=(read-at-aeon:ze for u.nao p.rov)
|
2016-11-24 07:25:07 +03:00
|
|
|
:: ~& %red-at-aeon
|
|
|
|
?~ vid
|
|
|
|
:: ?: =(0 u.nao)
|
2018-02-07 03:34:09 +03:00
|
|
|
:: ~& [%oh-poor `path`[syd '0' r.p.rov]]
|
2016-11-24 07:25:07 +03:00
|
|
|
:: $(xiq t.xiq)
|
2018-02-07 03:34:09 +03:00
|
|
|
:: ~& [%oh-well desk=syd mood=p.rov aeon=u.nao]
|
2016-11-24 07:25:07 +03:00
|
|
|
$(xiq t.xiq, xaq [i.xiq xaq])
|
2018-02-07 03:34:09 +03:00
|
|
|
$(xiq t.xiq, ..wake (balk-all q.i.xiq u.vid p.rov))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-01-19 03:54:41 +03:00
|
|
|
:: %next is just %mult with one path, so we pretend %next = %mult here.
|
|
|
|
?($next $mult)
|
2018-01-18 01:55:12 +03:00
|
|
|
:: because %mult requests need to wait on multiple files for each
|
|
|
|
:: revision that needs to be checked for changes, we keep two cache maps.
|
|
|
|
:: {old} is the revision at {(dec yon)}, {new} is the revision at {yon}.
|
|
|
|
:: if we have no {yon} yet, that means it was still unknown last time
|
|
|
|
:: we checked.
|
2018-02-07 03:34:09 +03:00
|
|
|
=* vor rov
|
2018-01-19 03:54:41 +03:00
|
|
|
|^
|
|
|
|
=/ rov/rove
|
|
|
|
?: ?=($mult -.vor) vor
|
2018-04-30 23:28:57 +03:00
|
|
|
=* mod p.vor
|
2018-01-19 03:54:41 +03:00
|
|
|
:* %mult
|
2018-04-30 23:28:57 +03:00
|
|
|
[q.mod [[p.mod r.mod] ~ ~]]
|
|
|
|
q.vor
|
|
|
|
[[[p.mod r.mod] r.vor] ~ ~]
|
2018-01-19 03:54:41 +03:00
|
|
|
~
|
|
|
|
==
|
|
|
|
?> ?=($mult -.rov)
|
2018-01-18 01:55:12 +03:00
|
|
|
=* mol p.rov
|
|
|
|
=* yon q.rov
|
|
|
|
=* old r.rov
|
|
|
|
=* new s.rov
|
|
|
|
:: we will either respond, or store the maybe updated request.
|
|
|
|
=; res/(each (map mood (each cage lobe)) rove)
|
2018-05-04 03:59:10 +03:00
|
|
|
?: ?=(%& -.res)
|
2018-01-19 03:54:41 +03:00
|
|
|
(respond p.res)
|
|
|
|
(store p.res)
|
2018-01-18 01:55:12 +03:00
|
|
|
|- :: so that we can retry for the next aeon if possible/needed.
|
|
|
|
:: if we don't have an aeon yet, see if we have one now.
|
|
|
|
?~ yon
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon p.mol)
|
2018-01-18 01:55:12 +03:00
|
|
|
:: if we still don't, wait.
|
|
|
|
?~ aey |+rov
|
|
|
|
:: if we do, update the request and retry.
|
|
|
|
$(rov [-.rov mol `+(u.aey) ~ ~])
|
2018-01-22 18:01:00 +03:00
|
|
|
:: if old isn't complete, try filling in the gaps.
|
2018-01-23 19:35:12 +03:00
|
|
|
=? old !(complete old)
|
|
|
|
(read-unknown mol(p [%ud (dec u.yon)]) old)
|
2018-01-18 01:55:12 +03:00
|
|
|
:: if the next aeon we want to compare is in the future, wait again.
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon [%ud u.yon])
|
2018-01-18 01:55:12 +03:00
|
|
|
?~ aey |+rov
|
|
|
|
:: if new isn't complete, try filling in the gaps.
|
2018-01-23 19:35:12 +03:00
|
|
|
=? new !(complete new)
|
|
|
|
(read-unknown mol(p [%ud u.yon]) new)
|
2018-01-18 01:55:12 +03:00
|
|
|
:: if they're still not both complete, wait again.
|
2018-01-23 19:35:12 +03:00
|
|
|
?. ?& (complete old)
|
|
|
|
(complete new)
|
2018-01-18 01:55:12 +03:00
|
|
|
==
|
|
|
|
|+rov
|
|
|
|
:: if there are any changes, send response. if none, move onto next aeon.
|
|
|
|
=; res
|
|
|
|
?^ res &+res
|
2018-01-19 03:54:41 +03:00
|
|
|
$(rov [-.rov mol `+(u.yon) old ~])
|
2018-01-18 01:55:12 +03:00
|
|
|
%+ roll ~(tap by old)
|
2018-01-23 19:35:12 +03:00
|
|
|
|= $: {{car/care pax/path} ole/cach}
|
2018-01-15 22:09:38 +03:00
|
|
|
res/(map mood (each cage lobe))
|
|
|
|
==
|
2018-01-23 19:35:12 +03:00
|
|
|
=+ neu=(~(got by new) car pax)
|
2018-08-16 02:48:37 +03:00
|
|
|
?< |(?=(~ ole) ?=(~ neu))
|
2018-01-18 01:55:12 +03:00
|
|
|
=- ?~(- res (~(put by res) u.-))
|
2018-01-15 22:09:38 +03:00
|
|
|
^- (unit (pair mood (each cage lobe)))
|
2018-01-23 19:35:12 +03:00
|
|
|
=+ mod=[car [%ud u.yon] pax]
|
2018-01-18 01:55:12 +03:00
|
|
|
?~ u.ole
|
|
|
|
?~ u.neu ~ :: not added
|
|
|
|
`[mod u.u.neu] :: added
|
|
|
|
?~ u.neu
|
2018-01-17 17:57:25 +03:00
|
|
|
`[mod [%& %null [%atom %n ~] ~]] :: deleted
|
2018-01-18 01:55:12 +03:00
|
|
|
?: (equivalent-data:ze u.u.neu u.u.ole) ~ :: unchanged
|
|
|
|
`[mod u.u.neu] :: changed
|
2018-01-19 03:54:41 +03:00
|
|
|
::
|
|
|
|
++ store :: check again later
|
|
|
|
|= rov/rove
|
|
|
|
^+ ..wake
|
2018-02-07 03:34:09 +03:00
|
|
|
=- ^^$(xiq t.xiq, xaq [i.xiq(p [for -]) xaq])
|
2018-01-19 03:54:41 +03:00
|
|
|
?> ?=($mult -.rov)
|
|
|
|
?: ?=($mult -.vor) rov
|
2018-08-16 02:48:37 +03:00
|
|
|
?> ?=({* ~ ~} r.rov)
|
2018-01-23 19:35:12 +03:00
|
|
|
=* one n.r.rov
|
2018-04-30 23:28:57 +03:00
|
|
|
[%next [p.p.one p.p.rov q.p.one] q.rov q.one]
|
2018-01-19 03:54:41 +03:00
|
|
|
::
|
|
|
|
++ respond :: send changes
|
|
|
|
|= res/(map mood (each cage lobe))
|
|
|
|
^+ ..wake
|
|
|
|
::NOTE want to use =-, but compiler bug?
|
|
|
|
?: ?=($mult -.vor)
|
2018-01-22 17:54:37 +03:00
|
|
|
^^$(xiq t.xiq, ..wake (blas-all q.i.xiq ~(key by res)))
|
2018-08-16 02:48:37 +03:00
|
|
|
?> ?=({* ~ ~} res)
|
2018-01-19 03:54:41 +03:00
|
|
|
^^$(xiq t.xiq, ..wake (blab-all q.i.xiq n.res))
|
|
|
|
::
|
2018-01-23 19:35:12 +03:00
|
|
|
++ complete :: no unknowns
|
|
|
|
|= hav/(map (pair care path) cach)
|
|
|
|
?& ?=(^ hav)
|
|
|
|
(levy ~(tap by `(map (pair care path) cach)`hav) know)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ know |=({(pair care path) c/cach} ?=(^ c)) :: know about file
|
2018-01-19 03:54:41 +03:00
|
|
|
::
|
|
|
|
++ read-unknown :: fill in the blanks
|
2018-01-23 19:35:12 +03:00
|
|
|
|= {mol/mool hav/(map (pair care path) cach)}
|
|
|
|
%. |= {{c/care p/path} o/cach}
|
2018-02-07 03:34:09 +03:00
|
|
|
?^(o o (aver for c p.mol p))
|
2018-01-19 03:54:41 +03:00
|
|
|
=- ~(urn by -)
|
|
|
|
?^ hav hav
|
2018-01-23 19:35:12 +03:00
|
|
|
%- ~(gas by *(map (pair care path) cach))
|
|
|
|
(turn ~(tap in q.mol) |=({c/care p/path} [[c p] ~]))
|
2018-01-19 03:54:41 +03:00
|
|
|
--
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
$many
|
2018-02-07 03:34:09 +03:00
|
|
|
=+ mot=`moat`q.rov
|
|
|
|
=* sav r.rov
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ nab=(case-to-aeon p.mot)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ nab
|
|
|
|
$(xiq t.xiq, xaq [i.xiq xaq])
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ huy=(case-to-aeon q.mot)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ huy
|
|
|
|
=. p.mot [%ud +(let.dom)]
|
|
|
|
%= $
|
|
|
|
xiq t.xiq
|
2018-02-07 03:34:09 +03:00
|
|
|
xaq [i.xiq(q.q.p mot) xaq]
|
2016-11-24 07:25:07 +03:00
|
|
|
..wake =+ ^= ear
|
2018-02-07 03:34:09 +03:00
|
|
|
(lobes-at-path:ze for let.dom r.mot)
|
2018-01-04 03:29:59 +03:00
|
|
|
?: =(sav ear) ..wake
|
2018-02-07 03:34:09 +03:00
|
|
|
(bleb-all q.i.xiq let.dom ?:(p.rov ~ `[u.nab let.dom]))
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
%= $
|
|
|
|
xiq t.xiq
|
|
|
|
..wake =- (blub-all:- q.i.xiq ~)
|
|
|
|
=+ ^= ear
|
2018-02-07 03:34:09 +03:00
|
|
|
(lobes-at-path:ze for u.huy r.mot)
|
2018-01-04 03:29:59 +03:00
|
|
|
?: =(sav ear) (blub-all q.i.xiq ~)
|
2018-02-07 03:34:09 +03:00
|
|
|
(bleb-all q.i.xiq +(u.nab) ?:(p.rov ~ `[u.nab u.huy]))
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
++ drop-me
|
|
|
|
^+ .
|
2019-05-04 05:24:24 +03:00
|
|
|
~| %clay-drop-me-not-implemented
|
|
|
|
!!
|
|
|
|
:: ?~ mer
|
|
|
|
:: .
|
|
|
|
:: %- emit(mer ~) ^- move :*
|
|
|
|
:: hen.u.mer %give %mere %| %user-interrupt
|
|
|
|
:: >sor.u.mer< >our< >cas.u.mer< >gem.u.mer< ~
|
|
|
|
:: ==
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
::
|
|
|
|
:: This core has no additional state, and the distinction exists purely for
|
|
|
|
:: documentation. The overarching theme is that `++de` directly contains
|
|
|
|
:: logic for metadata about the desk, while `++ze` is composed primarily
|
|
|
|
:: of helper functions for manipulating the desk state (`++dome`) itself.
|
|
|
|
:: Functions include:
|
|
|
|
::
|
|
|
|
:: -- converting between cases, commit hashes, commits, content hashes,
|
|
|
|
:: and content
|
|
|
|
:: -- creating commits and content and adding them to the tree
|
|
|
|
:: -- finding which data needs to be sent over the network to keep the
|
2018-02-08 00:28:33 +03:00
|
|
|
:: other urbit up-to-date
|
2016-11-24 07:25:07 +03:00
|
|
|
:: -- reading from the file tree through different `++care` options
|
|
|
|
:: -- the `++me` core for merging.
|
|
|
|
::
|
|
|
|
:: The dome is composed of the following:
|
|
|
|
::
|
|
|
|
:: -- `ank` is the ankh, which is the file data itself. An ankh is both
|
|
|
|
:: a possible file and a possible directory. An ankh has both:
|
|
|
|
:: -- `fil`, a possible file, stored as both a cage and its hash
|
|
|
|
:: -- `dir`, a map of @ta to more ankhs.
|
|
|
|
:: -- `let` is the number of the most recent revision.
|
|
|
|
:: -- `hit` is a map of revision numbers to commit hashes.
|
|
|
|
:: -- `lab` is a map of labels to revision numbers.
|
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
2019-05-11 00:51:37 +03:00
|
|
|
++ util (state:[^util] dom dom ran)
|
2016-11-24 07:25:07 +03:00
|
|
|
++ ze
|
|
|
|
|%
|
|
|
|
:: These convert between aeon (version number), tako (commit hash), yaki
|
|
|
|
:: (commit data structure), lobe (content hash), and blob (content).
|
|
|
|
++ aeon-to-tako ~(got by hit.dom)
|
|
|
|
++ aeon-to-yaki (cork aeon-to-tako tako-to-yaki)
|
|
|
|
++ lobe-to-blob ~(got by lat.ran)
|
|
|
|
++ tako-to-yaki ~(got by hut.ran)
|
2019-05-04 05:24:24 +03:00
|
|
|
++ page-to-lobe page-to-lobe:util
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Checks whether two pieces of data (either cages or lobes) are the same.
|
|
|
|
::
|
|
|
|
++ equivalent-data
|
|
|
|
|= {one/(each cage lobe) two/(each cage lobe)}
|
|
|
|
^- ?
|
2018-03-19 06:54:47 +03:00
|
|
|
?: ?=(%& -.one)
|
|
|
|
?: ?=(%& -.two)
|
2016-11-24 07:25:07 +03:00
|
|
|
=([p q.q]:p.one [p q.q]:p.two)
|
|
|
|
=(p.two (page-to-lobe [p q.q]:p.one))
|
2018-03-19 06:54:47 +03:00
|
|
|
?: ?=(%& -.two)
|
2016-11-24 07:25:07 +03:00
|
|
|
=(p.one (page-to-lobe [p q.q]:p.two))
|
|
|
|
=(p.one p.two)
|
|
|
|
::
|
|
|
|
:: Gets a map of the data at the given path and all children of it.
|
|
|
|
::
|
|
|
|
++ lobes-at-path
|
2018-02-07 03:34:09 +03:00
|
|
|
|= {for/(unit ship) yon/aeon pax/path}
|
2016-11-24 07:25:07 +03:00
|
|
|
^- (map path lobe)
|
|
|
|
?: =(0 yon) ~
|
2018-02-09 15:00:12 +03:00
|
|
|
:: we use %z for the check because it looks at all child paths.
|
2018-08-16 02:48:37 +03:00
|
|
|
?: |(?=(~ for) (may-read u.for %z yon pax)) ~
|
2016-11-24 07:25:07 +03:00
|
|
|
%- malt
|
|
|
|
%+ skim
|
2018-04-04 21:15:10 +03:00
|
|
|
%~ tap by
|
2018-04-04 21:07:05 +03:00
|
|
|
=< q
|
|
|
|
%- aeon-to-yaki
|
|
|
|
yon
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {p/path q/lobe}
|
2018-03-19 07:18:20 +03:00
|
|
|
?| ?=(~ pax)
|
|
|
|
?& !?=(~ p)
|
2016-11-24 07:25:07 +03:00
|
|
|
=(-.pax -.p)
|
|
|
|
$(p +.p, pax +.pax)
|
|
|
|
== ==
|
|
|
|
::
|
|
|
|
:: Creates a nako of all the changes between a and b.
|
|
|
|
::
|
|
|
|
++ make-nako
|
|
|
|
|= {a/aeon b/aeon}
|
|
|
|
^- nako
|
|
|
|
:+ ?> (lte b let.dom)
|
|
|
|
|-
|
|
|
|
?: =(b let.dom)
|
|
|
|
hit.dom
|
|
|
|
$(hit.dom (~(del by hit.dom) let.dom), let.dom (dec let.dom))
|
|
|
|
b
|
|
|
|
?: =(0 b)
|
|
|
|
[~ ~]
|
|
|
|
(data-twixt-takos (~(get by hit.dom) a) (aeon-to-tako b))
|
|
|
|
::
|
|
|
|
:: Gets the data between two commit hashes, assuming the first is an
|
|
|
|
:: ancestor of the second.
|
|
|
|
::
|
|
|
|
:: Get all the takos before `a`, then get all takos before `b` except the
|
|
|
|
:: ones we found before `a`. Then convert the takos to yakis and also get
|
|
|
|
:: all the data in all the yakis.
|
|
|
|
::
|
|
|
|
++ data-twixt-takos
|
|
|
|
|= {a/(unit tako) b/tako}
|
|
|
|
^- {(set yaki) (set plop)}
|
2019-05-03 04:50:20 +03:00
|
|
|
=+ old=?~(a ~ (reachable-takos:util u.a))
|
2016-11-24 07:25:07 +03:00
|
|
|
=+ ^- yal/(set tako)
|
|
|
|
%- silt
|
|
|
|
%+ skip
|
2019-05-03 04:50:20 +03:00
|
|
|
~(tap in (reachable-takos:util b))
|
2016-11-24 07:25:07 +03:00
|
|
|
|=(tak/tako (~(has in old) tak))
|
2017-02-13 22:58:49 +03:00
|
|
|
:- (silt (turn ~(tap in yal) tako-to-yaki))
|
|
|
|
(silt (turn ~(tap in (new-lobes (new-lobes ~ old) yal)) lobe-to-blob))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Get all the lobes that are referenced in `a` except those that are
|
|
|
|
:: already in `b`.
|
|
|
|
::
|
|
|
|
++ new-lobes :: object hash set
|
|
|
|
|= {b/(set lobe) a/(set tako)} :: that aren't in b
|
|
|
|
^- (set lobe)
|
2017-02-13 22:58:49 +03:00
|
|
|
%+ roll ~(tap in a)
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {tak/tako bar/(set lobe)}
|
|
|
|
^- (set lobe)
|
|
|
|
=+ yak=(tako-to-yaki tak)
|
2017-02-13 23:43:18 +03:00
|
|
|
%+ roll ~(tap by q.yak)
|
2016-11-24 07:25:07 +03:00
|
|
|
=< .(far bar)
|
|
|
|
|= {{path lob/lobe} far/(set lobe)}
|
|
|
|
^- (set lobe)
|
|
|
|
?~ (~(has in b) lob) :: don't need
|
|
|
|
far
|
|
|
|
=+ gar=(lobe-to-blob lob)
|
|
|
|
?- -.gar
|
|
|
|
$direct (~(put in far) lob)
|
|
|
|
$delta (~(put in $(lob q.q.gar)) lob)
|
|
|
|
==
|
|
|
|
::
|
2018-02-07 23:11:25 +03:00
|
|
|
:: Gets the permissions that apply to a particular node.
|
|
|
|
::
|
|
|
|
:: If the node has no permissions of its own, we use its parent's.
|
|
|
|
:: If no permissions have been set for the entire tree above the node,
|
|
|
|
:: we default to fully private (empty whitelist).
|
|
|
|
::
|
|
|
|
++ read-p
|
|
|
|
|= pax/path
|
|
|
|
^- (unit (unit (each cage lobe)))
|
|
|
|
=- [~ ~ %& %noun !>(-)]
|
|
|
|
:- (read-p-in pax per.red)
|
|
|
|
(read-p-in pax pew.red)
|
|
|
|
::
|
|
|
|
++ read-p-in
|
2018-02-12 19:56:48 +03:00
|
|
|
|= {pax/path pes/regs}
|
2018-02-07 23:11:25 +03:00
|
|
|
^- dict
|
2018-06-20 20:12:26 +03:00
|
|
|
=/ rul/(unit rule) (~(get by pes) pax)
|
2018-06-19 02:10:11 +03:00
|
|
|
?^ rul
|
|
|
|
:+ pax mod.u.rul
|
|
|
|
%- ~(rep in who.u.rul)
|
2018-06-20 01:27:16 +03:00
|
|
|
|= {w/whom out/(pair (set ship) (map @ta crew))}
|
2018-08-16 02:48:37 +03:00
|
|
|
?: ?=({%& @p} w)
|
2018-06-20 00:43:16 +03:00
|
|
|
[(~(put in p.out) +.w) q.out]
|
2018-06-20 20:12:26 +03:00
|
|
|
=/ cru/(unit crew) (~(get by cez.ruf) +.w)
|
2018-06-19 02:10:11 +03:00
|
|
|
?~ cru out
|
2018-06-20 00:43:16 +03:00
|
|
|
[p.out (~(put by q.out) +.w u.cru)]
|
|
|
|
?~ pax [/ %white ~ ~]
|
2018-02-13 21:45:24 +03:00
|
|
|
$(pax (scag (dec (lent pax)) `path`pax))
|
2018-02-07 23:04:07 +03:00
|
|
|
::
|
|
|
|
++ may-read
|
|
|
|
|= {who/ship car/care yon/aeon pax/path}
|
|
|
|
^- ?
|
|
|
|
?+ car
|
|
|
|
(allowed-by who pax per.red)
|
2018-02-07 23:11:25 +03:00
|
|
|
::
|
|
|
|
$p
|
|
|
|
=(who our)
|
2018-02-07 23:04:07 +03:00
|
|
|
::
|
|
|
|
?($y $z)
|
|
|
|
=+ tak=(~(get by hit.dom) yon)
|
|
|
|
?~ tak |
|
|
|
|
=+ yak=(tako-to-yaki u.tak)
|
|
|
|
=+ len=(lent pax)
|
2018-02-09 02:35:42 +03:00
|
|
|
=- (levy ~(tap in -) |=(p/path (allowed-by who p per.red)))
|
|
|
|
%+ roll ~(tap in (~(del in ~(key by q.yak)) pax))
|
|
|
|
|= {p/path s/(set path)}
|
|
|
|
?. =(pax (scag len p)) s
|
|
|
|
%- ~(put in s)
|
|
|
|
?: ?=($z car) p
|
|
|
|
(scag +(len) p)
|
2018-02-07 23:04:07 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
++ may-write
|
|
|
|
|= {w/ship p/path}
|
|
|
|
(allowed-by w p pew.red)
|
|
|
|
::
|
|
|
|
++ allowed-by
|
2018-02-12 19:56:48 +03:00
|
|
|
|= {who/ship pax/path pes/regs}
|
2018-02-07 23:04:07 +03:00
|
|
|
^- ?
|
2018-06-20 20:12:26 +03:00
|
|
|
=/ rul/real rul:(read-p-in pax pes)
|
|
|
|
=/ in-list/?
|
2018-06-20 00:43:16 +03:00
|
|
|
?| (~(has in p.who.rul) who)
|
2018-06-20 01:27:16 +03:00
|
|
|
::
|
2018-06-20 00:43:16 +03:00
|
|
|
%- ~(rep by q.who.rul)
|
2018-06-20 20:12:26 +03:00
|
|
|
|= {{@ta cru/crew} out/_|}
|
2018-06-20 00:43:16 +03:00
|
|
|
?: out &
|
|
|
|
(~(has in cru) who)
|
|
|
|
==
|
2018-06-19 02:10:11 +03:00
|
|
|
?: =(%black mod.rul)
|
|
|
|
!in-list
|
|
|
|
in-list
|
2018-08-22 22:56:46 +03:00
|
|
|
:: +read-t: produce the list of paths within a yaki with :pax as prefix
|
|
|
|
::
|
|
|
|
++ read-t
|
|
|
|
|= [yon=aeon pax=path]
|
|
|
|
^- (unit (unit [%file-list (hypo (list path))]))
|
|
|
|
:: if asked for version 0, produce an empty list of files
|
|
|
|
::
|
|
|
|
?: =(0 yon)
|
|
|
|
``[%file-list -:!>(*(list path)) *(list path)]
|
|
|
|
:: if asked for a future version, we don't have an answer
|
|
|
|
::
|
|
|
|
?~ tak=(~(get by hit.dom) yon)
|
|
|
|
~
|
|
|
|
:: look up the yaki snapshot based on the version
|
|
|
|
::
|
|
|
|
=/ yak=yaki (tako-to-yaki u.tak)
|
|
|
|
:: calculate the path length once outside the loop
|
|
|
|
::
|
|
|
|
=/ path-length (lent pax)
|
|
|
|
::
|
|
|
|
:^ ~ ~ %file-list
|
|
|
|
:- -:!>(*(list path))
|
|
|
|
^- (list path)
|
|
|
|
:: sort the matching paths alphabetically
|
|
|
|
::
|
|
|
|
=- (sort - aor)
|
|
|
|
:: traverse the filesystem, filtering for paths with :pax as prefix
|
|
|
|
::
|
|
|
|
%+ skim ~(tap in ~(key by q.yak))
|
|
|
|
|=(paf=path =(pax (scag path-length paf)))
|
2018-02-07 23:04:07 +03:00
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: Checks for existence of a node at an aeon.
|
|
|
|
::
|
|
|
|
:: This checks for existence of content at the node, and does *not* look
|
|
|
|
:: at any of its children.
|
|
|
|
::
|
|
|
|
++ read-u
|
|
|
|
|= {yon/aeon pax/path}
|
2018-03-19 07:18:20 +03:00
|
|
|
^- (unit (unit (each {$null (hypo ~)} lobe)))
|
2016-11-24 07:25:07 +03:00
|
|
|
=+ tak=(~(get by hit.dom) yon)
|
|
|
|
?~ tak
|
|
|
|
~
|
|
|
|
``[%& %null [%atom %n ~] ~]
|
|
|
|
::
|
|
|
|
:: Gets the dome (desk state) at a particular aeon.
|
|
|
|
::
|
|
|
|
:: For past aeons, we don't give an actual ankh in the dome, but the rest
|
2018-10-04 21:37:42 +03:00
|
|
|
:: of the data is legit. We also never send the mime cache over the wire.
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
++ read-v
|
|
|
|
|= {yon/aeon pax/path}
|
2018-10-04 21:37:42 +03:00
|
|
|
^- (unit (unit {$dome (hypo dome:clay)}))
|
2016-11-24 07:25:07 +03:00
|
|
|
?: (lth yon let.dom)
|
|
|
|
:* ~ ~ %dome -:!>(%dome)
|
2018-10-04 21:37:42 +03:00
|
|
|
^- dome:clay
|
|
|
|
:* ank=`[[%ank-in-old-v-not-implemented *ankh] ~ ~]
|
|
|
|
let=yon
|
|
|
|
hit=(molt (skim ~(tap by hit.dom) |=({p/@ud *} (lte p yon))))
|
|
|
|
lab=(molt (skim ~(tap by lab.dom) |=({* p/@ud} (lte p yon))))
|
|
|
|
== ==
|
2016-11-24 07:25:07 +03:00
|
|
|
?: (gth yon let.dom)
|
|
|
|
~
|
2018-10-04 21:37:42 +03:00
|
|
|
``[%dome -:!>(*dome:clay) [ank let hit lab]:dom]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2018-05-03 00:37:03 +03:00
|
|
|
:: Gets all cases refering to the same revision as the given case.
|
|
|
|
::
|
|
|
|
:: For the %da case, we give just the canonical timestamp of the revision.
|
|
|
|
::
|
|
|
|
++ read-w
|
|
|
|
|= cas/case
|
|
|
|
^- (unit (unit (each cage lobe)))
|
2019-05-04 05:24:24 +03:00
|
|
|
=+ aey=(case-to-aeon cas)
|
2018-05-03 00:37:03 +03:00
|
|
|
?~ aey ~
|
|
|
|
=- [~ ~ %& %cass !>(-)]
|
|
|
|
^- cass
|
|
|
|
:- u.aey
|
|
|
|
?: =(0 u.aey) `@da`0
|
|
|
|
t:(aeon-to-yaki u.aey)
|
|
|
|
::
|
2016-11-24 07:25:07 +03:00
|
|
|
:: Gets the data at a node.
|
|
|
|
::
|
2019-05-04 05:24:24 +03:00
|
|
|
++ read-x (cury read-x:util ?=(~ ref))
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
:: Gets an arch (directory listing) at a node.
|
|
|
|
::
|
|
|
|
++ read-y
|
|
|
|
|= {yon/aeon pax/path}
|
|
|
|
^- (unit (unit {$arch (hypo arch)}))
|
|
|
|
?: =(0 yon)
|
|
|
|
``[%arch -:!>(*arch) *arch]
|
|
|
|
=+ tak=(~(get by hit.dom) yon)
|
|
|
|
?~ tak
|
|
|
|
~
|
|
|
|
=+ yak=(tako-to-yaki u.tak)
|
|
|
|
=+ len=(lent pax)
|
|
|
|
:^ ~ ~ %arch
|
|
|
|
:: ~& cy+pax
|
|
|
|
:- -:!>(*arch)
|
|
|
|
^- arch
|
|
|
|
:- (~(get by q.yak) pax)
|
2018-03-19 07:18:20 +03:00
|
|
|
^- (map knot ~)
|
|
|
|
%- molt ^- (list (pair knot ~))
|
2016-11-24 07:25:07 +03:00
|
|
|
%+ turn
|
|
|
|
^- (list (pair path lobe))
|
2017-02-13 23:43:18 +03:00
|
|
|
%+ skim ~(tap by (~(del by q.yak) pax))
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
=(pax (scag len paf))
|
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
=+ pat=(slag len paf)
|
|
|
|
[?>(?=(^ pat) i.pat) ~]
|
|
|
|
::
|
|
|
|
:: Gets a recursive hash of a node and all its children.
|
|
|
|
::
|
|
|
|
++ read-z
|
|
|
|
|= {yon/aeon pax/path}
|
|
|
|
^- (unit (unit {$uvi (hypo @uvI)}))
|
|
|
|
?: =(0 yon)
|
|
|
|
``uvi+[-:!>(*@uvI) *@uvI]
|
|
|
|
=+ tak=(~(get by hit.dom) yon)
|
|
|
|
?~ tak
|
|
|
|
~
|
|
|
|
=+ yak=(tako-to-yaki u.tak)
|
|
|
|
=+ len=(lent pax)
|
|
|
|
:: ~& read-z+[yon=yon qyt=~(wyt by q.yak) pax=pax]
|
|
|
|
=+ ^- descendants/(list (pair path lobe))
|
|
|
|
:: ~& %turning
|
|
|
|
:: =- ~& %turned -
|
|
|
|
%+ turn
|
|
|
|
:: ~& %skimming
|
|
|
|
:: =- ~& %skimmed -
|
2017-02-13 23:43:18 +03:00
|
|
|
%+ skim ~(tap by (~(del by q.yak) pax))
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
=(pax (scag len paf))
|
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
[(slag len paf) lob]
|
|
|
|
=+ us=(~(get by q.yak) pax)
|
|
|
|
^- (unit (unit {$uvi (hypo @uvI)}))
|
|
|
|
:^ ~ ~ %uvi
|
|
|
|
:- -:!>(*@uvI)
|
2018-03-19 07:18:20 +03:00
|
|
|
?: &(?=(~ descendants) ?=(~ us))
|
2016-11-24 07:25:07 +03:00
|
|
|
*@uvI
|
|
|
|
%+ roll
|
|
|
|
^- (list (pair path lobe))
|
|
|
|
[[~ ?~(us *lobe u.us)] descendants]
|
|
|
|
|=({{path lobe} @uvI} (shax (jam +<)))
|
|
|
|
::
|
|
|
|
:: Get a value at an aeon.
|
|
|
|
::
|
|
|
|
:: Value can be either null, meaning we don't have it yet, {null null},
|
|
|
|
:: meaning we know it doesn't exist, or {null null (each cage lobe)},
|
|
|
|
:: meaning we either have the value directly or a content hash of the
|
|
|
|
:: value.
|
|
|
|
::
|
|
|
|
++ read-at-aeon :: read-at-aeon:ze
|
2019-05-03 04:50:20 +03:00
|
|
|
|= [for=(unit ship) yon=aeon mun=mood] :: seek and read
|
2016-11-24 07:25:07 +03:00
|
|
|
^- (unit (unit (each cage lobe)))
|
2018-08-16 02:48:37 +03:00
|
|
|
?. |(?=(~ for) (may-read u.for p.mun yon r.mun))
|
2018-02-07 23:04:07 +03:00
|
|
|
~
|
2018-05-03 00:40:21 +03:00
|
|
|
?- p.mun
|
2019-05-03 04:50:20 +03:00
|
|
|
%d
|
|
|
|
:: XX this should only allow reads at the current date
|
2018-12-13 10:42:15 +03:00
|
|
|
::
|
|
|
|
?: !=(our her)
|
|
|
|
[~ ~]
|
2017-01-04 10:08:40 +03:00
|
|
|
?^ r.mun
|
|
|
|
~&(%no-cd-path [~ ~])
|
2018-12-13 10:42:15 +03:00
|
|
|
[~ ~ %& %noun !>(~(key by dos.rom.ruf))]
|
2018-05-03 00:40:21 +03:00
|
|
|
::
|
2019-05-03 04:50:20 +03:00
|
|
|
%p (read-p r.mun)
|
|
|
|
%t (bind (read-t yon r.mun) (lift |=(a=cage [%& a])))
|
|
|
|
%u (read-u yon r.mun)
|
|
|
|
%v (bind (read-v yon r.mun) (lift |=(a/cage [%& a])))
|
|
|
|
%w (read-w q.mun)
|
|
|
|
%x (read-x yon r.mun)
|
|
|
|
%y (bind (read-y yon r.mun) (lift |=(a/cage [%& a])))
|
|
|
|
%z (bind (read-z yon r.mun) (lift |=(a/cage [%& a])))
|
2018-05-03 00:40:21 +03:00
|
|
|
==
|
2019-05-03 04:50:20 +03:00
|
|
|
++ zu zu:util
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
|
|
|
--
|
|
|
|
--
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
:: section 4cA, filesystem vane
|
|
|
|
::
|
|
|
|
:: This is the arvo interface vane. Our formal state is a `++raft`, which
|
|
|
|
:: has five components:
|
|
|
|
::
|
2018-12-13 10:42:15 +03:00
|
|
|
:: -- `rom` is the state for all local desks.
|
2016-11-24 07:25:07 +03:00
|
|
|
:: -- `hoy` is the state for all foreign desks.
|
|
|
|
:: -- `ran` is the global, hash-addressed object store.
|
|
|
|
:: -- `mon` is the set of mount points in unix.
|
|
|
|
:: -- `hez` is the duct to the unix sync.
|
|
|
|
::
|
|
|
|
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
|
|
=| :: instrument state
|
2019-05-11 00:51:37 +03:00
|
|
|
$: ver=%1 :: vane version
|
2019-02-02 00:46:09 +03:00
|
|
|
ruf=raft :: revision tree
|
2016-11-24 07:25:07 +03:00
|
|
|
== ::
|
2018-12-06 00:41:21 +03:00
|
|
|
|= [our=ship now=@da eny=@uvJ ski=sley] :: current invocation
|
2016-11-24 07:25:07 +03:00
|
|
|
^? :: opaque core
|
|
|
|
|% ::
|
|
|
|
++ call :: handle request
|
2018-12-04 00:22:39 +03:00
|
|
|
|= $: hen=duct
|
|
|
|
type=*
|
|
|
|
wrapped-task=(hobo task:able)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-05-11 00:51:37 +03:00
|
|
|
^- [(list move) _..^$]
|
2018-12-04 00:22:39 +03:00
|
|
|
::
|
|
|
|
=/ req=task:able
|
|
|
|
?. ?=(%soft -.wrapped-task)
|
|
|
|
wrapped-task
|
|
|
|
((hard task:able) p.wrapped-task)
|
|
|
|
::
|
2019-02-22 02:57:51 +03:00
|
|
|
:: only one of these should be going at once, so queue
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
?: ?=(?(%info %into %merg) -.req)
|
|
|
|
:: If there's an active write or a queue, enqueue
|
|
|
|
::
|
|
|
|
:: We only want one active write so each can be a clean
|
|
|
|
:: transaction.
|
|
|
|
::
|
|
|
|
?: |(!=(~ act.ruf) !=(~ cue.ruf))
|
|
|
|
=. cue.ruf (~(put to cue.ruf) [hen req])
|
|
|
|
[~ ..^$]
|
|
|
|
:: If there's the last commit happened in this event, enqueue
|
|
|
|
::
|
|
|
|
:: Without this, two commits could have the same date, which
|
|
|
|
:: would make clay violate referential transparency.
|
|
|
|
::
|
|
|
|
=/ =desk des.req
|
|
|
|
=/ =dojo (fall (~(get by dos.rom.ruf) desk) *dojo)
|
|
|
|
?: =(0 let.dom.dojo)
|
|
|
|
(handle-task hen req)
|
|
|
|
=/ sutil (state:util dom.dojo dom.dojo ran.ruf)
|
|
|
|
=/ last-write=@da t:(aeon-to-yaki:sutil let.dom.dojo)
|
|
|
|
?: !=(last-write now)
|
|
|
|
(handle-task hen req)
|
2019-02-23 02:52:18 +03:00
|
|
|
=. cue.ruf (~(put to cue.ruf) [hen req])
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ wait-behn [hen %pass /queued-request %b %wait now]
|
|
|
|
[[wait-behn ~] ..^$]
|
2019-02-22 02:57:51 +03:00
|
|
|
(handle-task hen req)
|
|
|
|
::
|
|
|
|
++ handle-task
|
|
|
|
|= [hen=duct req=task:able]
|
2019-05-11 00:51:37 +03:00
|
|
|
^- [(list move) _..^$]
|
2018-02-09 15:33:15 +03:00
|
|
|
?- -.req
|
2019-05-11 00:51:37 +03:00
|
|
|
%boat
|
2016-11-24 07:25:07 +03:00
|
|
|
:_ ..^$
|
2017-02-13 23:43:18 +03:00
|
|
|
[hen %give %hill (turn ~(tap by mon.ruf) head)]~
|
2018-02-07 23:07:42 +03:00
|
|
|
::.
|
2019-05-11 00:51:37 +03:00
|
|
|
%cred
|
2018-02-07 23:07:42 +03:00
|
|
|
=. cez.ruf
|
2018-02-09 15:33:15 +03:00
|
|
|
?~ cew.req (~(del by cez.ruf) nom.req)
|
|
|
|
(~(put by cez.ruf) nom.req cew.req)
|
2018-02-07 23:07:42 +03:00
|
|
|
:: wake all desks, a request may have been affected.
|
|
|
|
=| mos/(list move)
|
2018-12-13 10:42:15 +03:00
|
|
|
=/ des ~(tap in ~(key by dos.rom.ruf))
|
2018-02-07 23:07:42 +03:00
|
|
|
|-
|
|
|
|
?~ des [[[hen %give %mack ~] mos] ..^^$]
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our i.des)
|
2018-02-12 18:02:32 +03:00
|
|
|
=^ mor ruf
|
|
|
|
=< abet:wake
|
|
|
|
?: ?=(^ cew.req) den
|
|
|
|
(forget-crew:den nom.req)
|
2018-02-07 23:07:42 +03:00
|
|
|
$(des t.des, mos (weld mos mor))
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%crew
|
2018-02-07 23:07:42 +03:00
|
|
|
[[hen %give %cruz cez.ruf]~ ..^$]
|
2018-02-12 19:57:59 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%crow
|
2018-12-13 10:42:15 +03:00
|
|
|
=/ des ~(tap by dos.rom.ruf)
|
2018-02-12 19:57:59 +03:00
|
|
|
=| rus/(map desk {r/regs w/regs})
|
|
|
|
|^
|
|
|
|
?~ des [[hen %give %croz rus]~ ..^^$]
|
|
|
|
=+ per=(filter-rules per.q.i.des)
|
|
|
|
=+ pew=(filter-rules pew.q.i.des)
|
2018-02-13 21:47:44 +03:00
|
|
|
=? rus |(?=(^ per) ?=(^ pew))
|
|
|
|
(~(put by rus) p.i.des per pew)
|
|
|
|
$(des t.des)
|
2018-02-12 19:57:59 +03:00
|
|
|
::
|
|
|
|
++ filter-rules
|
|
|
|
|= pes/regs
|
|
|
|
^+ pes
|
|
|
|
=- (~(gas in *regs) -)
|
2018-02-13 21:47:44 +03:00
|
|
|
%+ skim ~(tap by pes)
|
2018-02-12 19:57:59 +03:00
|
|
|
|= {p/path r/rule}
|
2018-02-13 21:47:44 +03:00
|
|
|
(~(has in who.r) |+nom.req)
|
2018-02-12 19:57:59 +03:00
|
|
|
--
|
2018-11-23 20:19:23 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%crud
|
2018-11-23 20:19:23 +03:00
|
|
|
[[[hen %slip %d %flog req] ~] ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%drop
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our des.req)
|
2016-11-24 07:25:07 +03:00
|
|
|
abet:drop-me:den
|
|
|
|
[mos ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%info
|
2018-02-09 16:48:08 +03:00
|
|
|
?: =(%$ des.req)
|
2019-05-02 04:21:32 +03:00
|
|
|
~|(%info-no-desk !!)
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ =dojo (fall (~(get by dos.rom.ruf) des.req) *dojo)
|
2019-05-10 04:06:18 +03:00
|
|
|
=. act.ruf
|
|
|
|
=/ writer=form:commit-clad
|
2019-05-11 00:51:37 +03:00
|
|
|
%- %- commit
|
2019-05-10 04:06:18 +03:00
|
|
|
:* our
|
|
|
|
des.req
|
|
|
|
now
|
|
|
|
mon.ruf
|
|
|
|
hez.ruf
|
|
|
|
hun.rom.ruf
|
|
|
|
==
|
|
|
|
:* dit.req
|
2019-05-11 00:51:37 +03:00
|
|
|
dom.dojo
|
2019-05-10 04:06:18 +03:00
|
|
|
ran.ruf
|
|
|
|
==
|
|
|
|
`[hen req ~ %commit writer]
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our des.req)
|
|
|
|
abet:(take-commit:den [%y %init-clad ~])
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%init
|
2019-02-02 00:46:09 +03:00
|
|
|
~& [%init hen]
|
2018-12-13 10:42:15 +03:00
|
|
|
[~ ..^$(hun.rom.ruf hen)]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%into
|
2016-11-24 07:25:07 +03:00
|
|
|
=. hez.ruf `hen
|
|
|
|
:_ ..^$
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ bem=(~(get by mon.ruf) des.req)
|
2018-08-16 02:48:37 +03:00
|
|
|
?: &(?=(~ bem) !=(%$ des.req))
|
2018-02-09 16:48:08 +03:00
|
|
|
~|([%bad-mount-point-from-unix des.req] !!)
|
2016-11-24 07:25:07 +03:00
|
|
|
=+ ^- bem/beam
|
|
|
|
?^ bem
|
|
|
|
u.bem
|
2018-12-13 10:42:15 +03:00
|
|
|
[[our %base %ud 1] ~]
|
|
|
|
=/ dos (~(get by dos.rom.ruf) q.bem)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ dos
|
|
|
|
~
|
|
|
|
?: =(0 let.dom.u.dos)
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ cos=(mode-to-soba ~ s.bem all.req fis.req)
|
2019-05-11 00:51:37 +03:00
|
|
|
=+ ^- [one=soba two=soba]
|
2016-11-24 07:25:07 +03:00
|
|
|
%+ skid cos
|
2019-05-11 00:51:37 +03:00
|
|
|
|= [a=path b=miso]
|
|
|
|
?& ?=(%ins -.b)
|
|
|
|
?=(%mime p.p.b)
|
|
|
|
?=([%hoon ~] (slag (dec (lent a)) a))
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2018-12-13 10:59:53 +03:00
|
|
|
:~ [hen %pass /one %c %info q.bem %& one]
|
|
|
|
[hen %pass /two %c %info q.bem %& two]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
=+ yak=(~(got by hut.ran.ruf) (~(got by hit.dom.u.dos) let.dom.u.dos))
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ cos=(mode-to-soba q.yak (flop s.bem) all.req fis.req)
|
2018-12-13 10:59:53 +03:00
|
|
|
[hen %pass /both %c %info q.bem %& cos]~
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%merg :: direct state up
|
2018-02-09 16:48:08 +03:00
|
|
|
?: =(%$ des.req)
|
2019-05-03 04:06:31 +03:00
|
|
|
~&(%merg-no-desk !!)
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ =dojo (fall (~(get by dos.rom.ruf) des.req) *dojo)
|
2019-05-10 04:06:18 +03:00
|
|
|
=. act.ruf
|
|
|
|
=/ writer=form:merge-clad
|
|
|
|
%- %- merge
|
|
|
|
:* our
|
|
|
|
now
|
|
|
|
[her dem]:req
|
|
|
|
[our des.req]
|
|
|
|
cas.req
|
|
|
|
mon.ruf
|
|
|
|
hez.ruf
|
|
|
|
==
|
|
|
|
:* how.req
|
2019-05-11 00:51:37 +03:00
|
|
|
dom.dojo
|
2019-05-10 04:06:18 +03:00
|
|
|
ran.ruf
|
|
|
|
==
|
|
|
|
`[hen req ~ %merge writer]
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-05-11 00:51:37 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our des.req)
|
|
|
|
abet:(take-merge:den [%y %init-clad ~])
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%mont
|
2016-11-24 07:25:07 +03:00
|
|
|
=. hez.ruf ?^(hez.ruf hez.ruf `[[%$ %sync ~] ~])
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ pot=(~(get by mon.ruf) des.req)
|
2016-11-24 07:25:07 +03:00
|
|
|
?^ pot
|
|
|
|
~& [%already-mounted pot]
|
|
|
|
[~ ..^$]
|
2018-02-09 16:48:08 +03:00
|
|
|
=* bem bem.req
|
2016-11-24 07:25:07 +03:00
|
|
|
=. mon.ruf
|
2018-02-09 16:48:08 +03:00
|
|
|
(~(put by mon.ruf) des.req [p.bem q.bem r.bem] s.bem)
|
2018-12-13 10:42:15 +03:00
|
|
|
=/ dos (~(get by dos.rom.ruf) q.bem)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ dos
|
|
|
|
[~ ..^$]
|
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) p.bem q.bem)
|
2018-02-09 16:48:08 +03:00
|
|
|
abet:(mont:den des.req bem)
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
2017-01-12 18:50:35 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%dirk
|
2017-01-12 18:50:35 +03:00
|
|
|
?~ hez.ruf
|
|
|
|
~& %no-sync-duct
|
|
|
|
[~ ..^$]
|
2018-02-09 16:48:08 +03:00
|
|
|
?. (~(has by mon.ruf) des.req)
|
|
|
|
~& [%not-mounted des.req]
|
2017-01-12 18:50:35 +03:00
|
|
|
[~ ..^$]
|
2018-02-09 16:48:08 +03:00
|
|
|
:- ~[[u.hez.ruf %give %dirk des.req]]
|
2017-01-12 18:50:35 +03:00
|
|
|
..^$
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%ogre
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ hez.ruf
|
|
|
|
~& %no-sync-duct
|
|
|
|
[~ ..^$]
|
2018-02-09 16:48:08 +03:00
|
|
|
=* pot pot.req
|
|
|
|
?@ pot
|
|
|
|
?. (~(has by mon.ruf) pot)
|
|
|
|
~& [%not-mounted pot]
|
2016-11-24 07:25:07 +03:00
|
|
|
[~ ..^$]
|
2018-02-09 16:48:08 +03:00
|
|
|
:_ ..^$(mon.ruf (~(del by mon.ruf) pot))
|
|
|
|
[u.hez.ruf %give %ogre pot]~
|
2016-11-24 07:25:07 +03:00
|
|
|
:_ %_ ..^$
|
|
|
|
mon.ruf
|
|
|
|
%- molt
|
2017-02-13 23:43:18 +03:00
|
|
|
%+ skip ~(tap by mon.ruf)
|
2018-02-09 16:48:08 +03:00
|
|
|
(corl (cury test pot) tail)
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
%+ turn
|
2018-02-09 16:48:08 +03:00
|
|
|
(skim ~(tap by mon.ruf) (corl (cury test pot) tail))
|
|
|
|
|= {pon/term bem/beam}
|
|
|
|
[u.hez.ruf %give %ogre pon]
|
2018-02-07 00:18:25 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%perm
|
2018-02-07 00:18:25 +03:00
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our des.req)
|
2018-02-09 15:33:15 +03:00
|
|
|
abet:(perm:den pax.req rit.req)
|
2018-02-07 00:18:25 +03:00
|
|
|
[mos ..^$]
|
2018-10-10 04:24:25 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%sunk
|
2019-02-02 00:46:09 +03:00
|
|
|
~& rift=[p.req q.req]
|
|
|
|
~& desks=(turn ~(tap by dos.rom.ruf) head)
|
|
|
|
~& hoy=(turn ~(tap by hoy.ruf) head)
|
2019-03-23 03:44:23 +03:00
|
|
|
::
|
|
|
|
:: Don't clear state, because it doesn't quite work yet.
|
|
|
|
::
|
2019-04-30 20:40:38 +03:00
|
|
|
:: ?: =(0 0)
|
|
|
|
:: `..^$
|
2019-01-31 05:48:30 +03:00
|
|
|
:: if we sunk, don't clear clay
|
|
|
|
::
|
|
|
|
?: =(our p.req)
|
|
|
|
[~ ..^$]
|
|
|
|
:: cancel subscriptions
|
|
|
|
::
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ foreign-desk=(unit rung)
|
|
|
|
(~(get by hoy.ruf) p.req)
|
|
|
|
?~ foreign-desk
|
|
|
|
~& [%never-heard-of-her p.req q.req]
|
|
|
|
[~ ..^$]
|
|
|
|
~& old-rift=rit.u.foreign-desk
|
|
|
|
?: (gte rit.u.foreign-desk q.req)
|
|
|
|
~& 'replaying sunk, so not clearing state'
|
|
|
|
[~ ..^$]
|
2019-01-31 05:48:30 +03:00
|
|
|
=/ cancel-ducts=(list duct)
|
|
|
|
%- zing ^- (list (list duct))
|
2019-02-02 00:46:09 +03:00
|
|
|
%+ turn ~(tap by rus.u.foreign-desk)
|
2019-01-31 05:48:30 +03:00
|
|
|
|= [=desk =rede]
|
|
|
|
%+ weld
|
|
|
|
^- (list duct) %- zing ^- (list (list duct))
|
|
|
|
%+ turn ~(tap by qyx.rede)
|
|
|
|
|= [=wove ducts=(set duct)]
|
|
|
|
~(tap in ducts)
|
|
|
|
?~ ref.rede
|
|
|
|
~
|
|
|
|
(turn ~(tap by fod.u.ref.rede) head)
|
|
|
|
=/ cancel-moves=(list move)
|
|
|
|
%+ turn cancel-ducts
|
|
|
|
|= =duct
|
2019-05-02 04:21:32 +03:00
|
|
|
[duct %slip %b %drip !>([%writ ~])]
|
2019-01-31 05:48:30 +03:00
|
|
|
=/ clear-ford-cache-moves=(list move)
|
|
|
|
:~ [hen %pass /clear/keep %f %keep 0 1]
|
|
|
|
[hen %pass /clear/wipe %f %wipe 100]
|
2019-02-02 00:46:09 +03:00
|
|
|
[hen %pass /clear/kep %f %keep 2.048 64]
|
2019-01-31 05:48:30 +03:00
|
|
|
==
|
|
|
|
:: delete local state of foreign desk
|
|
|
|
::
|
|
|
|
=. hoy.ruf (~(del by hoy.ruf) p.req)
|
2019-02-02 00:46:09 +03:00
|
|
|
[(weld clear-ford-cache-moves cancel-moves) ..^$]
|
2019-02-01 10:37:00 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%vega [~ ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
?(%warp %werp)
|
2018-12-13 21:23:26 +03:00
|
|
|
:: capture whether this read is on behalf of another ship
|
|
|
|
:: for permissions enforcement
|
|
|
|
::
|
2018-02-09 15:33:15 +03:00
|
|
|
=^ for req
|
2019-05-11 00:51:37 +03:00
|
|
|
?: ?=(%warp -.req)
|
2018-02-09 15:33:15 +03:00
|
|
|
[~ req]
|
2018-12-13 21:23:26 +03:00
|
|
|
:- ?:(=(our who.req) ~ `who.req)
|
|
|
|
[%warp wer.req rif.req]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
?> ?=(%warp -.req)
|
2018-02-09 16:48:08 +03:00
|
|
|
=* rif rif.req
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) wer.req p.rif)
|
2016-11-24 07:25:07 +03:00
|
|
|
=< abet
|
2018-02-09 15:25:46 +03:00
|
|
|
?~ q.rif
|
2016-11-24 07:25:07 +03:00
|
|
|
cancel-request:den
|
2018-02-09 15:25:46 +03:00
|
|
|
(start-request:den for u.q.rif)
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%west
|
2018-02-09 16:48:08 +03:00
|
|
|
=* wer wer.req
|
|
|
|
=* pax pax.req
|
2019-05-11 00:51:37 +03:00
|
|
|
?: ?=({%question *} pax)
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ ryf=((hard riff) res.req)
|
2016-11-24 07:25:07 +03:00
|
|
|
:_ ..^$
|
|
|
|
:~ [hen %give %mack ~]
|
2018-12-13 21:23:26 +03:00
|
|
|
=/ =wire
|
|
|
|
[(scot %p our) (scot %p wer) t.pax]
|
|
|
|
[hen %pass wire %c %werp wer our ryf]
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-05-11 00:51:37 +03:00
|
|
|
?> ?=({%answer @ @ ~} pax)
|
2018-02-09 16:48:08 +03:00
|
|
|
=+ syd=(slav %tas i.t.pax)
|
|
|
|
=+ inx=(slav %ud i.t.t.pax)
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) wer syd)
|
2018-02-09 16:48:08 +03:00
|
|
|
abet:(take-foreign-update:den inx ((hard (unit rand)) res.req))
|
2016-11-24 07:25:07 +03:00
|
|
|
[[[hen %give %mack ~] mos] ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%wegh
|
2016-11-24 07:25:07 +03:00
|
|
|
:_ ..^$ :_ ~
|
|
|
|
:^ hen %give %mass
|
2019-01-30 03:38:27 +03:00
|
|
|
:+ %clay %|
|
|
|
|
:~ domestic+&+rom.ruf
|
|
|
|
foreign+&+hoy.ruf
|
|
|
|
:+ %object-store %|
|
|
|
|
:~ commits+&+hut.ran.ruf
|
|
|
|
blobs+&+lat.ran.ruf
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
2019-01-30 03:38:27 +03:00
|
|
|
dot+&+ruf
|
2016-11-24 07:25:07 +03:00
|
|
|
==
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ load
|
|
|
|
=> |%
|
2019-05-11 00:51:37 +03:00
|
|
|
+$ axle [%1 ruf-1=raft]
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|
2019-05-11 00:51:37 +03:00
|
|
|
|= *
|
|
|
|
..^$
|
|
|
|
:: |= old=axle
|
|
|
|
:: ^+ ..^$
|
|
|
|
:: ?> ?=(%1 -.old)
|
|
|
|
:: %_(..^$ ruf ruf-1.old)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
|
|
|
++ scry :: inspect
|
|
|
|
|= {fur/(unit (set monk)) ren/@tas why/shop syd/desk lot/coin tyl/path}
|
|
|
|
^- (unit (unit cage))
|
2018-03-19 06:54:47 +03:00
|
|
|
?. ?=(%& -.why) ~
|
2016-11-24 07:25:07 +03:00
|
|
|
=* his p.why
|
|
|
|
:: ~& scry+[ren `path`[(scot %p his) syd ~(rent co lot) tyl]]
|
|
|
|
:: =- ~& %scry-done -
|
2018-08-16 02:48:37 +03:00
|
|
|
=+ luk=?.(?=(%$ -.lot) ~ ((soft case) p.lot))
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ luk [~ ~]
|
|
|
|
?: =(%$ ren)
|
|
|
|
[~ ~]
|
|
|
|
=+ run=((soft care) ren)
|
|
|
|
?~ run [~ ~]
|
2018-02-06 23:57:38 +03:00
|
|
|
::TODO if it ever gets filled properly, pass in the full fur.
|
|
|
|
=/ for/(unit ship)
|
|
|
|
%- ~(rep in (fall fur ~))
|
|
|
|
|= {m/monk s/(unit ship)}
|
|
|
|
?^ s s
|
2018-05-04 03:59:10 +03:00
|
|
|
?: ?=(%| -.m) ~
|
2018-02-06 23:57:38 +03:00
|
|
|
?: =(p.m his) ~
|
|
|
|
`p.m
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski [/scryduct ~] ruf) his syd)
|
2018-02-07 03:34:09 +03:00
|
|
|
=+ (aver:den for u.run u.luk tyl)
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ - -
|
|
|
|
?~ u.- -
|
2018-03-19 06:54:47 +03:00
|
|
|
?: ?=(%& -.u.u.-) ``p.u.u.-
|
2016-11-24 07:25:07 +03:00
|
|
|
~
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
++ stay [%1 ruf]
|
2016-11-24 07:25:07 +03:00
|
|
|
++ take :: accept response
|
|
|
|
|= {tea/wire hen/duct hin/(hypo sign)}
|
2018-12-01 22:31:54 +03:00
|
|
|
^+ [*(list move) ..^$]
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=({$commit @ ~} tea)
|
|
|
|
=* syd i.t.tea
|
2016-11-24 07:25:07 +03:00
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) our syd)
|
2019-05-04 05:24:24 +03:00
|
|
|
abet:(take-commit:den q.hin)
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
2019-05-04 05:24:24 +03:00
|
|
|
?: ?=({$merge @ ~} tea)
|
2019-05-02 04:21:32 +03:00
|
|
|
=* syd i.t.tea
|
|
|
|
=^ mos ruf
|
|
|
|
=/ den ((de our now ski hen ruf) our syd)
|
2019-05-04 05:24:24 +03:00
|
|
|
abet:(take-merge:den q.hin)
|
2019-05-02 04:21:32 +03:00
|
|
|
[mos ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
?: ?=({$blab care @ @ *} tea)
|
|
|
|
?> ?=($made +<.q.hin)
|
2018-06-16 01:36:41 +03:00
|
|
|
?. ?=([%complete %success *] result.q.hin)
|
2016-11-24 07:25:07 +03:00
|
|
|
~| %blab-fail
|
2018-08-09 00:47:01 +03:00
|
|
|
~> %mean.|.((made-result-as-error:ford result.q.hin))
|
2016-11-24 07:25:07 +03:00
|
|
|
!! :: interpolate ford fail into stack trace
|
|
|
|
:_ ..^$ :_ ~
|
2019-05-02 04:21:32 +03:00
|
|
|
:* hen %slip %b %drip !>
|
|
|
|
:* %writ ~
|
2016-11-24 07:25:07 +03:00
|
|
|
^- {care case @tas}
|
|
|
|
[i.t.tea ((hard case) +>:(slay i.t.t.tea)) i.t.t.t.tea]
|
|
|
|
::
|
|
|
|
`path`t.t.t.t.tea
|
2018-08-09 00:47:01 +03:00
|
|
|
`cage`(result-to-cage:ford build-result.result.q.hin)
|
2019-05-02 04:21:32 +03:00
|
|
|
== ==
|
2016-11-24 07:25:07 +03:00
|
|
|
?- -.+.q.hin
|
2019-05-02 04:21:32 +03:00
|
|
|
%init-clad
|
|
|
|
~|(%clad-not-real !!)
|
2017-06-13 04:04:38 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%crud
|
2016-11-24 07:25:07 +03:00
|
|
|
[[[hen %slip %d %flog +.q.hin] ~] ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%made
|
2016-11-24 07:25:07 +03:00
|
|
|
?~ tea !!
|
|
|
|
?+ -.tea !!
|
2019-05-11 00:51:37 +03:00
|
|
|
$ergoing
|
|
|
|
?> ?=({@ @ ~} t.tea)
|
|
|
|
=+ syd=(slav %tas i.t.t.tea)
|
|
|
|
=^ mos ruf
|
|
|
|
=/ den ((de our now ski hen ruf) our syd)
|
|
|
|
abet:(take-ergo:den result.q.hin)
|
|
|
|
[mos ..^$]
|
|
|
|
::
|
|
|
|
%foreign-plops
|
2018-03-19 07:18:20 +03:00
|
|
|
?> ?=({@ @ @ @ ~} t.tea)
|
2016-11-24 07:25:07 +03:00
|
|
|
=+ her=(slav %p i.t.t.tea)
|
|
|
|
=* syd i.t.t.t.tea
|
|
|
|
=+ lem=(slav %da i.t.t.t.t.tea)
|
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) her syd)
|
2018-06-16 01:36:41 +03:00
|
|
|
abet:(take-foreign-plops:den ?~(lem ~ `lem) result.q.hin)
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%foreign-x
|
2016-11-24 07:25:07 +03:00
|
|
|
?> ?=({@ @ @ @ @ *} t.tea)
|
|
|
|
=+ her=(slav %p i.t.t.tea)
|
|
|
|
=+ syd=(slav %tas i.t.t.t.tea)
|
|
|
|
=+ car=((hard care) i.t.t.t.t.tea)
|
|
|
|
=+ ^- cas/case
|
|
|
|
=+ (slay i.t.t.t.t.t.tea)
|
2018-08-16 02:48:37 +03:00
|
|
|
?> ?=({~ %$ case} -)
|
2016-11-24 07:25:07 +03:00
|
|
|
->+
|
|
|
|
=* pax t.t.t.t.t.t.tea
|
|
|
|
=^ mos ruf
|
2019-02-02 00:46:09 +03:00
|
|
|
=/ den ((de our now ski hen ruf) her syd)
|
2018-06-16 01:36:41 +03:00
|
|
|
abet:(take-foreign-x:den car cas pax result.q.hin)
|
2016-11-24 07:25:07 +03:00
|
|
|
[mos ..^$]
|
|
|
|
==
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%mere
|
2018-03-19 06:54:47 +03:00
|
|
|
?: ?=(%& -.p.+.q.hin)
|
2016-11-24 07:25:07 +03:00
|
|
|
~& 'initial merge succeeded'
|
|
|
|
[~ ..^$]
|
|
|
|
~> %slog.
|
|
|
|
:^ 0 %rose [" " "[" "]"]
|
|
|
|
:^ leaf+"initial merge failed"
|
|
|
|
leaf+"my most sincere apologies"
|
|
|
|
>p.p.p.+.q.hin<
|
|
|
|
q.p.p.+.q.hin
|
|
|
|
[~ ..^$]
|
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%note [[hen %give +.q.hin]~ ..^$]
|
|
|
|
%wake
|
2019-04-10 06:15:37 +03:00
|
|
|
:: TODO: handle behn errors
|
|
|
|
::
|
|
|
|
?^ error.q.hin
|
|
|
|
[[hen %slip %d %flog %crud %wake u.error.q.hin]~ ..^$]
|
|
|
|
::
|
2019-02-16 12:24:37 +03:00
|
|
|
?: ?=([%tyme ~] tea)
|
|
|
|
~& %out-of-tyme
|
|
|
|
`..^$
|
2019-02-09 06:18:38 +03:00
|
|
|
:: dear reader, if it crashes here, check the wire. If it came
|
|
|
|
:: from ++bait, then I don't think we have any handling for that
|
|
|
|
:: sort of thing.
|
|
|
|
::
|
2019-01-18 08:37:34 +03:00
|
|
|
=^ queued cue.ruf ~(get to cue.ruf)
|
2018-09-06 02:05:23 +03:00
|
|
|
::
|
|
|
|
=/ queued-duct=duct -.queued
|
|
|
|
=/ queued-task=task:able +.queued
|
|
|
|
::
|
2019-03-13 15:04:54 +03:00
|
|
|
:: ~& :* %clay-waking
|
2019-03-08 08:27:07 +03:00
|
|
|
:: queued-duct
|
|
|
|
:: hen
|
|
|
|
:: ?~(cue.ruf /empty -:(need ~(top to cue.ruf)))
|
|
|
|
:: ==
|
2018-09-06 02:05:23 +03:00
|
|
|
~| [%mismatched-ducts %queued queued-duct %timer hen]
|
|
|
|
?> =(hen queued-duct)
|
|
|
|
::
|
2019-05-02 04:21:32 +03:00
|
|
|
(handle-task hen queued-task)
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%writ
|
2016-11-24 07:25:07 +03:00
|
|
|
?> ?=({@ @ *} tea)
|
|
|
|
~| i=i.tea
|
|
|
|
~| it=i.t.tea
|
|
|
|
=+ him=(slav %p i.t.tea)
|
|
|
|
:_ ..^$
|
2017-10-11 01:11:06 +03:00
|
|
|
:~ :* hen %pass /writ-want %a
|
2018-12-12 23:34:18 +03:00
|
|
|
%want him [%c %answer t.t.tea]
|
2016-11-24 07:25:07 +03:00
|
|
|
(bind p.+.q.hin rant-to-rand)
|
|
|
|
==
|
|
|
|
==
|
2017-06-13 04:04:38 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%send
|
2017-06-13 04:04:38 +03:00
|
|
|
[[[hen %give +.q.hin] ~] ..^$]
|
2016-11-24 07:25:07 +03:00
|
|
|
::
|
2019-05-11 00:51:37 +03:00
|
|
|
%woot
|
2016-11-24 07:25:07 +03:00
|
|
|
[~ ..^$]
|
|
|
|
:: ?~ r.q.hin [~ ..^$]
|
|
|
|
:: ~& [%clay-lost p.q.hin r.q.hin tea]
|
|
|
|
:: [~ ..^$]
|
|
|
|
==
|
|
|
|
::
|
|
|
|
++ rant-to-rand
|
|
|
|
|= rant
|
|
|
|
^- rand
|
|
|
|
[p q [p q.q]:r]
|
|
|
|
::
|
|
|
|
++ mode-to-soba
|
|
|
|
|= {hat/(map path lobe) pax/path all/? mod/mode}
|
|
|
|
^- soba
|
|
|
|
%+ weld
|
|
|
|
^- (list (pair path miso))
|
|
|
|
?. all
|
|
|
|
~
|
|
|
|
=+ mad=(malt mod)
|
|
|
|
=+ len=(lent pax)
|
|
|
|
=+ ^- descendants/(list path)
|
|
|
|
%+ turn
|
2017-02-13 23:43:18 +03:00
|
|
|
%+ skim ~(tap by hat)
|
2016-11-24 07:25:07 +03:00
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
=(pax (scag len paf))
|
|
|
|
|= {paf/path lob/lobe}
|
|
|
|
(slag len paf)
|
|
|
|
%+ murn
|
|
|
|
descendants
|
|
|
|
|= pat/path
|
2018-03-19 07:18:20 +03:00
|
|
|
^- (unit (pair path {$del ~}))
|
2016-11-24 07:25:07 +03:00
|
|
|
?: (~(has by mad) pat)
|
|
|
|
~
|
|
|
|
`[(weld pax pat) %del ~]
|
|
|
|
^- (list (pair path miso))
|
|
|
|
%+ murn mod
|
|
|
|
|= {pat/path mim/(unit mime)}
|
|
|
|
^- (unit (pair path miso))
|
|
|
|
=+ paf=(weld pax pat)
|
|
|
|
?~ mim
|
|
|
|
=+ (~(get by hat) paf)
|
|
|
|
?~ -
|
|
|
|
~& [%deleting-already-gone pax pat]
|
|
|
|
~
|
|
|
|
`[paf %del ~]
|
|
|
|
=+ (~(get by hat) paf)
|
|
|
|
?~ -
|
|
|
|
`[paf %ins %mime -:!>(*mime) u.mim]
|
|
|
|
`[paf %mut %mime -:!>(*mime) u.mim]
|
2019-02-02 00:46:09 +03:00
|
|
|
:: +rift-scry: for a +rift
|
|
|
|
::
|
|
|
|
++ rift-scry
|
2019-04-03 21:22:45 +03:00
|
|
|
~% %rift-scry ..is ~
|
2019-02-02 00:46:09 +03:00
|
|
|
|= who=ship
|
|
|
|
^- (unit rift)
|
|
|
|
=; lyf
|
|
|
|
?~(lyf ~ u.lyf)
|
|
|
|
;; (unit (unit rift))
|
|
|
|
%- (sloy-light ski)
|
|
|
|
=/ pur=spur
|
|
|
|
/(scot %p who)
|
|
|
|
[[151 %noun] %j our %rift da+now pur]
|
2016-11-24 07:25:07 +03:00
|
|
|
--
|