Add 'protocols/' from commit '93c196acaaf85e406f579a94489af5f1ade04ebd'

git-subtree-dir: protocols
git-subtree-mainline: 0c1080eb0b
git-subtree-split: 93c196acaa
This commit is contained in:
Tony Garnock-Jones 2021-07-01 10:00:50 +02:00
commit 94c63ef992
13 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,4 @@
version 1 .
embeddedType EntityRef.Ref .
Observe = <Observe @pattern dataspacePatterns.Pattern @observer #!any>.

View File

@ -0,0 +1,15 @@
version 1 .
; Dataspace patterns: a sublanguage of attenuation patterns.
Pattern = DDiscard / DBind / DLit / DCompound .
DDiscard = <_>.
DBind = <bind @name symbol @pattern Pattern>.
DLit = <lit @value any>.
DCompound = @rec <compound @ctor CRec @members { int: Pattern ...:... }>
/ @arr <compound @ctor CArr @members { int: Pattern ...:... }>
/ @dict <compound @ctor CDict @members { any: Pattern ...:... }> .
CRec = <rec @label any @arity int>.
CArr = <arr @arity int>.
CDict = <dict>.

View File

@ -0,0 +1,5 @@
version 1 .
embeddedType EntityRef.Ref .
Resolve = <resolve @sturdyref sturdy.SturdyRef @observer #!#!any>.
Bind = <bind @oid any @key bytes @target #!any>.

View File

@ -0,0 +1,14 @@
version 1 .
embeddedType sturdy.WireRef .
Assertion = any .
Handle = int .
Event = Assert / Retract / Message / Sync .
Oid = int .
Turn = [TurnEvent ...].
TurnEvent = [@oid Oid @event Event].
Assert = <assert @assertion Assertion @handle Handle>.
Retract = <retract @handle Handle>.
Message = <message @body Assertion>.
Sync = <sync @peer #!#t>.

View File

@ -0,0 +1,3 @@
version 1 .
RacketEvent = <racket-event @source #!any @event #!any>.

View File

@ -0,0 +1,21 @@
version 1 .
embeddedType EntityRef.Ref .
UserId = int .
Join = <joinedUser @uid UserId @handle #!Session>.
Session = @observeUsers <Observe =user @observer #!UserInfo>
/ @observeSpeech <Observe =says @observer #!Says>
/ NickClaim
/ Says
.
NickClaim = <claimNick @uid UserId @name string @k #!NickClaimResponse>.
NickClaimResponse = #t / NickConflict .
UserInfo = <user @uid UserId @name string>.
Says = <says @who UserId @what string>.
NickConflict = <nickConflict>.

View File

@ -0,0 +1,5 @@
version 1 .
embeddedType EntityRef.Ref .
RequireService = <require-service @serviceName any>.
ServiceRunning = <service-running @serviceName any>.

View File

@ -0,0 +1,5 @@
version 1 .
embeddedType EntityRef.Ref .
Present = <Present @username string>.
Says = <Says @who string @what string>.

View File

@ -0,0 +1,38 @@
version 1 .
embeddedType EntityRef.Ref .
; Assertion:
StreamConnection = <stream-connection @source #!Source @sink #!Sink @spec any>.
; Assertions:
StreamListenerReady = <stream-listener-ready @spec any>.
StreamListenerError = <stream-listener-error @spec any @message string>.
; Assertion:
StreamError = <error @message string>.
Source =
; Assertions:
/ <sink @controller #!Sink>
/ StreamError
; Messages:
/ <credit @amount CreditAmount @mode Mode>
.
Sink =
; Assertions:
/ <source @controller #!Source>
/ StreamError
; Messages:
/ <data @payload any @mode Mode>
/ <eof>
.
; Value:
CreditAmount = @count int / @unbounded =unbounded .
; Value:
Mode = =bytes / @lines LineMode / <packet @size int> / <object @description any>.
LineMode = =lf / =crlf .

View File

@ -0,0 +1,44 @@
version 1 .
; Each Attenuation is a stage. The sequence of Attenuations is run RIGHT-TO-LEFT.
; That is, the newest Attenuations are at the right.
SturdyRef = <ref @oid any @caveatChain [Attenuation ...] @sig bytes>.
; An individual Attenuation is run RIGHT-TO-LEFT.
; That is, the newest Caveats are at the right.
Attenuation = [Caveat ...].
; embodies 1st-party caveats over assertion structure, but nothing else
; can add 3rd-party caveats and richer predicates later
Caveat = Rewrite / Alts .
Rewrite = <rewrite @pattern Pattern @template Template>.
Alts = <or @alternatives [Rewrite ...]>.
Oid = int .
WireRef = @mine [0 @oid Oid] / @yours [1 @oid Oid @attenuation Caveat ...].
;---------------------------------------------------------------------------
ConstructorSpec = CRec / CArr / CDict .
CRec = <rec @label any @arity int>.
CArr = <arr @arity int>.
CDict = <dict>.
Lit = <lit @value any>.
Pattern = PDiscard / PAtom / PEmbedded / PBind / PAnd / PNot / Lit / PCompound .
PDiscard = <_>.
PAtom = =Boolean / =Float / =Double / =SignedInteger / =String / =ByteString / =Symbol .
PEmbedded = =Embedded .
PBind = <bind @name symbol @pattern Pattern>.
PAnd = <and @patterns [Pattern ...]>.
PNot = <not @pattern Pattern>.
PCompound = <compound @ctor ConstructorSpec @members PCompoundMembers>.
PCompoundMembers = { any: Pattern ...:... }.
Template = TAttenuate / TRef / Lit / TCompound .
TAttenuate = <attenuate @template Template @attenuation Attenuation>.
TRef = <ref @name symbol>.
TCompound = <compound @ctor ConstructorSpec @members TCompoundMembers>.
TCompoundMembers = { any: Template ...:... }.

View File

@ -0,0 +1,7 @@
version 1 .
embeddedType EntityRef.Ref .
TcpRemote = <tcp-remote @host string @port int>.
TcpLocal = <tcp-local @host string @port int>.
TcpPeerInfo = <tcp-peer @handle #!any @local TcpLocal @remote TcpRemote>.

View File

@ -0,0 +1,7 @@
version 1 .
SetTimer = <set-timer @label any @msecs double @kind TimerKind>.
TimerExpired = <timer-expired @label any @msecs double>.
TimerKind = =relative / =absolute / =clear .
LaterThan = <later-than @msecs double>.

View File

@ -0,0 +1,4 @@
version 1 .
embeddedType EntityRef.Ref .
Instance = <Instance @name string @argument any>.