Skip to content

Commit

Permalink
refactor(swingset): improve vat deliveries
Browse files Browse the repository at this point in the history
This moves some logic out of `deliverAndLogToVal` and into a higher-level
dispatch function, where it can react to all failure modes in a single place.

We pull "run-queue events" off the run-queue (currently named the "acceptance
queue". Many of these events are aimed at a specific vat, including 'notify',
but the primary one is 'send' and is aimed at a *target* kref, which is
either a kernel object or a kernel promise. For these we use `routeSendEvent`
to either queue the event on a promise queue, reject it if it can't be
delivered, or deliver it to a specific vat. This is the part that will change
with #3465: in that world, each vat-input-queue exists for a specific vat, so
the routing step moves earlier (into a "routing crank" that pulls events from
a vat-output-queue and possibly adds them to a vat-input-queue).

Some kinds of deliveries care about metering (or don't), and some have
opinions about what should happen if a crank gets unwound. These are now
reported as additional properties in the DeliveryStatus object that is
returned by this delivery path. `processDeliveryMessage` looks at these
properties, plus the delivery status (if any) to decide what to do at the end
of the crank.

I think most of the behavior should be the same as before. One change is that
the `runPolicy` will probably get more information about non-'send' cranks
than before (e.g. `create-vat` might report metering).

This refactoring should make it easier to implement #1848 vat-upgrade, as
well as #3465 queueing changes.

closes #4687
  • Loading branch information
warner committed Mar 2, 2022
1 parent 0a320ba commit f0f5f0d
Show file tree
Hide file tree
Showing 6 changed files with 455 additions and 262 deletions.
Loading

0 comments on commit f0f5f0d

Please sign in to comment.