Remove unneeded #:capture-projection argument to term->skeleton-interest

This commit is contained in:
Tony Garnock-Jones 2019-05-03 20:29:40 +01:00
parent 40ee3b4ca7
commit a86478b7b9
2 changed files with 34 additions and 36 deletions

View File

@ -74,38 +74,39 @@
;; (log-info "~a (asserted (observe (inbound ~v)))" inner-actor x) ;; (log-info "~a (asserted (observe (inbound ~v)))" inner-actor x)
(with-current-facet [outer-facet] (with-current-facet [outer-facet]
(with-non-script-context (with-non-script-context
(define outer-capture-proj (term->capture-proj x))
(define inner-capture-proj (map (lambda (p) (cons 0 p)) outer-capture-proj))
;; ^ inner-capture-proj accounts for the extra (inbound ...) layer around assertions
(define i (define i
(term->skeleton-interest (let ((inner-capture-proj
x ;; inner-capture-proj accounts for the extra (inbound ...) layer around
#:capture-projection outer-capture-proj ;; assertions
(lambda (op . captured-values) (let ((outer-capture-proj (term->capture-proj x)))
(define assertion (map (lambda (p) (cons 0 p)) outer-capture-proj))))
(instantiate-term->value (inbound x) captured-values (term->skeleton-interest
#:visibility-restriction-proj inner-capture-proj)) x
;; (log-info "~a => ~a ~a ~v" (lambda (op . captured-values)
;; outer-facet (define assertion
;; inner-facet (instantiate-term->value (inbound x) captured-values
;; op #:visibility-restriction-proj inner-capture-proj))
;; assertion) ;; (log-info "~a => ~a ~a ~v"
(match op ;; outer-facet
['+ (apply-patch! inner-ds inner-actor (bag assertion +1))] ;; inner-facet
['- (apply-patch! inner-ds inner-actor (bag assertion -1))] ;; op
['! (send-assertion! (dataspace-routing-table inner-ds) assertion)]) ;; assertion)
(schedule-inner!)) (match op
#:cleanup ['+ (apply-patch! inner-ds inner-actor (bag assertion +1))]
(lambda (cache) ['- (apply-patch! inner-ds inner-actor (bag assertion -1))]
(apply-patch! ['! (send-assertion! (dataspace-routing-table inner-ds) assertion)])
inner-ds (schedule-inner!))
inner-actor #:cleanup
(for/bag/count [(captured-values (in-bag cache))] (lambda (cache)
;; (log-info "~a (cleanup) ~v" inner-actor term) (apply-patch!
(values (instantiate-term->value (inbound x) captured-values inner-ds
#:visibility-restriction-proj inner-capture-proj) inner-actor
-1))) (for/bag/count [(captured-values (in-bag cache))]
(schedule-inner!)))) ;; (log-info "~a (cleanup) ~v" inner-actor term)
(values (instantiate-term->value (inbound x) captured-values
#:visibility-restriction-proj inner-capture-proj)
-1)))
(schedule-inner!)))))
(add-endpoint-if-live! outer-facet (add-endpoint-if-live! outer-facet
inbound-endpoints inbound-endpoints
x x

View File

@ -15,14 +15,11 @@
(require "pattern.rkt") (require "pattern.rkt")
(require "skeleton.rkt") (require "skeleton.rkt")
(define (term->skeleton-interest x (define (term->skeleton-interest x handler #:cleanup [cleanup #f])
#:capture-projection [capture-proj (term->capture-proj x)]
handler
#:cleanup [cleanup #f])
(skeleton-interest (term->skeleton x) (skeleton-interest (term->skeleton x)
(term->skeleton-proj x) (term->skeleton-proj x)
(term->key x) (term->key x)
capture-proj (term->capture-proj x)
handler handler
cleanup)) cleanup))