Ad-hoc serialization comity
From Erights
Kevin Reid (Talk | contribs) (add SerMap description) |
Kevin Reid (Talk | contribs) (introduce 'comity table' term) |
||
Line 7: | Line 7: | ||
=== Table-tagged references === | === Table-tagged references === | ||
- | There are multiple tables of [[graph exits]], and each [[CapTP]] [[eventual reference]] specifies one such table. Messages sent to a reference are serialized using that reference's table. PassByProxy objects in the message arguments, when unserialized on the other side, are remote references with the ''inverse'' of the original | + | There are multiple tables of [[graph exits]], called ''comity tables'', and each [[CapTP]] [[eventual reference]] specifies one such table. Messages sent to a reference are serialized using that reference's table. PassByProxy objects in the message arguments, when unserialized on the other side, are remote references with the ''inverse'' of the original comity table. |
- | Two eventual references are the [[same]] only if their | + | Two eventual references are the [[same]] only if their comity tables are the same. |
+ | |||
+ | It is not possible to retrieve the comity table of a reference. | ||
[[eventual send|Eventual-send]] result promises share the same table as the original reference; this is appropriate as any message sent on it ''before it resolves'' will be going to the original reference's host vat for forwarding. | [[eventual send|Eventual-send]] result promises share the same table as the original reference; this is appropriate as any message sent on it ''before it resolves'' will be going to the original reference's host vat for forwarding. | ||
- | The ' | + | The 'withComity' operation introduces an agreement. |
- | + | withComity(<var>referent</var>, <var>table</var> :ComityTable) | |
- | Returns | + | Returns a reference like <var>referent</var> except that the exit table is augmented with the entries in <var>map</var>. |
- | A | + | A ComityTable is an object with four fields: |
- | * <var>exits</var> :[[Map]]. Used as Data-E [[unscope]] for serializing arguments of messages to references having this | + | * <var>exits</var> :[[Map]]. Used as Data-E [[unscope]] for serializing arguments of messages to references having this ComityTable, except that the values are not exit names, but rather references to be used in the receiving vat. |
* <var>uncallers</var> :[[List]]. Used as Data-E [[uncaller]] list in the same way. | * <var>uncallers</var> :[[List]]. Used as Data-E [[uncaller]] list in the same way. | ||
- | * <var>invExits</var> :[[Map]] and <var>invUncallers</var> :[[List]]. When a [[PassByProxy]] reference is sent over a reference having this | + | * <var>invExits</var> :[[Map]] and <var>invUncallers</var> :[[List]]. When a [[PassByProxy]] reference is sent over a reference having this ComityTable, it arrives in the receiving vat having a ComityTable with these two fields exchanged with <var>exits</var> and <var>uncallers</var>. |
- | [[ | + | (This proposal was invented in conversation with MarkM by --[[User:Kevin Reid|Kevin Reid]] 22:19, 26 June 2008 (CDT)) |
Revision as of 04:36, 27 June 2008
Premise
Distributed applications running in multiple E vats should be able to exchange objects of custom types, i.e. to agree that their makers should be graph exits, without requiring that the objects be mobile code, or that the vats have matching entries in the global emaker namespace [which should go away too, but I haven't gotten to that problem yet --Kevin Reid 22:19, 26 June 2008 (CDT)]].
Proposals
Table-tagged references
There are multiple tables of graph exits, called comity tables, and each CapTP eventual reference specifies one such table. Messages sent to a reference are serialized using that reference's table. PassByProxy objects in the message arguments, when unserialized on the other side, are remote references with the inverse of the original comity table.
Two eventual references are the same only if their comity tables are the same.
It is not possible to retrieve the comity table of a reference.
Eventual-send result promises share the same table as the original reference; this is appropriate as any message sent on it before it resolves will be going to the original reference's host vat for forwarding.
The 'withComity' operation introduces an agreement.
withComity(referent, table :ComityTable)
Returns a reference like referent except that the exit table is augmented with the entries in map.
A ComityTable is an object with four fields:
- exits :Map. Used as Data-E unscope for serializing arguments of messages to references having this ComityTable, except that the values are not exit names, but rather references to be used in the receiving vat.
- uncallers :List. Used as Data-E uncaller list in the same way.
- invExits :Map and invUncallers :List. When a PassByProxy reference is sent over a reference having this ComityTable, it arrives in the receiving vat having a ComityTable with these two fields exchanged with exits and uncallers.
(This proposal was invented in conversation with MarkM by --Kevin Reid 22:19, 26 June 2008 (CDT))