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

commit b302d62dbd52b808f7e89aa8f5102df805afc8a2
Author: MTRNord <mtrnord1@gmail.com>
Date:   Thu, 14 Mar 2024 12:43:58 +0100

Initial Commit

Diffstat:
A.gitignore | 6++++++
AREADME.md | 28++++++++++++++++++++++++++++
Abenchmarks/plot_progression.py | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Abenchmarks/server_client_1.json | 1088+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Abenchmarks/server_client_1.png | 0
Abenchmarks/server_client_2.json | 1622+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Abenchmarks/server_client_2.png | 0
Abuild.sh | 32++++++++++++++++++++++++++++++++
Acmds/client/helpers/helper.go | 174+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acmds/client/main.go | 105+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acmds/server/main.go | 25+++++++++++++++++++++++++
Ago.mod | 7+++++++
Ago.sum | 18++++++++++++++++++
Aproto/federation/v1/federation.v1.capnp | 40++++++++++++++++++++++++++++++++++++++++
Aproto/federation/v1/federation.v1.capnp.go | 1557+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproto/federation/v1/types/types.capnp | 399+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aproto/federation/v1/types/types.capnp.go | 5858+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arpcserver/map_wrapper.go | 124+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arpcserver/rpc_server.go | 177+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arpcserver/utils.go | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
20 files changed, 11395 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,5 @@ +descriptor.pb +docs +matrix_protobuf_fed +bin/ +.mypy_cache +\ No newline at end of file diff --git a/README.md b/README.md @@ -0,0 +1,28 @@ +# What if Matrix was written using Cap'n'proto and a RPC federation API? + +This question is what I am trying to proof by actually implementing this into synapse. + +For simplicity this repo includes some go demo code for some of the details but +it also provides a suggested structure of folders for the proto files. + +## Will there be an MSC? + +Maybe but my hopes are either way very low that this will get mainline. + +## Will there be a synapse PR? + +Yes this is a major goal of this. It will also support fallback by design to the HTTP API +if the rpc API is not available. + +## Will this work with $Loadbalancer? + +It depends. Its doing RPC over unix or tcp sockets. So if your loadbalancer can handle that +it should work. + +## Will this be faster? + +Maybe. This is to be tested + +## What will be signed? + +The message that holds the signature map will be signed in its canonical binary form. diff --git a/benchmarks/plot_progression.py b/benchmarks/plot_progression.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +"""This program shows `hyperfine` benchmark results in a sequential way +in order to debug possible background interference, caching effects, +thermal throttling and similar effects. +""" + +import argparse +import json +import matplotlib.pyplot as plt +import numpy as np + + +def moving_average(times, num_runs): + times_padded = np.pad( + times, (num_runs // 2, num_runs - 1 - num_runs // 2), mode="edge" + ) + kernel = np.ones(num_runs) / num_runs + return np.convolve(times_padded, kernel, mode="valid") + + +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument("file", help="JSON file with benchmark results") +parser.add_argument("--title", help="Plot Title") +parser.add_argument("-o", "--output", help="Save image to the given filename.") +parser.add_argument( + "-w", + "--moving-average-width", + type=int, + metavar="num_runs", + help="Width of the moving-average window (default: N/5)", +) +parser.add_argument( + "--no-moving-average", + action="store_true", + help="Do not show moving average curve", +) + + +args = parser.parse_args() + +with open(args.file) as f: + results = json.load(f)["results"] + +for result in results: + label = result["command"] + times = result["times"] + num = len(times) + nums = range(num) + + plt.scatter(x=nums, y=times, marker=".") + plt.ylim([0, None]) + plt.xlim([-1, num]) + + if not args.no_moving_average: + moving_average_width = ( + num // 5 if args.moving_average_width is None else args.moving_average_width + ) + + average = moving_average(times, moving_average_width) + plt.plot(nums, average, "-") + +if args.title: + plt.title(args.title) + +legend = [] +for result in results: + legend.append(result["command"]) + if not args.no_moving_average: + legend.append("moving average") +plt.legend(legend) + +plt.ylabel("Time [s]") + +if args.output: + plt.savefig(args.output) +else: + plt.show() diff --git a/benchmarks/server_client_1.json b/benchmarks/server_client_1.json @@ -0,0 +1,1088 @@ +{ + "results": [ + { + "command": "../bin/client", + "mean": 0.003964113777570098, + "stddev": 0.00032544599920357226, + "median": 0.003911752, + "user": 0.001322192523364487, + "system": 0.0030931233644859806, + "min": 0.0033532650000000002, + "max": 0.005680849, + "times": [ + 0.005599215, + 0.0038517190000000004, + 0.003590264, + 0.004045816, + 0.003696955, + 0.0038912330000000005, + 0.004092023, + 0.003745407, + 0.003708508, + 0.0040189150000000005, + 0.00390038, + 0.0036111840000000004, + 0.003750297, + 0.003924877, + 0.004222139000000001, + 0.004780596000000001, + 0.0036649150000000004, + 0.003940636, + 0.004051346, + 0.003871335, + 0.003642563, + 0.003929495, + 0.003825419, + 0.0037565980000000003, + 0.0036074460000000003, + 0.0037225440000000004, + 0.0038162810000000004, + 0.003802255, + 0.005107324, + 0.00395862, + 0.005150315, + 0.0039373, + 0.00368337, + 0.0038346260000000003, + 0.003520201, + 0.003911752, + 0.0037265920000000004, + 0.003718907, + 0.003765244, + 0.004995923, + 0.004142489, + 0.003849884, + 0.003694802, + 0.0040451540000000005, + 0.004152117, + 0.003935506, + 0.0037420010000000004, + 0.003821942, + 0.003755767, + 0.003943212000000001, + 0.0038895390000000005, + 0.0036095100000000002, + 0.003923084, + 0.003796855, + 0.0036033180000000003, + 0.003767078, + 0.0037359790000000004, + 0.003692587, + 0.003438987, + 0.0036934790000000004, + 0.004076213, + 0.00409596, + 0.0038568480000000004, + 0.0036926570000000002, + 0.003562701, + 0.0037536130000000003, + 0.003597147, + 0.0035947830000000003, + 0.003653664, + 0.004097804, + 0.004034343, + 0.003712786, + 0.003650658, + 0.0037967340000000004, + 0.004041627, + 0.003788439, + 0.0037450870000000002, + 0.0036341660000000003, + 0.003945034, + 0.003886174, + 0.0037049210000000003, + 0.0036725190000000004, + 0.004433369, + 0.004000239, + 0.003596465, + 0.0035311410000000002, + 0.003723426, + 0.003998647, + 0.003743343, + 0.003512727, + 0.003697577, + 0.0037855730000000004, + 0.003915378000000001, + 0.0037604550000000002, + 0.0035786320000000004, + 0.004116349, + 0.004355432, + 0.004126999, + 0.004061546, + 0.004035566, + 0.003964161, + 0.003856337, + 0.004092644, + 0.003478903, + 0.0036876780000000002, + 0.003587639, + 0.003446362, + 0.003802455, + 0.0037435830000000004, + 0.0036364810000000004, + 0.0036124860000000003, + 0.0037875770000000003, + 0.004151625, + 0.004364378, + 0.003802656, + 0.0040182230000000005, + 0.00414821, + 0.004945949000000001, + 0.004596348, + 0.00466104, + 0.0041808010000000005, + 0.005680849, + 0.0036487040000000004, + 0.004092615, + 0.003898617, + 0.003944103, + 0.003828615, + 0.004078086, + 0.004121549, + 0.004268467000000001, + 0.0042259870000000005, + 0.0037117430000000004, + 0.0038558060000000003, + 0.00472468, + 0.0042171100000000005, + 0.004131728, + 0.0038367590000000003, + 0.003611013, + 0.003847561, + 0.003973338, + 0.004349691, + 0.004488062, + 0.004359189, + 0.003912393, + 0.003812053, + 0.003807294, + 0.0037351980000000003, + 0.0035593450000000002, + 0.0039239950000000004, + 0.0038591920000000004, + 0.0041530180000000005, + 0.003697296, + 0.004031969, + 0.003871886, + 0.004036498, + 0.0037314600000000002, + 0.004429692000000001, + 0.0039056800000000003, + 0.004196901, + 0.0038232450000000003, + 0.003645548, + 0.003627304, + 0.004059791, + 0.003772739, + 0.003568332, + 0.003721452, + 0.003832302, + 0.0037464990000000004, + 0.003822644, + 0.0037846510000000004, + 0.003970914, + 0.004019926, + 0.003665235, + 0.0035829100000000003, + 0.003459887, + 0.0041862520000000005, + 0.00375223, + 0.003610321, + 0.0035617500000000002, + 0.0038571490000000003, + 0.0036890100000000004, + 0.0037702540000000002, + 0.004044833, + 0.0039548230000000005, + 0.004229493, + 0.004022501, + 0.00397374, + 0.0037888490000000004, + 0.0036293680000000004, + 0.0043965490000000005, + 0.0037916240000000004, + 0.0038051, + 0.004065313, + 0.004114766000000001, + 0.003885462, + 0.0036551770000000003, + 0.003770765, + 0.003674964, + 0.003949824, + 0.00367312, + 0.00367809, + 0.004530983000000001, + 0.003995821, + 0.004004708, + 0.003687207, + 0.0037931080000000003, + 0.0037411890000000002, + 0.003876776, + 0.0036341560000000004, + 0.003915639, + 0.0042556420000000005, + 0.003745487, + 0.003962939, + 0.00365669, + 0.003771967, + 0.004002343, + 0.0038966540000000003, + 0.0038332730000000003, + 0.004331276, + 0.003681296, + 0.003827422, + 0.003817504, + 0.003941017000000001, + 0.0038447050000000003, + 0.003633996, + 0.003798418, + 0.00412761, + 0.0039246360000000004, + 0.003927692, + 0.003478141, + 0.0037877770000000004, + 0.003742281, + 0.0035294890000000002, + 0.0037671880000000003, + 0.0038403670000000003, + 0.0039028250000000004, + 0.003604241, + 0.00401126, + 0.003989519, + 0.0037281640000000004, + 0.004189387, + 0.003935648, + 0.003497318, + 0.0036781500000000003, + 0.004170251000000001, + 0.003683079, + 0.003549186, + 0.0037797720000000003, + 0.004189998, + 0.004430093, + 0.004412009000000001, + 0.004174328000000001, + 0.004666069, + 0.004085661, + 0.004107643, + 0.004052468, + 0.004486399, + 0.004395628, + 0.004948634, + 0.004875626, + 0.005493555000000001, + 0.004359308, + 0.004363186000000001, + 0.00458216, + 0.0042050970000000005, + 0.004185250000000001, + 0.003876205, + 0.0044678240000000004, + 0.004364939, + 0.004019315, + 0.004105919, + 0.004422588, + 0.004214204, + 0.004399455, + 0.004327027000000001, + 0.005082457, + 0.004543167, + 0.004316087000000001, + 0.0049147900000000005, + 0.004624110000000001, + 0.004442396, + 0.004327969, + 0.004071334, + 0.004512098, + 0.004280109000000001, + 0.004431906, + 0.004419663, + 0.004584345, + 0.004163288, + 0.004342867, + 0.004453477, + 0.004617236, + 0.004108303000000001, + 0.004490017000000001, + 0.003993376, + 0.004250162, + 0.004629139, + 0.004504253000000001, + 0.0045746860000000006, + 0.0039192870000000005, + 0.0042643590000000006, + 0.004490898, + 0.004062727, + 0.003972457, + 0.003952168, + 0.004641442, + 0.004085961, + 0.00402715, + 0.0038641620000000004, + 0.004151866000000001, + 0.0042417670000000005, + 0.004002334000000001, + 0.004021188, + 0.0041533790000000004, + 0.003955575, + 0.0035883300000000003, + 0.004075462, + 0.0036912250000000002, + 0.003865634, + 0.003714087, + 0.003575195, + 0.003441532, + 0.003623406, + 0.0036581020000000003, + 0.004194507, + 0.0039579590000000005, + 0.003872929, + 0.00380523, + 0.003988437, + 0.0037798320000000003, + 0.004129103, + 0.004464127, + 0.004362875, + 0.004068679, + 0.003933713, + 0.0038629000000000003, + 0.0038006420000000003, + 0.0036064240000000004, + 0.0034667200000000004, + 0.003961727, + 0.0036012440000000004, + 0.0033532650000000002, + 0.0034953040000000003, + 0.003973469, + 0.003926169, + 0.004101952, + 0.005008337000000001, + 0.004002955, + 0.004038572, + 0.003972406, + 0.0037545240000000004, + 0.0036990900000000004, + 0.0037044390000000003, + 0.0034410910000000003, + 0.003479354, + 0.003578992, + 0.0038469890000000003, + 0.003830608, + 0.0040758420000000005, + 0.0040640400000000005, + 0.004049793, + 0.0038611260000000003, + 0.003584723, + 0.0035710370000000004, + 0.004196181, + 0.003731601, + 0.004073388, + 0.0038381020000000004, + 0.004031388, + 0.003753923, + 0.0034467720000000003, + 0.004137399, + 0.004072125, + 0.00438122, + 0.0037443050000000003, + 0.0036441850000000003, + 0.003653153, + 0.0035952920000000004, + 0.004029816, + 0.003650458, + 0.003517155, + 0.0034692140000000004, + 0.004218142, + 0.004082775, + 0.0040688700000000005, + 0.003624889, + 0.004161083, + 0.003872798, + 0.003677829, + 0.003945436, + 0.0036166030000000004, + 0.004161164, + 0.004021329000000001, + 0.0038548740000000003, + 0.0044914790000000005, + 0.004024766, + 0.0037898610000000003, + 0.0035935100000000003, + 0.004681238, + 0.004291421, + 0.004108604, + 0.0041364470000000006, + 0.004053991, + 0.004077476, + 0.0036029670000000003, + 0.003841389, + 0.003515162, + 0.003789871, + 0.003645488, + 0.0038857920000000003, + 0.0037362690000000004, + 0.003968279, + 0.004168778000000001, + 0.0038654740000000003, + 0.0037312200000000004, + 0.004040807, + 0.003870945, + 0.003716121, + 0.003520932, + 0.0038460670000000003, + 0.0036646440000000003, + 0.003871095, + 0.0038633710000000004, + 0.003725219, + 0.004173307, + 0.004232048, + 0.0039767150000000005, + 0.0038722970000000002, + 0.003990792, + 0.0040075530000000005, + 0.003993035000000001, + 0.0036474920000000004, + 0.0037051610000000002, + 0.0038860030000000003, + 0.0038132950000000004, + 0.003702967, + 0.003890442, + 0.004156314, + 0.0038768060000000004, + 0.00387373, + 0.0038957920000000004, + 0.00409562, + 0.004321097, + 0.003971515, + 0.003679522, + 0.00393197, + 0.0043336, + 0.003868269, + 0.0037242770000000002, + 0.0038834980000000004, + 0.004011581, + 0.0038871450000000003, + 0.003764232, + 0.00367299, + 0.004191742, + 0.004081293000000001, + 0.004039804, + 0.004009887, + 0.0041272, + 0.0043461640000000005, + 0.0039499240000000005, + 0.004014897, + 0.003874141, + 0.0039537010000000004, + 0.003538045, + 0.0035522210000000004, + 0.003733704, + 0.003920819, + 0.0037121140000000003, + 0.0037175140000000003, + 0.004319343000000001, + 0.004585207, + 0.0041893170000000006, + 0.004188615000000001, + 0.0039203580000000005, + 0.004514372, + 0.0038887680000000003, + 0.003900811, + 0.003771346, + 0.003891133, + 0.003659584, + 0.003975102, + 0.004008134, + 0.004167977000000001, + 0.004257276, + 0.004303473, + 0.003992975, + 0.004230425, + 0.0037401780000000003, + 0.004106591000000001, + 0.0036875980000000003, + 0.004553386, + 0.004104697, + 0.0036758750000000003, + 0.00388426, + 0.0040644010000000005, + 0.003959282000000001, + 0.0042356040000000005, + 0.003935166, + 0.004251034, + 0.004161194, + 0.004005459, + 0.003954282, + 0.003992324, + 0.004274969, + 0.003842671, + 0.0038184760000000003, + 0.003899028, + 0.0040400950000000005, + 0.003640368, + 0.003658473, + 0.0037910540000000003, + 0.004262015, + 0.004055184, + 0.003774963, + 0.0038437730000000004, + 0.004215226, + 0.004068068, + 0.0037506370000000002, + 0.0038777470000000004, + 0.0037590030000000003, + 0.003980722, + 0.0036820470000000004, + 0.0037850320000000002, + 0.0038722070000000003, + 0.004493933, + 0.0038901710000000004, + 0.0038435030000000003, + 0.003946728, + 0.004165152, + 0.003869041, + 0.0039217010000000005, + 0.003611523, + 0.004199586, + 0.0037480520000000004 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ] +} diff --git a/benchmarks/server_client_1.png b/benchmarks/server_client_1.png Binary files differ. diff --git a/benchmarks/server_client_2.json b/benchmarks/server_client_2.json @@ -0,0 +1,1622 @@ +{ + "results": [ + { + "command": "../bin/client", + "mean": 0.004403641255610972, + "stddev": 0.00045463180823457306, + "median": 0.0043269365, + "user": 0.0014877269326683277, + "system": 0.0033881009975062354, + "min": 0.003512316, + "max": 0.007308127, + "times": [ + 0.0037404570000000004, + 0.0041167090000000005, + 0.004801574, + 0.00403261, + 0.0044406820000000005, + 0.0043534870000000005, + 0.004859805, + 0.004509482, + 0.004463175000000001, + 0.004716213, + 0.004247206, + 0.004245984, + 0.004249821, + 0.004640409000000001, + 0.00405364, + 0.003512316, + 0.003941568, + 0.0048615080000000005, + 0.004785604000000001, + 0.005034615, + 0.0050301980000000005, + 0.004238159, + 0.004268527, + 0.004066414, + 0.004407088, + 0.00411711, + 0.0038897800000000002, + 0.004134723, + 0.0050314290000000005, + 0.004102752, + 0.003951326000000001, + 0.0043648490000000005, + 0.004083436, + 0.0041075320000000005, + 0.0041678060000000005, + 0.004847431, + 0.004220255, + 0.004211759000000001, + 0.0041257460000000004, + 0.004015938, + 0.00430739, + 0.003999246000000001, + 0.004617026000000001, + 0.004678382, + 0.004526955, + 0.0040574370000000005, + 0.003911120000000001, + 0.0043711900000000005, + 0.0043879520000000005, + 0.00422303, + 0.004189947, + 0.004584745, + 0.0042155050000000005, + 0.003813135, + 0.004178486, + 0.004584043, + 0.004327428, + 0.004313962, + 0.004138961, + 0.005502271, + 0.0038792590000000004, + 0.004161774, + 0.0043080110000000005, + 0.004031097, + 0.00456683, + 0.004268166, + 0.0048865950000000005, + 0.004455941000000001, + 0.004055614, + 0.003880161, + 0.004316086, + 0.004498220000000001, + 0.0036883180000000003, + 0.0039743190000000005, + 0.004272133, + 0.004478333, + 0.0038703830000000002, + 0.004406828000000001, + 0.0044314440000000005, + 0.004715101, + 0.004027571000000001, + 0.003968378, + 0.0045631230000000005, + 0.004314974, + 0.0038332130000000002, + 0.004215085, + 0.0044148830000000005, + 0.0037311400000000004, + 0.004465068, + 0.004877608, + 0.004635641, + 0.00447641, + 0.003830037, + 0.004164259, + 0.004427898, + 0.004215296, + 0.003998695, + 0.004150974, + 0.004367674, + 0.004163878, + 0.0038630390000000004, + 0.004261693, + 0.004154731, + 0.004293934, + 0.0041810910000000005, + 0.0044039430000000004, + 0.004971256, + 0.003945635, + 0.0040827450000000005, + 0.003983757, + 0.004110627, + 0.004350671, + 0.004199576, + 0.0047147000000000005, + 0.004370489, + 0.005346436, + 0.003976243, + 0.004884792000000001, + 0.003915719000000001, + 0.004190048, + 0.0042541390000000005, + 0.004755207, + 0.0038293650000000004, + 0.003718335, + 0.004120737, + 0.004554006, + 0.004031087, + 0.004265541, + 0.0045779010000000005, + 0.004303342, + 0.004004396, + 0.003936859, + 0.0043017590000000005, + 0.005403654, + 0.0039404950000000005, + 0.004437716, + 0.004357765, + 0.004290197, + 0.0041676460000000005, + 0.003748322, + 0.004277132, + 0.004110608, + 0.004124584000000001, + 0.004133371, + 0.004439459000000001, + 0.003977956, + 0.0038598430000000004, + 0.004015828, + 0.004151154000000001, + 0.004278666, + 0.004035585, + 0.004042749, + 0.004302220000000001, + 0.004746771, + 0.004235764, + 0.0037910030000000003, + 0.0040904190000000005, + 0.004802516000000001, + 0.004343709, + 0.003881924, + 0.0044797660000000005, + 0.004738746, + 0.004214354, + 0.004163217, + 0.005008697, + 0.004439800000000001, + 0.004367674, + 0.004307930000000001, + 0.004166323, + 0.003957558, + 0.004818878, + 0.004087844, + 0.0043915790000000005, + 0.003944423, + 0.0041556530000000005, + 0.004849245, + 0.003916961, + 0.004223872, + 0.00419646, + 0.004203574, + 0.004034163, + 0.00394795, + 0.004135294, + 0.004281921, + 0.004025676000000001, + 0.0039205080000000005, + 0.0036702640000000003, + 0.004211428000000001, + 0.004232569, + 0.003749324, + 0.003613858, + 0.0042460530000000005, + 0.004366662, + 0.003826921, + 0.003555818, + 0.004135434, + 0.00453469, + 0.004054671, + 0.004894581, + 0.004681457, + 0.004771368000000001, + 0.004180821, + 0.004066133, + 0.004316818, + 0.004260702, + 0.0038626180000000004, + 0.004005328, + 0.0045968170000000004, + 0.003986844000000001, + 0.004030496000000001, + 0.00410138, + 0.004594783, + 0.004087684, + 0.00414884, + 0.004287141, + 0.004897086, + 0.004400626, + 0.004354509, + 0.004373855, + 0.004956047, + 0.004495416, + 0.004047529, + 0.0050536520000000005, + 0.004455319, + 0.004125375000000001, + 0.004026278, + 0.004655158, + 0.004173186000000001, + 0.004003656, + 0.004014085000000001, + 0.004205807000000001, + 0.004581418, + 0.004329422, + 0.004358155, + 0.004383574, + 0.004342196, + 0.004469507, + 0.00458255, + 0.004407589, + 0.004065752000000001, + 0.003682527, + 0.004189567, + 0.004911042, + 0.004192212, + 0.004493642, + 0.004142067, + 0.004089357, + 0.00375259, + 0.003834164, + 0.003931429, + 0.005073009000000001, + 0.004928315, + 0.004755678, + 0.005509494, + 0.004317689, + 0.0037995290000000003, + 0.004058769, + 0.004700824, + 0.0046411410000000005, + 0.004819218, + 0.0046496670000000006, + 0.004436334, + 0.005266153, + 0.004481529000000001, + 0.0051641410000000006, + 0.004763553, + 0.004160762, + 0.004922854, + 0.005018736, + 0.004362564, + 0.004376280000000001, + 0.004894741, + 0.004289005, + 0.004586388, + 0.005465581000000001, + 0.004903968000000001, + 0.004968621, + 0.004752692, + 0.005532788, + 0.004535632, + 0.004373404, + 0.004730901, + 0.0047506480000000005, + 0.004278556, + 0.0044499890000000005, + 0.004644779, + 0.0041921020000000005, + 0.004456061, + 0.004686066, + 0.004572011, + 0.004259169, + 0.0045152330000000004, + 0.004649437, + 0.004200688, + 0.004401718000000001, + 0.004235083000000001, + 0.005442808, + 0.004321056, + 0.004352695, + 0.005057779, + 0.005282806, + 0.004713538000000001, + 0.004791976, + 0.004769614, + 0.0043684150000000005, + 0.0042107870000000006, + 0.003925447, + 0.004765076, + 0.004102141, + 0.0039961300000000005, + 0.0039732280000000005, + 0.004365209, + 0.003748472, + 0.0042051960000000005, + 0.004275049, + 0.004377682, + 0.0040698800000000005, + 0.0036494950000000004, + 0.0045373950000000005, + 0.0048196490000000005, + 0.0042783050000000005, + 0.003970853, + 0.004298513, + 0.004465439, + 0.0043554100000000005, + 0.004193474, + 0.00437636, + 0.004249210000000001, + 0.004218121, + 0.0037583810000000003, + 0.004283274, + 0.003845255, + 0.004126568000000001, + 0.003776255, + 0.004997405, + 0.004545871, + 0.004143349, + 0.004279848, + 0.0042268570000000005, + 0.004204315, + 0.003777728, + 0.004454719, + 0.004746541, + 0.004437215, + 0.00422816, + 0.0045363930000000005, + 0.0049076350000000005, + 0.004072595, + 0.004096982, + 0.004281791, + 0.0044140920000000005, + 0.003938602, + 0.0039702620000000004, + 0.004094877, + 0.0047406900000000005, + 0.004155132000000001, + 0.00448179, + 0.005034185, + 0.004542896, + 0.0037154, + 0.003860174, + 0.004421365, + 0.004260651, + 0.003959983, + 0.0037362190000000003, + 0.004886164, + 0.004220927, + 0.003945365, + 0.0038683890000000003, + 0.004316106, + 0.004262545, + 0.003905089, + 0.004152186, + 0.004586588, + 0.003977085, + 0.003809087, + 0.003664563, + 0.004337256, + 0.004458546, + 0.004209485000000001, + 0.004081382000000001, + 0.004548917, + 0.004354359, + 0.00366275, + 0.0036257800000000003, + 0.0037682600000000003, + 0.004317739, + 0.0038902410000000004, + 0.0044418240000000005, + 0.004950907, + 0.004300657, + 0.0040066500000000005, + 0.004353206, + 0.005037891, + 0.004354609000000001, + 0.0042679350000000005, + 0.004668603, + 0.00440772, + 0.0041886350000000004, + 0.004061534, + 0.004533448000000001, + 0.004451412, + 0.00408582, + 0.004189076, + 0.005108696, + 0.004692849000000001, + 0.0036756450000000004, + 0.004029584, + 0.004324863, + 0.004239161, + 0.0038305580000000004, + 0.004515814, + 0.00515857, + 0.004004596, + 0.003745978, + 0.0037619270000000004, + 0.004237137, + 0.0043636460000000005, + 0.003955393000000001, + 0.004499222000000001, + 0.00424973, + 0.0039853910000000005, + 0.004422788, + 0.004461291, + 0.004904129, + 0.004344239000000001, + 0.003776395, + 0.004821883, + 0.004572732, + 0.0039895980000000004, + 0.004231566, + 0.004194286, + 0.004358456, + 0.003996853, + 0.004283815, + 0.004849635000000001, + 0.0042385700000000005, + 0.0039991770000000005, + 0.004073697, + 0.004634809, + 0.004350892, + 0.0037251880000000004, + 0.004326146, + 0.004738124000000001, + 0.004162766, + 0.003936908, + 0.004106810000000001, + 0.0047703450000000005, + 0.005356965, + 0.004001581000000001, + 0.004468645, + 0.004898177, + 0.004067696, + 0.004075531, + 0.004500655, + 0.0040800590000000005, + 0.004248468, + 0.004456211, + 0.005305878, + 0.004911142, + 0.004113923, + 0.004335653, + 0.0045604190000000005, + 0.004416657, + 0.004400917, + 0.004223061, + 0.0045590660000000005, + 0.003939454, + 0.003838132, + 0.004301238000000001, + 0.004303222000000001, + 0.003778949, + 0.004173015, + 0.005046809, + 0.004345011, + 0.003956486, + 0.0044480760000000005, + 0.004448858, + 0.004207751, + 0.0043180200000000005, + 0.004742793, + 0.004581298, + 0.004002273000000001, + 0.004000529, + 0.004237478, + 0.004322057000000001, + 0.003887675, + 0.003935446, + 0.004636412, + 0.004883279, + 0.004211218, + 0.004269388000000001, + 0.0041644790000000004, + 0.00465126, + 0.0041272290000000005, + 0.003931579, + 0.004036457, + 0.004537134, + 0.0038172030000000003, + 0.0037426110000000003, + 0.004400065, + 0.004157015, + 0.004231897, + 0.004221156, + 0.004710252000000001, + 0.0044111160000000005, + 0.003987875, + 0.0037016030000000004, + 0.003918314, + 0.004428068, + 0.004037469, + 0.003975973, + 0.004446483, + 0.004535361, + 0.003983587, + 0.0037218420000000004, + 0.004321216, + 0.004362103, + 0.003696725, + 0.0037894800000000005, + 0.004060232, + 0.005116942, + 0.004415464, + 0.004525122, + 0.004553746, + 0.004326445, + 0.0040200570000000005, + 0.004153629, + 0.004650049000000001, + 0.003962628, + 0.003809457, + 0.0039185140000000005, + 0.004394665, + 0.0040847190000000005, + 0.0041658120000000005, + 0.004241915000000001, + 0.004800723000000001, + 0.004557052000000001, + 0.0039037560000000004, + 0.00429152, + 0.004515825, + 0.003861937, + 0.0037335140000000003, + 0.00478339, + 0.00446077, + 0.0038252370000000004, + 0.004398292000000001, + 0.0044761290000000006, + 0.0044979500000000006, + 0.0038032860000000003, + 0.004100328, + 0.0038981560000000003, + 0.004465108000000001, + 0.004017812, + 0.0037788500000000003, + 0.0041672340000000006, + 0.0043763100000000004, + 0.003783138, + 0.0037307490000000002, + 0.004407178, + 0.0044455810000000005, + 0.004296169, + 0.004164299000000001, + 0.005457787, + 0.004776126, + 0.004175310000000001, + 0.004298082, + 0.004350291, + 0.004057046, + 0.0038444940000000004, + 0.0040777850000000004, + 0.004600444, + 0.00415973, + 0.004132419, + 0.004325705, + 0.004237607, + 0.0041393820000000005, + 0.004230534, + 0.004400747, + 0.004807115000000001, + 0.0041009290000000006, + 0.0039516970000000005, + 0.004537155, + 0.0045209230000000005, + 0.004201249000000001, + 0.0040549720000000004, + 0.004495757, + 0.0045834230000000005, + 0.004058269000000001, + 0.004632084000000001, + 0.005327269, + 0.0045561, + 0.004145604000000001, + 0.004179427, + 0.004386168, + 0.004032219, + 0.004012923, + 0.004419181, + 0.004781376, + 0.004142708, + 0.004678211000000001, + 0.0045165760000000004, + 0.005318392, + 0.0043654390000000005, + 0.00454038, + 0.004451372, + 0.004366652, + 0.004583342000000001, + 0.004324161, + 0.005596359, + 0.004030055, + 0.004289125, + 0.0042240820000000005, + 0.004784302000000001, + 0.004907114000000001, + 0.005101513, + 0.0050897500000000005, + 0.004246234000000001, + 0.004353537, + 0.004720491, + 0.0049098100000000006, + 0.004687008, + 0.00474634, + 0.005194909, + 0.004493162, + 0.004418941, + 0.004964803, + 0.004163738, + 0.003984639, + 0.0038369190000000003, + 0.004461522, + 0.004278685, + 0.0039239750000000006, + 0.0048021750000000005, + 0.005796136, + 0.005056337, + 0.004936961, + 0.005351545, + 0.0048082970000000004, + 0.004584103, + 0.0044721710000000005, + 0.005513241, + 0.004824028, + 0.0048045710000000005, + 0.005028564, + 0.0047004740000000005, + 0.0044720110000000006, + 0.004363926000000001, + 0.004556210000000001, + 0.004567542, + 0.0041278800000000004, + 0.004744247, + 0.005451244, + 0.004709721, + 0.005720904000000001, + 0.00503706, + 0.004205386, + 0.004870625, + 0.004727505, + 0.00403807, + 0.0039252670000000005, + 0.0048576010000000005, + 0.005648477000000001, + 0.004906523, + 0.004958642, + 0.005307893, + 0.0057194410000000005, + 0.004457083000000001, + 0.005039946, + 0.004247226000000001, + 0.004101119, + 0.004404334, + 0.00522187, + 0.004070992, + 0.005291452, + 0.005723449, + 0.006416911, + 0.005092746, + 0.005565130000000001, + 0.004752913, + 0.004068648, + 0.004628126000000001, + 0.004808668, + 0.004536343, + 0.004626053000000001, + 0.0060242180000000005, + 0.004772569, + 0.004619611, + 0.004146595, + 0.00488912, + 0.004579274, + 0.004030846, + 0.005232710000000001, + 0.004854084000000001, + 0.004399294000000001, + 0.004654166, + 0.0056036820000000005, + 0.00456113, + 0.004986305, + 0.00521114, + 0.003979309, + 0.0039213500000000005, + 0.004039673000000001, + 0.005097184, + 0.00506849, + 0.0044060060000000005, + 0.004967639, + 0.004546653, + 0.004173597, + 0.005087907, + 0.005833457, + 0.0046598360000000005, + 0.004756469, + 0.006781771000000001, + 0.005341336, + 0.005667282, + 0.007308127, + 0.004743395, + 0.0052705320000000005, + 0.006413384, + 0.004787618, + 0.004546051000000001, + 0.005014778, + 0.004739648, + 0.0050833580000000005, + 0.005453668, + 0.005130808000000001, + 0.004673322000000001, + 0.004774153000000001, + 0.0049040690000000005, + 0.004599874, + 0.004246023000000001, + 0.005004128, + 0.004877829, + 0.004068277, + 0.004375368, + 0.0048569, + 0.004003504000000001, + 0.004581438, + 0.004871807000000001, + 0.004610273000000001, + 0.004345662, + 0.004186130000000001, + 0.005125267, + 0.004826943, + 0.004179849, + 0.0055178200000000005, + 0.0047436250000000004, + 0.00424962, + 0.004369998, + 0.005118173, + 0.0044568820000000006, + 0.0041945770000000005, + 0.004711334, + 0.004889451, + 0.004041867, + 0.004405195000000001, + 0.004543908, + 0.004972528, + 0.0045297210000000004, + 0.0043878120000000005, + 0.004639418, + 0.004436233, + 0.004264789000000001, + 0.004110678, + 0.004431404, + 0.003927812, + 0.004019976000000001, + 0.004623027, + 0.004935017, + 0.004174378, + 0.004046486, + 0.003695302, + 0.004572130000000001, + 0.004187583, + 0.003957227000000001, + 0.004771418, + 0.004351323000000001, + 0.00429199, + 0.0043943540000000005, + 0.004266602, + 0.0043364350000000005, + 0.004093445, + 0.004247617, + 0.004511857, + 0.004083155000000001, + 0.004077004, + 0.0038081050000000004, + 0.00455585, + 0.004252536, + 0.004106229, + 0.0037838000000000004, + 0.005878251, + 0.0040294530000000005, + 0.004453606000000001, + 0.003997554, + 0.0056462230000000006, + 0.005034966, + 0.004787328, + 0.0047898820000000005, + 0.00454004, + 0.004130956 + ], + "exit_codes": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ] +} diff --git a/benchmarks/server_client_2.png b/benchmarks/server_client_2.png Binary files differ. diff --git a/build.sh b/build.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +shopt -s globstar +shopt -s extglob + +function getRealPath() +{ + local -i traversals=0 + currentDir="$1" + basename='' + while :; do + [[ "$currentDir" == '.' ]] && { echo "$1"; return 1; } + [[ $traversals -eq 0 ]] && pwd=$(cd "$currentDir" 2>&1 && pwd) && { echo "$pwd/$basename"; return 0; } + currentBasename="$(basename "$currentDir")" + currentDir="$(dirname "$currentDir")" + [[ "$currentBasename" == '..' ]] && (( ++traversals )) || { [[ traversals -gt 0 ]] && (( traversals-- )) || basename="$currentBasename/$basename"; } + done +} + +# Generate go code +echo "Generate go code" +path="./**/*.capnp" +go_stdlib=$(getRealPath "../go-capnp/std") +capnp compile -I $go_stdlib --verbose -ogo $path + +# Build go code +echo "Build go code" +rm -r bin +mkdir -p bin +go build -gcflags=all="-N -l" -o bin/server ./cmds/server/main.go +go build -gcflags=all="-N -l" -o bin/client ./cmds/client/main.go +\ No newline at end of file diff --git a/cmds/client/helpers/helper.go b/cmds/client/helpers/helper.go @@ -0,0 +1,174 @@ +package helpers + +import ( + "context" + "log" + + protocol "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1" + "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types" +) + +func QuoteString(s string) string { + return "\"" + s + "\"" +} + +type KeyStreamCallback struct { +} + +func NewKeyStreamCallback() KeyStreamCallback { + return KeyStreamCallback{} +} + +func (k KeyStreamCallback) Write(ctx context.Context, call protocol.StreamCallback_write) error { + log.Println("StreamCallback.Write") + p := call.Args() + + response_ptr, err := p.Value() + if err != nil { + return err + } + response := types.ServerKeysResponse(response_ptr.Struct()) + + if response.HasMetadata() { + metadata, err := response.Metadata() + if err != nil { + return err + } + + servername, err := metadata.ServerName() + if err != nil { + return err + } + valid_until_ts := metadata.ValidUntilTS() + + log.Println("Server keys metadata:\n", "servername:", QuoteString(servername), "valid_until_ts:", valid_until_ts) + } else if response.HasVerifyKeys() { + verify_keys, err := response.VerifyKeys() + if err != nil { + return err + } + + entries, err := verify_keys.Entries() + if err != nil { + return err + } + len_of_entries := entries.Len() + + // Print the verify keys + for i := 0; i < len_of_entries; i++ { + entry := entries.At(i) + + key_id_ptr, err := entry.Key() + if err != nil { + return err + } + + key_id := key_id_ptr.Text() + + key_ptr, err := entry.Value() + if err != nil { + return err + } + + key := key_ptr.Data() + + log.Println("Server keys verify_keys entry:", "key_id:", QuoteString(key_id), "key:", key) + } + } else if response.HasOldVerifyKeys() { + old_verify_keys, err := response.OldVerifyKeys() + if err != nil { + return err + } + + entries, err := old_verify_keys.Entries() + if err != nil { + return err + } + len_of_entries := entries.Len() + + // Print the verify keys + for i := 0; i < len_of_entries; i++ { + entry := entries.At(i) + + key_id_ptr, err := entry.Key() + if err != nil { + return err + } + + key_id := key_id_ptr.Text() + + key_ptr, err := entry.Value() + if err != nil { + return err + } + + key_wrapper := types.ServerKeysResponse_OldVerifyKey(key_ptr.Struct()) + key, err := key_wrapper.Key() + if err != nil { + return err + } + + expired_ts := key_wrapper.ExpiredTS() + + log.Println("Server keys old_verify_keys entry:", "key_id:", QuoteString(key_id), "key:", key, "expired_ts:", expired_ts) + } + } else { + log.Println("Server keys response has no metadata, verify_keys, or old_verify_keys") + } + + // Print the signatures + if response.HasSignatures() { + signatures, err := response.Signatures() + if err != nil { + return err + } + len_of_signatures := signatures.Len() + + for i := 0; i < len_of_signatures; i++ { + signature := signatures.At(i) + + server, err := signature.Server() + if err != nil { + return err + } + + signatures_map, err := signature.Signatures() + if err != nil { + return err + } + signatures_map_entries, err := signatures_map.Entries() + if err != nil { + return err + } + len_of_signatures_map_entries := signatures_map_entries.Len() + + for j := 0; j < len_of_signatures_map_entries; j++ { + signature_entry := signatures_map_entries.At(j) + + key_id_ptr, err := signature_entry.Key() + if err != nil { + return err + } + key_id := key_id_ptr.Text() + + signature_ptr, err := signature_entry.Value() + if err != nil { + return err + } + + signature := signature_ptr.Data() + + log.Println("Server keys signature:", "server:", QuoteString(server), "key_id:", QuoteString(key_id), "signature:", signature) + } + } + + } else { + log.Println("Server keys response has no signatures") + } + return nil +} + +func (k KeyStreamCallback) Done(ctx context.Context, call protocol.StreamCallback_done) error { + log.Println("StreamCallback.Done") + return nil +} diff --git a/cmds/client/main.go b/cmds/client/main.go @@ -0,0 +1,105 @@ +package main + +import ( + "context" + "log" + "net" + "time" + + "capnproto.org/go/capnp/v3/rpc" + "github.com/MTRNord/matrix_protobuf_fed/cmds/client/helpers" + protocol "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1" +) + +// This implements a dummy server for testing purposes of the rough api design especially around signatures + +func main() { + log.Println("Connecting to server on port localhost:2000") + + conn, err := net.Dial("tcp", "localhost:2000") + if err != nil { + log.Fatalln("Failed to connect to server:", err) + } + defer conn.Close() + + log.Println("Connected to server on port localhost:2000") + log.Println("Creating rpc client...") + + rpc_conn := rpc.NewConn(rpc.NewStreamTransport(conn), nil) + defer rpc_conn.Close() + + log.Println("Created rpc connection...") + + client := protocol.MatrixFederation(rpc_conn.Bootstrap(context.TODO())) + + log.Println("Created client...") + + timeoutCtx, cancel := context.WithTimeout(context.TODO(), time.Second*10) + err = printServerVersion(timeoutCtx, client) + if err != nil { + log.Println("Failed to print server version:", err) + } + cancel() + + timeoutCtx, cancel = context.WithTimeout(context.TODO(), time.Second*10) + err = printServerKeys(timeoutCtx, client) + if err != nil { + log.Println("Failed to print server version:", err) + } + cancel() +} + +func printServerKeys(ctx context.Context, client protocol.MatrixFederation) error { + callback := helpers.NewKeyStreamCallback() + callback_client := protocol.StreamCallback_ServerToClient(callback) + keys_future, release := client.GetKeys(ctx, func(p protocol.MatrixFederation_getKeys_Params) error { + log.Println("Sending getKeys request...") + + return p.SetCallback(callback_client) + }) + defer release() + + log.Println("Sent getKeys request...") + _, err := keys_future.Struct() + if err != nil { + log.Fatalln(err) + } + + return nil +} + +func printServerVersion(ctx context.Context, client protocol.MatrixFederation) error { + version_future, release := client.GetVersion(ctx, func(p protocol.MatrixFederation_getVersion_Params) error { + log.Println("Sending getVersion request...") + return nil + }) + defer release() + + log.Println("Sent getVersion request...") + + version_struct, err := version_future.Struct() + if err != nil { + return err + } + if !version_struct.HasServerVersion() { + log.Fatalln("No server version") + } + + server_version, err := version_struct.ServerVersion() + if err != nil { + return err + } + + name, err := server_version.Name() + if err != nil { + return err + } + + version, err := server_version.Version() + if err != nil { + return err + } + + log.Println("Server name:", helpers.QuoteString(name), "version:", helpers.QuoteString(version)) + return nil +} diff --git a/cmds/server/main.go b/cmds/server/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "context" + "log" + + "capnproto.org/go/capnp/v3" + "capnproto.org/go/capnp/v3/flowcontrol" + "capnproto.org/go/capnp/v3/rpc" + "github.com/MTRNord/matrix_protobuf_fed/rpcserver" + + protocol "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1" +) + +// This implements a dummy server for testing purposes of the rough api design especially around signatures + +func main() { + log.Println("Starting server on port localhost:2000") + server := rpcserver.NewServer() + + client := protocol.MatrixFederation_ServerToClient(server) + client.SetFlowLimiter(flowcontrol.NewFixedLimiter(1 << 16)) + + rpc.ListenAndServe(context.Background(), "tcp", "localhost:2000", capnp.Client(client)) +} diff --git a/go.mod b/go.mod @@ -0,0 +1,7 @@ +module github.com/MTRNord/matrix_protobuf_fed + +go 1.22.1 + +require capnproto.org/go/capnp/v3 v3.0.0-alpha.30.0.20240213214103-0d218d2660ff + +require golang.org/x/sync v0.6.0 // indirect diff --git a/go.sum b/go.sum @@ -0,0 +1,18 @@ +capnproto.org/go/capnp/v3 v3.0.0-alpha.30.0.20240213214103-0d218d2660ff h1:W2JuZk1N+B3ln0OsQsrd630WXfZiwJEq3L79IuB6rBY= +capnproto.org/go/capnp/v3 v3.0.0-alpha.30.0.20240213214103-0d218d2660ff/go.mod h1:GGCgwnINIqHrOaK2oUjMDnAsLNq68JI/X9Kcg1o/LSA= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/philhofer/fwd v1.1.1 h1:GdGcTjf5RNAxwS4QLsiMzJYj5KEvPJD3Abr261yRQXQ= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/tinylib/msgp v1.1.5 h1:2gXmtWueD2HefZHQe1QOy9HVzmFrLOVvsXwXBQ0ayy0= +github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= +github.com/tj/assert v0.0.3 h1:Df/BlaZ20mq6kuai7f5z2TvPFiwC3xaWJSDQNiIS3Rk= +github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= +golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/proto/federation/v1/federation.v1.capnp b/proto/federation/v1/federation.v1.capnp @@ -0,0 +1,39 @@ +using Go = import "/go.capnp"; +using Types = import "./types/types.capnp"; + +@0xee8fadeb6a9300eb; + +$Go.package("v1"); +$Go.import("github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1"); + +annotation methodUUID @0xe55590d1a37e8043 (method) :UInt64; + +# This is an async stream callback. This is a callback called on the other end +interface StreamCallback(T) { + # Data is written here. It behaves like a regular callback on the receiver and a function call on the caller + write @0 (value :T) -> stream; + # The stream will be closed when this is called. + done @1 (); +} + +interface MatrixFederation @0xf730448b3b47991e { + # Get the implementation name and version of this homeserver. + getVersion @0 () -> (serverVersion :Types.ServerVersion) $methodUUID(0xab1eb3e81f3344d1); + + # This combines the query via other servers and the direct query endpoints + getKeys @1 (server_keys :Types.Map(Text, Types.Map(Text, Types.QueryCriteria)), callback :StreamCallback(Types.ServerKeysResponse)) -> () $methodUUID(0x932dd11596dad50e); + + # Push messages representing live activity to another server. The destination + # name will be set to that of the receiving server itself. Each embedded PDU + # in the transaction body will be processed. + # + # Errors are returned as stream errors rather than at the end of the stream. + sendTransactions @2 () -> (callback :StreamCallback(Types.Transaction)) $methodUUID(0xec6b6ce167005c84); + + # [https://spec.matrix.org/v1.9/server-server-api/#get_matrixfederationv1backfillroomid](https://spec.matrix.org/v1.9/server-server-api/#get_matrixfederationv1backfillroomid) + # Retrieves a sliding-window history of previous PDUs that occurred in the + # given room. Starting from the PDU ID(s) given in the v argument, the PDUs + # given in v and the PDUs that preceded them are retrieved, up to the total + # number given by the limit. + backfill @3 (auth_data :Types.AuthData, roomID :Text, limit :UInt32, eventIDs :List(Text), callback :StreamCallback(Types.BackfillData)) -> () $methodUUID(0x970e8e8dfe8f0ced); +} +\ No newline at end of file diff --git a/proto/federation/v1/federation.v1.capnp.go b/proto/federation/v1/federation.v1.capnp.go @@ -0,0 +1,1557 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package v1 + +import ( + capnp "capnproto.org/go/capnp/v3" + text "capnproto.org/go/capnp/v3/encoding/text" + fc "capnproto.org/go/capnp/v3/flowcontrol" + schemas "capnproto.org/go/capnp/v3/schemas" + server "capnproto.org/go/capnp/v3/server" + stream "capnproto.org/go/capnp/v3/std/capnp/stream" + context "context" + types "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types" +) + +const MethodUUID_ = uint64(0xe55590d1a37e8043) + +type StreamCallback capnp.Client + +// StreamCallback_TypeID is the unique identifier for the type StreamCallback. +const StreamCallback_TypeID = 0x819a8ee6024db3d2 + +func (c StreamCallback) Write(ctx context.Context, params func(StreamCallback_write_Params) error) error { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0x819a8ee6024db3d2, + MethodID: 0, + InterfaceName: "proto/federation/v1/federation.v1.capnp:StreamCallback", + MethodName: "write", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(StreamCallback_write_Params(s)) } + } + + return capnp.Client(c).SendStreamCall(ctx, s) + +} + +func (c StreamCallback) Done(ctx context.Context, params func(StreamCallback_done_Params) error) (StreamCallback_done_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0x819a8ee6024db3d2, + MethodID: 1, + InterfaceName: "proto/federation/v1/federation.v1.capnp:StreamCallback", + MethodName: "done", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(StreamCallback_done_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return StreamCallback_done_Results_Future{Future: ans.Future()}, release + +} + +func (c StreamCallback) WaitStreaming() error { + return capnp.Client(c).WaitStreaming() +} + +// String returns a string that identifies this capability for debugging +// purposes. Its format should not be depended on: in particular, it +// should not be used to compare clients. Use IsSame to compare clients +// for equality. +func (c StreamCallback) String() string { + return "StreamCallback(" + capnp.Client(c).String() + ")" +} + +// AddRef creates a new Client that refers to the same capability as c. +// If c is nil or has resolved to null, then AddRef returns nil. +func (c StreamCallback) AddRef() StreamCallback { + return StreamCallback(capnp.Client(c).AddRef()) +} + +// Release releases a capability reference. If this is the last +// reference to the capability, then the underlying resources associated +// with the capability will be released. +// +// Release will panic if c has already been released, but not if c is +// nil or resolved to null. +func (c StreamCallback) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c StreamCallback) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c StreamCallback) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (StreamCallback) DecodeFromPtr(p capnp.Ptr) StreamCallback { + return StreamCallback(capnp.Client{}.DecodeFromPtr(p)) +} + +// IsValid reports whether c is a valid reference to a capability. +// A reference is invalid if it is nil, has resolved to null, or has +// been released. +func (c StreamCallback) IsValid() bool { + return capnp.Client(c).IsValid() +} + +// IsSame reports whether c and other refer to a capability created by the +// same call to NewClient. This can return false negatives if c or other +// are not fully resolved: use Resolve if this is an issue. If either +// c or other are released, then IsSame panics. +func (c StreamCallback) IsSame(other StreamCallback) bool { + return capnp.Client(c).IsSame(capnp.Client(other)) +} + +// Update the flowcontrol.FlowLimiter used to manage flow control for +// this client. This affects all future calls, but not calls already +// waiting to send. Passing nil sets the value to flowcontrol.NopLimiter, +// which is also the default. +func (c StreamCallback) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c StreamCallback) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A StreamCallback_Server is a StreamCallback with a local implementation. +type StreamCallback_Server interface { + Write(context.Context, StreamCallback_write) error + + Done(context.Context, StreamCallback_done) error +} + +// StreamCallback_NewServer creates a new Server from an implementation of StreamCallback_Server. +func StreamCallback_NewServer(s StreamCallback_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(StreamCallback_Methods(nil, s), s, c) +} + +// StreamCallback_ServerToClient creates a new Client from an implementation of StreamCallback_Server. +// The caller is responsible for calling Release on the returned Client. +func StreamCallback_ServerToClient(s StreamCallback_Server) StreamCallback { + return StreamCallback(capnp.NewClient(StreamCallback_NewServer(s))) +} + +// StreamCallback_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func StreamCallback_Methods(methods []server.Method, s StreamCallback_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 2) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0x819a8ee6024db3d2, + MethodID: 0, + InterfaceName: "proto/federation/v1/federation.v1.capnp:StreamCallback", + MethodName: "write", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Write(ctx, StreamCallback_write{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0x819a8ee6024db3d2, + MethodID: 1, + InterfaceName: "proto/federation/v1/federation.v1.capnp:StreamCallback", + MethodName: "done", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Done(ctx, StreamCallback_done{call}) + }, + }) + + return methods +} + +// StreamCallback_write holds the state for a server call to StreamCallback.write. +// See server.Call for documentation. +type StreamCallback_write struct { + *server.Call +} + +// Args returns the call's arguments. +func (c StreamCallback_write) Args() StreamCallback_write_Params { + return StreamCallback_write_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c StreamCallback_write) AllocResults() (stream.StreamResult, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return stream.StreamResult(r), err +} + +// StreamCallback_done holds the state for a server call to StreamCallback.done. +// See server.Call for documentation. +type StreamCallback_done struct { + *server.Call +} + +// Args returns the call's arguments. +func (c StreamCallback_done) Args() StreamCallback_done_Params { + return StreamCallback_done_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c StreamCallback_done) AllocResults() (StreamCallback_done_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return StreamCallback_done_Results(r), err +} + +// StreamCallback_List is a list of StreamCallback. +type StreamCallback_List = capnp.CapList[StreamCallback] + +// NewStreamCallback creates a new list of StreamCallback. +func NewStreamCallback_List(s *capnp.Segment, sz int32) (StreamCallback_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[StreamCallback](l), err +} + +type StreamCallback_write_Params capnp.Struct + +// StreamCallback_write_Params_TypeID is the unique identifier for the type StreamCallback_write_Params. +const StreamCallback_write_Params_TypeID = 0xc99d5953442de820 + +func NewStreamCallback_write_Params(s *capnp.Segment) (StreamCallback_write_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return StreamCallback_write_Params(st), err +} + +func NewRootStreamCallback_write_Params(s *capnp.Segment) (StreamCallback_write_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return StreamCallback_write_Params(st), err +} + +func ReadRootStreamCallback_write_Params(msg *capnp.Message) (StreamCallback_write_Params, error) { + root, err := msg.Root() + return StreamCallback_write_Params(root.Struct()), err +} + +func (s StreamCallback_write_Params) String() string { + str, _ := text.Marshal(0xc99d5953442de820, capnp.Struct(s)) + return str +} + +func (s StreamCallback_write_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (StreamCallback_write_Params) DecodeFromPtr(p capnp.Ptr) StreamCallback_write_Params { + return StreamCallback_write_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s StreamCallback_write_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s StreamCallback_write_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s StreamCallback_write_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s StreamCallback_write_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s StreamCallback_write_Params) Value() (capnp.Ptr, error) { + return capnp.Struct(s).Ptr(0) +} + +func (s StreamCallback_write_Params) HasValue() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s StreamCallback_write_Params) SetValue(v capnp.Ptr) error { + return capnp.Struct(s).SetPtr(0, v) +} + +// StreamCallback_write_Params_List is a list of StreamCallback_write_Params. +type StreamCallback_write_Params_List = capnp.StructList[StreamCallback_write_Params] + +// NewStreamCallback_write_Params creates a new list of StreamCallback_write_Params. +func NewStreamCallback_write_Params_List(s *capnp.Segment, sz int32) (StreamCallback_write_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[StreamCallback_write_Params](l), err +} + +// StreamCallback_write_Params_Future is a wrapper for a StreamCallback_write_Params promised by a client call. +type StreamCallback_write_Params_Future struct{ *capnp.Future } + +func (f StreamCallback_write_Params_Future) Struct() (StreamCallback_write_Params, error) { + p, err := f.Future.Ptr() + return StreamCallback_write_Params(p.Struct()), err +} +func (p StreamCallback_write_Params_Future) Value() *capnp.Future { + return p.Future.Field(0, nil) +} + +type StreamCallback_done_Params capnp.Struct + +// StreamCallback_done_Params_TypeID is the unique identifier for the type StreamCallback_done_Params. +const StreamCallback_done_Params_TypeID = 0xfffa8c2e7b1978ac + +func NewStreamCallback_done_Params(s *capnp.Segment) (StreamCallback_done_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return StreamCallback_done_Params(st), err +} + +func NewRootStreamCallback_done_Params(s *capnp.Segment) (StreamCallback_done_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return StreamCallback_done_Params(st), err +} + +func ReadRootStreamCallback_done_Params(msg *capnp.Message) (StreamCallback_done_Params, error) { + root, err := msg.Root() + return StreamCallback_done_Params(root.Struct()), err +} + +func (s StreamCallback_done_Params) String() string { + str, _ := text.Marshal(0xfffa8c2e7b1978ac, capnp.Struct(s)) + return str +} + +func (s StreamCallback_done_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (StreamCallback_done_Params) DecodeFromPtr(p capnp.Ptr) StreamCallback_done_Params { + return StreamCallback_done_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s StreamCallback_done_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s StreamCallback_done_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s StreamCallback_done_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s StreamCallback_done_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// StreamCallback_done_Params_List is a list of StreamCallback_done_Params. +type StreamCallback_done_Params_List = capnp.StructList[StreamCallback_done_Params] + +// NewStreamCallback_done_Params creates a new list of StreamCallback_done_Params. +func NewStreamCallback_done_Params_List(s *capnp.Segment, sz int32) (StreamCallback_done_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[StreamCallback_done_Params](l), err +} + +// StreamCallback_done_Params_Future is a wrapper for a StreamCallback_done_Params promised by a client call. +type StreamCallback_done_Params_Future struct{ *capnp.Future } + +func (f StreamCallback_done_Params_Future) Struct() (StreamCallback_done_Params, error) { + p, err := f.Future.Ptr() + return StreamCallback_done_Params(p.Struct()), err +} + +type StreamCallback_done_Results capnp.Struct + +// StreamCallback_done_Results_TypeID is the unique identifier for the type StreamCallback_done_Results. +const StreamCallback_done_Results_TypeID = 0xd37bc71261c39851 + +func NewStreamCallback_done_Results(s *capnp.Segment) (StreamCallback_done_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return StreamCallback_done_Results(st), err +} + +func NewRootStreamCallback_done_Results(s *capnp.Segment) (StreamCallback_done_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return StreamCallback_done_Results(st), err +} + +func ReadRootStreamCallback_done_Results(msg *capnp.Message) (StreamCallback_done_Results, error) { + root, err := msg.Root() + return StreamCallback_done_Results(root.Struct()), err +} + +func (s StreamCallback_done_Results) String() string { + str, _ := text.Marshal(0xd37bc71261c39851, capnp.Struct(s)) + return str +} + +func (s StreamCallback_done_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (StreamCallback_done_Results) DecodeFromPtr(p capnp.Ptr) StreamCallback_done_Results { + return StreamCallback_done_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s StreamCallback_done_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s StreamCallback_done_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s StreamCallback_done_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s StreamCallback_done_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// StreamCallback_done_Results_List is a list of StreamCallback_done_Results. +type StreamCallback_done_Results_List = capnp.StructList[StreamCallback_done_Results] + +// NewStreamCallback_done_Results creates a new list of StreamCallback_done_Results. +func NewStreamCallback_done_Results_List(s *capnp.Segment, sz int32) (StreamCallback_done_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[StreamCallback_done_Results](l), err +} + +// StreamCallback_done_Results_Future is a wrapper for a StreamCallback_done_Results promised by a client call. +type StreamCallback_done_Results_Future struct{ *capnp.Future } + +func (f StreamCallback_done_Results_Future) Struct() (StreamCallback_done_Results, error) { + p, err := f.Future.Ptr() + return StreamCallback_done_Results(p.Struct()), err +} + +type MatrixFederation capnp.Client + +// MatrixFederation_TypeID is the unique identifier for the type MatrixFederation. +const MatrixFederation_TypeID = 0xf730448b3b47991e + +func (c MatrixFederation) GetVersion(ctx context.Context, params func(MatrixFederation_getVersion_Params) error) (MatrixFederation_getVersion_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 0, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "getVersion", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(MatrixFederation_getVersion_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return MatrixFederation_getVersion_Results_Future{Future: ans.Future()}, release + +} + +func (c MatrixFederation) GetKeys(ctx context.Context, params func(MatrixFederation_getKeys_Params) error) (MatrixFederation_getKeys_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 1, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "getKeys", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 2} + s.PlaceArgs = func(s capnp.Struct) error { return params(MatrixFederation_getKeys_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return MatrixFederation_getKeys_Results_Future{Future: ans.Future()}, release + +} + +func (c MatrixFederation) SendTransactions(ctx context.Context, params func(MatrixFederation_sendTransactions_Params) error) (MatrixFederation_sendTransactions_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 2, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "sendTransactions", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(MatrixFederation_sendTransactions_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return MatrixFederation_sendTransactions_Results_Future{Future: ans.Future()}, release + +} + +func (c MatrixFederation) Backfill(ctx context.Context, params func(MatrixFederation_backfill_Params) error) (MatrixFederation_backfill_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 3, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "backfill", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 4} + s.PlaceArgs = func(s capnp.Struct) error { return params(MatrixFederation_backfill_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return MatrixFederation_backfill_Results_Future{Future: ans.Future()}, release + +} + +func (c MatrixFederation) WaitStreaming() error { + return capnp.Client(c).WaitStreaming() +} + +// String returns a string that identifies this capability for debugging +// purposes. Its format should not be depended on: in particular, it +// should not be used to compare clients. Use IsSame to compare clients +// for equality. +func (c MatrixFederation) String() string { + return "MatrixFederation(" + capnp.Client(c).String() + ")" +} + +// AddRef creates a new Client that refers to the same capability as c. +// If c is nil or has resolved to null, then AddRef returns nil. +func (c MatrixFederation) AddRef() MatrixFederation { + return MatrixFederation(capnp.Client(c).AddRef()) +} + +// Release releases a capability reference. If this is the last +// reference to the capability, then the underlying resources associated +// with the capability will be released. +// +// Release will panic if c has already been released, but not if c is +// nil or resolved to null. +func (c MatrixFederation) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c MatrixFederation) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c MatrixFederation) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (MatrixFederation) DecodeFromPtr(p capnp.Ptr) MatrixFederation { + return MatrixFederation(capnp.Client{}.DecodeFromPtr(p)) +} + +// IsValid reports whether c is a valid reference to a capability. +// A reference is invalid if it is nil, has resolved to null, or has +// been released. +func (c MatrixFederation) IsValid() bool { + return capnp.Client(c).IsValid() +} + +// IsSame reports whether c and other refer to a capability created by the +// same call to NewClient. This can return false negatives if c or other +// are not fully resolved: use Resolve if this is an issue. If either +// c or other are released, then IsSame panics. +func (c MatrixFederation) IsSame(other MatrixFederation) bool { + return capnp.Client(c).IsSame(capnp.Client(other)) +} + +// Update the flowcontrol.FlowLimiter used to manage flow control for +// this client. This affects all future calls, but not calls already +// waiting to send. Passing nil sets the value to flowcontrol.NopLimiter, +// which is also the default. +func (c MatrixFederation) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c MatrixFederation) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A MatrixFederation_Server is a MatrixFederation with a local implementation. +type MatrixFederation_Server interface { + GetVersion(context.Context, MatrixFederation_getVersion) error + + GetKeys(context.Context, MatrixFederation_getKeys) error + + SendTransactions(context.Context, MatrixFederation_sendTransactions) error + + Backfill(context.Context, MatrixFederation_backfill) error +} + +// MatrixFederation_NewServer creates a new Server from an implementation of MatrixFederation_Server. +func MatrixFederation_NewServer(s MatrixFederation_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(MatrixFederation_Methods(nil, s), s, c) +} + +// MatrixFederation_ServerToClient creates a new Client from an implementation of MatrixFederation_Server. +// The caller is responsible for calling Release on the returned Client. +func MatrixFederation_ServerToClient(s MatrixFederation_Server) MatrixFederation { + return MatrixFederation(capnp.NewClient(MatrixFederation_NewServer(s))) +} + +// MatrixFederation_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func MatrixFederation_Methods(methods []server.Method, s MatrixFederation_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 4) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 0, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "getVersion", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.GetVersion(ctx, MatrixFederation_getVersion{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 1, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "getKeys", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.GetKeys(ctx, MatrixFederation_getKeys{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 2, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "sendTransactions", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.SendTransactions(ctx, MatrixFederation_sendTransactions{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xf730448b3b47991e, + MethodID: 3, + InterfaceName: "proto/federation/v1/federation.v1.capnp:MatrixFederation", + MethodName: "backfill", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Backfill(ctx, MatrixFederation_backfill{call}) + }, + }) + + return methods +} + +// MatrixFederation_getVersion holds the state for a server call to MatrixFederation.getVersion. +// See server.Call for documentation. +type MatrixFederation_getVersion struct { + *server.Call +} + +// Args returns the call's arguments. +func (c MatrixFederation_getVersion) Args() MatrixFederation_getVersion_Params { + return MatrixFederation_getVersion_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c MatrixFederation_getVersion) AllocResults() (MatrixFederation_getVersion_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_getVersion_Results(r), err +} + +// MatrixFederation_getKeys holds the state for a server call to MatrixFederation.getKeys. +// See server.Call for documentation. +type MatrixFederation_getKeys struct { + *server.Call +} + +// Args returns the call's arguments. +func (c MatrixFederation_getKeys) Args() MatrixFederation_getKeys_Params { + return MatrixFederation_getKeys_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c MatrixFederation_getKeys) AllocResults() (MatrixFederation_getKeys_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_getKeys_Results(r), err +} + +// MatrixFederation_sendTransactions holds the state for a server call to MatrixFederation.sendTransactions. +// See server.Call for documentation. +type MatrixFederation_sendTransactions struct { + *server.Call +} + +// Args returns the call's arguments. +func (c MatrixFederation_sendTransactions) Args() MatrixFederation_sendTransactions_Params { + return MatrixFederation_sendTransactions_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c MatrixFederation_sendTransactions) AllocResults() (MatrixFederation_sendTransactions_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_sendTransactions_Results(r), err +} + +// MatrixFederation_backfill holds the state for a server call to MatrixFederation.backfill. +// See server.Call for documentation. +type MatrixFederation_backfill struct { + *server.Call +} + +// Args returns the call's arguments. +func (c MatrixFederation_backfill) Args() MatrixFederation_backfill_Params { + return MatrixFederation_backfill_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c MatrixFederation_backfill) AllocResults() (MatrixFederation_backfill_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_backfill_Results(r), err +} + +// MatrixFederation_List is a list of MatrixFederation. +type MatrixFederation_List = capnp.CapList[MatrixFederation] + +// NewMatrixFederation creates a new list of MatrixFederation. +func NewMatrixFederation_List(s *capnp.Segment, sz int32) (MatrixFederation_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[MatrixFederation](l), err +} + +type MatrixFederation_getVersion_Params capnp.Struct + +// MatrixFederation_getVersion_Params_TypeID is the unique identifier for the type MatrixFederation_getVersion_Params. +const MatrixFederation_getVersion_Params_TypeID = 0xa6475494fcf1c9df + +func NewMatrixFederation_getVersion_Params(s *capnp.Segment) (MatrixFederation_getVersion_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_getVersion_Params(st), err +} + +func NewRootMatrixFederation_getVersion_Params(s *capnp.Segment) (MatrixFederation_getVersion_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_getVersion_Params(st), err +} + +func ReadRootMatrixFederation_getVersion_Params(msg *capnp.Message) (MatrixFederation_getVersion_Params, error) { + root, err := msg.Root() + return MatrixFederation_getVersion_Params(root.Struct()), err +} + +func (s MatrixFederation_getVersion_Params) String() string { + str, _ := text.Marshal(0xa6475494fcf1c9df, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_getVersion_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_getVersion_Params) DecodeFromPtr(p capnp.Ptr) MatrixFederation_getVersion_Params { + return MatrixFederation_getVersion_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_getVersion_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_getVersion_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_getVersion_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_getVersion_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// MatrixFederation_getVersion_Params_List is a list of MatrixFederation_getVersion_Params. +type MatrixFederation_getVersion_Params_List = capnp.StructList[MatrixFederation_getVersion_Params] + +// NewMatrixFederation_getVersion_Params creates a new list of MatrixFederation_getVersion_Params. +func NewMatrixFederation_getVersion_Params_List(s *capnp.Segment, sz int32) (MatrixFederation_getVersion_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[MatrixFederation_getVersion_Params](l), err +} + +// MatrixFederation_getVersion_Params_Future is a wrapper for a MatrixFederation_getVersion_Params promised by a client call. +type MatrixFederation_getVersion_Params_Future struct{ *capnp.Future } + +func (f MatrixFederation_getVersion_Params_Future) Struct() (MatrixFederation_getVersion_Params, error) { + p, err := f.Future.Ptr() + return MatrixFederation_getVersion_Params(p.Struct()), err +} + +type MatrixFederation_getVersion_Results capnp.Struct + +// MatrixFederation_getVersion_Results_TypeID is the unique identifier for the type MatrixFederation_getVersion_Results. +const MatrixFederation_getVersion_Results_TypeID = 0xf35f5ffe08536d82 + +func NewMatrixFederation_getVersion_Results(s *capnp.Segment) (MatrixFederation_getVersion_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_getVersion_Results(st), err +} + +func NewRootMatrixFederation_getVersion_Results(s *capnp.Segment) (MatrixFederation_getVersion_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_getVersion_Results(st), err +} + +func ReadRootMatrixFederation_getVersion_Results(msg *capnp.Message) (MatrixFederation_getVersion_Results, error) { + root, err := msg.Root() + return MatrixFederation_getVersion_Results(root.Struct()), err +} + +func (s MatrixFederation_getVersion_Results) String() string { + str, _ := text.Marshal(0xf35f5ffe08536d82, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_getVersion_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_getVersion_Results) DecodeFromPtr(p capnp.Ptr) MatrixFederation_getVersion_Results { + return MatrixFederation_getVersion_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_getVersion_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_getVersion_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_getVersion_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_getVersion_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s MatrixFederation_getVersion_Results) ServerVersion() (types.ServerVersion, error) { + p, err := capnp.Struct(s).Ptr(0) + return types.ServerVersion(p.Struct()), err +} + +func (s MatrixFederation_getVersion_Results) HasServerVersion() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s MatrixFederation_getVersion_Results) SetServerVersion(v types.ServerVersion) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewServerVersion sets the serverVersion field to a newly +// allocated types.ServerVersion struct, preferring placement in s's segment. +func (s MatrixFederation_getVersion_Results) NewServerVersion() (types.ServerVersion, error) { + ss, err := types.NewServerVersion(capnp.Struct(s).Segment()) + if err != nil { + return types.ServerVersion{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// MatrixFederation_getVersion_Results_List is a list of MatrixFederation_getVersion_Results. +type MatrixFederation_getVersion_Results_List = capnp.StructList[MatrixFederation_getVersion_Results] + +// NewMatrixFederation_getVersion_Results creates a new list of MatrixFederation_getVersion_Results. +func NewMatrixFederation_getVersion_Results_List(s *capnp.Segment, sz int32) (MatrixFederation_getVersion_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[MatrixFederation_getVersion_Results](l), err +} + +// MatrixFederation_getVersion_Results_Future is a wrapper for a MatrixFederation_getVersion_Results promised by a client call. +type MatrixFederation_getVersion_Results_Future struct{ *capnp.Future } + +func (f MatrixFederation_getVersion_Results_Future) Struct() (MatrixFederation_getVersion_Results, error) { + p, err := f.Future.Ptr() + return MatrixFederation_getVersion_Results(p.Struct()), err +} +func (p MatrixFederation_getVersion_Results_Future) ServerVersion() types.ServerVersion_Future { + return types.ServerVersion_Future{Future: p.Future.Field(0, nil)} +} + +type MatrixFederation_getKeys_Params capnp.Struct + +// MatrixFederation_getKeys_Params_TypeID is the unique identifier for the type MatrixFederation_getKeys_Params. +const MatrixFederation_getKeys_Params_TypeID = 0x979c195cba352fad + +func NewMatrixFederation_getKeys_Params(s *capnp.Segment) (MatrixFederation_getKeys_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return MatrixFederation_getKeys_Params(st), err +} + +func NewRootMatrixFederation_getKeys_Params(s *capnp.Segment) (MatrixFederation_getKeys_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return MatrixFederation_getKeys_Params(st), err +} + +func ReadRootMatrixFederation_getKeys_Params(msg *capnp.Message) (MatrixFederation_getKeys_Params, error) { + root, err := msg.Root() + return MatrixFederation_getKeys_Params(root.Struct()), err +} + +func (s MatrixFederation_getKeys_Params) String() string { + str, _ := text.Marshal(0x979c195cba352fad, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_getKeys_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_getKeys_Params) DecodeFromPtr(p capnp.Ptr) MatrixFederation_getKeys_Params { + return MatrixFederation_getKeys_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_getKeys_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_getKeys_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_getKeys_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_getKeys_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s MatrixFederation_getKeys_Params) Server_keys() (types.Map, error) { + p, err := capnp.Struct(s).Ptr(0) + return types.Map(p.Struct()), err +} + +func (s MatrixFederation_getKeys_Params) HasServer_keys() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s MatrixFederation_getKeys_Params) SetServer_keys(v types.Map) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewServer_keys sets the server_keys field to a newly +// allocated types.Map struct, preferring placement in s's segment. +func (s MatrixFederation_getKeys_Params) NewServer_keys() (types.Map, error) { + ss, err := types.NewMap(capnp.Struct(s).Segment()) + if err != nil { + return types.Map{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s MatrixFederation_getKeys_Params) Callback() StreamCallback { + p, _ := capnp.Struct(s).Ptr(1) + return StreamCallback(p.Interface().Client()) +} + +func (s MatrixFederation_getKeys_Params) HasCallback() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s MatrixFederation_getKeys_Params) SetCallback(v StreamCallback) error { + if !v.IsValid() { + return capnp.Struct(s).SetPtr(1, capnp.Ptr{}) + } + seg := s.Segment() + in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v))) + return capnp.Struct(s).SetPtr(1, in.ToPtr()) +} + +// MatrixFederation_getKeys_Params_List is a list of MatrixFederation_getKeys_Params. +type MatrixFederation_getKeys_Params_List = capnp.StructList[MatrixFederation_getKeys_Params] + +// NewMatrixFederation_getKeys_Params creates a new list of MatrixFederation_getKeys_Params. +func NewMatrixFederation_getKeys_Params_List(s *capnp.Segment, sz int32) (MatrixFederation_getKeys_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[MatrixFederation_getKeys_Params](l), err +} + +// MatrixFederation_getKeys_Params_Future is a wrapper for a MatrixFederation_getKeys_Params promised by a client call. +type MatrixFederation_getKeys_Params_Future struct{ *capnp.Future } + +func (f MatrixFederation_getKeys_Params_Future) Struct() (MatrixFederation_getKeys_Params, error) { + p, err := f.Future.Ptr() + return MatrixFederation_getKeys_Params(p.Struct()), err +} +func (p MatrixFederation_getKeys_Params_Future) Server_keys() types.Map_Future { + return types.Map_Future{Future: p.Future.Field(0, nil)} +} +func (p MatrixFederation_getKeys_Params_Future) Callback() StreamCallback { + return StreamCallback(p.Future.Field(1, nil).Client()) +} + +type MatrixFederation_getKeys_Results capnp.Struct + +// MatrixFederation_getKeys_Results_TypeID is the unique identifier for the type MatrixFederation_getKeys_Results. +const MatrixFederation_getKeys_Results_TypeID = 0x902da9b8b1031221 + +func NewMatrixFederation_getKeys_Results(s *capnp.Segment) (MatrixFederation_getKeys_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_getKeys_Results(st), err +} + +func NewRootMatrixFederation_getKeys_Results(s *capnp.Segment) (MatrixFederation_getKeys_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_getKeys_Results(st), err +} + +func ReadRootMatrixFederation_getKeys_Results(msg *capnp.Message) (MatrixFederation_getKeys_Results, error) { + root, err := msg.Root() + return MatrixFederation_getKeys_Results(root.Struct()), err +} + +func (s MatrixFederation_getKeys_Results) String() string { + str, _ := text.Marshal(0x902da9b8b1031221, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_getKeys_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_getKeys_Results) DecodeFromPtr(p capnp.Ptr) MatrixFederation_getKeys_Results { + return MatrixFederation_getKeys_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_getKeys_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_getKeys_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_getKeys_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_getKeys_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// MatrixFederation_getKeys_Results_List is a list of MatrixFederation_getKeys_Results. +type MatrixFederation_getKeys_Results_List = capnp.StructList[MatrixFederation_getKeys_Results] + +// NewMatrixFederation_getKeys_Results creates a new list of MatrixFederation_getKeys_Results. +func NewMatrixFederation_getKeys_Results_List(s *capnp.Segment, sz int32) (MatrixFederation_getKeys_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[MatrixFederation_getKeys_Results](l), err +} + +// MatrixFederation_getKeys_Results_Future is a wrapper for a MatrixFederation_getKeys_Results promised by a client call. +type MatrixFederation_getKeys_Results_Future struct{ *capnp.Future } + +func (f MatrixFederation_getKeys_Results_Future) Struct() (MatrixFederation_getKeys_Results, error) { + p, err := f.Future.Ptr() + return MatrixFederation_getKeys_Results(p.Struct()), err +} + +type MatrixFederation_sendTransactions_Params capnp.Struct + +// MatrixFederation_sendTransactions_Params_TypeID is the unique identifier for the type MatrixFederation_sendTransactions_Params. +const MatrixFederation_sendTransactions_Params_TypeID = 0xff6b4b94e55e5d73 + +func NewMatrixFederation_sendTransactions_Params(s *capnp.Segment) (MatrixFederation_sendTransactions_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_sendTransactions_Params(st), err +} + +func NewRootMatrixFederation_sendTransactions_Params(s *capnp.Segment) (MatrixFederation_sendTransactions_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_sendTransactions_Params(st), err +} + +func ReadRootMatrixFederation_sendTransactions_Params(msg *capnp.Message) (MatrixFederation_sendTransactions_Params, error) { + root, err := msg.Root() + return MatrixFederation_sendTransactions_Params(root.Struct()), err +} + +func (s MatrixFederation_sendTransactions_Params) String() string { + str, _ := text.Marshal(0xff6b4b94e55e5d73, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_sendTransactions_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_sendTransactions_Params) DecodeFromPtr(p capnp.Ptr) MatrixFederation_sendTransactions_Params { + return MatrixFederation_sendTransactions_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_sendTransactions_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_sendTransactions_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_sendTransactions_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_sendTransactions_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// MatrixFederation_sendTransactions_Params_List is a list of MatrixFederation_sendTransactions_Params. +type MatrixFederation_sendTransactions_Params_List = capnp.StructList[MatrixFederation_sendTransactions_Params] + +// NewMatrixFederation_sendTransactions_Params creates a new list of MatrixFederation_sendTransactions_Params. +func NewMatrixFederation_sendTransactions_Params_List(s *capnp.Segment, sz int32) (MatrixFederation_sendTransactions_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[MatrixFederation_sendTransactions_Params](l), err +} + +// MatrixFederation_sendTransactions_Params_Future is a wrapper for a MatrixFederation_sendTransactions_Params promised by a client call. +type MatrixFederation_sendTransactions_Params_Future struct{ *capnp.Future } + +func (f MatrixFederation_sendTransactions_Params_Future) Struct() (MatrixFederation_sendTransactions_Params, error) { + p, err := f.Future.Ptr() + return MatrixFederation_sendTransactions_Params(p.Struct()), err +} + +type MatrixFederation_sendTransactions_Results capnp.Struct + +// MatrixFederation_sendTransactions_Results_TypeID is the unique identifier for the type MatrixFederation_sendTransactions_Results. +const MatrixFederation_sendTransactions_Results_TypeID = 0x9622325dc507c361 + +func NewMatrixFederation_sendTransactions_Results(s *capnp.Segment) (MatrixFederation_sendTransactions_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_sendTransactions_Results(st), err +} + +func NewRootMatrixFederation_sendTransactions_Results(s *capnp.Segment) (MatrixFederation_sendTransactions_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return MatrixFederation_sendTransactions_Results(st), err +} + +func ReadRootMatrixFederation_sendTransactions_Results(msg *capnp.Message) (MatrixFederation_sendTransactions_Results, error) { + root, err := msg.Root() + return MatrixFederation_sendTransactions_Results(root.Struct()), err +} + +func (s MatrixFederation_sendTransactions_Results) String() string { + str, _ := text.Marshal(0x9622325dc507c361, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_sendTransactions_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_sendTransactions_Results) DecodeFromPtr(p capnp.Ptr) MatrixFederation_sendTransactions_Results { + return MatrixFederation_sendTransactions_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_sendTransactions_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_sendTransactions_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_sendTransactions_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_sendTransactions_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s MatrixFederation_sendTransactions_Results) Callback() StreamCallback { + p, _ := capnp.Struct(s).Ptr(0) + return StreamCallback(p.Interface().Client()) +} + +func (s MatrixFederation_sendTransactions_Results) HasCallback() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s MatrixFederation_sendTransactions_Results) SetCallback(v StreamCallback) error { + if !v.IsValid() { + return capnp.Struct(s).SetPtr(0, capnp.Ptr{}) + } + seg := s.Segment() + in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v))) + return capnp.Struct(s).SetPtr(0, in.ToPtr()) +} + +// MatrixFederation_sendTransactions_Results_List is a list of MatrixFederation_sendTransactions_Results. +type MatrixFederation_sendTransactions_Results_List = capnp.StructList[MatrixFederation_sendTransactions_Results] + +// NewMatrixFederation_sendTransactions_Results creates a new list of MatrixFederation_sendTransactions_Results. +func NewMatrixFederation_sendTransactions_Results_List(s *capnp.Segment, sz int32) (MatrixFederation_sendTransactions_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[MatrixFederation_sendTransactions_Results](l), err +} + +// MatrixFederation_sendTransactions_Results_Future is a wrapper for a MatrixFederation_sendTransactions_Results promised by a client call. +type MatrixFederation_sendTransactions_Results_Future struct{ *capnp.Future } + +func (f MatrixFederation_sendTransactions_Results_Future) Struct() (MatrixFederation_sendTransactions_Results, error) { + p, err := f.Future.Ptr() + return MatrixFederation_sendTransactions_Results(p.Struct()), err +} +func (p MatrixFederation_sendTransactions_Results_Future) Callback() StreamCallback { + return StreamCallback(p.Future.Field(0, nil).Client()) +} + +type MatrixFederation_backfill_Params capnp.Struct + +// MatrixFederation_backfill_Params_TypeID is the unique identifier for the type MatrixFederation_backfill_Params. +const MatrixFederation_backfill_Params_TypeID = 0xc423d46c6c56b237 + +func NewMatrixFederation_backfill_Params(s *capnp.Segment) (MatrixFederation_backfill_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}) + return MatrixFederation_backfill_Params(st), err +} + +func NewRootMatrixFederation_backfill_Params(s *capnp.Segment) (MatrixFederation_backfill_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}) + return MatrixFederation_backfill_Params(st), err +} + +func ReadRootMatrixFederation_backfill_Params(msg *capnp.Message) (MatrixFederation_backfill_Params, error) { + root, err := msg.Root() + return MatrixFederation_backfill_Params(root.Struct()), err +} + +func (s MatrixFederation_backfill_Params) String() string { + str, _ := text.Marshal(0xc423d46c6c56b237, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_backfill_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_backfill_Params) DecodeFromPtr(p capnp.Ptr) MatrixFederation_backfill_Params { + return MatrixFederation_backfill_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_backfill_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_backfill_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_backfill_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_backfill_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s MatrixFederation_backfill_Params) Auth_data() (types.AuthData, error) { + p, err := capnp.Struct(s).Ptr(0) + return types.AuthData(p.Struct()), err +} + +func (s MatrixFederation_backfill_Params) HasAuth_data() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s MatrixFederation_backfill_Params) SetAuth_data(v types.AuthData) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewAuth_data sets the auth_data field to a newly +// allocated types.AuthData struct, preferring placement in s's segment. +func (s MatrixFederation_backfill_Params) NewAuth_data() (types.AuthData, error) { + ss, err := types.NewAuthData(capnp.Struct(s).Segment()) + if err != nil { + return types.AuthData{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s MatrixFederation_backfill_Params) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s MatrixFederation_backfill_Params) HasRoomID() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s MatrixFederation_backfill_Params) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s MatrixFederation_backfill_Params) SetRoomID(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s MatrixFederation_backfill_Params) Limit() uint32 { + return capnp.Struct(s).Uint32(0) +} + +func (s MatrixFederation_backfill_Params) SetLimit(v uint32) { + capnp.Struct(s).SetUint32(0, v) +} + +func (s MatrixFederation_backfill_Params) EventIDs() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(2) + return capnp.TextList(p.List()), err +} + +func (s MatrixFederation_backfill_Params) HasEventIDs() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s MatrixFederation_backfill_Params) SetEventIDs(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(2, v.ToPtr()) +} + +// NewEventIDs sets the eventIDs field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s MatrixFederation_backfill_Params) NewEventIDs(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(2, l.ToPtr()) + return l, err +} +func (s MatrixFederation_backfill_Params) Callback() StreamCallback { + p, _ := capnp.Struct(s).Ptr(3) + return StreamCallback(p.Interface().Client()) +} + +func (s MatrixFederation_backfill_Params) HasCallback() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s MatrixFederation_backfill_Params) SetCallback(v StreamCallback) error { + if !v.IsValid() { + return capnp.Struct(s).SetPtr(3, capnp.Ptr{}) + } + seg := s.Segment() + in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v))) + return capnp.Struct(s).SetPtr(3, in.ToPtr()) +} + +// MatrixFederation_backfill_Params_List is a list of MatrixFederation_backfill_Params. +type MatrixFederation_backfill_Params_List = capnp.StructList[MatrixFederation_backfill_Params] + +// NewMatrixFederation_backfill_Params creates a new list of MatrixFederation_backfill_Params. +func NewMatrixFederation_backfill_Params_List(s *capnp.Segment, sz int32) (MatrixFederation_backfill_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}, sz) + return capnp.StructList[MatrixFederation_backfill_Params](l), err +} + +// MatrixFederation_backfill_Params_Future is a wrapper for a MatrixFederation_backfill_Params promised by a client call. +type MatrixFederation_backfill_Params_Future struct{ *capnp.Future } + +func (f MatrixFederation_backfill_Params_Future) Struct() (MatrixFederation_backfill_Params, error) { + p, err := f.Future.Ptr() + return MatrixFederation_backfill_Params(p.Struct()), err +} +func (p MatrixFederation_backfill_Params_Future) Auth_data() types.AuthData_Future { + return types.AuthData_Future{Future: p.Future.Field(0, nil)} +} +func (p MatrixFederation_backfill_Params_Future) Callback() StreamCallback { + return StreamCallback(p.Future.Field(3, nil).Client()) +} + +type MatrixFederation_backfill_Results capnp.Struct + +// MatrixFederation_backfill_Results_TypeID is the unique identifier for the type MatrixFederation_backfill_Results. +const MatrixFederation_backfill_Results_TypeID = 0x8c1d77025e504f82 + +func NewMatrixFederation_backfill_Results(s *capnp.Segment) (MatrixFederation_backfill_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_backfill_Results(st), err +} + +func NewRootMatrixFederation_backfill_Results(s *capnp.Segment) (MatrixFederation_backfill_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return MatrixFederation_backfill_Results(st), err +} + +func ReadRootMatrixFederation_backfill_Results(msg *capnp.Message) (MatrixFederation_backfill_Results, error) { + root, err := msg.Root() + return MatrixFederation_backfill_Results(root.Struct()), err +} + +func (s MatrixFederation_backfill_Results) String() string { + str, _ := text.Marshal(0x8c1d77025e504f82, capnp.Struct(s)) + return str +} + +func (s MatrixFederation_backfill_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (MatrixFederation_backfill_Results) DecodeFromPtr(p capnp.Ptr) MatrixFederation_backfill_Results { + return MatrixFederation_backfill_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s MatrixFederation_backfill_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s MatrixFederation_backfill_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s MatrixFederation_backfill_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s MatrixFederation_backfill_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// MatrixFederation_backfill_Results_List is a list of MatrixFederation_backfill_Results. +type MatrixFederation_backfill_Results_List = capnp.StructList[MatrixFederation_backfill_Results] + +// NewMatrixFederation_backfill_Results creates a new list of MatrixFederation_backfill_Results. +func NewMatrixFederation_backfill_Results_List(s *capnp.Segment, sz int32) (MatrixFederation_backfill_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[MatrixFederation_backfill_Results](l), err +} + +// MatrixFederation_backfill_Results_Future is a wrapper for a MatrixFederation_backfill_Results promised by a client call. +type MatrixFederation_backfill_Results_Future struct{ *capnp.Future } + +func (f MatrixFederation_backfill_Results_Future) Struct() (MatrixFederation_backfill_Results, error) { + p, err := f.Future.Ptr() + return MatrixFederation_backfill_Results(p.Struct()), err +} + +const schema_ee8fadeb6a9300eb = "x\xda\xacVkl\x14U\x14>\xdf\xbdSf\x17v" + + "\x97\xbd\xdd\x12\xc5DV\x91\xc4bl\xcb\xb21\x08\xfc" + + "\xa0\x85\x02\xb6\x84\xb8\x97R\x12\x08\xd0\x0c\xed\x00K\xf7" + + "\x01;\xd3\x16\x82(\"\x8d\x82\xe5Q) D~\x88" + + "\xe2\x0bID\x12c\x10\x15\x02H0\xd1\xa4>\x121" + + "\xf1\xc1\x0f\x0c\x09h\xa2\xfe0*2\xe6Nw\xb6[" + + "\xb5\x11\xd2\xfe\xd9d\xe7;\xf7<\xbe\xef\xdes\xce\xa4" + + "\xd9Z\xb5\x16\x0b\xee/%&\xbf*\x19\xe1|vb" + + ">\xfba\xe7\xc1'I\x94\xf3\xbf\xae\xedYs\xed\xd8" + + "\xae\x9f\x88\xc2\x88\xc7\xfc'\x11\xa9\xf3\xebD\x91\xd9\xfe" + + "\xa7#\xbd~=\xd2\xeb\x1f\xedly4\xb1\x9cu\xdc" + + "\xddEb*\x884\x9d(~\xde\xbf\x80\x91\xe6\xdc[" + + "\xca\x8f\xbf\xfbz\xc5\xee\"\xe4\x8c\xbf^!\xc6Y\xfd" + + "\xfc\xb2\xc9\xe3\xf7\xf5!%P\xd0\xfb\xfe\xe7\x18!\xf2" + + "\x8d\x7f\x06\xc19V\xf5\xd0\xc9\xa5c_\xd8\x9f7`" + + "\xca 6r\xa62\xa8\x1b\xd9Ap\xbe\xbb\xf8\xf3\x8d" + + "\x9e\x85s_)\xf2\x9d\x1e\xb5D\xf9\x9e\xf2\xf6\xa2T" + + "\xea\x8b\xfb\xce\x91\x9c\x0au\xd6\xc5\x92\xa3\xea\x19!\xde" + + "9*\x0a\x82s\xcf\xd5\x8a\xda\x86\xc5\x87.\x92\x98\xd2" + + "\x17>\x8c\xf8\xe5\xc0x\xe5\xfd\xf7\x80\x0a/\x9f?k" + + "\x94^\xd8\xf8y\x9f\x81\xa6\xf0\xb1\xc1\xf1\xca\xfb\xac\xcd" + + "\x8f\xbf\xd4\xbb\xbb\xf1\x0au\x97\x97\xb0\x02=\x88\x8b\xe0" + + "AD&\x06u\xa2\x86\x09A\xae\x82lI7\xf8n" + + "65\xfdZ\\\xe3\x98\xe0\x0a\x15$\x16TA\xc6\x1d" + + "\x98;\xfd\xd9\xdaI\xbf\x0d \x1a\xf1\xc6\xe0\xc7\x88\xac" + + "\x0b\xba\x15\x05uD\x0e\x85t\"\xc7Z\xb6\xfcJ\xcf" + + "\xbcV\xa7\xa8\xde\xce\xd0v\x95\xd1\x9b\xeb\xc7n\xac\xec" + + "\xfa\xc3)\xca\xb53t\x17#\x87N9ksY;" + + "[\xb5\xd2,i1s\x86\x9d\xccf\xaa\xdacU+" + + "M\xef_e{\xac\xb2\xd9X\x9bY;\xad\xc1\xce\x99" + + "Fz\x961#\x95Za4\xb7&\x00\xe9\xe3%D" + + "\x05\xaa\x909~\xba#~\xb0\xe9\x80\x88M&\xaay" + + "\x10Db\xaa\x0e\x14\xc2\xc3\xe3LT<@TS\x8e" + + "\x9a\x87!\xea\xf4hG.i\x9b\x02Q\xa91\xf4\xdf" + + "-\xa5L5F\xb7d3\xff\x8d\x0dr \x01\xd4h" + + "\x10(\xc5\xc2Bm\xbe\xff\xabm\xbea\xe7\x92\xeb\xe7" + + "\xf4#\xaa\xc2\x95\xc9Tj\xc2\x02\xd3jK\xd9\xb0\x86" + + "\xe0k\x95i\xcf37XyW\x16Q\xc1\x97\xff\xb6" + + "}Yf\xa6ea\xce\xc8XF\xb3\xfao\x15\xf2\x93" + + "\x1a\xd7\x884\xc5K\xb0\x9eH\x068\xe4#\x0cN\xb3" + + "\xd1'\x17\x11A\xf4s\xa5\x98\xfa\x17\x81\x8a\xd3;\xa4" + + "\x06\x00\x09\x0e\x84\x9d\xc5\x9ft\x9c\x9bS}j+\x11" + + " \x08\xc3\xc0A\xc2\xc8\x19i\x8b\xa4\xaf\x90\xed\xc4\x15" + + "D\xb2\x9cC\x9ec\x10@\x99+\xed\x19U\xc2i\x0e" + + "y\x83\xc1\xb1\xcc\\\xbb\x99kj%\xdd\xdc`!\xec" + + "D.|xd\xcf\xb8\x8e7\x06\x14Q\xf4Q\xe0~" + + "\xe9SEH\x1fW\xbfa\x0e\x04\x88\x0d\xe9dM\xe2" + + "z\xcb\xbc\xc5\x1f\xbd\xa7\x98\x08\xd3\x10i\xed\x89\xbd\xba" + + "\x86\xf5\x9c\xea\x1e\x16Z\x17\x999+\x99\xcd\xb8\xcc\xf2" + + "\xb45\x1cw>/\x12\xc9\xb2\x82J\x9b\x16\x10\xc9\xc7" + + "8\xe43E*uN#\x92\x9b9d\x17\x03X\x19" + + "\x18\x91\xd86\x99Hn\xe5\x90\xbb\x19\x04ge\xe0D" + + "b\x87\x92\xb3\x8bC\xbe\xc6 4^\x06\x8dH\x1cQ" + + "\x1f_\xe6\x90\xdf38F\x9b\xbd\xba\xa9\xc5\xb0\x09\x06" + + "\xc2N\xf7\xf1\x0fvM|\xea\xf0\xa5<\xdb3r\xd9" + + "l\xba\xae\xd6\x95\"@\x88\xa6\x92\xe9\xa4\x0d\x1f1\xf8" + + "\x08\x8e\xd9nf\xec\xbaZKI\x11\"\x97be\x18" + + "\x1a\xaaJ\xe6\xa7k\xde\x8a\x8c\xd9\xfb\xcb?U\xd2o" + + "\xb5Q\xf6\xc5\xaet\xbb\x9b\xe2T7\xd2\x03\x9e\xa9b" + + "\xca\xc7!\xcb\x18\xa2\xedF\xaa\xcdD)\x06$\x84\xd2" + + "!\x84U}\xd3\xed\x0ez\xca\xb6n\xbd\xcb\xa7M{" + + "u\xb6\xa5\xb1\x91\xd7\xd5&\x00\xf8\x89\x0d\xcf\xf5\xf42" + + ")& \x97\xefSw\x16\x1e\xf9\"\x93\xa2\xae=\xc2" + + "\xce;\xdf\x1e>:\xfdR\xfc\xaa\xf7\xe4\xbc4F\xdc" + + "n\x1aD\x09\xf7-\xabY\xe5\xed\x04\xf0F\xafX\xb7" + + "D\xb4E\x09b\x9b\x9aT\xdeN\x01o/\x11\x9bf" + + "\x8aM\x0a\xee\xd6\xc1\x0a\x13\x16\xder\":\xb7\x8b\x1d" + + "\x0a~Q\x07/\xac\x15\xf0\xf6\x1d\xb1\xb7^\x1cP\xf0" + + "1\xdd\xf1\xb8 \x9e\xcdH\x0d\xac\x7fMP\xf7\xb0&" + + "\x00\xf8\x9d\xde\xdax\xf4\xea\x89qG\x89P\x8d'\xf2" + + "=s0\xe3\xd0\x97_\xef\x1b\xd3[\xb1\xc75v\xbc" + + "\xc1\x00o2\x10\x0dr\xf0\xcf\xadKW]N\xb5^" + + "w\x8fyo\x9e\x065w~\x0c\xec\xba\xb9cgh" + + "\xbf\x1b'\x01\x0c\xe7\xf4\xf2:\xcd\xd0ny\xbe\xf5\xfd" + + "\x1d\x00\x00\xff\xff\xb0\xce:\xf3" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_ee8fadeb6a9300eb, + Nodes: []uint64{ + 0x819a8ee6024db3d2, + 0x8c1d77025e504f82, + 0x902da9b8b1031221, + 0x9622325dc507c361, + 0x979c195cba352fad, + 0xa6475494fcf1c9df, + 0xc423d46c6c56b237, + 0xc99d5953442de820, + 0xd37bc71261c39851, + 0xe55590d1a37e8043, + 0xf35f5ffe08536d82, + 0xf730448b3b47991e, + 0xff6b4b94e55e5d73, + 0xfffa8c2e7b1978ac, + }, + Compressed: true, + }) +} diff --git a/proto/federation/v1/types/types.capnp b/proto/federation/v1/types/types.capnp @@ -0,0 +1,398 @@ +using Go = import "/go.capnp"; + +@0xb8a1e7de8a3a89ec; + +$Go.package("types"); +$Go.import("github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types"); + +# Broken right now. Hence inlined below +# using Json = import "/capnp/compat/json.capnp"; + +############################################################################################################################### + +############################################################################################################################### +# Copied from https://github.com/capnproto/go-capnp/blob/0d218d2660ffa094198d7aba689c4eb04ff6ae18/std/capnp/compat/json.capnp # +############################################################################################################################### + +struct JsonValue @0xb646fc9bdea8828e { + union { + # Standard JSON values. + null @0 :Void; + boolean @1 :Bool; + number @2 :Float64; + string @3 :Text; + array @4 :List(JsonValue); + object @5 :List(Field); + + # Non-standard: A "function call", applying a named function (named by a single identifier) + # to a parameter list. Examples: + # + # BinData(0, "Zm9vCg==") + # ISODate("2015-04-15T08:44:50.218Z") + # + # Mongo DB users will recognize the above as exactly the syntax Mongo uses to represent BSON + # "binary" and "date" types in text, since JSON has no analog of these. This is basically the + # reason this extension exists. We do NOT recommend using `call` unless you specifically need + # to be compatible with some silly format that uses this syntax. + call @6 :Call; + } + + struct Field @0x99d8d8a8f49ec4f6 { + name @0 :Text; + value @1 :JsonValue; + } + + struct Call @0x8c72e334d0537d39 { + function @0 :Text; + params @1 :List(JsonValue); + } +} + +############################################################################################################################### + +# A generic map from keys to values. +struct Map(Key, Value) { + entries @0 :List(Entry); + struct Entry @0xb000b19244fa63f4 { + key @0 :Key; + value @1 :Value; + } +} + +############################################################################################################################### + +# Defines a wrapper for signatures generated by a given server +struct Signature @0xbe04b152eaffa6c8 { + server @0 :Text; + signatures @1 :Map(Text, Data); +} + +# This is the equivalent of https://spec.matrix.org/v1.9/server-server-api/#request-authentication +# Since capnproto rpc has no method like HTTP methods and no uris we instead use unique u64 ids for methods here. +# It is intentionally not an enum to account for the MSC process. +# +# It is also mandatory to convert any json content to a capnproto content on the wire to ensure it can be +# canonicalized and signed. It is by design a duplication of the data here between federation wire format and the +# Clientside json format. The wireformat however does not introduce any further restrictions on the event formats. +# +# This eliminates the need for json Canonicalization when signing. +struct AuthData @0xd9a283298fbeb191 { + method @0 :UInt64; + origin @1 :Text; + destination @2 :Text; + signatures @3 :List(Signature); +} + +############################################################################################################################### + +# The version data of a server. +# This is equivalent to the response in +# https://spec.matrix.org/v1.9/server-server-api/#server-implementation +struct ServerVersion @0xe833d93baba2deb6 { + # Arbitrary name that identify this implementation. + name @0 :Text; + # Version of this implementation. The version format depends on the + # implementation. + version @1 :Text; +} + +# The Key Query request body. +# The query criteria. The outer string key on the object is the server name +# (eg: matrix.org). The inner string key is the Key ID to query for the +# particular server. If no key IDs are given to be queried, the notary server +# should query for all keys. If no servers are given, the notary server must +# return an empty server_keys array in the response. +# +# The notary server may return multiple keys regardless of the Key IDs given. +struct QueryCriteria @0xbbc6594b64ec5041 { + # A millisecond POSIX timestamp in milliseconds indicating when the + # returned certificates will need to be valid until to be useful to + # the requesting server. + # + # If not supplied, the current time as determined by the notary server is used. + minimumValidUntilTS @0 :Int64; +} + +# This response models the json response from +# https://spec.matrix.org/v1.9/server-server-api/#publishing-keys +struct ServerKeysResponse @0x91bc94026aa73194 { + # Digital signatures for this object signed using the verify_keys. + # The signature is calculated using the process described at [Signing + # JSON](https://spec.matrix.org/v1.9/appendices/#signing-json). + signatures @0 :List(Signature); + + struct Metadata @0xc6b8d5e8d14b4b9b { + # **Required:** DNS name of the homeserver. + serverName @0 :Text; + + # POSIX timestamp in milliseconds when the list of valid keys should be + # refreshed. This field **MUST** be ignored in room versions 1, 2, 3, + # and 4. Keys used beyond this timestamp **MUST** be considered invalid, + # depending on the room version specification. + # + # Servers **MUST** use the lesser of this field and 7 days into the future + # when determining if a key is valid. This is to avoid a situation where an + # attacker publishes a key which is valid for a significant amount of time + # without a way for the homeserver owner to revoke it. + validUntilTS @1 :Int64; + } + + struct OldVerifyKey @0x956498bd24be9c30 { + # **Required:** POSIX timestamp in milliseconds for when this key + # expired. + expiredTS @0 :Int64; + # **Required:** The key as bytes. _DO NOT USE BASE64 HERE!_ + key @1 :Data; + } + + union { + # Anything that can be send outside of the individual key data + metadata @1 :Metadata; + + # **Required:** + # Public keys of the homeserver for verifying digital signatures. + # + # The object’s key is the algorithm and version combined (`ed25519` + # being the algorithm and `abc123` being the version). Together, this + # forms the Key ID. The version must have characters matching the + # regular expression `[a-zA-Z0-9_]`. + verifyKeys @2 :Map(Text, Data); + + # The public keys that the server used to use and when it stopped using + # them. + # + # The object’s key is the algorithm and version combined (`ed25519` being + # the algorithm and `0ldK3y` being the version). + # Together, this forms the Key ID. The version must have characters + # matching the regular expression `[a-zA-Z0-9_]`. + oldVerifyKeys @3 :Map(Text, OldVerifyKey); + } +} + +struct Transaction @0x84bc4046c477cd59 { + authData @0 :AuthData; + + # Metadata which we only require once + struct Metadata @0xc97074bcbc8f1239 { + # **Required:** The transaction ID. + txnID @0 :Text; + # **Required:** The server_name of the homeserver sending this transaction. + origin @1 :Text; + # **Required:** POSIX timestamp in milliseconds on originating homeserver + # when this transaction started. + originServerTS @2 :Int64; + } + + struct EDU @0xa18f0aa774bf394b { + # **Required:** The type of ephemeral message. + eduType @0 :Text; + # **Required:** The content of the ephemeral message. + content @1 :JsonValue; + } + + struct PDU @0xb1beb572e4d306be { + struct EventReference @0xbb294824d9b4424b { + union { + eventID @0 :Text; + sha256 @1 :Text; + } + } + + struct Unsigned @0x83ba1e25907bb64e { + age @0 :UInt64; + } + + union { + roomVersion1 :group { + depth @0 :UInt64; + eventID @1 :Text; + originServerTS @2 :Int64; + roomID @3 :Text; + sender @4 :Text; + type @5 :Text; + redacts @6 :Text; + stateKey @7 :Text; + content @8 :JsonValue; + authEvents @9 :List(EventReference); + prevEvents @10 :List(EventReference); + hashes @11 :List(Text); + signatures @12 :List(Signature); + unsigned @13 :Unsigned; + } + roomVersion2 :group { + depth @14 :UInt64; + eventID @15 :Text; + originServerTS @16 :Int64; + roomID @17 :Text; + sender @18 :Text; + type @19 :Text; + redacts @20 :Text; + stateKey @21 :Text; + content @22 :JsonValue; + authEvents @23 :List(EventReference); + prevEvents @24 :List(EventReference); + hashes @25 :List(Text); + signatures @26 :List(Signature); + unsigned @27 :Unsigned; + } + roomVersion3 :group { + depth @28 :UInt64; + originServerTS @29 :Int64; + roomID @30 :Text; + sender @31 :Text; + type @32 :Text; + redacts @33 :Text; + stateKey @34 :Text; + content @35 :JsonValue; + authEvents @36 :List(Text); + prevEvents @37 :List(Text); + hashes @38 :List(Text); + signatures @39 :List(Signature); + unsigned @40 :Unsigned; + } + roomVersion4 :group { + depth @41 :UInt64; + originServerTS @42 :Int64; + roomID @43 :Text; + sender @44 :Text; + type @45 :Text; + redacts @46 :Text; + stateKey @47 :Text; + content @48 :JsonValue; + authEvents @49 :List(Text); + prevEvents @50 :List(Text); + hashes @51 :List(Text); + signatures @52 :List(Signature); + unsigned @53 :Unsigned; + } + roomVersion5 :group { + depth @54 :UInt64; + originServerTS @55 :Int64; + roomID @56 :Text; + sender @57 :Text; + type @58 :Text; + redacts @59 :Text; + stateKey @60 :Text; + content @61 :JsonValue; + authEvents @62 :List(Text); + prevEvents @63 :List(Text); + hashes @64 :List(Text); + signatures @65 :List(Signature); + unsigned @66 :Unsigned; + } + roomVersion6 :group { + depth @67 :UInt64; + originServerTS @68 :Int64; + roomID @69 :Text; + sender @70 :Text; + type @71 :Text; + redacts @72 :Text; + stateKey @73 :Text; + content @74 :JsonValue; + authEvents @75 :List(Text); + prevEvents @76 :List(Text); + hashes @77 :List(Text); + signatures @78 :List(Signature); + unsigned @79 :Unsigned; + } + roomVersion7 :group { + depth @80 :UInt64; + originServerTS @81 :Int64; + roomID @82 :Text; + sender @83 :Text; + type @84 :Text; + redacts @85 :Text; + stateKey @86 :Text; + content @87 :JsonValue; + authEvents @88 :List(Text); + prevEvents @89 :List(Text); + hashes @90 :List(Text); + signatures @91 :List(Signature); + unsigned @92 :Unsigned; + } + roomVersion8 :group { + depth @93 :UInt64; + originServerTS @94 :Int64; + roomID @95 :Text; + sender @96 :Text; + type @97 :Text; + redacts @98 :Text; + stateKey @99 :Text; + content @100 :JsonValue; + authEvents @101 :List(Text); + prevEvents @102 :List(Text); + hashes @103 :List(Text); + signatures @104 :List(Signature); + unsigned @105 :Unsigned; + } + roomVersion9 :group { + depth @106 :UInt64; + originServerTS @107 :Int64; + roomID @108 :Text; + sender @109 :Text; + type @110 :Text; + redacts @111 :Text; + stateKey @112 :Text; + content @113 :JsonValue; + authEvents @114 :List(Text); + prevEvents @115 :List(Text); + hashes @116 :List(Text); + signatures @117 :List(Signature); + unsigned @118 :Unsigned; + } + roomVersion10 :group { + depth @119 :UInt64; + originServerTS @120 :Int64; + roomID @121 :Text; + sender @122 :Text; + type @123 :Text; + redacts @124 :Text; + stateKey @125 :Text; + content @126 :JsonValue; + authEvents @127 :List(Text); + prevEvents @128 :List(Text); + hashes @129 :List(Text); + signatures @130 :List(Signature); + unsigned @131 :Unsigned; + } + roomVersion11 :group { + depth @132 :UInt64; + originServerTS @133 :Int64; + roomID @134 :Text; + sender @135 :Text; + type @136 :Text; + stateKey @137 :Text; + content @138 :JsonValue; + authEvents @139 :List(Text); + prevEvents @140 :List(Text); + hashes @141 :List(Text); + signatures @142 :List(Signature); + unsigned @143 :Unsigned; + } + } + } + + union { + # Anything that can be send outside of the individual key data + metadata @1 :Metadata; + + # The ephemeral message to be sent. + edu @2 :EDU; + + # The persistent message to be sent. + pdu @3 :PDU; + } +} + +struct BackfillData @0xf2951513b06ace65 { + struct Metadata { + origin @0 :Text; + originServerTS @1 :Int64; + } + + union { + # Anything that can be send outside of the individual key data + metadata @0 :Metadata; + pdu @1 :Transaction.PDU; + } +} +\ No newline at end of file diff --git a/proto/federation/v1/types/types.capnp.go b/proto/federation/v1/types/types.capnp.go @@ -0,0 +1,5858 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package types + +import ( + capnp "capnproto.org/go/capnp/v3" + text "capnproto.org/go/capnp/v3/encoding/text" + schemas "capnproto.org/go/capnp/v3/schemas" + math "math" + strconv "strconv" +) + +type JsonValue capnp.Struct +type JsonValue_Which uint16 + +const ( + JsonValue_Which_null JsonValue_Which = 0 + JsonValue_Which_boolean JsonValue_Which = 1 + JsonValue_Which_number JsonValue_Which = 2 + JsonValue_Which_string_ JsonValue_Which = 3 + JsonValue_Which_array JsonValue_Which = 4 + JsonValue_Which_object JsonValue_Which = 5 + JsonValue_Which_call JsonValue_Which = 6 +) + +func (w JsonValue_Which) String() string { + const s = "nullbooleannumberstring_arrayobjectcall" + switch w { + case JsonValue_Which_null: + return s[0:4] + case JsonValue_Which_boolean: + return s[4:11] + case JsonValue_Which_number: + return s[11:17] + case JsonValue_Which_string_: + return s[17:24] + case JsonValue_Which_array: + return s[24:29] + case JsonValue_Which_object: + return s[29:35] + case JsonValue_Which_call: + return s[35:39] + + } + return "JsonValue_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// JsonValue_TypeID is the unique identifier for the type JsonValue. +const JsonValue_TypeID = 0xb646fc9bdea8828e + +func NewJsonValue(s *capnp.Segment) (JsonValue, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}) + return JsonValue(st), err +} + +func NewRootJsonValue(s *capnp.Segment) (JsonValue, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}) + return JsonValue(st), err +} + +func ReadRootJsonValue(msg *capnp.Message) (JsonValue, error) { + root, err := msg.Root() + return JsonValue(root.Struct()), err +} + +func (s JsonValue) String() string { + str, _ := text.Marshal(0xb646fc9bdea8828e, capnp.Struct(s)) + return str +} + +func (s JsonValue) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (JsonValue) DecodeFromPtr(p capnp.Ptr) JsonValue { + return JsonValue(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s JsonValue) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s JsonValue) Which() JsonValue_Which { + return JsonValue_Which(capnp.Struct(s).Uint16(0)) +} +func (s JsonValue) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s JsonValue) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s JsonValue) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s JsonValue) SetNull() { + capnp.Struct(s).SetUint16(0, 0) + +} + +func (s JsonValue) Boolean() bool { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != boolean") + } + return capnp.Struct(s).Bit(16) +} + +func (s JsonValue) SetBoolean(v bool) { + capnp.Struct(s).SetUint16(0, 1) + capnp.Struct(s).SetBit(16, v) +} + +func (s JsonValue) Number() float64 { + if capnp.Struct(s).Uint16(0) != 2 { + panic("Which() != number") + } + return math.Float64frombits(capnp.Struct(s).Uint64(8)) +} + +func (s JsonValue) SetNumber(v float64) { + capnp.Struct(s).SetUint16(0, 2) + capnp.Struct(s).SetUint64(8, math.Float64bits(v)) +} + +func (s JsonValue) String_() (string, error) { + if capnp.Struct(s).Uint16(0) != 3 { + panic("Which() != string_") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s JsonValue) HasString_() bool { + if capnp.Struct(s).Uint16(0) != 3 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue) String_Bytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s JsonValue) SetString_(v string) error { + capnp.Struct(s).SetUint16(0, 3) + return capnp.Struct(s).SetText(0, v) +} + +func (s JsonValue) Array() (JsonValue_List, error) { + if capnp.Struct(s).Uint16(0) != 4 { + panic("Which() != array") + } + p, err := capnp.Struct(s).Ptr(0) + return JsonValue_List(p.List()), err +} + +func (s JsonValue) HasArray() bool { + if capnp.Struct(s).Uint16(0) != 4 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue) SetArray(v JsonValue_List) error { + capnp.Struct(s).SetUint16(0, 4) + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewArray sets the array field to a newly +// allocated JsonValue_List, preferring placement in s's segment. +func (s JsonValue) NewArray(n int32) (JsonValue_List, error) { + capnp.Struct(s).SetUint16(0, 4) + l, err := NewJsonValue_List(capnp.Struct(s).Segment(), n) + if err != nil { + return JsonValue_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s JsonValue) Object() (JsonValue_Field_List, error) { + if capnp.Struct(s).Uint16(0) != 5 { + panic("Which() != object") + } + p, err := capnp.Struct(s).Ptr(0) + return JsonValue_Field_List(p.List()), err +} + +func (s JsonValue) HasObject() bool { + if capnp.Struct(s).Uint16(0) != 5 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue) SetObject(v JsonValue_Field_List) error { + capnp.Struct(s).SetUint16(0, 5) + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewObject sets the object field to a newly +// allocated JsonValue_Field_List, preferring placement in s's segment. +func (s JsonValue) NewObject(n int32) (JsonValue_Field_List, error) { + capnp.Struct(s).SetUint16(0, 5) + l, err := NewJsonValue_Field_List(capnp.Struct(s).Segment(), n) + if err != nil { + return JsonValue_Field_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s JsonValue) Call() (JsonValue_Call, error) { + if capnp.Struct(s).Uint16(0) != 6 { + panic("Which() != call") + } + p, err := capnp.Struct(s).Ptr(0) + return JsonValue_Call(p.Struct()), err +} + +func (s JsonValue) HasCall() bool { + if capnp.Struct(s).Uint16(0) != 6 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue) SetCall(v JsonValue_Call) error { + capnp.Struct(s).SetUint16(0, 6) + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewCall sets the call field to a newly +// allocated JsonValue_Call struct, preferring placement in s's segment. +func (s JsonValue) NewCall() (JsonValue_Call, error) { + capnp.Struct(s).SetUint16(0, 6) + ss, err := NewJsonValue_Call(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue_Call{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// JsonValue_List is a list of JsonValue. +type JsonValue_List = capnp.StructList[JsonValue] + +// NewJsonValue creates a new list of JsonValue. +func NewJsonValue_List(s *capnp.Segment, sz int32) (JsonValue_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}, sz) + return capnp.StructList[JsonValue](l), err +} + +// JsonValue_Future is a wrapper for a JsonValue promised by a client call. +type JsonValue_Future struct{ *capnp.Future } + +func (f JsonValue_Future) Struct() (JsonValue, error) { + p, err := f.Future.Ptr() + return JsonValue(p.Struct()), err +} +func (p JsonValue_Future) Call() JsonValue_Call_Future { + return JsonValue_Call_Future{Future: p.Future.Field(0, nil)} +} + +type JsonValue_Field capnp.Struct + +// JsonValue_Field_TypeID is the unique identifier for the type JsonValue_Field. +const JsonValue_Field_TypeID = 0x99d8d8a8f49ec4f6 + +func NewJsonValue_Field(s *capnp.Segment) (JsonValue_Field, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return JsonValue_Field(st), err +} + +func NewRootJsonValue_Field(s *capnp.Segment) (JsonValue_Field, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return JsonValue_Field(st), err +} + +func ReadRootJsonValue_Field(msg *capnp.Message) (JsonValue_Field, error) { + root, err := msg.Root() + return JsonValue_Field(root.Struct()), err +} + +func (s JsonValue_Field) String() string { + str, _ := text.Marshal(0x99d8d8a8f49ec4f6, capnp.Struct(s)) + return str +} + +func (s JsonValue_Field) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (JsonValue_Field) DecodeFromPtr(p capnp.Ptr) JsonValue_Field { + return JsonValue_Field(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s JsonValue_Field) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s JsonValue_Field) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s JsonValue_Field) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s JsonValue_Field) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s JsonValue_Field) Name() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s JsonValue_Field) HasName() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue_Field) NameBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s JsonValue_Field) SetName(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s JsonValue_Field) Value() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(1) + return JsonValue(p.Struct()), err +} + +func (s JsonValue_Field) HasValue() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s JsonValue_Field) SetValue(v JsonValue) error { + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewValue sets the value field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s JsonValue_Field) NewValue() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// JsonValue_Field_List is a list of JsonValue_Field. +type JsonValue_Field_List = capnp.StructList[JsonValue_Field] + +// NewJsonValue_Field creates a new list of JsonValue_Field. +func NewJsonValue_Field_List(s *capnp.Segment, sz int32) (JsonValue_Field_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[JsonValue_Field](l), err +} + +// JsonValue_Field_Future is a wrapper for a JsonValue_Field promised by a client call. +type JsonValue_Field_Future struct{ *capnp.Future } + +func (f JsonValue_Field_Future) Struct() (JsonValue_Field, error) { + p, err := f.Future.Ptr() + return JsonValue_Field(p.Struct()), err +} +func (p JsonValue_Field_Future) Value() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(1, nil)} +} + +type JsonValue_Call capnp.Struct + +// JsonValue_Call_TypeID is the unique identifier for the type JsonValue_Call. +const JsonValue_Call_TypeID = 0x8c72e334d0537d39 + +func NewJsonValue_Call(s *capnp.Segment) (JsonValue_Call, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return JsonValue_Call(st), err +} + +func NewRootJsonValue_Call(s *capnp.Segment) (JsonValue_Call, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return JsonValue_Call(st), err +} + +func ReadRootJsonValue_Call(msg *capnp.Message) (JsonValue_Call, error) { + root, err := msg.Root() + return JsonValue_Call(root.Struct()), err +} + +func (s JsonValue_Call) String() string { + str, _ := text.Marshal(0x8c72e334d0537d39, capnp.Struct(s)) + return str +} + +func (s JsonValue_Call) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (JsonValue_Call) DecodeFromPtr(p capnp.Ptr) JsonValue_Call { + return JsonValue_Call(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s JsonValue_Call) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s JsonValue_Call) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s JsonValue_Call) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s JsonValue_Call) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s JsonValue_Call) Function() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s JsonValue_Call) HasFunction() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s JsonValue_Call) FunctionBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s JsonValue_Call) SetFunction(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s JsonValue_Call) Params() (JsonValue_List, error) { + p, err := capnp.Struct(s).Ptr(1) + return JsonValue_List(p.List()), err +} + +func (s JsonValue_Call) HasParams() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s JsonValue_Call) SetParams(v JsonValue_List) error { + return capnp.Struct(s).SetPtr(1, v.ToPtr()) +} + +// NewParams sets the params field to a newly +// allocated JsonValue_List, preferring placement in s's segment. +func (s JsonValue_Call) NewParams(n int32) (JsonValue_List, error) { + l, err := NewJsonValue_List(capnp.Struct(s).Segment(), n) + if err != nil { + return JsonValue_List{}, err + } + err = capnp.Struct(s).SetPtr(1, l.ToPtr()) + return l, err +} + +// JsonValue_Call_List is a list of JsonValue_Call. +type JsonValue_Call_List = capnp.StructList[JsonValue_Call] + +// NewJsonValue_Call creates a new list of JsonValue_Call. +func NewJsonValue_Call_List(s *capnp.Segment, sz int32) (JsonValue_Call_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[JsonValue_Call](l), err +} + +// JsonValue_Call_Future is a wrapper for a JsonValue_Call promised by a client call. +type JsonValue_Call_Future struct{ *capnp.Future } + +func (f JsonValue_Call_Future) Struct() (JsonValue_Call, error) { + p, err := f.Future.Ptr() + return JsonValue_Call(p.Struct()), err +} + +type Map capnp.Struct + +// Map_TypeID is the unique identifier for the type Map. +const Map_TypeID = 0xaa771e93a5bfc713 + +func NewMap(s *capnp.Segment) (Map, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Map(st), err +} + +func NewRootMap(s *capnp.Segment) (Map, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return Map(st), err +} + +func ReadRootMap(msg *capnp.Message) (Map, error) { + root, err := msg.Root() + return Map(root.Struct()), err +} + +func (s Map) String() string { + str, _ := text.Marshal(0xaa771e93a5bfc713, capnp.Struct(s)) + return str +} + +func (s Map) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Map) DecodeFromPtr(p capnp.Ptr) Map { + return Map(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Map) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Map) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Map) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Map) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Map) Entries() (Map_Entry_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return Map_Entry_List(p.List()), err +} + +func (s Map) HasEntries() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Map) SetEntries(v Map_Entry_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewEntries sets the entries field to a newly +// allocated Map_Entry_List, preferring placement in s's segment. +func (s Map) NewEntries(n int32) (Map_Entry_List, error) { + l, err := NewMap_Entry_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Map_Entry_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} + +// Map_List is a list of Map. +type Map_List = capnp.StructList[Map] + +// NewMap creates a new list of Map. +func NewMap_List(s *capnp.Segment, sz int32) (Map_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[Map](l), err +} + +// Map_Future is a wrapper for a Map promised by a client call. +type Map_Future struct{ *capnp.Future } + +func (f Map_Future) Struct() (Map, error) { + p, err := f.Future.Ptr() + return Map(p.Struct()), err +} + +type Map_Entry capnp.Struct + +// Map_Entry_TypeID is the unique identifier for the type Map_Entry. +const Map_Entry_TypeID = 0xb000b19244fa63f4 + +func NewMap_Entry(s *capnp.Segment) (Map_Entry, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Map_Entry(st), err +} + +func NewRootMap_Entry(s *capnp.Segment) (Map_Entry, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Map_Entry(st), err +} + +func ReadRootMap_Entry(msg *capnp.Message) (Map_Entry, error) { + root, err := msg.Root() + return Map_Entry(root.Struct()), err +} + +func (s Map_Entry) String() string { + str, _ := text.Marshal(0xb000b19244fa63f4, capnp.Struct(s)) + return str +} + +func (s Map_Entry) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Map_Entry) DecodeFromPtr(p capnp.Ptr) Map_Entry { + return Map_Entry(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Map_Entry) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Map_Entry) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Map_Entry) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Map_Entry) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Map_Entry) Key() (capnp.Ptr, error) { + return capnp.Struct(s).Ptr(0) +} + +func (s Map_Entry) HasKey() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Map_Entry) SetKey(v capnp.Ptr) error { + return capnp.Struct(s).SetPtr(0, v) +} +func (s Map_Entry) Value() (capnp.Ptr, error) { + return capnp.Struct(s).Ptr(1) +} + +func (s Map_Entry) HasValue() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Map_Entry) SetValue(v capnp.Ptr) error { + return capnp.Struct(s).SetPtr(1, v) +} + +// Map_Entry_List is a list of Map_Entry. +type Map_Entry_List = capnp.StructList[Map_Entry] + +// NewMap_Entry creates a new list of Map_Entry. +func NewMap_Entry_List(s *capnp.Segment, sz int32) (Map_Entry_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[Map_Entry](l), err +} + +// Map_Entry_Future is a wrapper for a Map_Entry promised by a client call. +type Map_Entry_Future struct{ *capnp.Future } + +func (f Map_Entry_Future) Struct() (Map_Entry, error) { + p, err := f.Future.Ptr() + return Map_Entry(p.Struct()), err +} +func (p Map_Entry_Future) Key() *capnp.Future { + return p.Future.Field(0, nil) +} +func (p Map_Entry_Future) Value() *capnp.Future { + return p.Future.Field(1, nil) +} + +type Signature capnp.Struct + +// Signature_TypeID is the unique identifier for the type Signature. +const Signature_TypeID = 0xbe04b152eaffa6c8 + +func NewSignature(s *capnp.Segment) (Signature, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Signature(st), err +} + +func NewRootSignature(s *capnp.Segment) (Signature, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Signature(st), err +} + +func ReadRootSignature(msg *capnp.Message) (Signature, error) { + root, err := msg.Root() + return Signature(root.Struct()), err +} + +func (s Signature) String() string { + str, _ := text.Marshal(0xbe04b152eaffa6c8, capnp.Struct(s)) + return str +} + +func (s Signature) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Signature) DecodeFromPtr(p capnp.Ptr) Signature { + return Signature(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Signature) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Signature) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Signature) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Signature) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Signature) Server() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Signature) HasServer() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Signature) ServerBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Signature) SetServer(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Signature) Signatures() (Map, error) { + p, err := capnp.Struct(s).Ptr(1) + return Map(p.Struct()), err +} + +func (s Signature) HasSignatures() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Signature) SetSignatures(v Map) error { + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Map struct, preferring placement in s's segment. +func (s Signature) NewSignatures() (Map, error) { + ss, err := NewMap(capnp.Struct(s).Segment()) + if err != nil { + return Map{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Signature_List is a list of Signature. +type Signature_List = capnp.StructList[Signature] + +// NewSignature creates a new list of Signature. +func NewSignature_List(s *capnp.Segment, sz int32) (Signature_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[Signature](l), err +} + +// Signature_Future is a wrapper for a Signature promised by a client call. +type Signature_Future struct{ *capnp.Future } + +func (f Signature_Future) Struct() (Signature, error) { + p, err := f.Future.Ptr() + return Signature(p.Struct()), err +} +func (p Signature_Future) Signatures() Map_Future { + return Map_Future{Future: p.Future.Field(1, nil)} +} + +type AuthData capnp.Struct + +// AuthData_TypeID is the unique identifier for the type AuthData. +const AuthData_TypeID = 0xd9a283298fbeb191 + +func NewAuthData(s *capnp.Segment) (AuthData, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}) + return AuthData(st), err +} + +func NewRootAuthData(s *capnp.Segment) (AuthData, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}) + return AuthData(st), err +} + +func ReadRootAuthData(msg *capnp.Message) (AuthData, error) { + root, err := msg.Root() + return AuthData(root.Struct()), err +} + +func (s AuthData) String() string { + str, _ := text.Marshal(0xd9a283298fbeb191, capnp.Struct(s)) + return str +} + +func (s AuthData) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (AuthData) DecodeFromPtr(p capnp.Ptr) AuthData { + return AuthData(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s AuthData) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s AuthData) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s AuthData) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s AuthData) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s AuthData) Method() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s AuthData) SetMethod(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s AuthData) Origin() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s AuthData) HasOrigin() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s AuthData) OriginBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s AuthData) SetOrigin(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s AuthData) Destination() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s AuthData) HasDestination() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s AuthData) DestinationBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s AuthData) SetDestination(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s AuthData) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(2) + return Signature_List(p.List()), err +} + +func (s AuthData) HasSignatures() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s AuthData) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(2, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s AuthData) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(2, l.ToPtr()) + return l, err +} + +// AuthData_List is a list of AuthData. +type AuthData_List = capnp.StructList[AuthData] + +// NewAuthData creates a new list of AuthData. +func NewAuthData_List(s *capnp.Segment, sz int32) (AuthData_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}, sz) + return capnp.StructList[AuthData](l), err +} + +// AuthData_Future is a wrapper for a AuthData promised by a client call. +type AuthData_Future struct{ *capnp.Future } + +func (f AuthData_Future) Struct() (AuthData, error) { + p, err := f.Future.Ptr() + return AuthData(p.Struct()), err +} + +type ServerVersion capnp.Struct + +// ServerVersion_TypeID is the unique identifier for the type ServerVersion. +const ServerVersion_TypeID = 0xe833d93baba2deb6 + +func NewServerVersion(s *capnp.Segment) (ServerVersion, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return ServerVersion(st), err +} + +func NewRootServerVersion(s *capnp.Segment) (ServerVersion, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return ServerVersion(st), err +} + +func ReadRootServerVersion(msg *capnp.Message) (ServerVersion, error) { + root, err := msg.Root() + return ServerVersion(root.Struct()), err +} + +func (s ServerVersion) String() string { + str, _ := text.Marshal(0xe833d93baba2deb6, capnp.Struct(s)) + return str +} + +func (s ServerVersion) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ServerVersion) DecodeFromPtr(p capnp.Ptr) ServerVersion { + return ServerVersion(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ServerVersion) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ServerVersion) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ServerVersion) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ServerVersion) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ServerVersion) Name() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s ServerVersion) HasName() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ServerVersion) NameBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s ServerVersion) SetName(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s ServerVersion) Version() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s ServerVersion) HasVersion() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s ServerVersion) VersionBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s ServerVersion) SetVersion(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +// ServerVersion_List is a list of ServerVersion. +type ServerVersion_List = capnp.StructList[ServerVersion] + +// NewServerVersion creates a new list of ServerVersion. +func NewServerVersion_List(s *capnp.Segment, sz int32) (ServerVersion_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[ServerVersion](l), err +} + +// ServerVersion_Future is a wrapper for a ServerVersion promised by a client call. +type ServerVersion_Future struct{ *capnp.Future } + +func (f ServerVersion_Future) Struct() (ServerVersion, error) { + p, err := f.Future.Ptr() + return ServerVersion(p.Struct()), err +} + +type QueryCriteria capnp.Struct + +// QueryCriteria_TypeID is the unique identifier for the type QueryCriteria. +const QueryCriteria_TypeID = 0xbbc6594b64ec5041 + +func NewQueryCriteria(s *capnp.Segment) (QueryCriteria, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return QueryCriteria(st), err +} + +func NewRootQueryCriteria(s *capnp.Segment) (QueryCriteria, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return QueryCriteria(st), err +} + +func ReadRootQueryCriteria(msg *capnp.Message) (QueryCriteria, error) { + root, err := msg.Root() + return QueryCriteria(root.Struct()), err +} + +func (s QueryCriteria) String() string { + str, _ := text.Marshal(0xbbc6594b64ec5041, capnp.Struct(s)) + return str +} + +func (s QueryCriteria) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (QueryCriteria) DecodeFromPtr(p capnp.Ptr) QueryCriteria { + return QueryCriteria(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s QueryCriteria) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s QueryCriteria) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s QueryCriteria) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s QueryCriteria) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s QueryCriteria) MinimumValidUntilTS() int64 { + return int64(capnp.Struct(s).Uint64(0)) +} + +func (s QueryCriteria) SetMinimumValidUntilTS(v int64) { + capnp.Struct(s).SetUint64(0, uint64(v)) +} + +// QueryCriteria_List is a list of QueryCriteria. +type QueryCriteria_List = capnp.StructList[QueryCriteria] + +// NewQueryCriteria creates a new list of QueryCriteria. +func NewQueryCriteria_List(s *capnp.Segment, sz int32) (QueryCriteria_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz) + return capnp.StructList[QueryCriteria](l), err +} + +// QueryCriteria_Future is a wrapper for a QueryCriteria promised by a client call. +type QueryCriteria_Future struct{ *capnp.Future } + +func (f QueryCriteria_Future) Struct() (QueryCriteria, error) { + p, err := f.Future.Ptr() + return QueryCriteria(p.Struct()), err +} + +type ServerKeysResponse capnp.Struct +type ServerKeysResponse_Which uint16 + +const ( + ServerKeysResponse_Which_metadata ServerKeysResponse_Which = 0 + ServerKeysResponse_Which_verifyKeys ServerKeysResponse_Which = 1 + ServerKeysResponse_Which_oldVerifyKeys ServerKeysResponse_Which = 2 +) + +func (w ServerKeysResponse_Which) String() string { + const s = "metadataverifyKeysoldVerifyKeys" + switch w { + case ServerKeysResponse_Which_metadata: + return s[0:8] + case ServerKeysResponse_Which_verifyKeys: + return s[8:18] + case ServerKeysResponse_Which_oldVerifyKeys: + return s[18:31] + + } + return "ServerKeysResponse_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// ServerKeysResponse_TypeID is the unique identifier for the type ServerKeysResponse. +const ServerKeysResponse_TypeID = 0x91bc94026aa73194 + +func NewServerKeysResponse(s *capnp.Segment) (ServerKeysResponse, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return ServerKeysResponse(st), err +} + +func NewRootServerKeysResponse(s *capnp.Segment) (ServerKeysResponse, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return ServerKeysResponse(st), err +} + +func ReadRootServerKeysResponse(msg *capnp.Message) (ServerKeysResponse, error) { + root, err := msg.Root() + return ServerKeysResponse(root.Struct()), err +} + +func (s ServerKeysResponse) String() string { + str, _ := text.Marshal(0x91bc94026aa73194, capnp.Struct(s)) + return str +} + +func (s ServerKeysResponse) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ServerKeysResponse) DecodeFromPtr(p capnp.Ptr) ServerKeysResponse { + return ServerKeysResponse(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ServerKeysResponse) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s ServerKeysResponse) Which() ServerKeysResponse_Which { + return ServerKeysResponse_Which(capnp.Struct(s).Uint16(0)) +} +func (s ServerKeysResponse) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ServerKeysResponse) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ServerKeysResponse) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ServerKeysResponse) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return Signature_List(p.List()), err +} + +func (s ServerKeysResponse) HasSignatures() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ServerKeysResponse) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s ServerKeysResponse) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s ServerKeysResponse) Metadata() (ServerKeysResponse_Metadata, error) { + if capnp.Struct(s).Uint16(0) != 0 { + panic("Which() != metadata") + } + p, err := capnp.Struct(s).Ptr(1) + return ServerKeysResponse_Metadata(p.Struct()), err +} + +func (s ServerKeysResponse) HasMetadata() bool { + if capnp.Struct(s).Uint16(0) != 0 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s ServerKeysResponse) SetMetadata(v ServerKeysResponse_Metadata) error { + capnp.Struct(s).SetUint16(0, 0) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewMetadata sets the metadata field to a newly +// allocated ServerKeysResponse_Metadata struct, preferring placement in s's segment. +func (s ServerKeysResponse) NewMetadata() (ServerKeysResponse_Metadata, error) { + capnp.Struct(s).SetUint16(0, 0) + ss, err := NewServerKeysResponse_Metadata(capnp.Struct(s).Segment()) + if err != nil { + return ServerKeysResponse_Metadata{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s ServerKeysResponse) VerifyKeys() (Map, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != verifyKeys") + } + p, err := capnp.Struct(s).Ptr(1) + return Map(p.Struct()), err +} + +func (s ServerKeysResponse) HasVerifyKeys() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s ServerKeysResponse) SetVerifyKeys(v Map) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewVerifyKeys sets the verifyKeys field to a newly +// allocated Map struct, preferring placement in s's segment. +func (s ServerKeysResponse) NewVerifyKeys() (Map, error) { + capnp.Struct(s).SetUint16(0, 1) + ss, err := NewMap(capnp.Struct(s).Segment()) + if err != nil { + return Map{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s ServerKeysResponse) OldVerifyKeys() (Map, error) { + if capnp.Struct(s).Uint16(0) != 2 { + panic("Which() != oldVerifyKeys") + } + p, err := capnp.Struct(s).Ptr(1) + return Map(p.Struct()), err +} + +func (s ServerKeysResponse) HasOldVerifyKeys() bool { + if capnp.Struct(s).Uint16(0) != 2 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s ServerKeysResponse) SetOldVerifyKeys(v Map) error { + capnp.Struct(s).SetUint16(0, 2) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewOldVerifyKeys sets the oldVerifyKeys field to a newly +// allocated Map struct, preferring placement in s's segment. +func (s ServerKeysResponse) NewOldVerifyKeys() (Map, error) { + capnp.Struct(s).SetUint16(0, 2) + ss, err := NewMap(capnp.Struct(s).Segment()) + if err != nil { + return Map{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// ServerKeysResponse_List is a list of ServerKeysResponse. +type ServerKeysResponse_List = capnp.StructList[ServerKeysResponse] + +// NewServerKeysResponse creates a new list of ServerKeysResponse. +func NewServerKeysResponse_List(s *capnp.Segment, sz int32) (ServerKeysResponse_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) + return capnp.StructList[ServerKeysResponse](l), err +} + +// ServerKeysResponse_Future is a wrapper for a ServerKeysResponse promised by a client call. +type ServerKeysResponse_Future struct{ *capnp.Future } + +func (f ServerKeysResponse_Future) Struct() (ServerKeysResponse, error) { + p, err := f.Future.Ptr() + return ServerKeysResponse(p.Struct()), err +} +func (p ServerKeysResponse_Future) Metadata() ServerKeysResponse_Metadata_Future { + return ServerKeysResponse_Metadata_Future{Future: p.Future.Field(1, nil)} +} +func (p ServerKeysResponse_Future) VerifyKeys() Map_Future { + return Map_Future{Future: p.Future.Field(1, nil)} +} +func (p ServerKeysResponse_Future) OldVerifyKeys() Map_Future { + return Map_Future{Future: p.Future.Field(1, nil)} +} + +type ServerKeysResponse_Metadata capnp.Struct + +// ServerKeysResponse_Metadata_TypeID is the unique identifier for the type ServerKeysResponse_Metadata. +const ServerKeysResponse_Metadata_TypeID = 0xc6b8d5e8d14b4b9b + +func NewServerKeysResponse_Metadata(s *capnp.Segment) (ServerKeysResponse_Metadata, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ServerKeysResponse_Metadata(st), err +} + +func NewRootServerKeysResponse_Metadata(s *capnp.Segment) (ServerKeysResponse_Metadata, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ServerKeysResponse_Metadata(st), err +} + +func ReadRootServerKeysResponse_Metadata(msg *capnp.Message) (ServerKeysResponse_Metadata, error) { + root, err := msg.Root() + return ServerKeysResponse_Metadata(root.Struct()), err +} + +func (s ServerKeysResponse_Metadata) String() string { + str, _ := text.Marshal(0xc6b8d5e8d14b4b9b, capnp.Struct(s)) + return str +} + +func (s ServerKeysResponse_Metadata) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ServerKeysResponse_Metadata) DecodeFromPtr(p capnp.Ptr) ServerKeysResponse_Metadata { + return ServerKeysResponse_Metadata(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ServerKeysResponse_Metadata) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ServerKeysResponse_Metadata) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ServerKeysResponse_Metadata) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ServerKeysResponse_Metadata) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ServerKeysResponse_Metadata) ServerName() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s ServerKeysResponse_Metadata) HasServerName() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ServerKeysResponse_Metadata) ServerNameBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s ServerKeysResponse_Metadata) SetServerName(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s ServerKeysResponse_Metadata) ValidUntilTS() int64 { + return int64(capnp.Struct(s).Uint64(0)) +} + +func (s ServerKeysResponse_Metadata) SetValidUntilTS(v int64) { + capnp.Struct(s).SetUint64(0, uint64(v)) +} + +// ServerKeysResponse_Metadata_List is a list of ServerKeysResponse_Metadata. +type ServerKeysResponse_Metadata_List = capnp.StructList[ServerKeysResponse_Metadata] + +// NewServerKeysResponse_Metadata creates a new list of ServerKeysResponse_Metadata. +func NewServerKeysResponse_Metadata_List(s *capnp.Segment, sz int32) (ServerKeysResponse_Metadata_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[ServerKeysResponse_Metadata](l), err +} + +// ServerKeysResponse_Metadata_Future is a wrapper for a ServerKeysResponse_Metadata promised by a client call. +type ServerKeysResponse_Metadata_Future struct{ *capnp.Future } + +func (f ServerKeysResponse_Metadata_Future) Struct() (ServerKeysResponse_Metadata, error) { + p, err := f.Future.Ptr() + return ServerKeysResponse_Metadata(p.Struct()), err +} + +type ServerKeysResponse_OldVerifyKey capnp.Struct + +// ServerKeysResponse_OldVerifyKey_TypeID is the unique identifier for the type ServerKeysResponse_OldVerifyKey. +const ServerKeysResponse_OldVerifyKey_TypeID = 0x956498bd24be9c30 + +func NewServerKeysResponse_OldVerifyKey(s *capnp.Segment) (ServerKeysResponse_OldVerifyKey, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ServerKeysResponse_OldVerifyKey(st), err +} + +func NewRootServerKeysResponse_OldVerifyKey(s *capnp.Segment) (ServerKeysResponse_OldVerifyKey, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ServerKeysResponse_OldVerifyKey(st), err +} + +func ReadRootServerKeysResponse_OldVerifyKey(msg *capnp.Message) (ServerKeysResponse_OldVerifyKey, error) { + root, err := msg.Root() + return ServerKeysResponse_OldVerifyKey(root.Struct()), err +} + +func (s ServerKeysResponse_OldVerifyKey) String() string { + str, _ := text.Marshal(0x956498bd24be9c30, capnp.Struct(s)) + return str +} + +func (s ServerKeysResponse_OldVerifyKey) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ServerKeysResponse_OldVerifyKey) DecodeFromPtr(p capnp.Ptr) ServerKeysResponse_OldVerifyKey { + return ServerKeysResponse_OldVerifyKey(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ServerKeysResponse_OldVerifyKey) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ServerKeysResponse_OldVerifyKey) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ServerKeysResponse_OldVerifyKey) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ServerKeysResponse_OldVerifyKey) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ServerKeysResponse_OldVerifyKey) ExpiredTS() int64 { + return int64(capnp.Struct(s).Uint64(0)) +} + +func (s ServerKeysResponse_OldVerifyKey) SetExpiredTS(v int64) { + capnp.Struct(s).SetUint64(0, uint64(v)) +} + +func (s ServerKeysResponse_OldVerifyKey) Key() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s ServerKeysResponse_OldVerifyKey) HasKey() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ServerKeysResponse_OldVerifyKey) SetKey(v []byte) error { + return capnp.Struct(s).SetData(0, v) +} + +// ServerKeysResponse_OldVerifyKey_List is a list of ServerKeysResponse_OldVerifyKey. +type ServerKeysResponse_OldVerifyKey_List = capnp.StructList[ServerKeysResponse_OldVerifyKey] + +// NewServerKeysResponse_OldVerifyKey creates a new list of ServerKeysResponse_OldVerifyKey. +func NewServerKeysResponse_OldVerifyKey_List(s *capnp.Segment, sz int32) (ServerKeysResponse_OldVerifyKey_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[ServerKeysResponse_OldVerifyKey](l), err +} + +// ServerKeysResponse_OldVerifyKey_Future is a wrapper for a ServerKeysResponse_OldVerifyKey promised by a client call. +type ServerKeysResponse_OldVerifyKey_Future struct{ *capnp.Future } + +func (f ServerKeysResponse_OldVerifyKey_Future) Struct() (ServerKeysResponse_OldVerifyKey, error) { + p, err := f.Future.Ptr() + return ServerKeysResponse_OldVerifyKey(p.Struct()), err +} + +type Transaction capnp.Struct +type Transaction_Which uint16 + +const ( + Transaction_Which_metadata Transaction_Which = 0 + Transaction_Which_edu Transaction_Which = 1 + Transaction_Which_pdu Transaction_Which = 2 +) + +func (w Transaction_Which) String() string { + const s = "metadataedupdu" + switch w { + case Transaction_Which_metadata: + return s[0:8] + case Transaction_Which_edu: + return s[8:11] + case Transaction_Which_pdu: + return s[11:14] + + } + return "Transaction_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// Transaction_TypeID is the unique identifier for the type Transaction. +const Transaction_TypeID = 0x84bc4046c477cd59 + +func NewTransaction(s *capnp.Segment) (Transaction, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return Transaction(st), err +} + +func NewRootTransaction(s *capnp.Segment) (Transaction, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return Transaction(st), err +} + +func ReadRootTransaction(msg *capnp.Message) (Transaction, error) { + root, err := msg.Root() + return Transaction(root.Struct()), err +} + +func (s Transaction) String() string { + str, _ := text.Marshal(0x84bc4046c477cd59, capnp.Struct(s)) + return str +} + +func (s Transaction) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction) DecodeFromPtr(p capnp.Ptr) Transaction { + return Transaction(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s Transaction) Which() Transaction_Which { + return Transaction_Which(capnp.Struct(s).Uint16(0)) +} +func (s Transaction) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction) AuthData() (AuthData, error) { + p, err := capnp.Struct(s).Ptr(0) + return AuthData(p.Struct()), err +} + +func (s Transaction) HasAuthData() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction) SetAuthData(v AuthData) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewAuthData sets the authData field to a newly +// allocated AuthData struct, preferring placement in s's segment. +func (s Transaction) NewAuthData() (AuthData, error) { + ss, err := NewAuthData(capnp.Struct(s).Segment()) + if err != nil { + return AuthData{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction) Metadata() (Transaction_Metadata, error) { + if capnp.Struct(s).Uint16(0) != 0 { + panic("Which() != metadata") + } + p, err := capnp.Struct(s).Ptr(1) + return Transaction_Metadata(p.Struct()), err +} + +func (s Transaction) HasMetadata() bool { + if capnp.Struct(s).Uint16(0) != 0 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction) SetMetadata(v Transaction_Metadata) error { + capnp.Struct(s).SetUint16(0, 0) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewMetadata sets the metadata field to a newly +// allocated Transaction_Metadata struct, preferring placement in s's segment. +func (s Transaction) NewMetadata() (Transaction_Metadata, error) { + capnp.Struct(s).SetUint16(0, 0) + ss, err := NewTransaction_Metadata(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_Metadata{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction) Edu() (Transaction_EDU, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != edu") + } + p, err := capnp.Struct(s).Ptr(1) + return Transaction_EDU(p.Struct()), err +} + +func (s Transaction) HasEdu() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction) SetEdu(v Transaction_EDU) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewEdu sets the edu field to a newly +// allocated Transaction_EDU struct, preferring placement in s's segment. +func (s Transaction) NewEdu() (Transaction_EDU, error) { + capnp.Struct(s).SetUint16(0, 1) + ss, err := NewTransaction_EDU(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_EDU{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction) Pdu() (Transaction_PDU, error) { + if capnp.Struct(s).Uint16(0) != 2 { + panic("Which() != pdu") + } + p, err := capnp.Struct(s).Ptr(1) + return Transaction_PDU(p.Struct()), err +} + +func (s Transaction) HasPdu() bool { + if capnp.Struct(s).Uint16(0) != 2 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction) SetPdu(v Transaction_PDU) error { + capnp.Struct(s).SetUint16(0, 2) + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewPdu sets the pdu field to a newly +// allocated Transaction_PDU struct, preferring placement in s's segment. +func (s Transaction) NewPdu() (Transaction_PDU, error) { + capnp.Struct(s).SetUint16(0, 2) + ss, err := NewTransaction_PDU(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Transaction_List is a list of Transaction. +type Transaction_List = capnp.StructList[Transaction] + +// NewTransaction creates a new list of Transaction. +func NewTransaction_List(s *capnp.Segment, sz int32) (Transaction_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) + return capnp.StructList[Transaction](l), err +} + +// Transaction_Future is a wrapper for a Transaction promised by a client call. +type Transaction_Future struct{ *capnp.Future } + +func (f Transaction_Future) Struct() (Transaction, error) { + p, err := f.Future.Ptr() + return Transaction(p.Struct()), err +} +func (p Transaction_Future) AuthData() AuthData_Future { + return AuthData_Future{Future: p.Future.Field(0, nil)} +} +func (p Transaction_Future) Metadata() Transaction_Metadata_Future { + return Transaction_Metadata_Future{Future: p.Future.Field(1, nil)} +} +func (p Transaction_Future) Edu() Transaction_EDU_Future { + return Transaction_EDU_Future{Future: p.Future.Field(1, nil)} +} +func (p Transaction_Future) Pdu() Transaction_PDU_Future { + return Transaction_PDU_Future{Future: p.Future.Field(1, nil)} +} + +type Transaction_Metadata capnp.Struct + +// Transaction_Metadata_TypeID is the unique identifier for the type Transaction_Metadata. +const Transaction_Metadata_TypeID = 0xc97074bcbc8f1239 + +func NewTransaction_Metadata(s *capnp.Segment) (Transaction_Metadata, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return Transaction_Metadata(st), err +} + +func NewRootTransaction_Metadata(s *capnp.Segment) (Transaction_Metadata, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return Transaction_Metadata(st), err +} + +func ReadRootTransaction_Metadata(msg *capnp.Message) (Transaction_Metadata, error) { + root, err := msg.Root() + return Transaction_Metadata(root.Struct()), err +} + +func (s Transaction_Metadata) String() string { + str, _ := text.Marshal(0xc97074bcbc8f1239, capnp.Struct(s)) + return str +} + +func (s Transaction_Metadata) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction_Metadata) DecodeFromPtr(p capnp.Ptr) Transaction_Metadata { + return Transaction_Metadata(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction_Metadata) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Transaction_Metadata) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_Metadata) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_Metadata) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_Metadata) TxnID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_Metadata) HasTxnID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_Metadata) TxnIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_Metadata) SetTxnID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_Metadata) Origin() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_Metadata) HasOrigin() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_Metadata) OriginBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_Metadata) SetOrigin(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_Metadata) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(0)) +} + +func (s Transaction_Metadata) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(0, uint64(v)) +} + +// Transaction_Metadata_List is a list of Transaction_Metadata. +type Transaction_Metadata_List = capnp.StructList[Transaction_Metadata] + +// NewTransaction_Metadata creates a new list of Transaction_Metadata. +func NewTransaction_Metadata_List(s *capnp.Segment, sz int32) (Transaction_Metadata_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) + return capnp.StructList[Transaction_Metadata](l), err +} + +// Transaction_Metadata_Future is a wrapper for a Transaction_Metadata promised by a client call. +type Transaction_Metadata_Future struct{ *capnp.Future } + +func (f Transaction_Metadata_Future) Struct() (Transaction_Metadata, error) { + p, err := f.Future.Ptr() + return Transaction_Metadata(p.Struct()), err +} + +type Transaction_EDU capnp.Struct + +// Transaction_EDU_TypeID is the unique identifier for the type Transaction_EDU. +const Transaction_EDU_TypeID = 0xa18f0aa774bf394b + +func NewTransaction_EDU(s *capnp.Segment) (Transaction_EDU, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Transaction_EDU(st), err +} + +func NewRootTransaction_EDU(s *capnp.Segment) (Transaction_EDU, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return Transaction_EDU(st), err +} + +func ReadRootTransaction_EDU(msg *capnp.Message) (Transaction_EDU, error) { + root, err := msg.Root() + return Transaction_EDU(root.Struct()), err +} + +func (s Transaction_EDU) String() string { + str, _ := text.Marshal(0xa18f0aa774bf394b, capnp.Struct(s)) + return str +} + +func (s Transaction_EDU) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction_EDU) DecodeFromPtr(p capnp.Ptr) Transaction_EDU { + return Transaction_EDU(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction_EDU) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Transaction_EDU) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_EDU) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_EDU) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_EDU) EduType() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_EDU) HasEduType() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_EDU) EduTypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_EDU) SetEduType(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_EDU) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(1) + return JsonValue(p.Struct()), err +} + +func (s Transaction_EDU) HasContent() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_EDU) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_EDU) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Transaction_EDU_List is a list of Transaction_EDU. +type Transaction_EDU_List = capnp.StructList[Transaction_EDU] + +// NewTransaction_EDU creates a new list of Transaction_EDU. +func NewTransaction_EDU_List(s *capnp.Segment, sz int32) (Transaction_EDU_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[Transaction_EDU](l), err +} + +// Transaction_EDU_Future is a wrapper for a Transaction_EDU promised by a client call. +type Transaction_EDU_Future struct{ *capnp.Future } + +func (f Transaction_EDU_Future) Struct() (Transaction_EDU, error) { + p, err := f.Future.Ptr() + return Transaction_EDU(p.Struct()), err +} +func (p Transaction_EDU_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(1, nil)} +} + +type Transaction_PDU capnp.Struct +type Transaction_PDU_roomVersion1 Transaction_PDU +type Transaction_PDU_roomVersion2 Transaction_PDU +type Transaction_PDU_roomVersion3 Transaction_PDU +type Transaction_PDU_roomVersion4 Transaction_PDU +type Transaction_PDU_roomVersion5 Transaction_PDU +type Transaction_PDU_roomVersion6 Transaction_PDU +type Transaction_PDU_roomVersion7 Transaction_PDU +type Transaction_PDU_roomVersion8 Transaction_PDU +type Transaction_PDU_roomVersion9 Transaction_PDU +type Transaction_PDU_roomVersion10 Transaction_PDU +type Transaction_PDU_roomVersion11 Transaction_PDU +type Transaction_PDU_Which uint16 + +const ( + Transaction_PDU_Which_roomVersion1 Transaction_PDU_Which = 0 + Transaction_PDU_Which_roomVersion2 Transaction_PDU_Which = 1 + Transaction_PDU_Which_roomVersion3 Transaction_PDU_Which = 2 + Transaction_PDU_Which_roomVersion4 Transaction_PDU_Which = 3 + Transaction_PDU_Which_roomVersion5 Transaction_PDU_Which = 4 + Transaction_PDU_Which_roomVersion6 Transaction_PDU_Which = 5 + Transaction_PDU_Which_roomVersion7 Transaction_PDU_Which = 6 + Transaction_PDU_Which_roomVersion8 Transaction_PDU_Which = 7 + Transaction_PDU_Which_roomVersion9 Transaction_PDU_Which = 8 + Transaction_PDU_Which_roomVersion10 Transaction_PDU_Which = 9 + Transaction_PDU_Which_roomVersion11 Transaction_PDU_Which = 10 +) + +func (w Transaction_PDU_Which) String() string { + const s = "roomVersion1roomVersion2roomVersion3roomVersion4roomVersion5roomVersion6roomVersion7roomVersion8roomVersion9roomVersion10roomVersion11" + switch w { + case Transaction_PDU_Which_roomVersion1: + return s[0:12] + case Transaction_PDU_Which_roomVersion2: + return s[12:24] + case Transaction_PDU_Which_roomVersion3: + return s[24:36] + case Transaction_PDU_Which_roomVersion4: + return s[36:48] + case Transaction_PDU_Which_roomVersion5: + return s[48:60] + case Transaction_PDU_Which_roomVersion6: + return s[60:72] + case Transaction_PDU_Which_roomVersion7: + return s[72:84] + case Transaction_PDU_Which_roomVersion8: + return s[84:96] + case Transaction_PDU_Which_roomVersion9: + return s[96:108] + case Transaction_PDU_Which_roomVersion10: + return s[108:121] + case Transaction_PDU_Which_roomVersion11: + return s[121:134] + + } + return "Transaction_PDU_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// Transaction_PDU_TypeID is the unique identifier for the type Transaction_PDU. +const Transaction_PDU_TypeID = 0xb1beb572e4d306be + +func NewTransaction_PDU(s *capnp.Segment) (Transaction_PDU, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 24, PointerCount: 12}) + return Transaction_PDU(st), err +} + +func NewRootTransaction_PDU(s *capnp.Segment) (Transaction_PDU, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 24, PointerCount: 12}) + return Transaction_PDU(st), err +} + +func ReadRootTransaction_PDU(msg *capnp.Message) (Transaction_PDU, error) { + root, err := msg.Root() + return Transaction_PDU(root.Struct()), err +} + +func (s Transaction_PDU) String() string { + str, _ := text.Marshal(0xb1beb572e4d306be, capnp.Struct(s)) + return str +} + +func (s Transaction_PDU) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction_PDU) DecodeFromPtr(p capnp.Ptr) Transaction_PDU { + return Transaction_PDU(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction_PDU) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s Transaction_PDU) Which() Transaction_PDU_Which { + return Transaction_PDU_Which(capnp.Struct(s).Uint16(16)) +} +func (s Transaction_PDU) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU) RoomVersion1() Transaction_PDU_roomVersion1 { + return Transaction_PDU_roomVersion1(s) +} + +func (s Transaction_PDU) SetRoomVersion1() { + capnp.Struct(s).SetUint16(16, 0) +} + +func (s Transaction_PDU_roomVersion1) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion1) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion1) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion1) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion1) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion1) EventID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasEventID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion1) EventIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetEventID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion1) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion1) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion1) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasRoomID() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion1) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetRoomID(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion1) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasSender() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion1) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetSender(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion1) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasType() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion1) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetType(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion1) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasRedacts() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion1) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetRedacts(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion1) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(5) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion1) HasStateKey() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion1) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(5) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion1) SetStateKey(v string) error { + return capnp.Struct(s).SetText(5, v) +} + +func (s Transaction_PDU_roomVersion1) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(6) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion1) HasContent() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion1) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(6, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(6, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion1) AuthEvents() (Transaction_PDU_EventReference_List, error) { + p, err := capnp.Struct(s).Ptr(7) + return Transaction_PDU_EventReference_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion1) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion1) SetAuthEvents(v Transaction_PDU_EventReference_List) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated Transaction_PDU_EventReference_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewAuthEvents(n int32) (Transaction_PDU_EventReference_List, error) { + l, err := NewTransaction_PDU_EventReference_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Transaction_PDU_EventReference_List{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion1) PrevEvents() (Transaction_PDU_EventReference_List, error) { + p, err := capnp.Struct(s).Ptr(8) + return Transaction_PDU_EventReference_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion1) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion1) SetPrevEvents(v Transaction_PDU_EventReference_List) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated Transaction_PDU_EventReference_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewPrevEvents(n int32) (Transaction_PDU_EventReference_List, error) { + l, err := NewTransaction_PDU_EventReference_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Transaction_PDU_EventReference_List{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion1) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(9) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion1) HasHashes() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion1) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion1) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(10) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion1) HasSignatures() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion1) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(10, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(10, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion1) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(11) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion1) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(11) +} + +func (s Transaction_PDU_roomVersion1) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(11, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion1) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(11, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion2() Transaction_PDU_roomVersion2 { + return Transaction_PDU_roomVersion2(s) +} + +func (s Transaction_PDU) SetRoomVersion2() { + capnp.Struct(s).SetUint16(16, 1) +} + +func (s Transaction_PDU_roomVersion2) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion2) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion2) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion2) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion2) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion2) EventID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasEventID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion2) EventIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetEventID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion2) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion2) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion2) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasRoomID() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion2) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetRoomID(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion2) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasSender() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion2) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetSender(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion2) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasType() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion2) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetType(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion2) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasRedacts() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion2) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetRedacts(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion2) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(5) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion2) HasStateKey() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion2) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(5) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion2) SetStateKey(v string) error { + return capnp.Struct(s).SetText(5, v) +} + +func (s Transaction_PDU_roomVersion2) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(6) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion2) HasContent() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion2) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(6, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(6, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion2) AuthEvents() (Transaction_PDU_EventReference_List, error) { + p, err := capnp.Struct(s).Ptr(7) + return Transaction_PDU_EventReference_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion2) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion2) SetAuthEvents(v Transaction_PDU_EventReference_List) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated Transaction_PDU_EventReference_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewAuthEvents(n int32) (Transaction_PDU_EventReference_List, error) { + l, err := NewTransaction_PDU_EventReference_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Transaction_PDU_EventReference_List{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion2) PrevEvents() (Transaction_PDU_EventReference_List, error) { + p, err := capnp.Struct(s).Ptr(8) + return Transaction_PDU_EventReference_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion2) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion2) SetPrevEvents(v Transaction_PDU_EventReference_List) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated Transaction_PDU_EventReference_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewPrevEvents(n int32) (Transaction_PDU_EventReference_List, error) { + l, err := NewTransaction_PDU_EventReference_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Transaction_PDU_EventReference_List{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion2) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(9) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion2) HasHashes() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion2) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion2) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(10) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion2) HasSignatures() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion2) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(10, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(10, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion2) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(11) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion2) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(11) +} + +func (s Transaction_PDU_roomVersion2) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(11, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion2) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(11, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion3() Transaction_PDU_roomVersion3 { + return Transaction_PDU_roomVersion3(s) +} + +func (s Transaction_PDU) SetRoomVersion3() { + capnp.Struct(s).SetUint16(16, 2) +} + +func (s Transaction_PDU_roomVersion3) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion3) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion3) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion3) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion3) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion3) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion3) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion3) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion3) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion3) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion3) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion3) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion3) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion3) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion3) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion3) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion3) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion3) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion3) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion3) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion3) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion3) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion3) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion3) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion3) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion3) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion3) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion3) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion3) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion3) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion3) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion3) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion3) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion3) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion3) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion3) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion3) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion3) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion3) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion3) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion3) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion3) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion3) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion3) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion3) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion3) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion4() Transaction_PDU_roomVersion4 { + return Transaction_PDU_roomVersion4(s) +} + +func (s Transaction_PDU) SetRoomVersion4() { + capnp.Struct(s).SetUint16(16, 3) +} + +func (s Transaction_PDU_roomVersion4) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion4) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion4) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion4) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion4) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion4) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion4) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion4) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion4) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion4) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion4) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion4) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion4) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion4) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion4) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion4) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion4) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion4) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion4) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion4) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion4) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion4) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion4) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion4) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion4) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion4) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion4) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion4) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion4) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion4) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion4) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion4) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion4) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion4) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion4) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion4) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion4) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion4) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion4) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion4) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion4) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion4) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion4) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion4) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion4) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion4) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion5() Transaction_PDU_roomVersion5 { + return Transaction_PDU_roomVersion5(s) +} + +func (s Transaction_PDU) SetRoomVersion5() { + capnp.Struct(s).SetUint16(16, 4) +} + +func (s Transaction_PDU_roomVersion5) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion5) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion5) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion5) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion5) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion5) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion5) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion5) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion5) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion5) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion5) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion5) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion5) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion5) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion5) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion5) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion5) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion5) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion5) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion5) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion5) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion5) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion5) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion5) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion5) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion5) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion5) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion5) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion5) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion5) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion5) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion5) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion5) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion5) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion5) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion5) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion5) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion5) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion5) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion5) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion5) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion5) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion5) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion5) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion5) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion5) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion6() Transaction_PDU_roomVersion6 { + return Transaction_PDU_roomVersion6(s) +} + +func (s Transaction_PDU) SetRoomVersion6() { + capnp.Struct(s).SetUint16(16, 5) +} + +func (s Transaction_PDU_roomVersion6) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion6) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion6) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion6) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion6) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion6) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion6) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion6) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion6) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion6) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion6) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion6) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion6) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion6) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion6) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion6) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion6) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion6) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion6) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion6) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion6) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion6) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion6) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion6) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion6) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion6) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion6) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion6) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion6) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion6) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion6) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion6) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion6) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion6) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion6) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion6) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion6) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion6) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion6) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion6) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion6) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion6) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion6) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion6) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion6) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion6) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion7() Transaction_PDU_roomVersion7 { + return Transaction_PDU_roomVersion7(s) +} + +func (s Transaction_PDU) SetRoomVersion7() { + capnp.Struct(s).SetUint16(16, 6) +} + +func (s Transaction_PDU_roomVersion7) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion7) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion7) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion7) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion7) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion7) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion7) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion7) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion7) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion7) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion7) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion7) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion7) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion7) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion7) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion7) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion7) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion7) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion7) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion7) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion7) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion7) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion7) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion7) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion7) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion7) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion7) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion7) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion7) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion7) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion7) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion7) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion7) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion7) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion7) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion7) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion7) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion7) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion7) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion7) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion7) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion7) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion7) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion7) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion7) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion7) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion8() Transaction_PDU_roomVersion8 { + return Transaction_PDU_roomVersion8(s) +} + +func (s Transaction_PDU) SetRoomVersion8() { + capnp.Struct(s).SetUint16(16, 7) +} + +func (s Transaction_PDU_roomVersion8) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion8) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion8) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion8) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion8) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion8) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion8) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion8) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion8) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion8) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion8) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion8) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion8) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion8) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion8) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion8) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion8) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion8) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion8) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion8) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion8) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion8) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion8) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion8) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion8) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion8) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion8) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion8) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion8) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion8) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion8) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion8) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion8) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion8) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion8) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion8) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion8) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion8) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion8) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion8) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion8) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion8) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion8) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion8) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion8) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion8) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion9() Transaction_PDU_roomVersion9 { + return Transaction_PDU_roomVersion9(s) +} + +func (s Transaction_PDU) SetRoomVersion9() { + capnp.Struct(s).SetUint16(16, 8) +} + +func (s Transaction_PDU_roomVersion9) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion9) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion9) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion9) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion9) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion9) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion9) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion9) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion9) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion9) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion9) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion9) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion9) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion9) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion9) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion9) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion9) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion9) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion9) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion9) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion9) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion9) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion9) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion9) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion9) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion9) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion9) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion9) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion9) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion9) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion9) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion9) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion9) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion9) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion9) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion9) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion9) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion9) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion9) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion9) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion9) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion9) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion9) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion9) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion9) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion9) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion10() Transaction_PDU_roomVersion10 { + return Transaction_PDU_roomVersion10(s) +} + +func (s Transaction_PDU) SetRoomVersion10() { + capnp.Struct(s).SetUint16(16, 9) +} + +func (s Transaction_PDU_roomVersion10) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion10) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion10) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion10) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion10) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion10) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion10) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion10) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion10) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion10) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion10) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion10) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion10) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion10) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion10) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion10) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion10) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion10) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion10) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion10) Redacts() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion10) HasRedacts() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion10) RedactsBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion10) SetRedacts(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion10) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion10) HasStateKey() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion10) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(4) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion10) SetStateKey(v string) error { + return capnp.Struct(s).SetText(4, v) +} + +func (s Transaction_PDU_roomVersion10) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(5) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion10) HasContent() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion10) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(5, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(5, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion10) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion10) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion10) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion10) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion10) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion10) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion10) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(8) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion10) HasHashes() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion10) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion10) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(9) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion10) HasSignatures() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion10) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(9, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(9, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion10) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(10) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion10) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(10) +} + +func (s Transaction_PDU_roomVersion10) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(10, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion10) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(10, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU) RoomVersion11() Transaction_PDU_roomVersion11 { + return Transaction_PDU_roomVersion11(s) +} + +func (s Transaction_PDU) SetRoomVersion11() { + capnp.Struct(s).SetUint16(16, 10) +} + +func (s Transaction_PDU_roomVersion11) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_roomVersion11) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_roomVersion11) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_roomVersion11) Depth() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_roomVersion11) SetDepth(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Transaction_PDU_roomVersion11) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(8)) +} + +func (s Transaction_PDU_roomVersion11) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(8, uint64(v)) +} + +func (s Transaction_PDU_roomVersion11) RoomID() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion11) HasRoomID() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_roomVersion11) RoomIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion11) SetRoomID(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_roomVersion11) Sender() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion11) HasSender() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Transaction_PDU_roomVersion11) SenderBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion11) SetSender(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +func (s Transaction_PDU_roomVersion11) Type() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion11) HasType() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Transaction_PDU_roomVersion11) TypeBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion11) SetType(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Transaction_PDU_roomVersion11) StateKey() (string, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.Text(), err +} + +func (s Transaction_PDU_roomVersion11) HasStateKey() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s Transaction_PDU_roomVersion11) StateKeyBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(3) + return p.TextBytes(), err +} + +func (s Transaction_PDU_roomVersion11) SetStateKey(v string) error { + return capnp.Struct(s).SetText(3, v) +} + +func (s Transaction_PDU_roomVersion11) Content() (JsonValue, error) { + p, err := capnp.Struct(s).Ptr(4) + return JsonValue(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion11) HasContent() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s Transaction_PDU_roomVersion11) SetContent(v JsonValue) error { + return capnp.Struct(s).SetPtr(4, capnp.Struct(v).ToPtr()) +} + +// NewContent sets the content field to a newly +// allocated JsonValue struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewContent() (JsonValue, error) { + ss, err := NewJsonValue(capnp.Struct(s).Segment()) + if err != nil { + return JsonValue{}, err + } + err = capnp.Struct(s).SetPtr(4, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s Transaction_PDU_roomVersion11) AuthEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(5) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion11) HasAuthEvents() bool { + return capnp.Struct(s).HasPtr(5) +} + +func (s Transaction_PDU_roomVersion11) SetAuthEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(5, v.ToPtr()) +} + +// NewAuthEvents sets the authEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewAuthEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(5, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion11) PrevEvents() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(6) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion11) HasPrevEvents() bool { + return capnp.Struct(s).HasPtr(6) +} + +func (s Transaction_PDU_roomVersion11) SetPrevEvents(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(6, v.ToPtr()) +} + +// NewPrevEvents sets the prevEvents field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewPrevEvents(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(6, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion11) Hashes() (capnp.TextList, error) { + p, err := capnp.Struct(s).Ptr(7) + return capnp.TextList(p.List()), err +} + +func (s Transaction_PDU_roomVersion11) HasHashes() bool { + return capnp.Struct(s).HasPtr(7) +} + +func (s Transaction_PDU_roomVersion11) SetHashes(v capnp.TextList) error { + return capnp.Struct(s).SetPtr(7, v.ToPtr()) +} + +// NewHashes sets the hashes field to a newly +// allocated capnp.TextList, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewHashes(n int32) (capnp.TextList, error) { + l, err := capnp.NewTextList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.TextList{}, err + } + err = capnp.Struct(s).SetPtr(7, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion11) Signatures() (Signature_List, error) { + p, err := capnp.Struct(s).Ptr(8) + return Signature_List(p.List()), err +} + +func (s Transaction_PDU_roomVersion11) HasSignatures() bool { + return capnp.Struct(s).HasPtr(8) +} + +func (s Transaction_PDU_roomVersion11) SetSignatures(v Signature_List) error { + return capnp.Struct(s).SetPtr(8, v.ToPtr()) +} + +// NewSignatures sets the signatures field to a newly +// allocated Signature_List, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewSignatures(n int32) (Signature_List, error) { + l, err := NewSignature_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Signature_List{}, err + } + err = capnp.Struct(s).SetPtr(8, l.ToPtr()) + return l, err +} +func (s Transaction_PDU_roomVersion11) Unsigned() (Transaction_PDU_Unsigned, error) { + p, err := capnp.Struct(s).Ptr(9) + return Transaction_PDU_Unsigned(p.Struct()), err +} + +func (s Transaction_PDU_roomVersion11) HasUnsigned() bool { + return capnp.Struct(s).HasPtr(9) +} + +func (s Transaction_PDU_roomVersion11) SetUnsigned(v Transaction_PDU_Unsigned) error { + return capnp.Struct(s).SetPtr(9, capnp.Struct(v).ToPtr()) +} + +// NewUnsigned sets the unsigned field to a newly +// allocated Transaction_PDU_Unsigned struct, preferring placement in s's segment. +func (s Transaction_PDU_roomVersion11) NewUnsigned() (Transaction_PDU_Unsigned, error) { + ss, err := NewTransaction_PDU_Unsigned(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU_Unsigned{}, err + } + err = capnp.Struct(s).SetPtr(9, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// Transaction_PDU_List is a list of Transaction_PDU. +type Transaction_PDU_List = capnp.StructList[Transaction_PDU] + +// NewTransaction_PDU creates a new list of Transaction_PDU. +func NewTransaction_PDU_List(s *capnp.Segment, sz int32) (Transaction_PDU_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 24, PointerCount: 12}, sz) + return capnp.StructList[Transaction_PDU](l), err +} + +// Transaction_PDU_Future is a wrapper for a Transaction_PDU promised by a client call. +type Transaction_PDU_Future struct{ *capnp.Future } + +func (f Transaction_PDU_Future) Struct() (Transaction_PDU, error) { + p, err := f.Future.Ptr() + return Transaction_PDU(p.Struct()), err +} +func (p Transaction_PDU_Future) RoomVersion1() Transaction_PDU_roomVersion1_Future { + return Transaction_PDU_roomVersion1_Future{p.Future} +} + +// Transaction_PDU_roomVersion1_Future is a wrapper for a Transaction_PDU_roomVersion1 promised by a client call. +type Transaction_PDU_roomVersion1_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion1_Future) Struct() (Transaction_PDU_roomVersion1, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion1(p.Struct()), err +} +func (p Transaction_PDU_roomVersion1_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(6, nil)} +} +func (p Transaction_PDU_roomVersion1_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(11, nil)} +} +func (p Transaction_PDU_Future) RoomVersion2() Transaction_PDU_roomVersion2_Future { + return Transaction_PDU_roomVersion2_Future{p.Future} +} + +// Transaction_PDU_roomVersion2_Future is a wrapper for a Transaction_PDU_roomVersion2 promised by a client call. +type Transaction_PDU_roomVersion2_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion2_Future) Struct() (Transaction_PDU_roomVersion2, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion2(p.Struct()), err +} +func (p Transaction_PDU_roomVersion2_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(6, nil)} +} +func (p Transaction_PDU_roomVersion2_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(11, nil)} +} +func (p Transaction_PDU_Future) RoomVersion3() Transaction_PDU_roomVersion3_Future { + return Transaction_PDU_roomVersion3_Future{p.Future} +} + +// Transaction_PDU_roomVersion3_Future is a wrapper for a Transaction_PDU_roomVersion3 promised by a client call. +type Transaction_PDU_roomVersion3_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion3_Future) Struct() (Transaction_PDU_roomVersion3, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion3(p.Struct()), err +} +func (p Transaction_PDU_roomVersion3_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion3_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion4() Transaction_PDU_roomVersion4_Future { + return Transaction_PDU_roomVersion4_Future{p.Future} +} + +// Transaction_PDU_roomVersion4_Future is a wrapper for a Transaction_PDU_roomVersion4 promised by a client call. +type Transaction_PDU_roomVersion4_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion4_Future) Struct() (Transaction_PDU_roomVersion4, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion4(p.Struct()), err +} +func (p Transaction_PDU_roomVersion4_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion4_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion5() Transaction_PDU_roomVersion5_Future { + return Transaction_PDU_roomVersion5_Future{p.Future} +} + +// Transaction_PDU_roomVersion5_Future is a wrapper for a Transaction_PDU_roomVersion5 promised by a client call. +type Transaction_PDU_roomVersion5_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion5_Future) Struct() (Transaction_PDU_roomVersion5, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion5(p.Struct()), err +} +func (p Transaction_PDU_roomVersion5_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion5_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion6() Transaction_PDU_roomVersion6_Future { + return Transaction_PDU_roomVersion6_Future{p.Future} +} + +// Transaction_PDU_roomVersion6_Future is a wrapper for a Transaction_PDU_roomVersion6 promised by a client call. +type Transaction_PDU_roomVersion6_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion6_Future) Struct() (Transaction_PDU_roomVersion6, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion6(p.Struct()), err +} +func (p Transaction_PDU_roomVersion6_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion6_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion7() Transaction_PDU_roomVersion7_Future { + return Transaction_PDU_roomVersion7_Future{p.Future} +} + +// Transaction_PDU_roomVersion7_Future is a wrapper for a Transaction_PDU_roomVersion7 promised by a client call. +type Transaction_PDU_roomVersion7_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion7_Future) Struct() (Transaction_PDU_roomVersion7, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion7(p.Struct()), err +} +func (p Transaction_PDU_roomVersion7_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion7_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion8() Transaction_PDU_roomVersion8_Future { + return Transaction_PDU_roomVersion8_Future{p.Future} +} + +// Transaction_PDU_roomVersion8_Future is a wrapper for a Transaction_PDU_roomVersion8 promised by a client call. +type Transaction_PDU_roomVersion8_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion8_Future) Struct() (Transaction_PDU_roomVersion8, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion8(p.Struct()), err +} +func (p Transaction_PDU_roomVersion8_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion8_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion9() Transaction_PDU_roomVersion9_Future { + return Transaction_PDU_roomVersion9_Future{p.Future} +} + +// Transaction_PDU_roomVersion9_Future is a wrapper for a Transaction_PDU_roomVersion9 promised by a client call. +type Transaction_PDU_roomVersion9_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion9_Future) Struct() (Transaction_PDU_roomVersion9, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion9(p.Struct()), err +} +func (p Transaction_PDU_roomVersion9_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion9_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion10() Transaction_PDU_roomVersion10_Future { + return Transaction_PDU_roomVersion10_Future{p.Future} +} + +// Transaction_PDU_roomVersion10_Future is a wrapper for a Transaction_PDU_roomVersion10 promised by a client call. +type Transaction_PDU_roomVersion10_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion10_Future) Struct() (Transaction_PDU_roomVersion10, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion10(p.Struct()), err +} +func (p Transaction_PDU_roomVersion10_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(5, nil)} +} +func (p Transaction_PDU_roomVersion10_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(10, nil)} +} +func (p Transaction_PDU_Future) RoomVersion11() Transaction_PDU_roomVersion11_Future { + return Transaction_PDU_roomVersion11_Future{p.Future} +} + +// Transaction_PDU_roomVersion11_Future is a wrapper for a Transaction_PDU_roomVersion11 promised by a client call. +type Transaction_PDU_roomVersion11_Future struct{ *capnp.Future } + +func (f Transaction_PDU_roomVersion11_Future) Struct() (Transaction_PDU_roomVersion11, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_roomVersion11(p.Struct()), err +} +func (p Transaction_PDU_roomVersion11_Future) Content() JsonValue_Future { + return JsonValue_Future{Future: p.Future.Field(4, nil)} +} +func (p Transaction_PDU_roomVersion11_Future) Unsigned() Transaction_PDU_Unsigned_Future { + return Transaction_PDU_Unsigned_Future{Future: p.Future.Field(9, nil)} +} + +type Transaction_PDU_EventReference capnp.Struct +type Transaction_PDU_EventReference_Which uint16 + +const ( + Transaction_PDU_EventReference_Which_eventID Transaction_PDU_EventReference_Which = 0 + Transaction_PDU_EventReference_Which_sha256 Transaction_PDU_EventReference_Which = 1 +) + +func (w Transaction_PDU_EventReference_Which) String() string { + const s = "eventIDsha256" + switch w { + case Transaction_PDU_EventReference_Which_eventID: + return s[0:7] + case Transaction_PDU_EventReference_Which_sha256: + return s[7:13] + + } + return "Transaction_PDU_EventReference_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// Transaction_PDU_EventReference_TypeID is the unique identifier for the type Transaction_PDU_EventReference. +const Transaction_PDU_EventReference_TypeID = 0xbb294824d9b4424b + +func NewTransaction_PDU_EventReference(s *capnp.Segment) (Transaction_PDU_EventReference, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return Transaction_PDU_EventReference(st), err +} + +func NewRootTransaction_PDU_EventReference(s *capnp.Segment) (Transaction_PDU_EventReference, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return Transaction_PDU_EventReference(st), err +} + +func ReadRootTransaction_PDU_EventReference(msg *capnp.Message) (Transaction_PDU_EventReference, error) { + root, err := msg.Root() + return Transaction_PDU_EventReference(root.Struct()), err +} + +func (s Transaction_PDU_EventReference) String() string { + str, _ := text.Marshal(0xbb294824d9b4424b, capnp.Struct(s)) + return str +} + +func (s Transaction_PDU_EventReference) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction_PDU_EventReference) DecodeFromPtr(p capnp.Ptr) Transaction_PDU_EventReference { + return Transaction_PDU_EventReference(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction_PDU_EventReference) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s Transaction_PDU_EventReference) Which() Transaction_PDU_EventReference_Which { + return Transaction_PDU_EventReference_Which(capnp.Struct(s).Uint16(0)) +} +func (s Transaction_PDU_EventReference) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_EventReference) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_EventReference) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_EventReference) EventID() (string, error) { + if capnp.Struct(s).Uint16(0) != 0 { + panic("Which() != eventID") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_EventReference) HasEventID() bool { + if capnp.Struct(s).Uint16(0) != 0 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_EventReference) EventIDBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_EventReference) SetEventID(v string) error { + capnp.Struct(s).SetUint16(0, 0) + return capnp.Struct(s).SetText(0, v) +} + +func (s Transaction_PDU_EventReference) Sha256() (string, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != sha256") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Transaction_PDU_EventReference) HasSha256() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Transaction_PDU_EventReference) Sha256Bytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Transaction_PDU_EventReference) SetSha256(v string) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetText(0, v) +} + +// Transaction_PDU_EventReference_List is a list of Transaction_PDU_EventReference. +type Transaction_PDU_EventReference_List = capnp.StructList[Transaction_PDU_EventReference] + +// NewTransaction_PDU_EventReference creates a new list of Transaction_PDU_EventReference. +func NewTransaction_PDU_EventReference_List(s *capnp.Segment, sz int32) (Transaction_PDU_EventReference_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[Transaction_PDU_EventReference](l), err +} + +// Transaction_PDU_EventReference_Future is a wrapper for a Transaction_PDU_EventReference promised by a client call. +type Transaction_PDU_EventReference_Future struct{ *capnp.Future } + +func (f Transaction_PDU_EventReference_Future) Struct() (Transaction_PDU_EventReference, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_EventReference(p.Struct()), err +} + +type Transaction_PDU_Unsigned capnp.Struct + +// Transaction_PDU_Unsigned_TypeID is the unique identifier for the type Transaction_PDU_Unsigned. +const Transaction_PDU_Unsigned_TypeID = 0x83ba1e25907bb64e + +func NewTransaction_PDU_Unsigned(s *capnp.Segment) (Transaction_PDU_Unsigned, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return Transaction_PDU_Unsigned(st), err +} + +func NewRootTransaction_PDU_Unsigned(s *capnp.Segment) (Transaction_PDU_Unsigned, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return Transaction_PDU_Unsigned(st), err +} + +func ReadRootTransaction_PDU_Unsigned(msg *capnp.Message) (Transaction_PDU_Unsigned, error) { + root, err := msg.Root() + return Transaction_PDU_Unsigned(root.Struct()), err +} + +func (s Transaction_PDU_Unsigned) String() string { + str, _ := text.Marshal(0x83ba1e25907bb64e, capnp.Struct(s)) + return str +} + +func (s Transaction_PDU_Unsigned) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Transaction_PDU_Unsigned) DecodeFromPtr(p capnp.Ptr) Transaction_PDU_Unsigned { + return Transaction_PDU_Unsigned(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Transaction_PDU_Unsigned) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Transaction_PDU_Unsigned) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Transaction_PDU_Unsigned) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Transaction_PDU_Unsigned) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Transaction_PDU_Unsigned) Age() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Transaction_PDU_Unsigned) SetAge(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +// Transaction_PDU_Unsigned_List is a list of Transaction_PDU_Unsigned. +type Transaction_PDU_Unsigned_List = capnp.StructList[Transaction_PDU_Unsigned] + +// NewTransaction_PDU_Unsigned creates a new list of Transaction_PDU_Unsigned. +func NewTransaction_PDU_Unsigned_List(s *capnp.Segment, sz int32) (Transaction_PDU_Unsigned_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz) + return capnp.StructList[Transaction_PDU_Unsigned](l), err +} + +// Transaction_PDU_Unsigned_Future is a wrapper for a Transaction_PDU_Unsigned promised by a client call. +type Transaction_PDU_Unsigned_Future struct{ *capnp.Future } + +func (f Transaction_PDU_Unsigned_Future) Struct() (Transaction_PDU_Unsigned, error) { + p, err := f.Future.Ptr() + return Transaction_PDU_Unsigned(p.Struct()), err +} + +type BackfillData capnp.Struct +type BackfillData_Which uint16 + +const ( + BackfillData_Which_metadata BackfillData_Which = 0 + BackfillData_Which_pdu BackfillData_Which = 1 +) + +func (w BackfillData_Which) String() string { + const s = "metadatapdu" + switch w { + case BackfillData_Which_metadata: + return s[0:8] + case BackfillData_Which_pdu: + return s[8:11] + + } + return "BackfillData_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// BackfillData_TypeID is the unique identifier for the type BackfillData. +const BackfillData_TypeID = 0xf2951513b06ace65 + +func NewBackfillData(s *capnp.Segment) (BackfillData, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return BackfillData(st), err +} + +func NewRootBackfillData(s *capnp.Segment) (BackfillData, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return BackfillData(st), err +} + +func ReadRootBackfillData(msg *capnp.Message) (BackfillData, error) { + root, err := msg.Root() + return BackfillData(root.Struct()), err +} + +func (s BackfillData) String() string { + str, _ := text.Marshal(0xf2951513b06ace65, capnp.Struct(s)) + return str +} + +func (s BackfillData) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (BackfillData) DecodeFromPtr(p capnp.Ptr) BackfillData { + return BackfillData(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s BackfillData) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s BackfillData) Which() BackfillData_Which { + return BackfillData_Which(capnp.Struct(s).Uint16(0)) +} +func (s BackfillData) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s BackfillData) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s BackfillData) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s BackfillData) Metadata() (BackfillData_Metadata, error) { + if capnp.Struct(s).Uint16(0) != 0 { + panic("Which() != metadata") + } + p, err := capnp.Struct(s).Ptr(0) + return BackfillData_Metadata(p.Struct()), err +} + +func (s BackfillData) HasMetadata() bool { + if capnp.Struct(s).Uint16(0) != 0 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s BackfillData) SetMetadata(v BackfillData_Metadata) error { + capnp.Struct(s).SetUint16(0, 0) + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewMetadata sets the metadata field to a newly +// allocated BackfillData_Metadata struct, preferring placement in s's segment. +func (s BackfillData) NewMetadata() (BackfillData_Metadata, error) { + capnp.Struct(s).SetUint16(0, 0) + ss, err := NewBackfillData_Metadata(capnp.Struct(s).Segment()) + if err != nil { + return BackfillData_Metadata{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s BackfillData) Pdu() (Transaction_PDU, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != pdu") + } + p, err := capnp.Struct(s).Ptr(0) + return Transaction_PDU(p.Struct()), err +} + +func (s BackfillData) HasPdu() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s BackfillData) SetPdu(v Transaction_PDU) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewPdu sets the pdu field to a newly +// allocated Transaction_PDU struct, preferring placement in s's segment. +func (s BackfillData) NewPdu() (Transaction_PDU, error) { + capnp.Struct(s).SetUint16(0, 1) + ss, err := NewTransaction_PDU(capnp.Struct(s).Segment()) + if err != nil { + return Transaction_PDU{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// BackfillData_List is a list of BackfillData. +type BackfillData_List = capnp.StructList[BackfillData] + +// NewBackfillData creates a new list of BackfillData. +func NewBackfillData_List(s *capnp.Segment, sz int32) (BackfillData_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[BackfillData](l), err +} + +// BackfillData_Future is a wrapper for a BackfillData promised by a client call. +type BackfillData_Future struct{ *capnp.Future } + +func (f BackfillData_Future) Struct() (BackfillData, error) { + p, err := f.Future.Ptr() + return BackfillData(p.Struct()), err +} +func (p BackfillData_Future) Metadata() BackfillData_Metadata_Future { + return BackfillData_Metadata_Future{Future: p.Future.Field(0, nil)} +} +func (p BackfillData_Future) Pdu() Transaction_PDU_Future { + return Transaction_PDU_Future{Future: p.Future.Field(0, nil)} +} + +type BackfillData_Metadata capnp.Struct + +// BackfillData_Metadata_TypeID is the unique identifier for the type BackfillData_Metadata. +const BackfillData_Metadata_TypeID = 0xe9224c8fac4d82c4 + +func NewBackfillData_Metadata(s *capnp.Segment) (BackfillData_Metadata, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return BackfillData_Metadata(st), err +} + +func NewRootBackfillData_Metadata(s *capnp.Segment) (BackfillData_Metadata, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return BackfillData_Metadata(st), err +} + +func ReadRootBackfillData_Metadata(msg *capnp.Message) (BackfillData_Metadata, error) { + root, err := msg.Root() + return BackfillData_Metadata(root.Struct()), err +} + +func (s BackfillData_Metadata) String() string { + str, _ := text.Marshal(0xe9224c8fac4d82c4, capnp.Struct(s)) + return str +} + +func (s BackfillData_Metadata) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (BackfillData_Metadata) DecodeFromPtr(p capnp.Ptr) BackfillData_Metadata { + return BackfillData_Metadata(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s BackfillData_Metadata) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s BackfillData_Metadata) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s BackfillData_Metadata) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s BackfillData_Metadata) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s BackfillData_Metadata) Origin() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s BackfillData_Metadata) HasOrigin() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s BackfillData_Metadata) OriginBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s BackfillData_Metadata) SetOrigin(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s BackfillData_Metadata) OriginServerTS() int64 { + return int64(capnp.Struct(s).Uint64(0)) +} + +func (s BackfillData_Metadata) SetOriginServerTS(v int64) { + capnp.Struct(s).SetUint64(0, uint64(v)) +} + +// BackfillData_Metadata_List is a list of BackfillData_Metadata. +type BackfillData_Metadata_List = capnp.StructList[BackfillData_Metadata] + +// NewBackfillData_Metadata creates a new list of BackfillData_Metadata. +func NewBackfillData_Metadata_List(s *capnp.Segment, sz int32) (BackfillData_Metadata_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[BackfillData_Metadata](l), err +} + +// BackfillData_Metadata_Future is a wrapper for a BackfillData_Metadata promised by a client call. +type BackfillData_Metadata_Future struct{ *capnp.Future } + +func (f BackfillData_Metadata_Future) Struct() (BackfillData_Metadata, error) { + p, err := f.Future.Ptr() + return BackfillData_Metadata(p.Struct()), err +} + +const schema_b8a1e7de8a3a89ec = "x\xda\xecZ\x7fpT\xd7u>\xe7\xbd]\xad\x16$" + + "\xb4\x8f\xb7\x0eu0^#\x0b\x1b)FHZ\x09K" + + "\x8a\xd3E\xb2D\xb0\x84\x1c=V\"F\x85\x84\x87\xf6" + + "\x81\x16\xaf\xde\xaev\xdf\x0a\x96\xe0\xf0\xbb1\x0e\x04;" + + "\xb1[Hp[\x18S\x93\x1f\x9e\x82'xh\x0d\x18" + + "&\xd4\xb5;Ik\xa6a\x0am\x86\xc4m\x18C\x87" + + "N\x9b\x0cv\x0b\x0dl\xe7\xdc\xdd\xf7\xde\xee\xb2\xb7\x80" + + "\x81\xc43\xd5?\x9a\xb9\xdf\x1e\xddw\xee\xb9\xdf9\xdf" + + "=\xf7\xbd\xba?\xf2\xccv\xd4\x97\xff\xf1D\x10\x94\xd3" + + "\xce\x92\xf4\x93o|\xe5\xf9i\xf7\xff\xd5FPf!" + + "\xa6\x8f\x96\xfc\xc3/\xe3\x07\x8f\x1e\x00\x87\x0b\xc0_\xef" + + "\xbe\x82r\x8f\xdb\x05 ?\xe1\x0e\x00\xa6\x17\xfed\xe5" + + "\x899\xb3\x0fo\x02\xe5!\xc4\xf4\xc5-\xad\xcf\x9d\xfd" + + "`\xf7!\xe8\x14\\\"\x80?\xec\xfe&\xca\xeb\xdd\x8f" + + "\x02\xc8{\xdd\x1f\x00\xa6wy\x07\xaa\xd5\xaf\xfez\x13" + + "\xcd-\xdas\xdfS\xe6B\x00\xff\xfaq\x9f\x16\x00\xfd" + + ";\xc7\xfd\\\x00L\xb7<\x13|\xaf\xf1_\xe3[A" + + "\xaa\xc3\xf476\xec;\xfb\x9d\xdf\xccy\x03\x9c\x02\xf9" + + "\xf1~\xf9\xf7P\xbe\\N~|X\xbe\x120\xfdb" + + "\xfd\xab+\x84\x17\x0f\xbfP\xdc\x0fm\xc2\xdf\xa2\xbc~" + + "\xc2\xc3\x00\xf2\xcb\x13\xc8\x8f\xba]G\xab\x8e\xec\x08\xbd" + + "\x04J\x0b\xe6\xfc\xb3\x13i\xf2\xa9\x9e\x06An\xf3\xd0" + + "\xe4\x9f\xf3\xd0\xe4\x1f\x9d\xf8\x93K\xfbN\x9f\xdeY\xcc" + + "\x93\x97=\xaf\xa3|\x90\x19\x1f`\xc6\x1d\x9f\x97G\x1c" + + "\x07\xfe\xfe\xdb\xc5\x97X.\xb1%N\x93\xd8\x12\xab\xfe" + + "\xf9[\xa7~\xf6\\\xcd\xae\xe2\xb6\xc3\xdeJ\xb2\xdd\xec" + + "e\xb6\x81\x86\xda\x91\xb7\xd7\xf4\xfeiq\xdb\x9fLb" + + "\xf3\x9e\x9b\xc4l\xbb[\xde2^\x1d\xb7}7H\x0d" + + "9[\x94qx\xc6\xe4\xd7Q\xee\x9cL\x0e\xb7M&" + + "\x87\xbf\xe4Xt\xa5\xef\xeb\x97\xf6\x15\x9f\xf8\xe5\xc9l" + + "\xe2\x83\x93'\x89\x80i\xf9o\xde\xda\xfb\xad\xfbW~" + + "\x0f\xa4\x87r\xa2\xecD\x97\x07\xfd-\xbe\xf9(\xf7\xf8" + + "&\x01\xc8\xfd\xbe\x00\xc5\xc37\xe9\xadK\x83W:\xbe" + + "y`\xbfT\x93\xf3\xbfN\x81\xcc_\xf3m@\xf9\xb8" + + "\x8f\xfc8\xe2#?\xac'+\x0d(\xda^w\x96\xb9" + + "\xc6c\xa9\xff\xde\x07^G\xb9\xfe\x81\x87\x01\xfc=\x0f" + + "Di\x91\xd6F(\x0f\xa1\x90\xb3\xe5\xe8\xa2e\x1e\x99" + + "\xba\x01\xe5\x93S\xc9\xfe\xdc\xd4\xedHAi\xff\xe1\x99" + + "\xaa\xb9\xd5o\x16\xf0\xba\x13]\x02\x80\x7f\xdb\x835\x82" + + "\xfc\xda\x83\xe4\xcew\x1f$w\xdaz/\x86\xba\x17\xbe" + + "\xfdf\x01\xa3X\x1a8\xab\xf6\xa0<\xa5\x8a\x8c\xef\xad" + + "\xa24x\xe7\xcf\xd3\xff6\xff\x80\xe3hA\\X\xc0" + + "\xdb\xaa6\xa0\xdc\xcf\x8c\x95*\x9a\xf9\xa4\xd6\xbc\xa4g" + + "\xe3\xa7~T<\xe0\x97\xabX\xc0\xa5il'\xbf\xd3" + + "\xdd}\xf2\xfc\xa9Co\x17%\xea\xc2\xe9\x13\x0595" + + "\x9dfNN\xa7\x99[&n?|\xd8\x88\xbdK!" + + "\xbcn\xe3\xcfL\xff'\x94?d\xd6\xbf\x9a\xfe\x17\x80" + + "\xe9G\xde\xef\x9e3\xfb\x17\xaf\xbc[\xdc\x8fm\xd5\xcc" + + "\x8f\xbd\xd5l\xe3'W\xbc\xf9\x99\xcd\xbd_\xfcqq" + + "\xdb\xea\x19\xcc\xb6m\x06\xf3y\xef\xa1\xb5\x1f\\\xfc\xd1" + + "\x92\x7f,n\xbb\xa5\x8e\xd9\xee\xaec\xb6/\x1c8\xba" + + "\xbdz\xe3\x9e3\x05Qv\x8a\xe4\xf1\x05\xffj\x94\xaf" + + "\xfa\xc9\xe3\xcb~J\xdb7\xce\xee\xf9\xfeg\xcf\xf8\xcf" + + "\x17\x0b\xf3\xb9\xc6=(_md\xc6\x8d\x14\x8c\x13\x1b" + + "z~\xb0}^\xe5\x05P\xfc\x88i\xed\xefV\xec\x97" + + "\xefy\xe9\xd7\xd9\xd0\xf57\xfd\x0b\xca#Md=\xdc" + + "D\xd653\x17\x7f\xad\xef\xcb\xdf\xff\x0fNz5\xb1" + + "T<\xd7\xf4*9m\xcdUPl2L\xfaU\xf3" + + "\xb7Qv\xb7P\x1e\xdc\xd3BS\x9f\x1d\x12SgJ" + + "\"\x1f\x15\x9f:\xd9\xc2\xe2\xb1\xad\xe5\xe7\x02\\K\xc7" + + "\xe2Q#:s\x99V\x12\xd2\xe2\xaa\x11\x8e\xea3G" + + "\xebg\x1a\xa9\x98\x96\xc8\xfc\xad\x1dTcz\xac\xb5/" + + "\xae\xea\x09u\x90\x0cj{;\xfak\xfb\xf5@\"\xbc" + + "\\\xd7B\xbd\x88\x8aCt\x008\x10@*\xaf\x04P" + + "JET\xbc\x02\xba\xd4\xe5\x1a\xbaA@7\xa0\xf5\x18" + + "\xe7\xcd>\x06u\xa5\x0cs\x08&I]9UF\xaa" + + "\xb4\x97%\x95W\xa6{4C\x0d\xa9\x86\x0a\x00\xae\xce" + + "\x8e~WoG\xbf\xe2\xb1\xbcR\xbb\x00\x94%\"*" + + "\x11\x01\xa7`:\x8d^$8L\xf0\x90\x88\x8a!\xe0" + + "\x14\xe1\x1a\xc1\x02\x804Bk\x88\x88\xa8\xac\x12p\x8a" + + "x\x95`\x11@J\x12\x1c\x13QY#`ZM\x1a" + + "C\x1d\x99\xe7\xa1\xc7\xe6\x14 z\x00\xd3\xc3\xb67\xe8" + + "\xb1\x97\x90\xf9\xd5\xa5\x85\x92\xe8\xb1\xd7\x92Ec\x0c\xb5" + + "\x16\x95\x9d\xc9\x0c\x9b\xeb\xd6v'\x1e\x8d\x0e/\xd0\xe2" + + "\x89pT\xd4\x9b\x95F\x0a\x84\x17\x17\x03\xc8\x8b\xb1\x01" + + " \xf8\x14\x8a\x18\x0c\xa1\x80\x12\xa2\x17\xbf\x04 \xab\xb8" + + "\x1a \xb8\x84\xf0\x08\x0a\x88\x82\x17\xbf\x0c \x87\xb1\x15" + + " \x18\"8F\xe6\"zq\x091\x98\xe1C\x84\x1b" + + "\x84;\x04/\xaa\x00\xf2\x08\xd6\x00\x04#\x84\xaf\"\xdc" + + ")zq)\x15\x0bl\x07\x08\xc6\x08_Cx\x89\xc3" + + "\x8b\x83\x00r\x0a\xbb\x00\x82\xab\x08\xdfD\xb8\xcb\xe9\xc5" + + "\x10\x80\xbc\x9e\xd9\xaf!\xfcY\xc2KK\xbc\xa8\x01\xc8" + + "\x9bq\x00 \xb8\x89\xf0?#\xdc\xed\xf2\xe22\xd2X" + + "\x86\xef\"\xfc\x10\xe1\xe3J\xbd\xb8\x1c@>\xc8\xfc\xdc" + + "O\xf8\x8f\x09\x1f\xef\xf6\xe2\x10\x80\xfc.\xb3\x7f\x87\xf0" + + "_\x12^6\xce\x8ba\x00\xf9}\xe6\xcf/\x08\xbf\x88" + + "\x02\xfaBZ\xcc\x18\xb28\x1c\x8d\x87\x97\x87\xf5\xa0\x06" + + "\x81\xf8\xa8\x16\xef\x0b\xa2\x13\x04t\x02\x06(\xdcOt" + + "`\x19\x08X\x06\x18HhzH\x8b\x9b\xc3\x0a\xda(" + + "s\xb06\xae\x85\xd4A#a\x8e\xd3\x09C5\xb4n" + + "-ET1m\x06\xa3\xba\xa1\xe9\x06zl\xc5\xc9\xd2" + + "\x81h\xd79\xaa\xe9 \x1a\x09\x9c\x00\xd8+\"\xfb\xaf" + + "\x09\x8c*\xda(\xe7\xb7\xc0\x90\x9a\x18\xd2\xae\xfb\x0fJ" + + "`\xd5H\xc6A\xb4\x7f\xf3\xd8\xca\x02\xc8\xac\x92z&" + + "\xd13d\xb6\xcej\x05\x04\xbdA^w%\xa2\xfa\x02" + + "5\x92\xd4j+\x1eW#\x11*\x1a\xa5VzVS" + + "\x1eN\x17Qi\xcc2\x92\xc0\xfaV\x00\xe5\x11\x11\x95" + + "\xb9\x02\xa6\x97%uF\xee\x9c(\x05bj\\\x1d\xce" + + "\xf1;7V\x13r<\xbbAa\x0bj\xb4\x99\xddZ" + + "*1_K\xc4\xa2zB\xa3\x0a\x869B(\xb9\xbb" + + "\xec\xe3\x9b\xe4^\x91[l\xd2_\x88\x84\x16h\xf1\xf0" + + "2\xa8Huk\xa9\xdc\x9a3\x90\xad9k\xf2jN" + + "\x8a\xd6\xbaJDeS^\xcdYO\xd6\xebDT~" + + "\x9aWsN\xc6\x01\x94\xf7D\x0cV\xa1p\xb3\xfb\x95" + + "_|\xacUd\xf7k\x94\x9cMuk \xa6\x12\xe8" + + "\xb1\x8fH\x00\xb3QB\x9f\xe2\x100\x17\x94\xf0a\x0a" + + "\x06\xdb.\xfa\xeb\xc9\xd2\xa7\x1c\x046]\xd4\\\xbe\x8f" + + "\x96\x7f;3z\xec\x18\xdfZ\xed\xbb~\x03k\xb3\x9b" + + "\xe2\xa3\x85\xa6\x0a\xb86\xdf\xe6\x9aE\xb5\xca,\xd5\x9a" + + "\x05Lk\xabb\xe1\xb8\x16\xea\x03\xb4\xf2\xdb\xf5\xb4\x96" + + "b+.\xff8\x84\xf7\xcd\x09k\x91P\x81\x175\x00" + + "J\x95\x88J]\x0e\xe3g4\xd8\xaeU\xe8\xea\xb0U" + + "4|\xa34Q\x91rp\x07\xd4\xc1o\xaa\xc3}\x1c" + + "u\x98R\\\x1d\xee\xe7\xa8\x83\x8f\xa3\x0e\x0fp\xd4a" + + "*G\x1d*9\xea\xf0 G\x1d\xaa8\xea0\x8d\xa3" + + "\x0e\x0fq\xd4\xe1a\x8e:L\x1fS\x87\xdbP\x87\x8f" + + "MP\x97^_g2t%\x87\xa1\xab\x8a34\xc5" + + "a\xe8j\x0eC\xbf\xc2a\xe8\x1a\x0eC\x9f\xe10\xf4" + + "\xab\x1c\x86\xae\xe50t\x1d\x87\xa1\xeb9\x0c\xdd\xc0a" + + "\xe8\xc61\x86\xfe.\x18*\xea-&AWp\x08\xfa" + + "tq\x82F8\x04\x1d\xe6\x10T\xe7\x104\xca!h" + + "\x8cC\xd0\x11\x0eA\xe3\x1c\x82&8\x0458\x04M" + + "r\x08::F\xd0\xbbw\xc0\xb6\x09\xea\xd3k;;" + + "\xfa\x0b\xce\x1b\xed\xc5\xce\x1b\xed\xf6yc\xad\x16J\xf6" + + "\xe5\x86\x91\x1f\xa2;\x901\xf5J\xb3\xe9\x9a\x9cb\x09" + + "c\x10#\xd6\xa1u&\x93\x9fa\x04\xb5\x89+d\x0e" + + "\xca\xf2z\x96G\xeb\x08\xdfj&\x8c\x08 oaD" + + "d\xc4}\xdeL\x18\x07\x80\xbc\x8d\xe1\xcf\x12\xfe\xa2\x99" + + "0N\x00\xf9\x05\x96H[\x09\xdfa&L\x09\x80\xfc" + + "\x12{\xee\xf3\x84\xef2\x13\xc6\x05 \xefd\xc4\xddA" + + "\xf8+f\xc2\x94\x02\xc8\xbb\x99=K\x8c}f\xc2\xb8" + + "\x01\xe4\xbd,\x01^!\xfc\x98\x990\xe3\x00\xe4#\x0c" + + "?L\xf8i3a\xc6\x03\xc8\xa7\x98\x9f\xef\x99\x89\xc1" + + "\x12\xa6\x0c@\xbe\xc0\xec\xcf\x13\xee\x10\x04\x94\xca\xc7{" + + "\xb1\x1c@F\xa1\x0b`\xbe b\xb0L(\xcc\xa3\xb5" + + "\xda\xa8\xa6\x1bv\xbe|B\xf3\xcac_\x90Z-\xdb" + + "\xf5\x19v\x9d\xd5o!\xd7\x1c\xff7\xb5{T\x8c)" + + "\x0eD\xeb\xae\x19\x1b|\x9d\xba\x11O\xe5^\x84\xb5g" + + "/\xc2\x9a)\xb9t#\x1e\xceq\xcb\xfc\xc7\xa2-\x12" + + "\xd1\x9f,\xdbJQrVJ\xce\x06W\xb7\x96\xf2\xb1" + + "^\xe2f\x8bA\x8f\x1a\xabe\x0eAA\x19\xa8\xbcA" + + "\xdb\xc1:\x9d\x89\x98\xd7\xb0\xe1D\xab\x03\x99\xe8\xbc\xfe" + + "\xa7\x8fU\xa0z;\xfaY\x8fmm\xad\xe4^m\xef" + + "\x065\xdcD\x03c\xbe\xb6\x0c\x02Z\\\xd3\x07\xb5t" + + "\xbf\xbds\xca#\xa2\xa3,\x9d\xc6\x9c7\x09\xf24\\" + + "\x01B9^#\xd4\xbaf\x96%\x86\x0aW\x09\xb5^" + + "\x93HW\x09\x14\x7fC\xa0us,] \xd0\xf1?" + + "\x04ZW\xcf\xd2)\x02\x9dW\x08\xb4\xeeT\xa5\xe3\x04" + + "\x96\\&\xd0\xbaX\x97^#\xd0\xf5\xdf\x04Z\xaf\x9c" + + "\xa4\x9d\x04\x96\xfe\x17\x81\xd6\xcb\x14i3\x81\xee\x8f\x08" + + "\xb4\xde\xc6H#q\x10\xca\xc7}H\xa0u/,-" + + "\x8e\x83\x906\xeb&T\x84\xa3z}\xfe\xb0!\x7f\xe8" + + "\xcf\x1f6\xe6\x0f\x9b\xf2\x87\xb3\xf2\x87\x8f\xe6\x0f\x9b\xf3" + + "\x87-\xf6\xd0Gn\xd4\x15\x8c\xebo\xb9-\xce\xdc\xb1" + + "\xd8\xef\xb9\xdc\x0d9\xaf\xdf\x9c5\x99\xa6\x99\xdd\x15)" + + "\xf7\xb1\xddf\x04>H}\xf3~\x11\x95\xc3\x02N\xc1" + + "kiO\x86\xc2\x7fI\xc9\xf6C\x11\x95c\x02N\x11" + + "\xae\x9a\x97*GZ\x01\x94C\"*'\x04\xa4\xfd\xce" + + "\xdc\xa9\x1c'\xf4\xb0\x88\xca;\x02\xd2\x863\x9d\x90\xfe" + + "\x9a\xb2\xe0\x98\x88\xca\xcf\x04\xa4\x1dg*!\x9d!\xdb" + + "\x9f\x8a\xa8\xfc\xa7\x80\xb4\xe5L#\xa4\x7f'/\xce\x8b" + + "\xa8\\\xa2F=\x19\x89@\xc9\xda\xa5\xd1hDSu" + + "D\x10\x10\x01\x03zrx\xa9\x16\xc7\xf1 \xe0x\xaa" + + "\xacF<\xac/\xb7\x1az5\x1eWS\xdc\xab\xab@" + + "t\xe9\x0am\xd0\xb0\x7f\xb7\xc2\x94\xf9\xbdbP\x8dD" + + "\xd0c\x07\xec\xf6\x94\xd9L5-^A\x99\x96-\x19" + + "f\xc8s\x8f\x0e\x94_\xd9\xa2\xd1\x9a{v\xc8\x97\x9b" + + "@bHmh\x9ae)\xc5MRCIj\xf1\xd4" + + "\xe3\xf1\xb0\xa1\xb9\xe2a\xb5\xe0\xb5\xc2\x1e\x00\xc5#\xa2" + + "r\x9f\x80\xe9\xe1\xb0\x1e\x1eN\x0e/@5\x12\x0e\xf5" + + "\xebF\xd8\x15\xb1%\xedf\x9f\x16\xcc\xca\x85VX\"" + + "[\x8b\x95\xc8\x81\xec\x05\xd1:\x81D\x92D\xd4\xd6\xc1" + + "\\\xdd\xb9\xfd\x0b\xb5;p\xbaz\xd4\xecGz9\xfd" + + "\x88R\xbc\x1f\x99\xcf\xe9G\x82\x9c~\xa4\x8f\xd3\x8f\xf4" + + "s\xfa\x91\x05\x9c~\xe4\x8b\x9c~\xe4)N?\xb2\x90" + + "\xd3\x8f\x0cp\xfa\x91?\xe0\xf4#\x8b\xc6\xfa\x91\xbb\xd7" + + "0\x17\xb9\x95\xcd^\x9b\xa3Z\x90q\x03EndW" + + "\x00(u\"*\x8f\x09\x98\xce$\xdc\x93*\x88\xf6\x95" + + "hz4\x9b\xfcP\x11.\x96\xfd\xb7\xf063\xe3\x96" + + "h0\xb7\xca,\xb7:I\x10f\x8b\xa8\xcc\xcb)\x04" + + "OPu\xe8\x10Q\xe9\xcd\xa4\x0c\xa9L\xcfj\x00e" + + "\x9e\x88\xcaS\x02\xfa\x8cUz\x0e/2\xfc\xb9\xe11" + + "\xfcN$}C\xa6\xa5\xf2\xe2\x84\xe2=U\x05\xa7\xa7" + + "\xf2pz*\x89\xd3SM\xe4\xf4T2\xa7\xa7\xf2r" + + "z\xaa{8=\xd5\xa78=\xd5$NO\xf5{\x9c" + + "\x9e\xea^NO\xf5iNO5y\xac\xa7\xfa\xc4^" + + "\xb05\x99\x826\x8b#h\x8f\x16\x17\xb4f\x8e\xa0\xb5" + + "p\x04\xad\x95#h\x9f\xe5\x08\xdac\x1cA\xfb\x1cG" + + "\xd0~\x9f#h\x01\x8e\xa0\xcd\xe6\x08Z\x1bG\xd0\xda" + + "\xc7\x04\xedwC\xd0F\x93\xa0\xd5\x1c\x82\xd6\x14'\xe8" + + "g8\x04}\x84C\xd0\x19\x1c\x82\xd6r\x08:\x93C" + + "\xd0:\x0eA\xeb9\x04m\xe0\x10\xd4\xcf!h#\x87" + + "\xa0Mc\x04\xbd{\xb7Rm\xc9@\xe6\x9b\xa4^\xd6" + + "VX\xdf!\xd0\x91e\x91\x88\xca\x90}\xbc\xd2Z\xed" + + "\xef\xa1\xcc\x9bU)\xbc\xd4\xfe\x1aJ\x12\x85L\xb3<" + + "2\x90\xfd\xe8i\xab\x80\x81a\xcd\x18\x8a\x86\xcc\xbd*" + + "<\xdd\x84\xb4\x84\x11\xd6U\x03\\\xe1\xa8^\xbc=\xe2" + + "\x06\xe0f\x9b6v\x12\xa4\xac\xa3g\xdc\xcc+\xf5v" + + "\xce+\xf5\xb5\xa3,u\xf5\xeb\x9a\xd4\x1b\x1c\x1c\xdb\xd5" + + "\xc1\xa7\x97\x85#\x11\x8as\xe6\xe4\xe8\xcaF\xbcx\x0b" + + "i9\xb2\xda\xfe\xc4\xe0\xb7w,t\xe9\xf5\xf5J]" + + "\xa64m\x02\x90\xdbXiz\x8cro\xaeY\x9a6" + + "\x03\xc8\x9d\xac4u\x10\xde\x9b-M\x7f\x08 \xf7\xb0" + + "\xd4\x9eKp\x9fY\x9a\xbe\x06 +\x0c\x9fG\xf8S" + + "fiz\x16@\xeeg\xa5\xa9\x97\xf0Efi\xda\x02" + + " /d)oWD*M\xcf\xb1\x8aH%h\x11" + + "\xe1Cfi\xfa:\x80\xac\xb1\xd2\x112\x8f\xaf\xac4" + + "me\xe7\xd7\x01\xb3d\xed0K\xd36v\xbel5" + + "\xcf\x97?0K\xd37\x00\xe4\xef2\xfb}\x84\x9f0" + + "K\xd3v\x00\xf98\xf3\xe7\x98Y\xb2\xee|\x09\xfa\xff" + + "\xf2\xd2\xc9\xce\x06\xd1P\x15\x07\xe6|\x02+aW\xee" + + "wRy7J9\x9f{\xd97Jy\x1f\xe1\xe4\x7f" + + "\xc3dMz\xb7?\x95\x9ce\xea\xf8\xe3\x1c\x1d\xef(" + + "\xae\xe3\x9d\x1c\x1d\x9f\xc3\xd1\xf1\xcfst|.G\xc7" + + "\x9f\xe0\xe8x\x17G\xc7\xbb9:>\x8f\xa3\xe3=\x1c" + + "\x1d\x7f\x92\xa3\xe3_\x18\xd3\xf1[O\xaa\xff\x0d\x00\x00" + + "\xff\xff\x8b\x9a]\xf6" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_b8a1e7de8a3a89ec, + Nodes: []uint64{ + 0x83ba1e25907bb64e, + 0x84bc4046c477cd59, + 0x84f27e61295a149c, + 0x8c72e334d0537d39, + 0x91bc94026aa73194, + 0x956498bd24be9c30, + 0x99d8d8a8f49ec4f6, + 0x9acfb10471134744, + 0x9c2a8adcd593db24, + 0x9f507cc6712e323f, + 0xa18f0aa774bf394b, + 0xa8f48b54fa5c045e, + 0xaa771e93a5bfc713, + 0xb000b19244fa63f4, + 0xb1beb572e4d306be, + 0xb646fc9bdea8828e, + 0xbb294824d9b4424b, + 0xbbc6594b64ec5041, + 0xbe04b152eaffa6c8, + 0xc316834d603865d1, + 0xc6b8d5e8d14b4b9b, + 0xc97074bcbc8f1239, + 0xc9a4e040464be12c, + 0xcc5750852bbb0f1b, + 0xd760c3ece77fb8a5, + 0xd9a283298fbeb191, + 0xe833d93baba2deb6, + 0xe9224c8fac4d82c4, + 0xefab5f54875d2f2a, + 0xf2951513b06ace65, + 0xf66c06d9790368de, + }, + Compressed: true, + }) +} diff --git a/rpcserver/map_wrapper.go b/rpcserver/map_wrapper.go @@ -0,0 +1,124 @@ +package rpcserver + +import ( + capnp "capnproto.org/go/capnp/v3" + protocol_types "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types" +) + +/* + * This is a wrapper for the Map capnproto type which is defined as: + * + * ``` + * # A generic map from keys to values. + * struct Map(Key, Value) { + * entries @0 :List(Entry); + * struct Entry @0xb000b19244fa63f4 { + * key @0 :Key; + * value @1 :Value; + * } + * } + * ``` + * + * Contrary to normal go maps this map has a fixed size. + */ +type Map[Key capnp.Ptr, Value capnp.Ptr] struct { + internal_map *protocol_types.Map +} + +// NewMap creates a new Map Wrapper +func NewMap[Key capnp.Ptr, Value capnp.Ptr](s *capnp.Segment) (*Map[Key, Value], error) { + internal_map, err := protocol_types.NewMap(s) + if err != nil { + return nil, err + } + + return &Map[Key, Value]{ + internal_map: &internal_map, + }, nil +} + +// FromMap converts a capnp map to a wrapper +func FromMap[Key capnp.Ptr, Value capnp.Ptr](m *protocol_types.Map) *Map[Key, Value] { + return &Map[Key, Value]{ + internal_map: m, + } +} + +// HasEntries returns true if the map has entries +func (m *Map[Key, Value]) HasEntries() bool { + return m.internal_map.HasEntries() +} + +// Get a Segment of the internal map +func (m *Map[Key, Value]) Segment() *capnp.Segment { + return m.internal_map.Segment() +} + +// Entries returns the entries of the map as a go map +func (m *Map[Key, Value]) Entries() (map[Key]Value, error) { + // Check if we have entries. If not we return an empty map + result := make(map[Key]Value) + if !m.internal_map.HasEntries() { + return result, nil + } + + entries, err := m.internal_map.Entries() + if err != nil { + return nil, err + } + + for i := 0; i < entries.Len(); i++ { + entry := entries.At(i) + key, err := entry.Key() + if err != nil { + return nil, err + } + + value, err := entry.Value() + if err != nil { + return nil, err + } + + result[Key(key)] = Value(value) + } + + return result, nil +} + +type ErrMapTooLarge struct{} + +func (e ErrMapTooLarge) Error() string { + return "Map supplied is larger than the internal map." +} + +// SetEntries sets the entries of the map +func (m *Map[Key, Value]) SetEntries(entries map[Key]Value) error { + // Check if we have any entries + if !m.internal_map.HasEntries() { + // Allocate enough entries + _, err := m.internal_map.NewEntries(int32(len(entries))) + if err != nil { + return err + } + } + + // Ensure the map is not larger than the internal map + internal_entries, err := m.internal_map.Entries() + if err != nil { + return err + } + if len(entries) > internal_entries.Len() { + return ErrMapTooLarge{} + } + + // Set the entries. Important: We cant use the Entries() method we defined earlier in this struct as that one is a copy. + idx := 0 + for key, value := range entries { + entry := internal_entries.At(idx) + entry.SetKey(capnp.Ptr(key)) + entry.SetValue(capnp.Ptr(value)) + idx++ + } + + return nil +} diff --git a/rpcserver/rpc_server.go b/rpcserver/rpc_server.go @@ -0,0 +1,177 @@ +package rpcserver + +import ( + "bytes" + "context" + "crypto/ed25519" + "encoding/base64" + "log" + "time" + + capnp "capnproto.org/go/capnp/v3" + + protocol "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1" + "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types" +) + +type SigningKeyWrapper struct { + *protocol.MatrixFederation + entityName string + keyID KeyID + privateKey ed25519.PrivateKey +} + +type RPCMatrixServer struct { + signing_key SigningKeyWrapper +} + +func NewServer() RPCMatrixServer { + // Check JSON verification using the test vectors from https://matrix.org/docs/spec/appendices.html + seed, err := base64.RawStdEncoding.DecodeString("YJDBA9Xnr2sVqXD9Vj7XVUnmFZcZrlw8Md7kMW+3XA1") + if err != nil { + log.Fatal(err) + } + random := bytes.NewBuffer(seed) + entityName := "domain" + keyID := KeyID("ed25519:1") + + _, privateKey, err := ed25519.GenerateKey(random) + if err != nil { + log.Fatal(err) + } + + return RPCMatrixServer{ + signing_key: SigningKeyWrapper{ + entityName: entityName, + keyID: keyID, + privateKey: privateKey, + }, + } +} + +func (s RPCMatrixServer) GetVersion(ctx context.Context, call protocol.MatrixFederation_getVersion) error { + res, err := call.AllocResults() // Allocate the results struct + if err != nil { + return err + } + + version, err := res.NewServerVersion() + if err != nil { + return err + } + version.SetName("Matrix Federation Cap'n'Proto RPC Proxy") + version.SetVersion("0.1.0") + + return nil +} + +func (s RPCMatrixServer) GetKeys(ctx context.Context, call protocol.MatrixFederation_getKeys) error { + _, err := call.AllocResults() // Allocate the results struct + if err != nil { + return err + } + + client := call.Args().Callback() + + err = client.Write(ctx, func(p protocol.StreamCallback_write_Params) error { + log.Println("Sending server keys metadata response...") + + response, err := types.NewServerKeysResponse(p.Segment()) + if err != nil { + return err + } + p.SetValue(response.ToPtr()) + + metadata, err := response.NewMetadata() + if err != nil { + return err + } + metadata.SetServerName("placeholder") + metadata.SetValidUntilTS(time.Now().UTC().Add(time.Hour * 24).Unix()) + + metadata_bytes, err := capnp.Canonicalize(capnp.Struct(metadata)) + if err != nil { + return err + } + signatures, err := response.NewSignatures(1) + if err != nil { + return err + } + err = SignCapnproto("placeholder", "placeholder", s.signing_key.privateKey, metadata_bytes, &signatures) + if err != nil { + return err + } + return response.SetSignatures(signatures) + }) + if err != nil { + return err + } + + err = client.Write(ctx, func(p protocol.StreamCallback_write_Params) error { + log.Println("Sending server keys verify_keys response...") + + response, err := types.NewServerKeysResponse(p.Segment()) + if err != nil { + return err + } + p.SetValue(response.ToPtr()) + + verify_keys_raw, err := response.NewVerifyKeys() + if err != nil { + return err + } + verify_keys := FromMap(&verify_keys_raw) + verify_keys_entries, err := verify_keys.Entries() + if err != nil { + return err + } + key, err := capnp.NewText(verify_keys.Segment(), "placeholder") + if err != nil { + return err + } + + log.Println("Original Key bytes:", s.signing_key.privateKey.Public().(ed25519.PublicKey)) + data, err := capnp.NewData(verify_keys.Segment(), s.signing_key.privateKey.Public().(ed25519.PublicKey)) + if err != nil { + return err + } + + verify_keys_entries[key.ToPtr()] = data.ToPtr() + verify_keys.SetEntries(verify_keys_entries) + + verify_keys_bytes, err := capnp.Canonicalize(capnp.Struct(verify_keys_raw)) + if err != nil { + return err + } + signatures, err := response.NewSignatures(1) + if err != nil { + return err + } + err = SignCapnproto("placeholder", "placeholder", s.signing_key.privateKey, verify_keys_bytes, &signatures) + if err != nil { + return err + } + return response.SetSignatures(signatures) + }) + if err != nil { + return err + } + + future, release := client.Done(ctx, nil) + defer release() + _, err = future.Struct() + + if err := client.WaitStreaming(); err != nil { + return err + } + + return err +} + +func (s RPCMatrixServer) SendTransactions(context.Context, protocol.MatrixFederation_sendTransactions) error { + return nil +} + +func (s RPCMatrixServer) Backfill(context.Context, protocol.MatrixFederation_backfill) error { + return nil +} diff --git a/rpcserver/utils.go b/rpcserver/utils.go @@ -0,0 +1,57 @@ +package rpcserver + +import ( + "crypto/ed25519" + + capnp "capnproto.org/go/capnp/v3" + "github.com/MTRNord/matrix_protobuf_fed/proto/federation/v1/types" +) + +// The go parser currently doesnt support custom annotations so we keep track of it manually +const ( + GetVersion_MethodID = 0xab1eb3e81f3344d1 + GetKeys_MethodID = 0x932dd11596dad50e + SendTransactions_MethodID = 0xec6b6ce167005c84 + Backfill_MethodID = 0x970e8e8dfe8f0ced +) + +// A KeyID is the ID of a ed25519 key used to sign Protobuf. +// The key IDs have a format of "ed25519:[0-9A-Za-z]+" +// If we switch to using a different signing algorithm then we will change the +// prefix used. +type KeyID string + +// This signs a capnproto byte sequeence in canonical form (has to be canonicalized by the caller) and adds the signature to the signatures list. +// This is the capnproto equivalent to https://spec.matrix.org/v1.9/appendices/#signing-json +// This is not expected to yield the same signature as the json counterpart as the capnproto serialization is different. +func SignCapnproto(signingName string, keyID KeyID, privateKey ed25519.PrivateKey, message []byte, signatures *types.Signature_List) error { + signature := ed25519.Sign(privateKey, message) + + // Go doesnt support generic types from go-capnp yet https://github.com/capnproto/go-capnp/issues/27 + list_size := signatures.Len() + map_entry := signatures.At(list_size - 1) + map_entry.SetServer(signingName) + signatures_map, err := map_entry.NewSignatures() + if err != nil { + return err + } + signatures_map_wrapper := FromMap(&signatures_map) + signatures_map_go, err := signatures_map_wrapper.Entries() + if err != nil { + return err + } + + key, err := capnp.NewText(signatures_map_wrapper.Segment(), string(keyID)) + if err != nil { + return err + } + + data, err := capnp.NewData(signatures_map_wrapper.Segment(), signature) + if err != nil { + return err + } + signatures_map_go[key.ToPtr()] = data.ToPtr() + signatures_map_wrapper.SetEntries(signatures_map_go) + + return nil +}