From f85da922dafab612682ab6a47fc86b054663e157 Mon Sep 17 00:00:00 2001 From: Ian Denhardt Date: Wed, 17 May 2023 17:55:00 -0500 Subject: [PATCH] CapTP AST / data representation and serialization #3 --- packages/ocproto/lib/ocapn.capnp | 53 ++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 packages/ocproto/lib/ocapn.capnp diff --git a/packages/ocproto/lib/ocapn.capnp b/packages/ocproto/lib/ocapn.capnp new file mode 100644 index 0000000..e28829d --- /dev/null +++ b/packages/ocproto/lib/ocapn.capnp @@ -0,0 +1,53 @@ +# ocapn.capnp +@0xcd301da1d95b8242; + +struct Value { + union { + ## Atoms ## + + undefined @0 :Void; + null @1 :Void; + bool @2 :Bool; + float64 @3 :Float64; + + unsignedInt @4 :Data; + # Non-negative integer, in big-endian format + negativeInt @5 :Data; + # Negative integer. value is `-1 - n`, where `n` + # is the data interpreted as an unsigned big-endian integer. + + string @6 :Text; + byteString @7 :Data; + symbol @8 :Text; # Might be removed, pending #46. + + ## Containers ## + + list @9 :List(Value); + + struct @10 :List(StructField); + # Duplicate keys are not allowed; will need to enforce this at a higher level + # of abstraction. + + tagged :group { + label @11 :Text; + value @12 :Value; + } + + capability @13 :Cap; + + error @14 :Error; + } +} + +struct StructField { + key @0 :Text; + value @1 :Value; +} + +interface Cap { + # TODO +} + +struct Error { + # TODO, pending #10. +} \ No newline at end of file