feat(ocapn): Minimum viable OCapN#2962
Conversation
|
see previous PR #2781 for review and discussion |
…ass-style selectors
e5123d8 to
5c1c185
Compare
kriskowal
left a comment
There was a problem hiding this comment.
I’m reapproving this with light review and some comments that can be addressed now or later given that we want this to grow fast and evolve. We will likely be relying on the rigor of our test suite.
There’s code in here for finalization, which I would like to be sure works somehow.
| { weakValues: gcImports }, | ||
| ); | ||
|
|
||
| let lastExportID = 0; |
There was a problem hiding this comment.
I have documented feelings about identity document initialism https://kriskowal.com/naming-things/#identifer
| * Called when we have encountered a new value that needs to be assigned a slot. | ||
| * | ||
| * @param {any} val | ||
| * @returns {CapTPSlot} |
There was a problem hiding this comment.
I also have case convention feelings https://kriskowal.com/naming-things/#pick-one-case-convention
I recommend CaptpSlot or CapSlot or Slot.
| /** | ||
| * @typedef {import('../cryptography.js').OcapnPublicKey} OcapnPublicKey | ||
| * @typedef {import('../cryptography.js').OcapnKeyPair} OcapnKeyPair | ||
| * @typedef {import('../codecs/components.js').OcapnPublicKeyData} OcapnPublicKeyData | ||
| * @typedef {import('../codecs/components.js').OcapnLocation} OcapnLocation | ||
| * @typedef {import('../codecs/components.js').OcapnSignature} OcapnSignature | ||
| * @typedef {import('./types.js').Session} Session | ||
| * @typedef {import('./types.js').Connection} Connection | ||
| * @typedef {import('./types.js').Client} Client | ||
| * @typedef {import('./types.js').NetLayer} NetLayer | ||
| * @typedef {import('./types.js').SelfIdentity} SelfIdentity | ||
| * @typedef {import('./types.js').Logger} Logger | ||
| * @typedef {import('./types.js').LocationId} LocationId | ||
| * @typedef {import('./types.js').PendingSession} PendingSession | ||
| * @typedef {import('./types.js').SessionManager} SessionManager | ||
| * @typedef {import('./ocapn.js').GrantTracker} GrantTracker | ||
| * @typedef {import('./ocapn.js').Ocapn} Ocapn | ||
| */ |
There was a problem hiding this comment.
Can use /** import {} from "" */ notation now, which is more transparent to the language server since it doesn’t create a new type.
| @@ -0,0 +1,98 @@ | |||
| // @ts-check | |||
There was a problem hiding this comment.
Elsewhere, we’re moving in the direction of writing all-types files as .ts. This is not a hard line but one we can move incrementally.
| * @param {OcapnSignature} sig | ||
| * @returns {Uint8Array} | ||
| */ | ||
| export const ocapNSignatureToBytes = sig => { |
There was a problem hiding this comment.
| export const ocapNSignatureToBytes = sig => { | |
| export const ocapnSignatureToBytes = sig => { |
| * @param {Uint8Array} peerIdTwo | ||
| * @returns {Uint8Array} | ||
| */ | ||
| export const makeSessionId = (peerIdOne, peerIdTwo) => { |
There was a problem hiding this comment.
As much as I loathe “id”, I will accept it in general if it’s consistently capitalized like you have here: Id.
This PR is intended to land a work-in-progress implementation of the client, and is not ready to be published.
The implementation is a single vat single process (no comms vat).
Implements Passables
Remote calls + Pipelining
Third Party Handoffs
Eager promise subscription (lazy promise subscription to be explored later)
A tcp-testing-only netlayer (no tor netlayer yet)
This does not yet implement GC messages.
this was mostly built against this test suite https://github.com/ocapn/ocapn-test-suite
which lags behind the spec a bit. I expect dramatic spec changes to come, so I don't mind being behind spec at this point.
There is some implementation weirdness around use of pass-style due to a need for an ImmutableArrayBuffer. This implementation currently still uses mutable Uint8Arrays and thus some homespun passStyleOf checks. The intention is to replace these with exclusively real pass-style before publishing.
This PR replaces #2781 with a rebase on
master. See it for previous review and discussion. No other changes.This is intended to be merged as is but is not yet deemed ready to be published