matrix-capnproto-fed

What if Matrix was written using Cap'n'proto and a RPC federation API?
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-capnproto-fed.git
Log | Files | Refs | README | LICENSE

federation.v1.capnp (2088B)


      1 using Go = import "/go.capnp";
      2 using Types = import "./types/types.capnp";
      3 
      4 @0xee8fadeb6a9300eb;
      5 
      6 $Go.package("v1");
      7 $Go.import("github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1");
      8 
      9 annotation methodUUID @0xe55590d1a37e8043 (method) :UInt64;
     10 
     11 # This is an async stream callback. This is a callback called on the other end
     12 interface StreamCallback(T) {
     13     # Data is written here. It behaves like a regular callback on the receiver and a function call on the caller
     14     write @0 (value :T) -> stream;
     15     # The stream will be closed when this is called.
     16     done @1 ();
     17 }
     18 
     19 interface MatrixFederation @0xf730448b3b47991e {
     20     # Get the implementation name and version of this homeserver.
     21     getVersion @0 () -> (serverVersion :Types.ServerVersion) $methodUUID(0xab1eb3e81f3344d1);
     22 
     23     # This combines the query via other servers and the direct query endpoints
     24     getKeys @1 (server_keys :Types.Map(Text, Types.Map(Text, Types.QueryCriteria)), callback :StreamCallback(Types.ServerKeysResponse)) -> () $methodUUID(0x932dd11596dad50e);
     25 
     26     # Push messages representing live activity to another server. The destination
     27     # name will be set to that of the receiving server itself. Each embedded PDU
     28     # in the transaction body will be processed.
     29     #
     30     # Errors are returned as stream errors rather than at the end of the stream.
     31     sendTransactions @2 () -> (callback :StreamCallback(Types.Transaction)) $methodUUID(0xec6b6ce167005c84);
     32 
     33     # [https://spec.matrix.org/v1.9/server-server-api/#get_matrixfederationv1backfillroomid](https://spec.matrix.org/v1.9/server-server-api/#get_matrixfederationv1backfillroomid)
     34     # Retrieves a sliding-window history of previous PDUs that occurred in the
     35     # given room. Starting from the PDU ID(s) given in the v argument, the PDUs
     36     # given in v and the PDUs that preceded them are retrieved, up to the total
     37     # number given by the limit.
     38     backfill @3 (auth_data :Types.AuthData, roomID :Text, limit :UInt32, eventIDs :List(Text), callback :StreamCallback(Types.BackfillData)) -> () $methodUUID(0x970e8e8dfe8f0ced);
     39 }