Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out processing of coordinate pairs from SPROUTS-LOOP #44

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/dryad.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,15 @@ NOTE: In the basic implementation, these messages must be waiting for the DRYAD
(push ids pairs))
(t
(error "Two distinct match edges laid claim to the same vertex.")))))
(assert (= (length pairs) (/ (length addresses) 2)))
(dolist (pair pairs)
(send-message (dryad-match-address dryad)
(make-message-reap :ids pair)))
(process-continuation dryad `(WIND-DOWN)))))))
(process-continuation dryad
`(PROCESS-PAIRS ,pairs)
`(WIND-DOWN)))))))

(define-process-upkeep ((dryad dryad) now) (PROCESS-PAIRS pairs)
"Iterates through `PAIRS' and sends corresponding REAP messages."
(dolist (pair pairs)
(send-message (dryad-match-address dryad)
(make-message-reap :ids pair))))

(define-process-upkeep ((dryad dryad) now) (SEND-EXPAND sprout)
"Directs SPROUT to perform blossom expansion."
Expand All @@ -157,12 +161,16 @@ NOTE: In the basic implementation, these messages must be waiting for the DRYAD
;; and directly expand it if appropriate.
(sync-rpc (make-message-blossom-parent)
(topmost sprout)
(sync-rpc (make-message-values :values '(children parent))
((children parent) topmost)
(sync-rpc (make-message-values :values '(children parent match-edge))
((children parent match-edge) topmost)
(when (or children parent)
(log-entry :entry-type 'aborting-dryad-expansion
:reason 'tree-structure))
(unless (or children parent)
(log-entry :entry-type 'dryad-sending-expand
:sprout sprout
:topmost topmost
:match-edge match-edge)
(sync-rpc (make-message-expand)
(expand-reply topmost)
nil))))))
Expand Down
10 changes: 8 additions & 2 deletions src/logger.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
(eql 'REWINDING (getf entry ':entry-type)))
(and (eql 'SUPERVISOR (getf entry ':source-type))
(eql 'MULTIREWEIGHTING (getf entry ':entry-type)))
(and (eql 'message-wilt (type-of (getf entry ':payload))))
(and (eql 'HANDLING-SOW (getf entry ':entry-type))))
(and (eql 'MESSAGE-WILT (type-of (getf entry ':payload))))
(and (eql 'HANDLING-SOW (getf entry ':entry-type)))
;; dryad expansion
(and (eql 'COMMAND (getf entry ':entry-type))
(eql 'SEND-EXPAND (getf entry ':command)))
(and (eql 'DRYAD-SENDING-EXPAND (getf entry ':entry-type)))
(and (eql 'SPAWNED-FRESH-BLOSSOM (getf entry ':entry-type)))
(and (eql 'BLOSSOM-EXTINGUISHED (getf entry ':entry-type))))
(push entry entries))))))
2 changes: 2 additions & 0 deletions src/operations/contract.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ PETAL-CHILD-EDGES: The list of child edges attached to the blossoms in the subtr
:paused? t
:debug? (process-debug? supervisor))))
(schedule fresh-blossom now)
(log-entry :entry-type 'spawned-fresh-blossom
:fresh-blossom fresh-blossom)
(push (make-data-frame-contract
:fresh-blossom (process-public-address fresh-blossom)
:pong (data-frame-supervisor-pong supervisor-frame))
Expand Down
2 changes: 2 additions & 0 deletions src/operations/expand.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,6 @@ In the right diagram, b0 is both the `root-node' and the `matched-node', because
;; NOTE: There's no data frame to pop.
(when reply-channel
(send-message reply-channel (make-message-rpc-done)))
(log-entry :entry-type 'blossom-extinguished
:blossom node)
(setf (blossom-node-wilting node) t))
Loading