From 1c48af301e5ca8db6d5d07488b53060cc80d448a Mon Sep 17 00:00:00 2001 From: Semisol Date: Sat, 12 Oct 2024 14:27:17 +0300 Subject: [PATCH 1/4] Update schemas --- std/capnp/c++.capnp | 1 - std/capnp/compat/byte-stream.capnp | 48 + .../compat/bytestream/byte-stream.capnp.go | 1364 ++++++ std/capnp/compat/http-over-capnp.capnp | 271 ++ .../httpovercapnp/http-over-capnp.capnp.go | 4281 +++++++++++++++++ std/capnp/compat/json-rpc.capnp | 46 + std/capnp/compat/json-test.capnp | 126 + std/capnp/compat/json.capnp | 1 - std/capnp/compat/json/json.capnp.go | 38 +- std/capnp/compat/jsonrpc/json-rpc.capnp.go | 435 ++ std/capnp/compat/jsontest/json-test.capnp.go | 1556 ++++++ std/capnp/compiler/grammar.capnp | 274 ++ std/capnp/compiler/grammar/grammar.capnp.go | 3335 +++++++++++++ std/capnp/compiler/lexer.capnp | 70 + std/capnp/compiler/lexer/lexer.capnp.go | 727 +++ std/capnp/cxx/c++.capnp.go | 6 +- std/capnp/persistent.capnp | 1 - std/capnp/rpc-twoparty.capnp | 6 +- std/capnp/rpc.capnp | 402 +- std/capnp/rpc/rpc.capnp.go | 692 ++- std/capnp/rpctwoparty/rpc-twoparty.capnp.go | 238 +- std/go/go.capnp.go | 14 +- 22 files changed, 13471 insertions(+), 461 deletions(-) create mode 100644 std/capnp/compat/byte-stream.capnp create mode 100644 std/capnp/compat/bytestream/byte-stream.capnp.go create mode 100644 std/capnp/compat/http-over-capnp.capnp create mode 100644 std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go create mode 100644 std/capnp/compat/json-rpc.capnp create mode 100644 std/capnp/compat/json-test.capnp create mode 100644 std/capnp/compat/jsonrpc/json-rpc.capnp.go create mode 100644 std/capnp/compat/jsontest/json-test.capnp.go create mode 100644 std/capnp/compiler/grammar.capnp create mode 100644 std/capnp/compiler/grammar/grammar.capnp.go create mode 100644 std/capnp/compiler/lexer.capnp create mode 100644 std/capnp/compiler/lexer/lexer.capnp.go diff --git a/std/capnp/c++.capnp b/std/capnp/c++.capnp index d1d1aec6..de1ad5c1 100644 --- a/std/capnp/c++.capnp +++ b/std/capnp/c++.capnp @@ -46,7 +46,6 @@ annotation allowCancellation(interface, method, file) :Void; # If your code is not cancellation-safe, then allowing cancellation might give a malicious client # an easy way to induce use-after-free or other bugs in your server, by requesting cancellation # when not expected. - using Go = import "/go.capnp"; $Go.package("cxx"); $Go.import("capnproto.org/go/capnp/v3/std/capnp/cxx"); diff --git a/std/capnp/compat/byte-stream.capnp b/std/capnp/compat/byte-stream.capnp new file mode 100644 index 00000000..51177e23 --- /dev/null +++ b/std/capnp/compat/byte-stream.capnp @@ -0,0 +1,48 @@ +@0x8f5d14e1c273738d; + +using Cxx = import "/capnp/c++.capnp"; +$Cxx.namespace("capnp"); +$Cxx.allowCancellation; + +interface ByteStream { + write @0 (bytes :Data) -> stream; + # Write a chunk. + + end @1 (); + # Signals clean EOF. (If the ByteStream is dropped without calling this, then the stream was + # prematurely canceled and so the body should not be considered complete.) + + getSubstream @2 (callback :SubstreamCallback, + limit :UInt64 = 0xffffffffffffffff) -> (substream :ByteStream); + # This method is used to implement path shortening optimization. It is designed in particular + # with KJ streams' pumpTo() in mind. + # + # getSubstream() returns a new stream object that can be used to write to the same destination + # as this stream. The substream will operate until it has received `limit` bytes, or its `end()` + # method has been called, whichever occurs first. At that time, it invokes one of the methods of + # `callback` based on the termination condition. + # + # While a substream is active, it is an error to call write() on the original stream. Doing so + # may throw an exception or may arbitrarily interleave bytes with the substream's writes. + + startTls @3 (expectedServerHostname :Text) -> stream; + # Client calls this method when it wants to initiate TLS. This ByteStream is not terminated, + # the caller should reuse it. + + interface SubstreamCallback { + ended @0 (byteCount :UInt64); + # `end()` was called on the substream after writing `byteCount` bytes. The `end()` call was + # NOT forwarded to the underlying stream, which remains open. + + reachedLimit @1 () -> (next :ByteStream); + # The number of bytes specified by the `limit` parameter of `getSubstream()` was reached. + # The substream will "resolve itself" to `next`, so that all future calls to the substream + # are forwarded to `next`. + # + # If the `write()` call which reached the limit included bytes past the limit, then the first + # `write()` call to `next` will be for those leftover bytes. + } +} +using Go = import "/go.capnp"; +$Go.package("bytestream"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/bytestream"); diff --git a/std/capnp/compat/bytestream/byte-stream.capnp.go b/std/capnp/compat/bytestream/byte-stream.capnp.go new file mode 100644 index 00000000..b976a987 --- /dev/null +++ b/std/capnp/compat/bytestream/byte-stream.capnp.go @@ -0,0 +1,1364 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package bytestream + +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" +) + +type ByteStream capnp.Client + +// ByteStream_TypeID is the unique identifier for the type ByteStream. +const ByteStream_TypeID = 0xd2e7d8a0dc0a9766 + +func (c ByteStream) Write(ctx context.Context, params func(ByteStream_write_Params) error) error { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 0, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "write", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_write_Params(s)) } + } + + return capnp.Client(c).SendStreamCall(ctx, s) + +} + +func (c ByteStream) End(ctx context.Context, params func(ByteStream_end_Params) error) (ByteStream_end_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 1, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "end", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_end_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return ByteStream_end_Results_Future{Future: ans.Future()}, release + +} + +func (c ByteStream) GetSubstream(ctx context.Context, params func(ByteStream_getSubstream_Params) error) (ByteStream_getSubstream_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 2, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "getSubstream", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_getSubstream_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return ByteStream_getSubstream_Results_Future{Future: ans.Future()}, release + +} + +func (c ByteStream) StartTls(ctx context.Context, params func(ByteStream_startTls_Params) error) error { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 3, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "startTls", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_startTls_Params(s)) } + } + + return capnp.Client(c).SendStreamCall(ctx, s) + +} + +func (c ByteStream) 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 ByteStream) String() string { + return "ByteStream(" + 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 ByteStream) AddRef() ByteStream { + return ByteStream(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 ByteStream) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c ByteStream) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c ByteStream) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (ByteStream) DecodeFromPtr(p capnp.Ptr) ByteStream { + return ByteStream(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 ByteStream) 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 ByteStream) IsSame(other ByteStream) 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 ByteStream) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c ByteStream) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A ByteStream_Server is a ByteStream with a local implementation. +type ByteStream_Server interface { + Write(context.Context, ByteStream_write) error + + End(context.Context, ByteStream_end) error + + GetSubstream(context.Context, ByteStream_getSubstream) error + + StartTls(context.Context, ByteStream_startTls) error +} + +// ByteStream_NewServer creates a new Server from an implementation of ByteStream_Server. +func ByteStream_NewServer(s ByteStream_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(ByteStream_Methods(nil, s), s, c) +} + +// ByteStream_ServerToClient creates a new Client from an implementation of ByteStream_Server. +// The caller is responsible for calling Release on the returned Client. +func ByteStream_ServerToClient(s ByteStream_Server) ByteStream { + return ByteStream(capnp.NewClient(ByteStream_NewServer(s))) +} + +// ByteStream_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func ByteStream_Methods(methods []server.Method, s ByteStream_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 4) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 0, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "write", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Write(ctx, ByteStream_write{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 1, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "end", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.End(ctx, ByteStream_end{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 2, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "getSubstream", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.GetSubstream(ctx, ByteStream_getSubstream{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xd2e7d8a0dc0a9766, + MethodID: 3, + InterfaceName: "byte-stream.capnp:ByteStream", + MethodName: "startTls", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartTls(ctx, ByteStream_startTls{call}) + }, + }) + + return methods +} + +// ByteStream_write holds the state for a server call to ByteStream.write. +// See server.Call for documentation. +type ByteStream_write struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_write) Args() ByteStream_write_Params { + return ByteStream_write_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_write) AllocResults() (stream.StreamResult, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return stream.StreamResult(r), err +} + +// ByteStream_end holds the state for a server call to ByteStream.end. +// See server.Call for documentation. +type ByteStream_end struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_end) Args() ByteStream_end_Params { + return ByteStream_end_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_end) AllocResults() (ByteStream_end_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_end_Results(r), err +} + +// ByteStream_getSubstream holds the state for a server call to ByteStream.getSubstream. +// See server.Call for documentation. +type ByteStream_getSubstream struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_getSubstream) Args() ByteStream_getSubstream_Params { + return ByteStream_getSubstream_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_getSubstream) AllocResults() (ByteStream_getSubstream_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_getSubstream_Results(r), err +} + +// ByteStream_startTls holds the state for a server call to ByteStream.startTls. +// See server.Call for documentation. +type ByteStream_startTls struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_startTls) Args() ByteStream_startTls_Params { + return ByteStream_startTls_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_startTls) AllocResults() (stream.StreamResult, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return stream.StreamResult(r), err +} + +// ByteStream_List is a list of ByteStream. +type ByteStream_List = capnp.CapList[ByteStream] + +// NewByteStream creates a new list of ByteStream. +func NewByteStream_List(s *capnp.Segment, sz int32) (ByteStream_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[ByteStream](l), err +} + +type ByteStream_SubstreamCallback capnp.Client + +// ByteStream_SubstreamCallback_TypeID is the unique identifier for the type ByteStream_SubstreamCallback. +const ByteStream_SubstreamCallback_TypeID = 0xb23c0a13cf65c36e + +func (c ByteStream_SubstreamCallback) Ended(ctx context.Context, params func(ByteStream_SubstreamCallback_ended_Params) error) (ByteStream_SubstreamCallback_ended_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb23c0a13cf65c36e, + MethodID: 0, + InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback", + MethodName: "ended", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_SubstreamCallback_ended_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return ByteStream_SubstreamCallback_ended_Results_Future{Future: ans.Future()}, release + +} + +func (c ByteStream_SubstreamCallback) ReachedLimit(ctx context.Context, params func(ByteStream_SubstreamCallback_reachedLimit_Params) error) (ByteStream_SubstreamCallback_reachedLimit_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb23c0a13cf65c36e, + MethodID: 1, + InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback", + MethodName: "reachedLimit", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} + s.PlaceArgs = func(s capnp.Struct) error { return params(ByteStream_SubstreamCallback_reachedLimit_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return ByteStream_SubstreamCallback_reachedLimit_Results_Future{Future: ans.Future()}, release + +} + +func (c ByteStream_SubstreamCallback) 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 ByteStream_SubstreamCallback) String() string { + return "ByteStream_SubstreamCallback(" + 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 ByteStream_SubstreamCallback) AddRef() ByteStream_SubstreamCallback { + return ByteStream_SubstreamCallback(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 ByteStream_SubstreamCallback) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c ByteStream_SubstreamCallback) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c ByteStream_SubstreamCallback) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (ByteStream_SubstreamCallback) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback { + return ByteStream_SubstreamCallback(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 ByteStream_SubstreamCallback) 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 ByteStream_SubstreamCallback) IsSame(other ByteStream_SubstreamCallback) 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 ByteStream_SubstreamCallback) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c ByteStream_SubstreamCallback) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A ByteStream_SubstreamCallback_Server is a ByteStream_SubstreamCallback with a local implementation. +type ByteStream_SubstreamCallback_Server interface { + Ended(context.Context, ByteStream_SubstreamCallback_ended) error + + ReachedLimit(context.Context, ByteStream_SubstreamCallback_reachedLimit) error +} + +// ByteStream_SubstreamCallback_NewServer creates a new Server from an implementation of ByteStream_SubstreamCallback_Server. +func ByteStream_SubstreamCallback_NewServer(s ByteStream_SubstreamCallback_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(ByteStream_SubstreamCallback_Methods(nil, s), s, c) +} + +// ByteStream_SubstreamCallback_ServerToClient creates a new Client from an implementation of ByteStream_SubstreamCallback_Server. +// The caller is responsible for calling Release on the returned Client. +func ByteStream_SubstreamCallback_ServerToClient(s ByteStream_SubstreamCallback_Server) ByteStream_SubstreamCallback { + return ByteStream_SubstreamCallback(capnp.NewClient(ByteStream_SubstreamCallback_NewServer(s))) +} + +// ByteStream_SubstreamCallback_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func ByteStream_SubstreamCallback_Methods(methods []server.Method, s ByteStream_SubstreamCallback_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 2) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb23c0a13cf65c36e, + MethodID: 0, + InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback", + MethodName: "ended", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Ended(ctx, ByteStream_SubstreamCallback_ended{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb23c0a13cf65c36e, + MethodID: 1, + InterfaceName: "byte-stream.capnp:ByteStream.SubstreamCallback", + MethodName: "reachedLimit", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.ReachedLimit(ctx, ByteStream_SubstreamCallback_reachedLimit{call}) + }, + }) + + return methods +} + +// ByteStream_SubstreamCallback_ended holds the state for a server call to ByteStream_SubstreamCallback.ended. +// See server.Call for documentation. +type ByteStream_SubstreamCallback_ended struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_SubstreamCallback_ended) Args() ByteStream_SubstreamCallback_ended_Params { + return ByteStream_SubstreamCallback_ended_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_SubstreamCallback_ended) AllocResults() (ByteStream_SubstreamCallback_ended_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_SubstreamCallback_ended_Results(r), err +} + +// ByteStream_SubstreamCallback_reachedLimit holds the state for a server call to ByteStream_SubstreamCallback.reachedLimit. +// See server.Call for documentation. +type ByteStream_SubstreamCallback_reachedLimit struct { + *server.Call +} + +// Args returns the call's arguments. +func (c ByteStream_SubstreamCallback_reachedLimit) Args() ByteStream_SubstreamCallback_reachedLimit_Params { + return ByteStream_SubstreamCallback_reachedLimit_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c ByteStream_SubstreamCallback_reachedLimit) AllocResults() (ByteStream_SubstreamCallback_reachedLimit_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_SubstreamCallback_reachedLimit_Results(r), err +} + +// ByteStream_SubstreamCallback_List is a list of ByteStream_SubstreamCallback. +type ByteStream_SubstreamCallback_List = capnp.CapList[ByteStream_SubstreamCallback] + +// NewByteStream_SubstreamCallback creates a new list of ByteStream_SubstreamCallback. +func NewByteStream_SubstreamCallback_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[ByteStream_SubstreamCallback](l), err +} + +type ByteStream_SubstreamCallback_ended_Params capnp.Struct + +// ByteStream_SubstreamCallback_ended_Params_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_ended_Params. +const ByteStream_SubstreamCallback_ended_Params_TypeID = 0xccb18eca8acafbe7 + +func NewByteStream_SubstreamCallback_ended_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return ByteStream_SubstreamCallback_ended_Params(st), err +} + +func NewRootByteStream_SubstreamCallback_ended_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return ByteStream_SubstreamCallback_ended_Params(st), err +} + +func ReadRootByteStream_SubstreamCallback_ended_Params(msg *capnp.Message) (ByteStream_SubstreamCallback_ended_Params, error) { + root, err := msg.Root() + return ByteStream_SubstreamCallback_ended_Params(root.Struct()), err +} + +func (s ByteStream_SubstreamCallback_ended_Params) String() string { + str, _ := text.Marshal(0xccb18eca8acafbe7, capnp.Struct(s)) + return str +} + +func (s ByteStream_SubstreamCallback_ended_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_SubstreamCallback_ended_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_ended_Params { + return ByteStream_SubstreamCallback_ended_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_SubstreamCallback_ended_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_SubstreamCallback_ended_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_SubstreamCallback_ended_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_SubstreamCallback_ended_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_SubstreamCallback_ended_Params) ByteCount() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s ByteStream_SubstreamCallback_ended_Params) SetByteCount(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +// ByteStream_SubstreamCallback_ended_Params_List is a list of ByteStream_SubstreamCallback_ended_Params. +type ByteStream_SubstreamCallback_ended_Params_List = capnp.StructList[ByteStream_SubstreamCallback_ended_Params] + +// NewByteStream_SubstreamCallback_ended_Params creates a new list of ByteStream_SubstreamCallback_ended_Params. +func NewByteStream_SubstreamCallback_ended_Params_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_ended_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz) + return capnp.StructList[ByteStream_SubstreamCallback_ended_Params](l), err +} + +// ByteStream_SubstreamCallback_ended_Params_Future is a wrapper for a ByteStream_SubstreamCallback_ended_Params promised by a client call. +type ByteStream_SubstreamCallback_ended_Params_Future struct{ *capnp.Future } + +func (f ByteStream_SubstreamCallback_ended_Params_Future) Struct() (ByteStream_SubstreamCallback_ended_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_SubstreamCallback_ended_Params(p.Struct()), err +} + +type ByteStream_SubstreamCallback_ended_Results capnp.Struct + +// ByteStream_SubstreamCallback_ended_Results_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_ended_Results. +const ByteStream_SubstreamCallback_ended_Results_TypeID = 0xba8feb56b5b6922d + +func NewByteStream_SubstreamCallback_ended_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_SubstreamCallback_ended_Results(st), err +} + +func NewRootByteStream_SubstreamCallback_ended_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_ended_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_SubstreamCallback_ended_Results(st), err +} + +func ReadRootByteStream_SubstreamCallback_ended_Results(msg *capnp.Message) (ByteStream_SubstreamCallback_ended_Results, error) { + root, err := msg.Root() + return ByteStream_SubstreamCallback_ended_Results(root.Struct()), err +} + +func (s ByteStream_SubstreamCallback_ended_Results) String() string { + str, _ := text.Marshal(0xba8feb56b5b6922d, capnp.Struct(s)) + return str +} + +func (s ByteStream_SubstreamCallback_ended_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_SubstreamCallback_ended_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_ended_Results { + return ByteStream_SubstreamCallback_ended_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_SubstreamCallback_ended_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_SubstreamCallback_ended_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_SubstreamCallback_ended_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_SubstreamCallback_ended_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// ByteStream_SubstreamCallback_ended_Results_List is a list of ByteStream_SubstreamCallback_ended_Results. +type ByteStream_SubstreamCallback_ended_Results_List = capnp.StructList[ByteStream_SubstreamCallback_ended_Results] + +// NewByteStream_SubstreamCallback_ended_Results creates a new list of ByteStream_SubstreamCallback_ended_Results. +func NewByteStream_SubstreamCallback_ended_Results_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_ended_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[ByteStream_SubstreamCallback_ended_Results](l), err +} + +// ByteStream_SubstreamCallback_ended_Results_Future is a wrapper for a ByteStream_SubstreamCallback_ended_Results promised by a client call. +type ByteStream_SubstreamCallback_ended_Results_Future struct{ *capnp.Future } + +func (f ByteStream_SubstreamCallback_ended_Results_Future) Struct() (ByteStream_SubstreamCallback_ended_Results, error) { + p, err := f.Future.Ptr() + return ByteStream_SubstreamCallback_ended_Results(p.Struct()), err +} + +type ByteStream_SubstreamCallback_reachedLimit_Params capnp.Struct + +// ByteStream_SubstreamCallback_reachedLimit_Params_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_reachedLimit_Params. +const ByteStream_SubstreamCallback_reachedLimit_Params_TypeID = 0xd80bf35671585f44 + +func NewByteStream_SubstreamCallback_reachedLimit_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_SubstreamCallback_reachedLimit_Params(st), err +} + +func NewRootByteStream_SubstreamCallback_reachedLimit_Params(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_SubstreamCallback_reachedLimit_Params(st), err +} + +func ReadRootByteStream_SubstreamCallback_reachedLimit_Params(msg *capnp.Message) (ByteStream_SubstreamCallback_reachedLimit_Params, error) { + root, err := msg.Root() + return ByteStream_SubstreamCallback_reachedLimit_Params(root.Struct()), err +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Params) String() string { + str, _ := text.Marshal(0xd80bf35671585f44, capnp.Struct(s)) + return str +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_SubstreamCallback_reachedLimit_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_reachedLimit_Params { + return ByteStream_SubstreamCallback_reachedLimit_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_SubstreamCallback_reachedLimit_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// ByteStream_SubstreamCallback_reachedLimit_Params_List is a list of ByteStream_SubstreamCallback_reachedLimit_Params. +type ByteStream_SubstreamCallback_reachedLimit_Params_List = capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Params] + +// NewByteStream_SubstreamCallback_reachedLimit_Params creates a new list of ByteStream_SubstreamCallback_reachedLimit_Params. +func NewByteStream_SubstreamCallback_reachedLimit_Params_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_reachedLimit_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Params](l), err +} + +// ByteStream_SubstreamCallback_reachedLimit_Params_Future is a wrapper for a ByteStream_SubstreamCallback_reachedLimit_Params promised by a client call. +type ByteStream_SubstreamCallback_reachedLimit_Params_Future struct{ *capnp.Future } + +func (f ByteStream_SubstreamCallback_reachedLimit_Params_Future) Struct() (ByteStream_SubstreamCallback_reachedLimit_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_SubstreamCallback_reachedLimit_Params(p.Struct()), err +} + +type ByteStream_SubstreamCallback_reachedLimit_Results capnp.Struct + +// ByteStream_SubstreamCallback_reachedLimit_Results_TypeID is the unique identifier for the type ByteStream_SubstreamCallback_reachedLimit_Results. +const ByteStream_SubstreamCallback_reachedLimit_Results_TypeID = 0xddd06638ed144353 + +func NewByteStream_SubstreamCallback_reachedLimit_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_SubstreamCallback_reachedLimit_Results(st), err +} + +func NewRootByteStream_SubstreamCallback_reachedLimit_Results(s *capnp.Segment) (ByteStream_SubstreamCallback_reachedLimit_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_SubstreamCallback_reachedLimit_Results(st), err +} + +func ReadRootByteStream_SubstreamCallback_reachedLimit_Results(msg *capnp.Message) (ByteStream_SubstreamCallback_reachedLimit_Results, error) { + root, err := msg.Root() + return ByteStream_SubstreamCallback_reachedLimit_Results(root.Struct()), err +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) String() string { + str, _ := text.Marshal(0xddd06638ed144353, capnp.Struct(s)) + return str +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_SubstreamCallback_reachedLimit_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_SubstreamCallback_reachedLimit_Results { + return ByteStream_SubstreamCallback_reachedLimit_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_SubstreamCallback_reachedLimit_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_SubstreamCallback_reachedLimit_Results) Next() ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return ByteStream(p.Interface().Client()) +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) HasNext() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ByteStream_SubstreamCallback_reachedLimit_Results) SetNext(v ByteStream) 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()) +} + +// ByteStream_SubstreamCallback_reachedLimit_Results_List is a list of ByteStream_SubstreamCallback_reachedLimit_Results. +type ByteStream_SubstreamCallback_reachedLimit_Results_List = capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Results] + +// NewByteStream_SubstreamCallback_reachedLimit_Results creates a new list of ByteStream_SubstreamCallback_reachedLimit_Results. +func NewByteStream_SubstreamCallback_reachedLimit_Results_List(s *capnp.Segment, sz int32) (ByteStream_SubstreamCallback_reachedLimit_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[ByteStream_SubstreamCallback_reachedLimit_Results](l), err +} + +// ByteStream_SubstreamCallback_reachedLimit_Results_Future is a wrapper for a ByteStream_SubstreamCallback_reachedLimit_Results promised by a client call. +type ByteStream_SubstreamCallback_reachedLimit_Results_Future struct{ *capnp.Future } + +func (f ByteStream_SubstreamCallback_reachedLimit_Results_Future) Struct() (ByteStream_SubstreamCallback_reachedLimit_Results, error) { + p, err := f.Future.Ptr() + return ByteStream_SubstreamCallback_reachedLimit_Results(p.Struct()), err +} +func (p ByteStream_SubstreamCallback_reachedLimit_Results_Future) Next() ByteStream { + return ByteStream(p.Future.Field(0, nil).Client()) +} + +type ByteStream_write_Params capnp.Struct + +// ByteStream_write_Params_TypeID is the unique identifier for the type ByteStream_write_Params. +const ByteStream_write_Params_TypeID = 0xa45d8c4c07bb36d2 + +func NewByteStream_write_Params(s *capnp.Segment) (ByteStream_write_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_write_Params(st), err +} + +func NewRootByteStream_write_Params(s *capnp.Segment) (ByteStream_write_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_write_Params(st), err +} + +func ReadRootByteStream_write_Params(msg *capnp.Message) (ByteStream_write_Params, error) { + root, err := msg.Root() + return ByteStream_write_Params(root.Struct()), err +} + +func (s ByteStream_write_Params) String() string { + str, _ := text.Marshal(0xa45d8c4c07bb36d2, capnp.Struct(s)) + return str +} + +func (s ByteStream_write_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_write_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_write_Params { + return ByteStream_write_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_write_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_write_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_write_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_write_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_write_Params) Bytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s ByteStream_write_Params) HasBytes() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ByteStream_write_Params) SetBytes(v []byte) error { + return capnp.Struct(s).SetData(0, v) +} + +// ByteStream_write_Params_List is a list of ByteStream_write_Params. +type ByteStream_write_Params_List = capnp.StructList[ByteStream_write_Params] + +// NewByteStream_write_Params creates a new list of ByteStream_write_Params. +func NewByteStream_write_Params_List(s *capnp.Segment, sz int32) (ByteStream_write_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[ByteStream_write_Params](l), err +} + +// ByteStream_write_Params_Future is a wrapper for a ByteStream_write_Params promised by a client call. +type ByteStream_write_Params_Future struct{ *capnp.Future } + +func (f ByteStream_write_Params_Future) Struct() (ByteStream_write_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_write_Params(p.Struct()), err +} + +type ByteStream_end_Params capnp.Struct + +// ByteStream_end_Params_TypeID is the unique identifier for the type ByteStream_end_Params. +const ByteStream_end_Params_TypeID = 0xcbd32047945c0144 + +func NewByteStream_end_Params(s *capnp.Segment) (ByteStream_end_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_end_Params(st), err +} + +func NewRootByteStream_end_Params(s *capnp.Segment) (ByteStream_end_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_end_Params(st), err +} + +func ReadRootByteStream_end_Params(msg *capnp.Message) (ByteStream_end_Params, error) { + root, err := msg.Root() + return ByteStream_end_Params(root.Struct()), err +} + +func (s ByteStream_end_Params) String() string { + str, _ := text.Marshal(0xcbd32047945c0144, capnp.Struct(s)) + return str +} + +func (s ByteStream_end_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_end_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_end_Params { + return ByteStream_end_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_end_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_end_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_end_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_end_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// ByteStream_end_Params_List is a list of ByteStream_end_Params. +type ByteStream_end_Params_List = capnp.StructList[ByteStream_end_Params] + +// NewByteStream_end_Params creates a new list of ByteStream_end_Params. +func NewByteStream_end_Params_List(s *capnp.Segment, sz int32) (ByteStream_end_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[ByteStream_end_Params](l), err +} + +// ByteStream_end_Params_Future is a wrapper for a ByteStream_end_Params promised by a client call. +type ByteStream_end_Params_Future struct{ *capnp.Future } + +func (f ByteStream_end_Params_Future) Struct() (ByteStream_end_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_end_Params(p.Struct()), err +} + +type ByteStream_end_Results capnp.Struct + +// ByteStream_end_Results_TypeID is the unique identifier for the type ByteStream_end_Results. +const ByteStream_end_Results_TypeID = 0xe7e2ddbc3c63d594 + +func NewByteStream_end_Results(s *capnp.Segment) (ByteStream_end_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_end_Results(st), err +} + +func NewRootByteStream_end_Results(s *capnp.Segment) (ByteStream_end_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return ByteStream_end_Results(st), err +} + +func ReadRootByteStream_end_Results(msg *capnp.Message) (ByteStream_end_Results, error) { + root, err := msg.Root() + return ByteStream_end_Results(root.Struct()), err +} + +func (s ByteStream_end_Results) String() string { + str, _ := text.Marshal(0xe7e2ddbc3c63d594, capnp.Struct(s)) + return str +} + +func (s ByteStream_end_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_end_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_end_Results { + return ByteStream_end_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_end_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_end_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_end_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_end_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// ByteStream_end_Results_List is a list of ByteStream_end_Results. +type ByteStream_end_Results_List = capnp.StructList[ByteStream_end_Results] + +// NewByteStream_end_Results creates a new list of ByteStream_end_Results. +func NewByteStream_end_Results_List(s *capnp.Segment, sz int32) (ByteStream_end_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[ByteStream_end_Results](l), err +} + +// ByteStream_end_Results_Future is a wrapper for a ByteStream_end_Results promised by a client call. +type ByteStream_end_Results_Future struct{ *capnp.Future } + +func (f ByteStream_end_Results_Future) Struct() (ByteStream_end_Results, error) { + p, err := f.Future.Ptr() + return ByteStream_end_Results(p.Struct()), err +} + +type ByteStream_getSubstream_Params capnp.Struct + +// ByteStream_getSubstream_Params_TypeID is the unique identifier for the type ByteStream_getSubstream_Params. +const ByteStream_getSubstream_Params_TypeID = 0xc5b18e80fc80d9f8 + +func NewByteStream_getSubstream_Params(s *capnp.Segment) (ByteStream_getSubstream_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ByteStream_getSubstream_Params(st), err +} + +func NewRootByteStream_getSubstream_Params(s *capnp.Segment) (ByteStream_getSubstream_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ByteStream_getSubstream_Params(st), err +} + +func ReadRootByteStream_getSubstream_Params(msg *capnp.Message) (ByteStream_getSubstream_Params, error) { + root, err := msg.Root() + return ByteStream_getSubstream_Params(root.Struct()), err +} + +func (s ByteStream_getSubstream_Params) String() string { + str, _ := text.Marshal(0xc5b18e80fc80d9f8, capnp.Struct(s)) + return str +} + +func (s ByteStream_getSubstream_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_getSubstream_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_getSubstream_Params { + return ByteStream_getSubstream_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_getSubstream_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_getSubstream_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_getSubstream_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_getSubstream_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_getSubstream_Params) Callback() ByteStream_SubstreamCallback { + p, _ := capnp.Struct(s).Ptr(0) + return ByteStream_SubstreamCallback(p.Interface().Client()) +} + +func (s ByteStream_getSubstream_Params) HasCallback() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ByteStream_getSubstream_Params) SetCallback(v ByteStream_SubstreamCallback) 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()) +} + +func (s ByteStream_getSubstream_Params) Limit() uint64 { + return capnp.Struct(s).Uint64(0) ^ 18446744073709551615 +} + +func (s ByteStream_getSubstream_Params) SetLimit(v uint64) { + capnp.Struct(s).SetUint64(0, v^18446744073709551615) +} + +// ByteStream_getSubstream_Params_List is a list of ByteStream_getSubstream_Params. +type ByteStream_getSubstream_Params_List = capnp.StructList[ByteStream_getSubstream_Params] + +// NewByteStream_getSubstream_Params creates a new list of ByteStream_getSubstream_Params. +func NewByteStream_getSubstream_Params_List(s *capnp.Segment, sz int32) (ByteStream_getSubstream_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[ByteStream_getSubstream_Params](l), err +} + +// ByteStream_getSubstream_Params_Future is a wrapper for a ByteStream_getSubstream_Params promised by a client call. +type ByteStream_getSubstream_Params_Future struct{ *capnp.Future } + +func (f ByteStream_getSubstream_Params_Future) Struct() (ByteStream_getSubstream_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_getSubstream_Params(p.Struct()), err +} +func (p ByteStream_getSubstream_Params_Future) Callback() ByteStream_SubstreamCallback { + return ByteStream_SubstreamCallback(p.Future.Field(0, nil).Client()) +} + +type ByteStream_getSubstream_Results capnp.Struct + +// ByteStream_getSubstream_Results_TypeID is the unique identifier for the type ByteStream_getSubstream_Results. +const ByteStream_getSubstream_Results_TypeID = 0x8d198ede6d27756a + +func NewByteStream_getSubstream_Results(s *capnp.Segment) (ByteStream_getSubstream_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_getSubstream_Results(st), err +} + +func NewRootByteStream_getSubstream_Results(s *capnp.Segment) (ByteStream_getSubstream_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_getSubstream_Results(st), err +} + +func ReadRootByteStream_getSubstream_Results(msg *capnp.Message) (ByteStream_getSubstream_Results, error) { + root, err := msg.Root() + return ByteStream_getSubstream_Results(root.Struct()), err +} + +func (s ByteStream_getSubstream_Results) String() string { + str, _ := text.Marshal(0x8d198ede6d27756a, capnp.Struct(s)) + return str +} + +func (s ByteStream_getSubstream_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_getSubstream_Results) DecodeFromPtr(p capnp.Ptr) ByteStream_getSubstream_Results { + return ByteStream_getSubstream_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_getSubstream_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_getSubstream_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_getSubstream_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_getSubstream_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_getSubstream_Results) Substream() ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return ByteStream(p.Interface().Client()) +} + +func (s ByteStream_getSubstream_Results) HasSubstream() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ByteStream_getSubstream_Results) SetSubstream(v ByteStream) 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()) +} + +// ByteStream_getSubstream_Results_List is a list of ByteStream_getSubstream_Results. +type ByteStream_getSubstream_Results_List = capnp.StructList[ByteStream_getSubstream_Results] + +// NewByteStream_getSubstream_Results creates a new list of ByteStream_getSubstream_Results. +func NewByteStream_getSubstream_Results_List(s *capnp.Segment, sz int32) (ByteStream_getSubstream_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[ByteStream_getSubstream_Results](l), err +} + +// ByteStream_getSubstream_Results_Future is a wrapper for a ByteStream_getSubstream_Results promised by a client call. +type ByteStream_getSubstream_Results_Future struct{ *capnp.Future } + +func (f ByteStream_getSubstream_Results_Future) Struct() (ByteStream_getSubstream_Results, error) { + p, err := f.Future.Ptr() + return ByteStream_getSubstream_Results(p.Struct()), err +} +func (p ByteStream_getSubstream_Results_Future) Substream() ByteStream { + return ByteStream(p.Future.Field(0, nil).Client()) +} + +type ByteStream_startTls_Params capnp.Struct + +// ByteStream_startTls_Params_TypeID is the unique identifier for the type ByteStream_startTls_Params. +const ByteStream_startTls_Params_TypeID = 0xea8253a695da1ab8 + +func NewByteStream_startTls_Params(s *capnp.Segment) (ByteStream_startTls_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_startTls_Params(st), err +} + +func NewRootByteStream_startTls_Params(s *capnp.Segment) (ByteStream_startTls_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return ByteStream_startTls_Params(st), err +} + +func ReadRootByteStream_startTls_Params(msg *capnp.Message) (ByteStream_startTls_Params, error) { + root, err := msg.Root() + return ByteStream_startTls_Params(root.Struct()), err +} + +func (s ByteStream_startTls_Params) String() string { + str, _ := text.Marshal(0xea8253a695da1ab8, capnp.Struct(s)) + return str +} + +func (s ByteStream_startTls_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ByteStream_startTls_Params) DecodeFromPtr(p capnp.Ptr) ByteStream_startTls_Params { + return ByteStream_startTls_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ByteStream_startTls_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ByteStream_startTls_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ByteStream_startTls_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ByteStream_startTls_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ByteStream_startTls_Params) ExpectedServerHostname() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s ByteStream_startTls_Params) HasExpectedServerHostname() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ByteStream_startTls_Params) ExpectedServerHostnameBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s ByteStream_startTls_Params) SetExpectedServerHostname(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +// ByteStream_startTls_Params_List is a list of ByteStream_startTls_Params. +type ByteStream_startTls_Params_List = capnp.StructList[ByteStream_startTls_Params] + +// NewByteStream_startTls_Params creates a new list of ByteStream_startTls_Params. +func NewByteStream_startTls_Params_List(s *capnp.Segment, sz int32) (ByteStream_startTls_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[ByteStream_startTls_Params](l), err +} + +// ByteStream_startTls_Params_Future is a wrapper for a ByteStream_startTls_Params promised by a client call. +type ByteStream_startTls_Params_Future struct{ *capnp.Future } + +func (f ByteStream_startTls_Params_Future) Struct() (ByteStream_startTls_Params, error) { + p, err := f.Future.Ptr() + return ByteStream_startTls_Params(p.Struct()), err +} + +const schema_8f5d14e1c273738d = "x\xda\xa4\x94_h\x1cU\x18\xc5\xcf\x99\xb9\xd3\xe9\x9f" + + "\x84\xedu\x02\xdab\x88\x94\x14\xff`Z\xd3U\xa9R" + + "\xd8\xb5)\xa8\xa1\xc2\xdel)\x16,e\xb2{\xabI" + + "w\xa7\xc9\xcc\xaci\x84B\x11D,6\xa5\xa1A\xf4" + + "\xc9\x07\xf1=BE\xab\x0f\xfe\xa1/UP+B\x15" + + "+X\x90@\xc4'\x11\x14\x0b#w63\xd9\x94H" + + "\x0c\xee\xdb\xce|\xf3\x9d\xdf\xfd\xce\xf9\xeeC\xb7X\x16" + + "\x83\xdd%\x17\x96:\xe4lH\xc6[\xf76\x7f\x9a\xd9" + + "v\x0e\xb2\x97\x80C\x17(\xbeb\xcf\x12\xf4\xe6\xec\x12" + + "\x98\\{\xf4#\xf7\xe0\xebG\xdf\xe9,\xf8\xd0\x1e1" + + "\x05W\xd2\x82\xe0s\xfd\x95\xb7y\xdf{\x90\xbdvr" + + "\xfc\x8d\xcd?\xbe}}\xe1\x1a\xc0\xe2/\xf6K\xf4\xfe" + + "\xb2]\xc0\xfb\xc3~\xd5{Z\xb8@20\xfb\xfe\xa5" + + "\xc3\xbf\x9e\xbf\x0c\xb9\x9b\x80yT\x1c\x14\x8b\x84H\xfe" + + "\xfc\xfe\xcc\xad33\xf3W\xa0z\x99+\xed\x14g\x8d" + + "\xd2#b\x0aL\x0e\xf0\xb9\x8bO\xde\xf3\xed\x17m\x94" + + "\xf4\xdb9\xb1\xdf|\xbb\xf0\xf7\xd5\xb3Wg\xe6\xbf\x84" + + "\xda\xcd\xec\xd5iq\xd3|zA\x18\xc8\x9cK\xdea" + + "'\xe7\xa2\xe8\xb3\x9f{\x8e\x9e\x07\xe8]\x12\x8b\xde\xa7" + + "\xe2N\xa0\xf8\x8dp\xe9M;\x06\xf2\xc0\xb1g'\x0f" + + "\xff\xbe\xe5z\x07\xa4\xefl\xb7 \x92\xeaP\xcfo{" + + "\x8f\x7f}\xa3\xfd\xa6\xcdx\xc4\xd9a\x81\xde\xa4c\x84" + + ".~W\xdb\xf7\xf1\x8d\x9b\x0b\x1d\x8c\x17\x9ca\xc3\xf8" + + "\xc1\xf6\x1f\xe6\xde\xad\xbe\xbc\xd89\xc8\xd3\xce\xb8a|" + + "\xcd)\xa1\x9e\x8cN\xc7z \x8aCG\xfb\xcd]5" + + "\x7f\"\x98x|\xfft\xac\xabqh\x1e<\xaf\xe3j" + + "k4J\xff\xf4\x8f\xe8\xa8\xd5\x88\x19)a\x0b@\x10" + + "\x90\xdd#\x80\xea\xb2\xa9\xee\xb2\x98DK\x95`\x93\xb2" + + "\xd3\x14J0\x17\x12\xab\x0aM\x85c\xb1\xee\xaf\xf8\xa1" + + "\xdf\\)\xb0\x07P\x1bm\xaa\x1e\x8b}\xa6E\xc4n" + + "X\xec^\xb3a\x8e=\xe4\x97\x1a\x8dQ\xbfv\xa2B" + + "\xaa\x8d\xb6\x03\xe4\xc61\xcb\x85\x1c\xdc\x03K\xeet\xc9" + + "\xdc\x05fC\x97\xdb\xc6aI\xe9\xf6\xe9\xa0\xae\xebe" + + "&\xa1\xf6k/\xe8\xfaA\x14\xc6\x9acq\x99\x15." + + "\xb3lX\x8b\xa5\x8d\xb2+\xede\x06Zh5\xe2h" + + "=&\xa4#\x8a\xd2\xa1d3\xba\x7f\x18P\xf7\xd9T" + + "\x0f[${H\xd2\x1c\x08\xeaA\x9bj\xaf\xc5\xa4\xb6" + + "$\x0b\x80ryu\xda\xc6\xf45\xcc1\xb8\x09\x167" + + "%\xd9\x0f@\x0e\xb5eU(\x1d\xd43\x96\xacp]" + + "g\xaf\xf8\xa1\xeb7\xff5K\xa6\xe7\xd0\xc9V\x00." + + "\xa1u\x18n\xdd.T0\xfd\x95`\xe7\xb5\xc0\xd9$" + + "\x93f\xa6\xcd\x13jk\x1a\x80\xecza0\xff\xc9T" + + "\xf1\xadco\xcaI\x13\x00\x9d\x06`i\xdf\x99-\x95" + + "<\xb2\x03\x96|\xc6\xa5\x95\xdf\x16\xcc.0\xf9\x84\x09" + + "\xc7c.\xed|\xd3\x96{\x0e\x0c\xa7\xa1\xeaK\xb3]" + + "\xa6\xab\x03\x13\x9f\xccM\xa4\xd4e&Q\xec\x87\xf1\xa1" + + "F\x04`e\x98\xdc\xff8\xd0,\x90\xc6\xc7\xd4\x13\xbb" + + "\x19\xfd\xbf&f\xd3\xddF\xbc\xc2\x9d\x07\x96\x17\xb1\x10" + + "\xe8S\xf1\xbaW\xdc$\xa6}\x85D\x1d\xe9Z\xbd6" + + "\x9bI\x7f\xc5/\x84\xb7\xc5\xe42\xa0\xb6\xdaTw[" + + "L\xf4\xa9\x09]\x8bu\x9dU\x1d\xbe\xa8\xc3\xa7N\x96" + + "\xa28\xf0\x9b\x9a]\xb0\xd8\x05\xfe\x13\x00\x00\xff\xff\xbf" + + "\x0c\x05)" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_8f5d14e1c273738d, + Nodes: []uint64{ + 0x8d198ede6d27756a, + 0xa45d8c4c07bb36d2, + 0xb23c0a13cf65c36e, + 0xba8feb56b5b6922d, + 0xc5b18e80fc80d9f8, + 0xcbd32047945c0144, + 0xccb18eca8acafbe7, + 0xd2e7d8a0dc0a9766, + 0xd80bf35671585f44, + 0xddd06638ed144353, + 0xe7e2ddbc3c63d594, + 0xea8253a695da1ab8, + }, + Compressed: true, + }) +} diff --git a/std/capnp/compat/http-over-capnp.capnp b/std/capnp/compat/http-over-capnp.capnp new file mode 100644 index 00000000..dbbb624a --- /dev/null +++ b/std/capnp/compat/http-over-capnp.capnp @@ -0,0 +1,271 @@ +# Copyright (c) 2019 Cloudflare, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +@0xb665280aaff2e632; +# Cap'n Proto interface for HTTP. + +using import "byte-stream.capnp".ByteStream; + +using Cxx = import "/capnp/c++.capnp"; +$Cxx.namespace("capnp"); +$Cxx.allowCancellation; + +interface HttpService { + request @1 (request :HttpRequest, context :ClientRequestContext) + -> (requestBody :ByteStream); + # Perform an HTTP request. + # + # The client sends the request method/url/headers. The server responds with a `ByteStream` where + # the client can make calls to stream up the request body. `requestBody` will be null in the case + # that request.bodySize.fixed == 0. + # + # The server will send a response by invoking a method on `callback`. + # + # `request()` does not return until the server is completely done processing the request, + # including sending the response. The client therefore must use promise pipelining to send the + # request body. The client may request cancellation of the HTTP request by canceling the + # `request()` call itself. + + startRequest @0 (request :HttpRequest, context :ClientRequestContext) + -> (requestBody :ByteStream, context :ServerRequestContext); + # DEPRECATED: Older form of `request()`. In this version, the server immediately returns a + # `ServerRequestContext` before it begins processing the request. This version was designed + # before `CallContext::setPipeline()` was introduced. At that time, it was impossible for the + # server to receive data sent to the `requestBody` stream until `startRequest()` had returned + # a stream capability to use, hence the ongoing call on the server side had to be represented + # using a separate capability. Now that we have `CallContext::setPipeline()`, the server can + # begin receiving the request body without returning from the top-level RPC, so we can now use + # `request()` instead of `startRequest()`. The new approach is more intuitive and avoids some + # unnecessary bookkeeping. + # + # `HttpOverCapnpFactory` will continue to support both methods. Use the `peerOptimizationLevel` + # constructor parameter to specify which method to use, for backwards-compatibiltiy purposes. + + connect @2 (host :Text, headers :List(HttpHeader), down :ByteStream, + context :ConnectClientRequestContext, settings :ConnectSettings) + -> (up :ByteStream); + # Setup an HTTP CONNECT proxy tunnel. + # + # The client sends the request host/headers together with a `down` ByteStream that will be used + # for communication across the tunnel. The server will respond with the other side of that + # ByteStream for two-way communication. The `context` includes callbacks which are used to + # supply the client with headers. + + interface ClientRequestContext { + # Provides callbacks for the server to send the response. + + startResponse @0 (response :HttpResponse) -> (body :ByteStream); + # Server calls this method to send the response status and headers and to begin streaming the + # response body. `body` will be null in the case that response.bodySize.fixed == 0, which is + # required for HEAD responses and status codes 204, 205, and 304. + + startWebSocket @1 (headers :List(HttpHeader), upSocket :WebSocket) + -> (downSocket :WebSocket); + # Server calls this method to indicate that the request is a valid WebSocket handshake and it + # wishes to accept it as a WebSocket. + # + # Client -> Server WebSocket frames will be sent via method calls on `upSocket`, while + # Server -> Client will be sent as calls to `downSocket`. + } + + interface ConnectClientRequestContext { + # Provides callbacks for the server to send the response. + + startConnect @0 (response :HttpResponse); + # Server calls this method to let the client know that the CONNECT request has been + # accepted. It also includes status code and header information. + + startError @1 (response :HttpResponse) -> (body :ByteStream); + # Server calls this method to let the client know that the CONNECT request has been rejected. + } + + interface ServerRequestContext { + # DEPRECATED: Used only with startRequest(); see comments there. + # + # Represents execution of a particular request on the server side. + # + # Dropping this object before the request completes will cancel the request. + # + # ServerRequestContext is always a promise capability. The client must wait for it to + # resolve using whenMoreResolved() in order to find out when the server is really done + # processing the request. This will throw an exception if the server failed in some way that + # could not be captured in the HTTP response. Note that it's possible for such an exception to + # be thrown even after the response body has been completely transmitted. + } +} + +struct ConnectSettings { + useTls @0 :Bool; +} + +interface WebSocket { + sendText @0 (text :Text) -> stream; + sendData @1 (data :Data) -> stream; + # Send a text or data frame. + + close @2 (code :UInt16, reason :Text); + # Send a close frame. +} + +struct HttpRequest { + # Standard HTTP request metadata. + + method @0 :HttpMethod; + url @1 :Text; + headers @2 :List(HttpHeader); + bodySize :union { + unknown @3 :Void; # e.g. due to transfer-encoding: chunked + fixed @4 :UInt64; # e.g. due to content-length + } +} + +struct HttpResponse { + # Standard HTTP response metadata. + + statusCode @0 :UInt16; + statusText @1 :Text; # leave null if it matches the default for statusCode + headers @2 :List(HttpHeader); + bodySize :union { + unknown @3 :Void; # e.g. due to transfer-encoding: chunked + fixed @4 :UInt64; # e.g. due to content-length + } +} + +enum HttpMethod { + # This enum aligns precisely with the kj::HttpMethod enum. However, the backwards-compat + # constraints of a public-facing C++ enum vs. an internal Cap'n Proto interface differ in + # several ways, which could possibly lead to divergence someday. For now, a unit test verifies + # that they match exactly; if that test ever fails, we'll have to figure out what to do about it. + + get @0; + head @1; + post @2; + put @3; + delete @4; + patch @5; + purge @6; + options @7; + trace @8; + + copy @9; + lock @10; + mkcol @11; + move @12; + propfind @13; + proppatch @14; + search @15; + unlock @16; + acl @17; + + report @18; + mkactivity @19; + checkout @20; + merge @21; + + msearch @22; + notify @23; + subscribe @24; + unsubscribe @25; +} + +annotation commonText @0x857745131db6fc83(enumerant) :Text; + +enum CommonHeaderName { + invalid @0; + # Dummy to serve as default value. Should never actually appear on wire. + + acceptCharset @1 $commonText("Accept-Charset"); + acceptEncoding @2 $commonText("Accept-Encoding"); + acceptLanguage @3 $commonText("Accept-Language"); + acceptRanges @4 $commonText("Accept-Ranges"); + accept @5 $commonText("Accept"); + accessControlAllowOrigin @6 $commonText("Access-Control-Allow-Origin"); + age @7 $commonText("Age"); + allow @8 $commonText("Allow"); + authorization @9 $commonText("Authorization"); + cacheControl @10 $commonText("Cache-Control"); + contentDisposition @11 $commonText("Content-Disposition"); + contentEncoding @12 $commonText("Content-Encoding"); + contentLanguage @13 $commonText("Content-Language"); + contentLength @14 $commonText("Content-Length"); + contentLocation @15 $commonText("Content-Location"); + contentRange @16 $commonText("Content-Range"); + contentType @17 $commonText("Content-Type"); + cookie @18 $commonText("Cookie"); + date @19 $commonText("Date"); + etag @20 $commonText("ETag"); + expect @21 $commonText("Expect"); + expires @22 $commonText("Expires"); + from @23 $commonText("From"); + host @24 $commonText("Host"); + ifMatch @25 $commonText("If-Match"); + ifModifiedSince @26 $commonText("If-Modified-Since"); + ifNoneMatch @27 $commonText("If-None-Match"); + ifRange @28 $commonText("If-Range"); + ifUnmodifiedSince @29 $commonText("If-Unmodified-Since"); + lastModified @30 $commonText("Last-Modified"); + link @31 $commonText("Link"); + location @32 $commonText("Location"); + maxForwards @33 $commonText("Max-Forwards"); + proxyAuthenticate @34 $commonText("Proxy-Authenticate"); + proxyAuthorization @35 $commonText("Proxy-Authorization"); + range @36 $commonText("Range"); + referer @37 $commonText("Referer"); + refresh @38 $commonText("Refresh"); + retryAfter @39 $commonText("Retry-After"); + server @40 $commonText("Server"); + setCookie @41 $commonText("Set-Cookie"); + strictTransportSecurity @42 $commonText("Strict-Transport-Security"); + transferEncoding @43 $commonText("Transfer-Encoding"); + userAgent @44 $commonText("User-Agent"); + vary @45 $commonText("Vary"); + via @46 $commonText("Via"); + wwwAuthenticate @47 $commonText("WWW-Authenticate"); +} + +enum CommonHeaderValue { + invalid @0; + + gzipDeflate @1 $commonText("gzip, deflate"); + + # TODO(someday): "gzip, deflate" is the only common header value recognized by HPACK. +} + +struct HttpHeader { + union { + common :group { + name @0 :CommonHeaderName; + union { + commonValue @1 :CommonHeaderValue; + value @2 :Text; + } + } + uncommon @3 :NameValue; + } + + struct NameValue { + name @0 :Text; + value @1 :Text; + } +} +using Go = import "/go.capnp"; +$Go.package("httpovercapnp"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/httpovercapnp"); diff --git a/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go b/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go new file mode 100644 index 00000000..c15422ac --- /dev/null +++ b/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go @@ -0,0 +1,4281 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package httpovercapnp + +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" + bytestream "capnproto.org/go/capnp/v3/std/capnp/bytestream" + stream "capnproto.org/go/capnp/v3/std/capnp/stream" + context "context" + strconv "strconv" +) + +const CommonText = uint64(0x857745131db6fc83) + +type HttpService capnp.Client + +// HttpService_TypeID is the unique identifier for the type HttpService. +const HttpService_TypeID = 0x92963bfdad2beb6a + +func (c HttpService) StartRequest(ctx context.Context, params func(HttpService_startRequest_Params) error) (HttpService_startRequest_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "startRequest", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 2} + s.PlaceArgs = func(s capnp.Struct) error { return params(HttpService_startRequest_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_startRequest_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService) Request(ctx context.Context, params func(HttpService_request_Params) error) (HttpService_request_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "request", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 2} + s.PlaceArgs = func(s capnp.Struct) error { return params(HttpService_request_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_request_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService) Connect(ctx context.Context, params func(HttpService_connect_Params) error) (HttpService_connect_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 2, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "connect", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 5} + s.PlaceArgs = func(s capnp.Struct) error { return params(HttpService_connect_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_connect_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService) 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 HttpService) String() string { + return "HttpService(" + 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 HttpService) AddRef() HttpService { + return HttpService(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 HttpService) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c HttpService) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c HttpService) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (HttpService) DecodeFromPtr(p capnp.Ptr) HttpService { + return HttpService(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 HttpService) 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 HttpService) IsSame(other HttpService) 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 HttpService) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c HttpService) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A HttpService_Server is a HttpService with a local implementation. +type HttpService_Server interface { + StartRequest(context.Context, HttpService_startRequest) error + + Request(context.Context, HttpService_request) error + + Connect(context.Context, HttpService_connect) error +} + +// HttpService_NewServer creates a new Server from an implementation of HttpService_Server. +func HttpService_NewServer(s HttpService_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(HttpService_Methods(nil, s), s, c) +} + +// HttpService_ServerToClient creates a new Client from an implementation of HttpService_Server. +// The caller is responsible for calling Release on the returned Client. +func HttpService_ServerToClient(s HttpService_Server) HttpService { + return HttpService(capnp.NewClient(HttpService_NewServer(s))) +} + +// HttpService_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func HttpService_Methods(methods []server.Method, s HttpService_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 3) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "startRequest", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartRequest(ctx, HttpService_startRequest{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "request", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Request(ctx, HttpService_request{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0x92963bfdad2beb6a, + MethodID: 2, + InterfaceName: "http-over-capnp.capnp:HttpService", + MethodName: "connect", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Connect(ctx, HttpService_connect{call}) + }, + }) + + return methods +} + +// HttpService_startRequest holds the state for a server call to HttpService.startRequest. +// See server.Call for documentation. +type HttpService_startRequest struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_startRequest) Args() HttpService_startRequest_Params { + return HttpService_startRequest_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_startRequest) AllocResults() (HttpService_startRequest_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_startRequest_Results(r), err +} + +// HttpService_request holds the state for a server call to HttpService.request. +// See server.Call for documentation. +type HttpService_request struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_request) Args() HttpService_request_Params { + return HttpService_request_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_request) AllocResults() (HttpService_request_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_request_Results(r), err +} + +// HttpService_connect holds the state for a server call to HttpService.connect. +// See server.Call for documentation. +type HttpService_connect struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_connect) Args() HttpService_connect_Params { + return HttpService_connect_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_connect) AllocResults() (HttpService_connect_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_connect_Results(r), err +} + +// HttpService_List is a list of HttpService. +type HttpService_List = capnp.CapList[HttpService] + +// NewHttpService creates a new list of HttpService. +func NewHttpService_List(s *capnp.Segment, sz int32) (HttpService_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[HttpService](l), err +} + +type HttpService_ClientRequestContext capnp.Client + +// HttpService_ClientRequestContext_TypeID is the unique identifier for the type HttpService_ClientRequestContext. +const HttpService_ClientRequestContext_TypeID = 0xea3256705c0b63ba + +func (c HttpService_ClientRequestContext) StartResponse(ctx context.Context, params func(HttpService_ClientRequestContext_startResponse_Params) error) (HttpService_ClientRequestContext_startResponse_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xea3256705c0b63ba, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService.ClientRequestContext", + MethodName: "startResponse", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(HttpService_ClientRequestContext_startResponse_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_ClientRequestContext_startResponse_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService_ClientRequestContext) StartWebSocket(ctx context.Context, params func(HttpService_ClientRequestContext_startWebSocket_Params) error) (HttpService_ClientRequestContext_startWebSocket_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xea3256705c0b63ba, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService.ClientRequestContext", + MethodName: "startWebSocket", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 2} + s.PlaceArgs = func(s capnp.Struct) error { return params(HttpService_ClientRequestContext_startWebSocket_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_ClientRequestContext_startWebSocket_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService_ClientRequestContext) 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 HttpService_ClientRequestContext) String() string { + return "HttpService_ClientRequestContext(" + 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 HttpService_ClientRequestContext) AddRef() HttpService_ClientRequestContext { + return HttpService_ClientRequestContext(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 HttpService_ClientRequestContext) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c HttpService_ClientRequestContext) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c HttpService_ClientRequestContext) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (HttpService_ClientRequestContext) DecodeFromPtr(p capnp.Ptr) HttpService_ClientRequestContext { + return HttpService_ClientRequestContext(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 HttpService_ClientRequestContext) 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 HttpService_ClientRequestContext) IsSame(other HttpService_ClientRequestContext) 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 HttpService_ClientRequestContext) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c HttpService_ClientRequestContext) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A HttpService_ClientRequestContext_Server is a HttpService_ClientRequestContext with a local implementation. +type HttpService_ClientRequestContext_Server interface { + StartResponse(context.Context, HttpService_ClientRequestContext_startResponse) error + + StartWebSocket(context.Context, HttpService_ClientRequestContext_startWebSocket) error +} + +// HttpService_ClientRequestContext_NewServer creates a new Server from an implementation of HttpService_ClientRequestContext_Server. +func HttpService_ClientRequestContext_NewServer(s HttpService_ClientRequestContext_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(HttpService_ClientRequestContext_Methods(nil, s), s, c) +} + +// HttpService_ClientRequestContext_ServerToClient creates a new Client from an implementation of HttpService_ClientRequestContext_Server. +// The caller is responsible for calling Release on the returned Client. +func HttpService_ClientRequestContext_ServerToClient(s HttpService_ClientRequestContext_Server) HttpService_ClientRequestContext { + return HttpService_ClientRequestContext(capnp.NewClient(HttpService_ClientRequestContext_NewServer(s))) +} + +// HttpService_ClientRequestContext_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func HttpService_ClientRequestContext_Methods(methods []server.Method, s HttpService_ClientRequestContext_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 2) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xea3256705c0b63ba, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService.ClientRequestContext", + MethodName: "startResponse", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartResponse(ctx, HttpService_ClientRequestContext_startResponse{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xea3256705c0b63ba, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService.ClientRequestContext", + MethodName: "startWebSocket", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartWebSocket(ctx, HttpService_ClientRequestContext_startWebSocket{call}) + }, + }) + + return methods +} + +// HttpService_ClientRequestContext_startResponse holds the state for a server call to HttpService_ClientRequestContext.startResponse. +// See server.Call for documentation. +type HttpService_ClientRequestContext_startResponse struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_ClientRequestContext_startResponse) Args() HttpService_ClientRequestContext_startResponse_Params { + return HttpService_ClientRequestContext_startResponse_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_ClientRequestContext_startResponse) AllocResults() (HttpService_ClientRequestContext_startResponse_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startResponse_Results(r), err +} + +// HttpService_ClientRequestContext_startWebSocket holds the state for a server call to HttpService_ClientRequestContext.startWebSocket. +// See server.Call for documentation. +type HttpService_ClientRequestContext_startWebSocket struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_ClientRequestContext_startWebSocket) Args() HttpService_ClientRequestContext_startWebSocket_Params { + return HttpService_ClientRequestContext_startWebSocket_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_ClientRequestContext_startWebSocket) AllocResults() (HttpService_ClientRequestContext_startWebSocket_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startWebSocket_Results(r), err +} + +// HttpService_ClientRequestContext_List is a list of HttpService_ClientRequestContext. +type HttpService_ClientRequestContext_List = capnp.CapList[HttpService_ClientRequestContext] + +// NewHttpService_ClientRequestContext creates a new list of HttpService_ClientRequestContext. +func NewHttpService_ClientRequestContext_List(s *capnp.Segment, sz int32) (HttpService_ClientRequestContext_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[HttpService_ClientRequestContext](l), err +} + +type HttpService_ClientRequestContext_startResponse_Params capnp.Struct + +// HttpService_ClientRequestContext_startResponse_Params_TypeID is the unique identifier for the type HttpService_ClientRequestContext_startResponse_Params. +const HttpService_ClientRequestContext_startResponse_Params_TypeID = 0x81e666258a901e30 + +func NewHttpService_ClientRequestContext_startResponse_Params(s *capnp.Segment) (HttpService_ClientRequestContext_startResponse_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startResponse_Params(st), err +} + +func NewRootHttpService_ClientRequestContext_startResponse_Params(s *capnp.Segment) (HttpService_ClientRequestContext_startResponse_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startResponse_Params(st), err +} + +func ReadRootHttpService_ClientRequestContext_startResponse_Params(msg *capnp.Message) (HttpService_ClientRequestContext_startResponse_Params, error) { + root, err := msg.Root() + return HttpService_ClientRequestContext_startResponse_Params(root.Struct()), err +} + +func (s HttpService_ClientRequestContext_startResponse_Params) String() string { + str, _ := text.Marshal(0x81e666258a901e30, capnp.Struct(s)) + return str +} + +func (s HttpService_ClientRequestContext_startResponse_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ClientRequestContext_startResponse_Params) DecodeFromPtr(p capnp.Ptr) HttpService_ClientRequestContext_startResponse_Params { + return HttpService_ClientRequestContext_startResponse_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ClientRequestContext_startResponse_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ClientRequestContext_startResponse_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ClientRequestContext_startResponse_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ClientRequestContext_startResponse_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ClientRequestContext_startResponse_Params) Response() (HttpResponse, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpResponse(p.Struct()), err +} + +func (s HttpService_ClientRequestContext_startResponse_Params) HasResponse() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ClientRequestContext_startResponse_Params) SetResponse(v HttpResponse) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewResponse sets the response field to a newly +// allocated HttpResponse struct, preferring placement in s's segment. +func (s HttpService_ClientRequestContext_startResponse_Params) NewResponse() (HttpResponse, error) { + ss, err := NewHttpResponse(capnp.Struct(s).Segment()) + if err != nil { + return HttpResponse{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// HttpService_ClientRequestContext_startResponse_Params_List is a list of HttpService_ClientRequestContext_startResponse_Params. +type HttpService_ClientRequestContext_startResponse_Params_List = capnp.StructList[HttpService_ClientRequestContext_startResponse_Params] + +// NewHttpService_ClientRequestContext_startResponse_Params creates a new list of HttpService_ClientRequestContext_startResponse_Params. +func NewHttpService_ClientRequestContext_startResponse_Params_List(s *capnp.Segment, sz int32) (HttpService_ClientRequestContext_startResponse_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ClientRequestContext_startResponse_Params](l), err +} + +// HttpService_ClientRequestContext_startResponse_Params_Future is a wrapper for a HttpService_ClientRequestContext_startResponse_Params promised by a client call. +type HttpService_ClientRequestContext_startResponse_Params_Future struct{ *capnp.Future } + +func (f HttpService_ClientRequestContext_startResponse_Params_Future) Struct() (HttpService_ClientRequestContext_startResponse_Params, error) { + p, err := f.Future.Ptr() + return HttpService_ClientRequestContext_startResponse_Params(p.Struct()), err +} +func (p HttpService_ClientRequestContext_startResponse_Params_Future) Response() HttpResponse_Future { + return HttpResponse_Future{Future: p.Future.Field(0, nil)} +} + +type HttpService_ClientRequestContext_startResponse_Results capnp.Struct + +// HttpService_ClientRequestContext_startResponse_Results_TypeID is the unique identifier for the type HttpService_ClientRequestContext_startResponse_Results. +const HttpService_ClientRequestContext_startResponse_Results_TypeID = 0x955c85d7a557d8e9 + +func NewHttpService_ClientRequestContext_startResponse_Results(s *capnp.Segment) (HttpService_ClientRequestContext_startResponse_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startResponse_Results(st), err +} + +func NewRootHttpService_ClientRequestContext_startResponse_Results(s *capnp.Segment) (HttpService_ClientRequestContext_startResponse_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startResponse_Results(st), err +} + +func ReadRootHttpService_ClientRequestContext_startResponse_Results(msg *capnp.Message) (HttpService_ClientRequestContext_startResponse_Results, error) { + root, err := msg.Root() + return HttpService_ClientRequestContext_startResponse_Results(root.Struct()), err +} + +func (s HttpService_ClientRequestContext_startResponse_Results) String() string { + str, _ := text.Marshal(0x955c85d7a557d8e9, capnp.Struct(s)) + return str +} + +func (s HttpService_ClientRequestContext_startResponse_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ClientRequestContext_startResponse_Results) DecodeFromPtr(p capnp.Ptr) HttpService_ClientRequestContext_startResponse_Results { + return HttpService_ClientRequestContext_startResponse_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ClientRequestContext_startResponse_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ClientRequestContext_startResponse_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ClientRequestContext_startResponse_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ClientRequestContext_startResponse_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ClientRequestContext_startResponse_Results) Body() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_ClientRequestContext_startResponse_Results) HasBody() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ClientRequestContext_startResponse_Results) SetBody(v bytestream.ByteStream) 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()) +} + +// HttpService_ClientRequestContext_startResponse_Results_List is a list of HttpService_ClientRequestContext_startResponse_Results. +type HttpService_ClientRequestContext_startResponse_Results_List = capnp.StructList[HttpService_ClientRequestContext_startResponse_Results] + +// NewHttpService_ClientRequestContext_startResponse_Results creates a new list of HttpService_ClientRequestContext_startResponse_Results. +func NewHttpService_ClientRequestContext_startResponse_Results_List(s *capnp.Segment, sz int32) (HttpService_ClientRequestContext_startResponse_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ClientRequestContext_startResponse_Results](l), err +} + +// HttpService_ClientRequestContext_startResponse_Results_Future is a wrapper for a HttpService_ClientRequestContext_startResponse_Results promised by a client call. +type HttpService_ClientRequestContext_startResponse_Results_Future struct{ *capnp.Future } + +func (f HttpService_ClientRequestContext_startResponse_Results_Future) Struct() (HttpService_ClientRequestContext_startResponse_Results, error) { + p, err := f.Future.Ptr() + return HttpService_ClientRequestContext_startResponse_Results(p.Struct()), err +} +func (p HttpService_ClientRequestContext_startResponse_Results_Future) Body() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(0, nil).Client()) +} + +type HttpService_ClientRequestContext_startWebSocket_Params capnp.Struct + +// HttpService_ClientRequestContext_startWebSocket_Params_TypeID is the unique identifier for the type HttpService_ClientRequestContext_startWebSocket_Params. +const HttpService_ClientRequestContext_startWebSocket_Params_TypeID = 0xf6850b405e21d2c1 + +func NewHttpService_ClientRequestContext_startWebSocket_Params(s *capnp.Segment) (HttpService_ClientRequestContext_startWebSocket_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_ClientRequestContext_startWebSocket_Params(st), err +} + +func NewRootHttpService_ClientRequestContext_startWebSocket_Params(s *capnp.Segment) (HttpService_ClientRequestContext_startWebSocket_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_ClientRequestContext_startWebSocket_Params(st), err +} + +func ReadRootHttpService_ClientRequestContext_startWebSocket_Params(msg *capnp.Message) (HttpService_ClientRequestContext_startWebSocket_Params, error) { + root, err := msg.Root() + return HttpService_ClientRequestContext_startWebSocket_Params(root.Struct()), err +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) String() string { + str, _ := text.Marshal(0xf6850b405e21d2c1, capnp.Struct(s)) + return str +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ClientRequestContext_startWebSocket_Params) DecodeFromPtr(p capnp.Ptr) HttpService_ClientRequestContext_startWebSocket_Params { + return HttpService_ClientRequestContext_startWebSocket_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ClientRequestContext_startWebSocket_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ClientRequestContext_startWebSocket_Params) Headers() (HttpHeader_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpHeader_List(p.List()), err +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) HasHeaders() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) SetHeaders(v HttpHeader_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewHeaders sets the headers field to a newly +// allocated HttpHeader_List, preferring placement in s's segment. +func (s HttpService_ClientRequestContext_startWebSocket_Params) NewHeaders(n int32) (HttpHeader_List, error) { + l, err := NewHttpHeader_List(capnp.Struct(s).Segment(), n) + if err != nil { + return HttpHeader_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s HttpService_ClientRequestContext_startWebSocket_Params) UpSocket() WebSocket { + p, _ := capnp.Struct(s).Ptr(1) + return WebSocket(p.Interface().Client()) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) HasUpSocket() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Params) SetUpSocket(v WebSocket) 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()) +} + +// HttpService_ClientRequestContext_startWebSocket_Params_List is a list of HttpService_ClientRequestContext_startWebSocket_Params. +type HttpService_ClientRequestContext_startWebSocket_Params_List = capnp.StructList[HttpService_ClientRequestContext_startWebSocket_Params] + +// NewHttpService_ClientRequestContext_startWebSocket_Params creates a new list of HttpService_ClientRequestContext_startWebSocket_Params. +func NewHttpService_ClientRequestContext_startWebSocket_Params_List(s *capnp.Segment, sz int32) (HttpService_ClientRequestContext_startWebSocket_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[HttpService_ClientRequestContext_startWebSocket_Params](l), err +} + +// HttpService_ClientRequestContext_startWebSocket_Params_Future is a wrapper for a HttpService_ClientRequestContext_startWebSocket_Params promised by a client call. +type HttpService_ClientRequestContext_startWebSocket_Params_Future struct{ *capnp.Future } + +func (f HttpService_ClientRequestContext_startWebSocket_Params_Future) Struct() (HttpService_ClientRequestContext_startWebSocket_Params, error) { + p, err := f.Future.Ptr() + return HttpService_ClientRequestContext_startWebSocket_Params(p.Struct()), err +} +func (p HttpService_ClientRequestContext_startWebSocket_Params_Future) UpSocket() WebSocket { + return WebSocket(p.Future.Field(1, nil).Client()) +} + +type HttpService_ClientRequestContext_startWebSocket_Results capnp.Struct + +// HttpService_ClientRequestContext_startWebSocket_Results_TypeID is the unique identifier for the type HttpService_ClientRequestContext_startWebSocket_Results. +const HttpService_ClientRequestContext_startWebSocket_Results_TypeID = 0xbd146efdadd86c3d + +func NewHttpService_ClientRequestContext_startWebSocket_Results(s *capnp.Segment) (HttpService_ClientRequestContext_startWebSocket_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startWebSocket_Results(st), err +} + +func NewRootHttpService_ClientRequestContext_startWebSocket_Results(s *capnp.Segment) (HttpService_ClientRequestContext_startWebSocket_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ClientRequestContext_startWebSocket_Results(st), err +} + +func ReadRootHttpService_ClientRequestContext_startWebSocket_Results(msg *capnp.Message) (HttpService_ClientRequestContext_startWebSocket_Results, error) { + root, err := msg.Root() + return HttpService_ClientRequestContext_startWebSocket_Results(root.Struct()), err +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) String() string { + str, _ := text.Marshal(0xbd146efdadd86c3d, capnp.Struct(s)) + return str +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ClientRequestContext_startWebSocket_Results) DecodeFromPtr(p capnp.Ptr) HttpService_ClientRequestContext_startWebSocket_Results { + return HttpService_ClientRequestContext_startWebSocket_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ClientRequestContext_startWebSocket_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ClientRequestContext_startWebSocket_Results) DownSocket() WebSocket { + p, _ := capnp.Struct(s).Ptr(0) + return WebSocket(p.Interface().Client()) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) HasDownSocket() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ClientRequestContext_startWebSocket_Results) SetDownSocket(v WebSocket) 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()) +} + +// HttpService_ClientRequestContext_startWebSocket_Results_List is a list of HttpService_ClientRequestContext_startWebSocket_Results. +type HttpService_ClientRequestContext_startWebSocket_Results_List = capnp.StructList[HttpService_ClientRequestContext_startWebSocket_Results] + +// NewHttpService_ClientRequestContext_startWebSocket_Results creates a new list of HttpService_ClientRequestContext_startWebSocket_Results. +func NewHttpService_ClientRequestContext_startWebSocket_Results_List(s *capnp.Segment, sz int32) (HttpService_ClientRequestContext_startWebSocket_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ClientRequestContext_startWebSocket_Results](l), err +} + +// HttpService_ClientRequestContext_startWebSocket_Results_Future is a wrapper for a HttpService_ClientRequestContext_startWebSocket_Results promised by a client call. +type HttpService_ClientRequestContext_startWebSocket_Results_Future struct{ *capnp.Future } + +func (f HttpService_ClientRequestContext_startWebSocket_Results_Future) Struct() (HttpService_ClientRequestContext_startWebSocket_Results, error) { + p, err := f.Future.Ptr() + return HttpService_ClientRequestContext_startWebSocket_Results(p.Struct()), err +} +func (p HttpService_ClientRequestContext_startWebSocket_Results_Future) DownSocket() WebSocket { + return WebSocket(p.Future.Field(0, nil).Client()) +} + +type HttpService_ConnectClientRequestContext capnp.Client + +// HttpService_ConnectClientRequestContext_TypeID is the unique identifier for the type HttpService_ConnectClientRequestContext. +const HttpService_ConnectClientRequestContext_TypeID = 0xda572939a4c3d728 + +func (c HttpService_ConnectClientRequestContext) StartConnect(ctx context.Context, params func(HttpService_ConnectClientRequestContext_startConnect_Params) error) (HttpService_ConnectClientRequestContext_startConnect_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xda572939a4c3d728, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService.ConnectClientRequestContext", + MethodName: "startConnect", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { + return params(HttpService_ConnectClientRequestContext_startConnect_Params(s)) + } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_ConnectClientRequestContext_startConnect_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService_ConnectClientRequestContext) StartError(ctx context.Context, params func(HttpService_ConnectClientRequestContext_startError_Params) error) (HttpService_ConnectClientRequestContext_startError_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xda572939a4c3d728, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService.ConnectClientRequestContext", + MethodName: "startError", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { + return params(HttpService_ConnectClientRequestContext_startError_Params(s)) + } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return HttpService_ConnectClientRequestContext_startError_Results_Future{Future: ans.Future()}, release + +} + +func (c HttpService_ConnectClientRequestContext) 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 HttpService_ConnectClientRequestContext) String() string { + return "HttpService_ConnectClientRequestContext(" + 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 HttpService_ConnectClientRequestContext) AddRef() HttpService_ConnectClientRequestContext { + return HttpService_ConnectClientRequestContext(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 HttpService_ConnectClientRequestContext) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c HttpService_ConnectClientRequestContext) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c HttpService_ConnectClientRequestContext) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (HttpService_ConnectClientRequestContext) DecodeFromPtr(p capnp.Ptr) HttpService_ConnectClientRequestContext { + return HttpService_ConnectClientRequestContext(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 HttpService_ConnectClientRequestContext) 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 HttpService_ConnectClientRequestContext) IsSame(other HttpService_ConnectClientRequestContext) 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 HttpService_ConnectClientRequestContext) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c HttpService_ConnectClientRequestContext) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A HttpService_ConnectClientRequestContext_Server is a HttpService_ConnectClientRequestContext with a local implementation. +type HttpService_ConnectClientRequestContext_Server interface { + StartConnect(context.Context, HttpService_ConnectClientRequestContext_startConnect) error + + StartError(context.Context, HttpService_ConnectClientRequestContext_startError) error +} + +// HttpService_ConnectClientRequestContext_NewServer creates a new Server from an implementation of HttpService_ConnectClientRequestContext_Server. +func HttpService_ConnectClientRequestContext_NewServer(s HttpService_ConnectClientRequestContext_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(HttpService_ConnectClientRequestContext_Methods(nil, s), s, c) +} + +// HttpService_ConnectClientRequestContext_ServerToClient creates a new Client from an implementation of HttpService_ConnectClientRequestContext_Server. +// The caller is responsible for calling Release on the returned Client. +func HttpService_ConnectClientRequestContext_ServerToClient(s HttpService_ConnectClientRequestContext_Server) HttpService_ConnectClientRequestContext { + return HttpService_ConnectClientRequestContext(capnp.NewClient(HttpService_ConnectClientRequestContext_NewServer(s))) +} + +// HttpService_ConnectClientRequestContext_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func HttpService_ConnectClientRequestContext_Methods(methods []server.Method, s HttpService_ConnectClientRequestContext_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 2) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xda572939a4c3d728, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:HttpService.ConnectClientRequestContext", + MethodName: "startConnect", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartConnect(ctx, HttpService_ConnectClientRequestContext_startConnect{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xda572939a4c3d728, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:HttpService.ConnectClientRequestContext", + MethodName: "startError", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.StartError(ctx, HttpService_ConnectClientRequestContext_startError{call}) + }, + }) + + return methods +} + +// HttpService_ConnectClientRequestContext_startConnect holds the state for a server call to HttpService_ConnectClientRequestContext.startConnect. +// See server.Call for documentation. +type HttpService_ConnectClientRequestContext_startConnect struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_ConnectClientRequestContext_startConnect) Args() HttpService_ConnectClientRequestContext_startConnect_Params { + return HttpService_ConnectClientRequestContext_startConnect_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_ConnectClientRequestContext_startConnect) AllocResults() (HttpService_ConnectClientRequestContext_startConnect_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return HttpService_ConnectClientRequestContext_startConnect_Results(r), err +} + +// HttpService_ConnectClientRequestContext_startError holds the state for a server call to HttpService_ConnectClientRequestContext.startError. +// See server.Call for documentation. +type HttpService_ConnectClientRequestContext_startError struct { + *server.Call +} + +// Args returns the call's arguments. +func (c HttpService_ConnectClientRequestContext_startError) Args() HttpService_ConnectClientRequestContext_startError_Params { + return HttpService_ConnectClientRequestContext_startError_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c HttpService_ConnectClientRequestContext_startError) AllocResults() (HttpService_ConnectClientRequestContext_startError_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startError_Results(r), err +} + +// HttpService_ConnectClientRequestContext_List is a list of HttpService_ConnectClientRequestContext. +type HttpService_ConnectClientRequestContext_List = capnp.CapList[HttpService_ConnectClientRequestContext] + +// NewHttpService_ConnectClientRequestContext creates a new list of HttpService_ConnectClientRequestContext. +func NewHttpService_ConnectClientRequestContext_List(s *capnp.Segment, sz int32) (HttpService_ConnectClientRequestContext_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[HttpService_ConnectClientRequestContext](l), err +} + +type HttpService_ConnectClientRequestContext_startConnect_Params capnp.Struct + +// HttpService_ConnectClientRequestContext_startConnect_Params_TypeID is the unique identifier for the type HttpService_ConnectClientRequestContext_startConnect_Params. +const HttpService_ConnectClientRequestContext_startConnect_Params_TypeID = 0xd0eab1ea093a6673 + +func NewHttpService_ConnectClientRequestContext_startConnect_Params(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startConnect_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startConnect_Params(st), err +} + +func NewRootHttpService_ConnectClientRequestContext_startConnect_Params(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startConnect_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startConnect_Params(st), err +} + +func ReadRootHttpService_ConnectClientRequestContext_startConnect_Params(msg *capnp.Message) (HttpService_ConnectClientRequestContext_startConnect_Params, error) { + root, err := msg.Root() + return HttpService_ConnectClientRequestContext_startConnect_Params(root.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) String() string { + str, _ := text.Marshal(0xd0eab1ea093a6673, capnp.Struct(s)) + return str +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ConnectClientRequestContext_startConnect_Params) DecodeFromPtr(p capnp.Ptr) HttpService_ConnectClientRequestContext_startConnect_Params { + return HttpService_ConnectClientRequestContext_startConnect_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ConnectClientRequestContext_startConnect_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ConnectClientRequestContext_startConnect_Params) Response() (HttpResponse, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpResponse(p.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) HasResponse() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Params) SetResponse(v HttpResponse) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewResponse sets the response field to a newly +// allocated HttpResponse struct, preferring placement in s's segment. +func (s HttpService_ConnectClientRequestContext_startConnect_Params) NewResponse() (HttpResponse, error) { + ss, err := NewHttpResponse(capnp.Struct(s).Segment()) + if err != nil { + return HttpResponse{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// HttpService_ConnectClientRequestContext_startConnect_Params_List is a list of HttpService_ConnectClientRequestContext_startConnect_Params. +type HttpService_ConnectClientRequestContext_startConnect_Params_List = capnp.StructList[HttpService_ConnectClientRequestContext_startConnect_Params] + +// NewHttpService_ConnectClientRequestContext_startConnect_Params creates a new list of HttpService_ConnectClientRequestContext_startConnect_Params. +func NewHttpService_ConnectClientRequestContext_startConnect_Params_List(s *capnp.Segment, sz int32) (HttpService_ConnectClientRequestContext_startConnect_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ConnectClientRequestContext_startConnect_Params](l), err +} + +// HttpService_ConnectClientRequestContext_startConnect_Params_Future is a wrapper for a HttpService_ConnectClientRequestContext_startConnect_Params promised by a client call. +type HttpService_ConnectClientRequestContext_startConnect_Params_Future struct{ *capnp.Future } + +func (f HttpService_ConnectClientRequestContext_startConnect_Params_Future) Struct() (HttpService_ConnectClientRequestContext_startConnect_Params, error) { + p, err := f.Future.Ptr() + return HttpService_ConnectClientRequestContext_startConnect_Params(p.Struct()), err +} +func (p HttpService_ConnectClientRequestContext_startConnect_Params_Future) Response() HttpResponse_Future { + return HttpResponse_Future{Future: p.Future.Field(0, nil)} +} + +type HttpService_ConnectClientRequestContext_startConnect_Results capnp.Struct + +// HttpService_ConnectClientRequestContext_startConnect_Results_TypeID is the unique identifier for the type HttpService_ConnectClientRequestContext_startConnect_Results. +const HttpService_ConnectClientRequestContext_startConnect_Results_TypeID = 0xfa73959a9a2b477d + +func NewHttpService_ConnectClientRequestContext_startConnect_Results(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startConnect_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return HttpService_ConnectClientRequestContext_startConnect_Results(st), err +} + +func NewRootHttpService_ConnectClientRequestContext_startConnect_Results(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startConnect_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return HttpService_ConnectClientRequestContext_startConnect_Results(st), err +} + +func ReadRootHttpService_ConnectClientRequestContext_startConnect_Results(msg *capnp.Message) (HttpService_ConnectClientRequestContext_startConnect_Results, error) { + root, err := msg.Root() + return HttpService_ConnectClientRequestContext_startConnect_Results(root.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Results) String() string { + str, _ := text.Marshal(0xfa73959a9a2b477d, capnp.Struct(s)) + return str +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ConnectClientRequestContext_startConnect_Results) DecodeFromPtr(p capnp.Ptr) HttpService_ConnectClientRequestContext_startConnect_Results { + return HttpService_ConnectClientRequestContext_startConnect_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ConnectClientRequestContext_startConnect_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ConnectClientRequestContext_startConnect_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// HttpService_ConnectClientRequestContext_startConnect_Results_List is a list of HttpService_ConnectClientRequestContext_startConnect_Results. +type HttpService_ConnectClientRequestContext_startConnect_Results_List = capnp.StructList[HttpService_ConnectClientRequestContext_startConnect_Results] + +// NewHttpService_ConnectClientRequestContext_startConnect_Results creates a new list of HttpService_ConnectClientRequestContext_startConnect_Results. +func NewHttpService_ConnectClientRequestContext_startConnect_Results_List(s *capnp.Segment, sz int32) (HttpService_ConnectClientRequestContext_startConnect_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[HttpService_ConnectClientRequestContext_startConnect_Results](l), err +} + +// HttpService_ConnectClientRequestContext_startConnect_Results_Future is a wrapper for a HttpService_ConnectClientRequestContext_startConnect_Results promised by a client call. +type HttpService_ConnectClientRequestContext_startConnect_Results_Future struct{ *capnp.Future } + +func (f HttpService_ConnectClientRequestContext_startConnect_Results_Future) Struct() (HttpService_ConnectClientRequestContext_startConnect_Results, error) { + p, err := f.Future.Ptr() + return HttpService_ConnectClientRequestContext_startConnect_Results(p.Struct()), err +} + +type HttpService_ConnectClientRequestContext_startError_Params capnp.Struct + +// HttpService_ConnectClientRequestContext_startError_Params_TypeID is the unique identifier for the type HttpService_ConnectClientRequestContext_startError_Params. +const HttpService_ConnectClientRequestContext_startError_Params_TypeID = 0xfe0ea4cde5df8164 + +func NewHttpService_ConnectClientRequestContext_startError_Params(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startError_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startError_Params(st), err +} + +func NewRootHttpService_ConnectClientRequestContext_startError_Params(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startError_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startError_Params(st), err +} + +func ReadRootHttpService_ConnectClientRequestContext_startError_Params(msg *capnp.Message) (HttpService_ConnectClientRequestContext_startError_Params, error) { + root, err := msg.Root() + return HttpService_ConnectClientRequestContext_startError_Params(root.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) String() string { + str, _ := text.Marshal(0xfe0ea4cde5df8164, capnp.Struct(s)) + return str +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ConnectClientRequestContext_startError_Params) DecodeFromPtr(p capnp.Ptr) HttpService_ConnectClientRequestContext_startError_Params { + return HttpService_ConnectClientRequestContext_startError_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ConnectClientRequestContext_startError_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ConnectClientRequestContext_startError_Params) Response() (HttpResponse, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpResponse(p.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) HasResponse() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ConnectClientRequestContext_startError_Params) SetResponse(v HttpResponse) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewResponse sets the response field to a newly +// allocated HttpResponse struct, preferring placement in s's segment. +func (s HttpService_ConnectClientRequestContext_startError_Params) NewResponse() (HttpResponse, error) { + ss, err := NewHttpResponse(capnp.Struct(s).Segment()) + if err != nil { + return HttpResponse{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// HttpService_ConnectClientRequestContext_startError_Params_List is a list of HttpService_ConnectClientRequestContext_startError_Params. +type HttpService_ConnectClientRequestContext_startError_Params_List = capnp.StructList[HttpService_ConnectClientRequestContext_startError_Params] + +// NewHttpService_ConnectClientRequestContext_startError_Params creates a new list of HttpService_ConnectClientRequestContext_startError_Params. +func NewHttpService_ConnectClientRequestContext_startError_Params_List(s *capnp.Segment, sz int32) (HttpService_ConnectClientRequestContext_startError_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ConnectClientRequestContext_startError_Params](l), err +} + +// HttpService_ConnectClientRequestContext_startError_Params_Future is a wrapper for a HttpService_ConnectClientRequestContext_startError_Params promised by a client call. +type HttpService_ConnectClientRequestContext_startError_Params_Future struct{ *capnp.Future } + +func (f HttpService_ConnectClientRequestContext_startError_Params_Future) Struct() (HttpService_ConnectClientRequestContext_startError_Params, error) { + p, err := f.Future.Ptr() + return HttpService_ConnectClientRequestContext_startError_Params(p.Struct()), err +} +func (p HttpService_ConnectClientRequestContext_startError_Params_Future) Response() HttpResponse_Future { + return HttpResponse_Future{Future: p.Future.Field(0, nil)} +} + +type HttpService_ConnectClientRequestContext_startError_Results capnp.Struct + +// HttpService_ConnectClientRequestContext_startError_Results_TypeID is the unique identifier for the type HttpService_ConnectClientRequestContext_startError_Results. +const HttpService_ConnectClientRequestContext_startError_Results_TypeID = 0xb92efa728643f0ed + +func NewHttpService_ConnectClientRequestContext_startError_Results(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startError_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startError_Results(st), err +} + +func NewRootHttpService_ConnectClientRequestContext_startError_Results(s *capnp.Segment) (HttpService_ConnectClientRequestContext_startError_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_ConnectClientRequestContext_startError_Results(st), err +} + +func ReadRootHttpService_ConnectClientRequestContext_startError_Results(msg *capnp.Message) (HttpService_ConnectClientRequestContext_startError_Results, error) { + root, err := msg.Root() + return HttpService_ConnectClientRequestContext_startError_Results(root.Struct()), err +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) String() string { + str, _ := text.Marshal(0xb92efa728643f0ed, capnp.Struct(s)) + return str +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_ConnectClientRequestContext_startError_Results) DecodeFromPtr(p capnp.Ptr) HttpService_ConnectClientRequestContext_startError_Results { + return HttpService_ConnectClientRequestContext_startError_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_ConnectClientRequestContext_startError_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_ConnectClientRequestContext_startError_Results) Body() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) HasBody() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_ConnectClientRequestContext_startError_Results) SetBody(v bytestream.ByteStream) 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()) +} + +// HttpService_ConnectClientRequestContext_startError_Results_List is a list of HttpService_ConnectClientRequestContext_startError_Results. +type HttpService_ConnectClientRequestContext_startError_Results_List = capnp.StructList[HttpService_ConnectClientRequestContext_startError_Results] + +// NewHttpService_ConnectClientRequestContext_startError_Results creates a new list of HttpService_ConnectClientRequestContext_startError_Results. +func NewHttpService_ConnectClientRequestContext_startError_Results_List(s *capnp.Segment, sz int32) (HttpService_ConnectClientRequestContext_startError_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_ConnectClientRequestContext_startError_Results](l), err +} + +// HttpService_ConnectClientRequestContext_startError_Results_Future is a wrapper for a HttpService_ConnectClientRequestContext_startError_Results promised by a client call. +type HttpService_ConnectClientRequestContext_startError_Results_Future struct{ *capnp.Future } + +func (f HttpService_ConnectClientRequestContext_startError_Results_Future) Struct() (HttpService_ConnectClientRequestContext_startError_Results, error) { + p, err := f.Future.Ptr() + return HttpService_ConnectClientRequestContext_startError_Results(p.Struct()), err +} +func (p HttpService_ConnectClientRequestContext_startError_Results_Future) Body() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(0, nil).Client()) +} + +type HttpService_ServerRequestContext capnp.Client + +// HttpService_ServerRequestContext_TypeID is the unique identifier for the type HttpService_ServerRequestContext. +const HttpService_ServerRequestContext_TypeID = 0x99ae26bfd34f3f3b + +func (c HttpService_ServerRequestContext) 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 HttpService_ServerRequestContext) String() string { + return "HttpService_ServerRequestContext(" + 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 HttpService_ServerRequestContext) AddRef() HttpService_ServerRequestContext { + return HttpService_ServerRequestContext(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 HttpService_ServerRequestContext) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c HttpService_ServerRequestContext) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c HttpService_ServerRequestContext) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (HttpService_ServerRequestContext) DecodeFromPtr(p capnp.Ptr) HttpService_ServerRequestContext { + return HttpService_ServerRequestContext(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 HttpService_ServerRequestContext) 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 HttpService_ServerRequestContext) IsSame(other HttpService_ServerRequestContext) 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 HttpService_ServerRequestContext) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c HttpService_ServerRequestContext) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A HttpService_ServerRequestContext_Server is a HttpService_ServerRequestContext with a local implementation. +type HttpService_ServerRequestContext_Server interface { +} + +// HttpService_ServerRequestContext_NewServer creates a new Server from an implementation of HttpService_ServerRequestContext_Server. +func HttpService_ServerRequestContext_NewServer(s HttpService_ServerRequestContext_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(HttpService_ServerRequestContext_Methods(nil, s), s, c) +} + +// HttpService_ServerRequestContext_ServerToClient creates a new Client from an implementation of HttpService_ServerRequestContext_Server. +// The caller is responsible for calling Release on the returned Client. +func HttpService_ServerRequestContext_ServerToClient(s HttpService_ServerRequestContext_Server) HttpService_ServerRequestContext { + return HttpService_ServerRequestContext(capnp.NewClient(HttpService_ServerRequestContext_NewServer(s))) +} + +// HttpService_ServerRequestContext_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func HttpService_ServerRequestContext_Methods(methods []server.Method, s HttpService_ServerRequestContext_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 0) + } + + return methods +} + +// HttpService_ServerRequestContext_List is a list of HttpService_ServerRequestContext. +type HttpService_ServerRequestContext_List = capnp.CapList[HttpService_ServerRequestContext] + +// NewHttpService_ServerRequestContext creates a new list of HttpService_ServerRequestContext. +func NewHttpService_ServerRequestContext_List(s *capnp.Segment, sz int32) (HttpService_ServerRequestContext_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[HttpService_ServerRequestContext](l), err +} + +type HttpService_startRequest_Params capnp.Struct + +// HttpService_startRequest_Params_TypeID is the unique identifier for the type HttpService_startRequest_Params. +const HttpService_startRequest_Params_TypeID = 0xccefbf23794af7b3 + +func NewHttpService_startRequest_Params(s *capnp.Segment) (HttpService_startRequest_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_startRequest_Params(st), err +} + +func NewRootHttpService_startRequest_Params(s *capnp.Segment) (HttpService_startRequest_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_startRequest_Params(st), err +} + +func ReadRootHttpService_startRequest_Params(msg *capnp.Message) (HttpService_startRequest_Params, error) { + root, err := msg.Root() + return HttpService_startRequest_Params(root.Struct()), err +} + +func (s HttpService_startRequest_Params) String() string { + str, _ := text.Marshal(0xccefbf23794af7b3, capnp.Struct(s)) + return str +} + +func (s HttpService_startRequest_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_startRequest_Params) DecodeFromPtr(p capnp.Ptr) HttpService_startRequest_Params { + return HttpService_startRequest_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_startRequest_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_startRequest_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_startRequest_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_startRequest_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_startRequest_Params) Request() (HttpRequest, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpRequest(p.Struct()), err +} + +func (s HttpService_startRequest_Params) HasRequest() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_startRequest_Params) SetRequest(v HttpRequest) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewRequest sets the request field to a newly +// allocated HttpRequest struct, preferring placement in s's segment. +func (s HttpService_startRequest_Params) NewRequest() (HttpRequest, error) { + ss, err := NewHttpRequest(capnp.Struct(s).Segment()) + if err != nil { + return HttpRequest{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s HttpService_startRequest_Params) Context() HttpService_ClientRequestContext { + p, _ := capnp.Struct(s).Ptr(1) + return HttpService_ClientRequestContext(p.Interface().Client()) +} + +func (s HttpService_startRequest_Params) HasContext() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpService_startRequest_Params) SetContext(v HttpService_ClientRequestContext) 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()) +} + +// HttpService_startRequest_Params_List is a list of HttpService_startRequest_Params. +type HttpService_startRequest_Params_List = capnp.StructList[HttpService_startRequest_Params] + +// NewHttpService_startRequest_Params creates a new list of HttpService_startRequest_Params. +func NewHttpService_startRequest_Params_List(s *capnp.Segment, sz int32) (HttpService_startRequest_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[HttpService_startRequest_Params](l), err +} + +// HttpService_startRequest_Params_Future is a wrapper for a HttpService_startRequest_Params promised by a client call. +type HttpService_startRequest_Params_Future struct{ *capnp.Future } + +func (f HttpService_startRequest_Params_Future) Struct() (HttpService_startRequest_Params, error) { + p, err := f.Future.Ptr() + return HttpService_startRequest_Params(p.Struct()), err +} +func (p HttpService_startRequest_Params_Future) Request() HttpRequest_Future { + return HttpRequest_Future{Future: p.Future.Field(0, nil)} +} +func (p HttpService_startRequest_Params_Future) Context() HttpService_ClientRequestContext { + return HttpService_ClientRequestContext(p.Future.Field(1, nil).Client()) +} + +type HttpService_startRequest_Results capnp.Struct + +// HttpService_startRequest_Results_TypeID is the unique identifier for the type HttpService_startRequest_Results. +const HttpService_startRequest_Results_TypeID = 0xa9da072c30fec5de + +func NewHttpService_startRequest_Results(s *capnp.Segment) (HttpService_startRequest_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_startRequest_Results(st), err +} + +func NewRootHttpService_startRequest_Results(s *capnp.Segment) (HttpService_startRequest_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_startRequest_Results(st), err +} + +func ReadRootHttpService_startRequest_Results(msg *capnp.Message) (HttpService_startRequest_Results, error) { + root, err := msg.Root() + return HttpService_startRequest_Results(root.Struct()), err +} + +func (s HttpService_startRequest_Results) String() string { + str, _ := text.Marshal(0xa9da072c30fec5de, capnp.Struct(s)) + return str +} + +func (s HttpService_startRequest_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_startRequest_Results) DecodeFromPtr(p capnp.Ptr) HttpService_startRequest_Results { + return HttpService_startRequest_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_startRequest_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_startRequest_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_startRequest_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_startRequest_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_startRequest_Results) RequestBody() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_startRequest_Results) HasRequestBody() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_startRequest_Results) SetRequestBody(v bytestream.ByteStream) 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()) +} + +func (s HttpService_startRequest_Results) Context() HttpService_ServerRequestContext { + p, _ := capnp.Struct(s).Ptr(1) + return HttpService_ServerRequestContext(p.Interface().Client()) +} + +func (s HttpService_startRequest_Results) HasContext() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpService_startRequest_Results) SetContext(v HttpService_ServerRequestContext) 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()) +} + +// HttpService_startRequest_Results_List is a list of HttpService_startRequest_Results. +type HttpService_startRequest_Results_List = capnp.StructList[HttpService_startRequest_Results] + +// NewHttpService_startRequest_Results creates a new list of HttpService_startRequest_Results. +func NewHttpService_startRequest_Results_List(s *capnp.Segment, sz int32) (HttpService_startRequest_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[HttpService_startRequest_Results](l), err +} + +// HttpService_startRequest_Results_Future is a wrapper for a HttpService_startRequest_Results promised by a client call. +type HttpService_startRequest_Results_Future struct{ *capnp.Future } + +func (f HttpService_startRequest_Results_Future) Struct() (HttpService_startRequest_Results, error) { + p, err := f.Future.Ptr() + return HttpService_startRequest_Results(p.Struct()), err +} +func (p HttpService_startRequest_Results_Future) RequestBody() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(0, nil).Client()) +} + +func (p HttpService_startRequest_Results_Future) Context() HttpService_ServerRequestContext { + return HttpService_ServerRequestContext(p.Future.Field(1, nil).Client()) +} + +type HttpService_request_Params capnp.Struct + +// HttpService_request_Params_TypeID is the unique identifier for the type HttpService_request_Params. +const HttpService_request_Params_TypeID = 0xccc73319af8d2a1b + +func NewHttpService_request_Params(s *capnp.Segment) (HttpService_request_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_request_Params(st), err +} + +func NewRootHttpService_request_Params(s *capnp.Segment) (HttpService_request_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpService_request_Params(st), err +} + +func ReadRootHttpService_request_Params(msg *capnp.Message) (HttpService_request_Params, error) { + root, err := msg.Root() + return HttpService_request_Params(root.Struct()), err +} + +func (s HttpService_request_Params) String() string { + str, _ := text.Marshal(0xccc73319af8d2a1b, capnp.Struct(s)) + return str +} + +func (s HttpService_request_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_request_Params) DecodeFromPtr(p capnp.Ptr) HttpService_request_Params { + return HttpService_request_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_request_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_request_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_request_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_request_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_request_Params) Request() (HttpRequest, error) { + p, err := capnp.Struct(s).Ptr(0) + return HttpRequest(p.Struct()), err +} + +func (s HttpService_request_Params) HasRequest() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_request_Params) SetRequest(v HttpRequest) error { + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewRequest sets the request field to a newly +// allocated HttpRequest struct, preferring placement in s's segment. +func (s HttpService_request_Params) NewRequest() (HttpRequest, error) { + ss, err := NewHttpRequest(capnp.Struct(s).Segment()) + if err != nil { + return HttpRequest{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s HttpService_request_Params) Context() HttpService_ClientRequestContext { + p, _ := capnp.Struct(s).Ptr(1) + return HttpService_ClientRequestContext(p.Interface().Client()) +} + +func (s HttpService_request_Params) HasContext() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpService_request_Params) SetContext(v HttpService_ClientRequestContext) 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()) +} + +// HttpService_request_Params_List is a list of HttpService_request_Params. +type HttpService_request_Params_List = capnp.StructList[HttpService_request_Params] + +// NewHttpService_request_Params creates a new list of HttpService_request_Params. +func NewHttpService_request_Params_List(s *capnp.Segment, sz int32) (HttpService_request_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[HttpService_request_Params](l), err +} + +// HttpService_request_Params_Future is a wrapper for a HttpService_request_Params promised by a client call. +type HttpService_request_Params_Future struct{ *capnp.Future } + +func (f HttpService_request_Params_Future) Struct() (HttpService_request_Params, error) { + p, err := f.Future.Ptr() + return HttpService_request_Params(p.Struct()), err +} +func (p HttpService_request_Params_Future) Request() HttpRequest_Future { + return HttpRequest_Future{Future: p.Future.Field(0, nil)} +} +func (p HttpService_request_Params_Future) Context() HttpService_ClientRequestContext { + return HttpService_ClientRequestContext(p.Future.Field(1, nil).Client()) +} + +type HttpService_request_Results capnp.Struct + +// HttpService_request_Results_TypeID is the unique identifier for the type HttpService_request_Results. +const HttpService_request_Results_TypeID = 0xfd030bd777152c43 + +func NewHttpService_request_Results(s *capnp.Segment) (HttpService_request_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_request_Results(st), err +} + +func NewRootHttpService_request_Results(s *capnp.Segment) (HttpService_request_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_request_Results(st), err +} + +func ReadRootHttpService_request_Results(msg *capnp.Message) (HttpService_request_Results, error) { + root, err := msg.Root() + return HttpService_request_Results(root.Struct()), err +} + +func (s HttpService_request_Results) String() string { + str, _ := text.Marshal(0xfd030bd777152c43, capnp.Struct(s)) + return str +} + +func (s HttpService_request_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_request_Results) DecodeFromPtr(p capnp.Ptr) HttpService_request_Results { + return HttpService_request_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_request_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_request_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_request_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_request_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_request_Results) RequestBody() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_request_Results) HasRequestBody() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_request_Results) SetRequestBody(v bytestream.ByteStream) 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()) +} + +// HttpService_request_Results_List is a list of HttpService_request_Results. +type HttpService_request_Results_List = capnp.StructList[HttpService_request_Results] + +// NewHttpService_request_Results creates a new list of HttpService_request_Results. +func NewHttpService_request_Results_List(s *capnp.Segment, sz int32) (HttpService_request_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_request_Results](l), err +} + +// HttpService_request_Results_Future is a wrapper for a HttpService_request_Results promised by a client call. +type HttpService_request_Results_Future struct{ *capnp.Future } + +func (f HttpService_request_Results_Future) Struct() (HttpService_request_Results, error) { + p, err := f.Future.Ptr() + return HttpService_request_Results(p.Struct()), err +} +func (p HttpService_request_Results_Future) RequestBody() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(0, nil).Client()) +} + +type HttpService_connect_Params capnp.Struct + +// HttpService_connect_Params_TypeID is the unique identifier for the type HttpService_connect_Params. +const HttpService_connect_Params_TypeID = 0xa8d63d909cead201 + +func NewHttpService_connect_Params(s *capnp.Segment) (HttpService_connect_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 5}) + return HttpService_connect_Params(st), err +} + +func NewRootHttpService_connect_Params(s *capnp.Segment) (HttpService_connect_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 5}) + return HttpService_connect_Params(st), err +} + +func ReadRootHttpService_connect_Params(msg *capnp.Message) (HttpService_connect_Params, error) { + root, err := msg.Root() + return HttpService_connect_Params(root.Struct()), err +} + +func (s HttpService_connect_Params) String() string { + str, _ := text.Marshal(0xa8d63d909cead201, capnp.Struct(s)) + return str +} + +func (s HttpService_connect_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_connect_Params) DecodeFromPtr(p capnp.Ptr) HttpService_connect_Params { + return HttpService_connect_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_connect_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_connect_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_connect_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_connect_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_connect_Params) Host() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s HttpService_connect_Params) HasHost() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_connect_Params) HostBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s HttpService_connect_Params) SetHost(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s HttpService_connect_Params) Headers() (HttpHeader_List, error) { + p, err := capnp.Struct(s).Ptr(1) + return HttpHeader_List(p.List()), err +} + +func (s HttpService_connect_Params) HasHeaders() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpService_connect_Params) SetHeaders(v HttpHeader_List) error { + return capnp.Struct(s).SetPtr(1, v.ToPtr()) +} + +// NewHeaders sets the headers field to a newly +// allocated HttpHeader_List, preferring placement in s's segment. +func (s HttpService_connect_Params) NewHeaders(n int32) (HttpHeader_List, error) { + l, err := NewHttpHeader_List(capnp.Struct(s).Segment(), n) + if err != nil { + return HttpHeader_List{}, err + } + err = capnp.Struct(s).SetPtr(1, l.ToPtr()) + return l, err +} +func (s HttpService_connect_Params) Down() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(2) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_connect_Params) HasDown() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s HttpService_connect_Params) SetDown(v bytestream.ByteStream) error { + if !v.IsValid() { + return capnp.Struct(s).SetPtr(2, capnp.Ptr{}) + } + seg := s.Segment() + in := capnp.NewInterface(seg, seg.Message().CapTable().Add(capnp.Client(v))) + return capnp.Struct(s).SetPtr(2, in.ToPtr()) +} + +func (s HttpService_connect_Params) Context() HttpService_ConnectClientRequestContext { + p, _ := capnp.Struct(s).Ptr(3) + return HttpService_ConnectClientRequestContext(p.Interface().Client()) +} + +func (s HttpService_connect_Params) HasContext() bool { + return capnp.Struct(s).HasPtr(3) +} + +func (s HttpService_connect_Params) SetContext(v HttpService_ConnectClientRequestContext) 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()) +} + +func (s HttpService_connect_Params) Settings() (ConnectSettings, error) { + p, err := capnp.Struct(s).Ptr(4) + return ConnectSettings(p.Struct()), err +} + +func (s HttpService_connect_Params) HasSettings() bool { + return capnp.Struct(s).HasPtr(4) +} + +func (s HttpService_connect_Params) SetSettings(v ConnectSettings) error { + return capnp.Struct(s).SetPtr(4, capnp.Struct(v).ToPtr()) +} + +// NewSettings sets the settings field to a newly +// allocated ConnectSettings struct, preferring placement in s's segment. +func (s HttpService_connect_Params) NewSettings() (ConnectSettings, error) { + ss, err := NewConnectSettings(capnp.Struct(s).Segment()) + if err != nil { + return ConnectSettings{}, err + } + err = capnp.Struct(s).SetPtr(4, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// HttpService_connect_Params_List is a list of HttpService_connect_Params. +type HttpService_connect_Params_List = capnp.StructList[HttpService_connect_Params] + +// NewHttpService_connect_Params creates a new list of HttpService_connect_Params. +func NewHttpService_connect_Params_List(s *capnp.Segment, sz int32) (HttpService_connect_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 5}, sz) + return capnp.StructList[HttpService_connect_Params](l), err +} + +// HttpService_connect_Params_Future is a wrapper for a HttpService_connect_Params promised by a client call. +type HttpService_connect_Params_Future struct{ *capnp.Future } + +func (f HttpService_connect_Params_Future) Struct() (HttpService_connect_Params, error) { + p, err := f.Future.Ptr() + return HttpService_connect_Params(p.Struct()), err +} +func (p HttpService_connect_Params_Future) Down() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(2, nil).Client()) +} + +func (p HttpService_connect_Params_Future) Context() HttpService_ConnectClientRequestContext { + return HttpService_ConnectClientRequestContext(p.Future.Field(3, nil).Client()) +} + +func (p HttpService_connect_Params_Future) Settings() ConnectSettings_Future { + return ConnectSettings_Future{Future: p.Future.Field(4, nil)} +} + +type HttpService_connect_Results capnp.Struct + +// HttpService_connect_Results_TypeID is the unique identifier for the type HttpService_connect_Results. +const HttpService_connect_Results_TypeID = 0xbf2721059c3d9248 + +func NewHttpService_connect_Results(s *capnp.Segment) (HttpService_connect_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_connect_Results(st), err +} + +func NewRootHttpService_connect_Results(s *capnp.Segment) (HttpService_connect_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return HttpService_connect_Results(st), err +} + +func ReadRootHttpService_connect_Results(msg *capnp.Message) (HttpService_connect_Results, error) { + root, err := msg.Root() + return HttpService_connect_Results(root.Struct()), err +} + +func (s HttpService_connect_Results) String() string { + str, _ := text.Marshal(0xbf2721059c3d9248, capnp.Struct(s)) + return str +} + +func (s HttpService_connect_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpService_connect_Results) DecodeFromPtr(p capnp.Ptr) HttpService_connect_Results { + return HttpService_connect_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpService_connect_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpService_connect_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpService_connect_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpService_connect_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpService_connect_Results) Up() bytestream.ByteStream { + p, _ := capnp.Struct(s).Ptr(0) + return bytestream.ByteStream(p.Interface().Client()) +} + +func (s HttpService_connect_Results) HasUp() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpService_connect_Results) SetUp(v bytestream.ByteStream) 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()) +} + +// HttpService_connect_Results_List is a list of HttpService_connect_Results. +type HttpService_connect_Results_List = capnp.StructList[HttpService_connect_Results] + +// NewHttpService_connect_Results creates a new list of HttpService_connect_Results. +func NewHttpService_connect_Results_List(s *capnp.Segment, sz int32) (HttpService_connect_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[HttpService_connect_Results](l), err +} + +// HttpService_connect_Results_Future is a wrapper for a HttpService_connect_Results promised by a client call. +type HttpService_connect_Results_Future struct{ *capnp.Future } + +func (f HttpService_connect_Results_Future) Struct() (HttpService_connect_Results, error) { + p, err := f.Future.Ptr() + return HttpService_connect_Results(p.Struct()), err +} +func (p HttpService_connect_Results_Future) Up() bytestream.ByteStream { + return bytestream.ByteStream(p.Future.Field(0, nil).Client()) +} + +type ConnectSettings capnp.Struct + +// ConnectSettings_TypeID is the unique identifier for the type ConnectSettings. +const ConnectSettings_TypeID = 0xf981e8428b86f885 + +func NewConnectSettings(s *capnp.Segment) (ConnectSettings, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return ConnectSettings(st), err +} + +func NewRootConnectSettings(s *capnp.Segment) (ConnectSettings, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}) + return ConnectSettings(st), err +} + +func ReadRootConnectSettings(msg *capnp.Message) (ConnectSettings, error) { + root, err := msg.Root() + return ConnectSettings(root.Struct()), err +} + +func (s ConnectSettings) String() string { + str, _ := text.Marshal(0xf981e8428b86f885, capnp.Struct(s)) + return str +} + +func (s ConnectSettings) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ConnectSettings) DecodeFromPtr(p capnp.Ptr) ConnectSettings { + return ConnectSettings(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ConnectSettings) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ConnectSettings) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ConnectSettings) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ConnectSettings) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ConnectSettings) UseTls() bool { + return capnp.Struct(s).Bit(0) +} + +func (s ConnectSettings) SetUseTls(v bool) { + capnp.Struct(s).SetBit(0, v) +} + +// ConnectSettings_List is a list of ConnectSettings. +type ConnectSettings_List = capnp.StructList[ConnectSettings] + +// NewConnectSettings creates a new list of ConnectSettings. +func NewConnectSettings_List(s *capnp.Segment, sz int32) (ConnectSettings_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 0}, sz) + return capnp.StructList[ConnectSettings](l), err +} + +// ConnectSettings_Future is a wrapper for a ConnectSettings promised by a client call. +type ConnectSettings_Future struct{ *capnp.Future } + +func (f ConnectSettings_Future) Struct() (ConnectSettings, error) { + p, err := f.Future.Ptr() + return ConnectSettings(p.Struct()), err +} + +type WebSocket capnp.Client + +// WebSocket_TypeID is the unique identifier for the type WebSocket. +const WebSocket_TypeID = 0xb09c33a9f4caa823 + +func (c WebSocket) SendText(ctx context.Context, params func(WebSocket_sendText_Params) error) error { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "sendText", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(WebSocket_sendText_Params(s)) } + } + + return capnp.Client(c).SendStreamCall(ctx, s) + +} + +func (c WebSocket) SendData(ctx context.Context, params func(WebSocket_sendData_Params) error) error { + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "sendData", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(WebSocket_sendData_Params(s)) } + } + + return capnp.Client(c).SendStreamCall(ctx, s) + +} + +func (c WebSocket) Close(ctx context.Context, params func(WebSocket_close_Params) error) (WebSocket_close_Results_Future, capnp.ReleaseFunc) { + + s := capnp.Send{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 2, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "close", + }, + } + if params != nil { + s.ArgsSize = capnp.ObjectSize{DataSize: 8, PointerCount: 1} + s.PlaceArgs = func(s capnp.Struct) error { return params(WebSocket_close_Params(s)) } + } + + ans, release := capnp.Client(c).SendCall(ctx, s) + return WebSocket_close_Results_Future{Future: ans.Future()}, release + +} + +func (c WebSocket) 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 WebSocket) String() string { + return "WebSocket(" + 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 WebSocket) AddRef() WebSocket { + return WebSocket(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 WebSocket) Release() { + capnp.Client(c).Release() +} + +// Resolve blocks until the capability is fully resolved or the Context +// expires. +func (c WebSocket) Resolve(ctx context.Context) error { + return capnp.Client(c).Resolve(ctx) +} + +func (c WebSocket) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Client(c).EncodeAsPtr(seg) +} + +func (WebSocket) DecodeFromPtr(p capnp.Ptr) WebSocket { + return WebSocket(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 WebSocket) 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 WebSocket) IsSame(other WebSocket) 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 WebSocket) SetFlowLimiter(lim fc.FlowLimiter) { + capnp.Client(c).SetFlowLimiter(lim) +} + +// Get the current flowcontrol.FlowLimiter used to manage flow control +// for this client. +func (c WebSocket) GetFlowLimiter() fc.FlowLimiter { + return capnp.Client(c).GetFlowLimiter() +} + +// A WebSocket_Server is a WebSocket with a local implementation. +type WebSocket_Server interface { + SendText(context.Context, WebSocket_sendText) error + + SendData(context.Context, WebSocket_sendData) error + + Close(context.Context, WebSocket_close) error +} + +// WebSocket_NewServer creates a new Server from an implementation of WebSocket_Server. +func WebSocket_NewServer(s WebSocket_Server) *server.Server { + c, _ := s.(server.Shutdowner) + return server.New(WebSocket_Methods(nil, s), s, c) +} + +// WebSocket_ServerToClient creates a new Client from an implementation of WebSocket_Server. +// The caller is responsible for calling Release on the returned Client. +func WebSocket_ServerToClient(s WebSocket_Server) WebSocket { + return WebSocket(capnp.NewClient(WebSocket_NewServer(s))) +} + +// WebSocket_Methods appends Methods to a slice that invoke the methods on s. +// This can be used to create a more complicated Server. +func WebSocket_Methods(methods []server.Method, s WebSocket_Server) []server.Method { + if cap(methods) == 0 { + methods = make([]server.Method, 0, 3) + } + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 0, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "sendText", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.SendText(ctx, WebSocket_sendText{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 1, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "sendData", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.SendData(ctx, WebSocket_sendData{call}) + }, + }) + + methods = append(methods, server.Method{ + Method: capnp.Method{ + InterfaceID: 0xb09c33a9f4caa823, + MethodID: 2, + InterfaceName: "http-over-capnp.capnp:WebSocket", + MethodName: "close", + }, + Impl: func(ctx context.Context, call *server.Call) error { + return s.Close(ctx, WebSocket_close{call}) + }, + }) + + return methods +} + +// WebSocket_sendText holds the state for a server call to WebSocket.sendText. +// See server.Call for documentation. +type WebSocket_sendText struct { + *server.Call +} + +// Args returns the call's arguments. +func (c WebSocket_sendText) Args() WebSocket_sendText_Params { + return WebSocket_sendText_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c WebSocket_sendText) AllocResults() (stream.StreamResult, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return stream.StreamResult(r), err +} + +// WebSocket_sendData holds the state for a server call to WebSocket.sendData. +// See server.Call for documentation. +type WebSocket_sendData struct { + *server.Call +} + +// Args returns the call's arguments. +func (c WebSocket_sendData) Args() WebSocket_sendData_Params { + return WebSocket_sendData_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c WebSocket_sendData) AllocResults() (stream.StreamResult, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return stream.StreamResult(r), err +} + +// WebSocket_close holds the state for a server call to WebSocket.close. +// See server.Call for documentation. +type WebSocket_close struct { + *server.Call +} + +// Args returns the call's arguments. +func (c WebSocket_close) Args() WebSocket_close_Params { + return WebSocket_close_Params(c.Call.Args()) +} + +// AllocResults allocates the results struct. +func (c WebSocket_close) AllocResults() (WebSocket_close_Results, error) { + r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return WebSocket_close_Results(r), err +} + +// WebSocket_List is a list of WebSocket. +type WebSocket_List = capnp.CapList[WebSocket] + +// NewWebSocket creates a new list of WebSocket. +func NewWebSocket_List(s *capnp.Segment, sz int32) (WebSocket_List, error) { + l, err := capnp.NewPointerList(s, sz) + return capnp.CapList[WebSocket](l), err +} + +type WebSocket_sendText_Params capnp.Struct + +// WebSocket_sendText_Params_TypeID is the unique identifier for the type WebSocket_sendText_Params. +const WebSocket_sendText_Params_TypeID = 0xdcf946892e5778c3 + +func NewWebSocket_sendText_Params(s *capnp.Segment) (WebSocket_sendText_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return WebSocket_sendText_Params(st), err +} + +func NewRootWebSocket_sendText_Params(s *capnp.Segment) (WebSocket_sendText_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return WebSocket_sendText_Params(st), err +} + +func ReadRootWebSocket_sendText_Params(msg *capnp.Message) (WebSocket_sendText_Params, error) { + root, err := msg.Root() + return WebSocket_sendText_Params(root.Struct()), err +} + +func (s WebSocket_sendText_Params) String() string { + str, _ := text.Marshal(0xdcf946892e5778c3, capnp.Struct(s)) + return str +} + +func (s WebSocket_sendText_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (WebSocket_sendText_Params) DecodeFromPtr(p capnp.Ptr) WebSocket_sendText_Params { + return WebSocket_sendText_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s WebSocket_sendText_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s WebSocket_sendText_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s WebSocket_sendText_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s WebSocket_sendText_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s WebSocket_sendText_Params) Text() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s WebSocket_sendText_Params) HasText() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s WebSocket_sendText_Params) TextBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s WebSocket_sendText_Params) SetText(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +// WebSocket_sendText_Params_List is a list of WebSocket_sendText_Params. +type WebSocket_sendText_Params_List = capnp.StructList[WebSocket_sendText_Params] + +// NewWebSocket_sendText_Params creates a new list of WebSocket_sendText_Params. +func NewWebSocket_sendText_Params_List(s *capnp.Segment, sz int32) (WebSocket_sendText_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[WebSocket_sendText_Params](l), err +} + +// WebSocket_sendText_Params_Future is a wrapper for a WebSocket_sendText_Params promised by a client call. +type WebSocket_sendText_Params_Future struct{ *capnp.Future } + +func (f WebSocket_sendText_Params_Future) Struct() (WebSocket_sendText_Params, error) { + p, err := f.Future.Ptr() + return WebSocket_sendText_Params(p.Struct()), err +} + +type WebSocket_sendData_Params capnp.Struct + +// WebSocket_sendData_Params_TypeID is the unique identifier for the type WebSocket_sendData_Params. +const WebSocket_sendData_Params_TypeID = 0xa9b84fb6432f030f + +func NewWebSocket_sendData_Params(s *capnp.Segment) (WebSocket_sendData_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return WebSocket_sendData_Params(st), err +} + +func NewRootWebSocket_sendData_Params(s *capnp.Segment) (WebSocket_sendData_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return WebSocket_sendData_Params(st), err +} + +func ReadRootWebSocket_sendData_Params(msg *capnp.Message) (WebSocket_sendData_Params, error) { + root, err := msg.Root() + return WebSocket_sendData_Params(root.Struct()), err +} + +func (s WebSocket_sendData_Params) String() string { + str, _ := text.Marshal(0xa9b84fb6432f030f, capnp.Struct(s)) + return str +} + +func (s WebSocket_sendData_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (WebSocket_sendData_Params) DecodeFromPtr(p capnp.Ptr) WebSocket_sendData_Params { + return WebSocket_sendData_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s WebSocket_sendData_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s WebSocket_sendData_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s WebSocket_sendData_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s WebSocket_sendData_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s WebSocket_sendData_Params) Data() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s WebSocket_sendData_Params) HasData() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s WebSocket_sendData_Params) SetData(v []byte) error { + return capnp.Struct(s).SetData(0, v) +} + +// WebSocket_sendData_Params_List is a list of WebSocket_sendData_Params. +type WebSocket_sendData_Params_List = capnp.StructList[WebSocket_sendData_Params] + +// NewWebSocket_sendData_Params creates a new list of WebSocket_sendData_Params. +func NewWebSocket_sendData_Params_List(s *capnp.Segment, sz int32) (WebSocket_sendData_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[WebSocket_sendData_Params](l), err +} + +// WebSocket_sendData_Params_Future is a wrapper for a WebSocket_sendData_Params promised by a client call. +type WebSocket_sendData_Params_Future struct{ *capnp.Future } + +func (f WebSocket_sendData_Params_Future) Struct() (WebSocket_sendData_Params, error) { + p, err := f.Future.Ptr() + return WebSocket_sendData_Params(p.Struct()), err +} + +type WebSocket_close_Params capnp.Struct + +// WebSocket_close_Params_TypeID is the unique identifier for the type WebSocket_close_Params. +const WebSocket_close_Params_TypeID = 0xba1fca454f465e9a + +func NewWebSocket_close_Params(s *capnp.Segment) (WebSocket_close_Params, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return WebSocket_close_Params(st), err +} + +func NewRootWebSocket_close_Params(s *capnp.Segment) (WebSocket_close_Params, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return WebSocket_close_Params(st), err +} + +func ReadRootWebSocket_close_Params(msg *capnp.Message) (WebSocket_close_Params, error) { + root, err := msg.Root() + return WebSocket_close_Params(root.Struct()), err +} + +func (s WebSocket_close_Params) String() string { + str, _ := text.Marshal(0xba1fca454f465e9a, capnp.Struct(s)) + return str +} + +func (s WebSocket_close_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (WebSocket_close_Params) DecodeFromPtr(p capnp.Ptr) WebSocket_close_Params { + return WebSocket_close_Params(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s WebSocket_close_Params) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s WebSocket_close_Params) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s WebSocket_close_Params) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s WebSocket_close_Params) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s WebSocket_close_Params) Code() uint16 { + return capnp.Struct(s).Uint16(0) +} + +func (s WebSocket_close_Params) SetCode(v uint16) { + capnp.Struct(s).SetUint16(0, v) +} + +func (s WebSocket_close_Params) Reason() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s WebSocket_close_Params) HasReason() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s WebSocket_close_Params) ReasonBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s WebSocket_close_Params) SetReason(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +// WebSocket_close_Params_List is a list of WebSocket_close_Params. +type WebSocket_close_Params_List = capnp.StructList[WebSocket_close_Params] + +// NewWebSocket_close_Params creates a new list of WebSocket_close_Params. +func NewWebSocket_close_Params_List(s *capnp.Segment, sz int32) (WebSocket_close_Params_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[WebSocket_close_Params](l), err +} + +// WebSocket_close_Params_Future is a wrapper for a WebSocket_close_Params promised by a client call. +type WebSocket_close_Params_Future struct{ *capnp.Future } + +func (f WebSocket_close_Params_Future) Struct() (WebSocket_close_Params, error) { + p, err := f.Future.Ptr() + return WebSocket_close_Params(p.Struct()), err +} + +type WebSocket_close_Results capnp.Struct + +// WebSocket_close_Results_TypeID is the unique identifier for the type WebSocket_close_Results. +const WebSocket_close_Results_TypeID = 0x913fe85057da9522 + +func NewWebSocket_close_Results(s *capnp.Segment) (WebSocket_close_Results, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return WebSocket_close_Results(st), err +} + +func NewRootWebSocket_close_Results(s *capnp.Segment) (WebSocket_close_Results, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) + return WebSocket_close_Results(st), err +} + +func ReadRootWebSocket_close_Results(msg *capnp.Message) (WebSocket_close_Results, error) { + root, err := msg.Root() + return WebSocket_close_Results(root.Struct()), err +} + +func (s WebSocket_close_Results) String() string { + str, _ := text.Marshal(0x913fe85057da9522, capnp.Struct(s)) + return str +} + +func (s WebSocket_close_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (WebSocket_close_Results) DecodeFromPtr(p capnp.Ptr) WebSocket_close_Results { + return WebSocket_close_Results(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s WebSocket_close_Results) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s WebSocket_close_Results) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s WebSocket_close_Results) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s WebSocket_close_Results) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} + +// WebSocket_close_Results_List is a list of WebSocket_close_Results. +type WebSocket_close_Results_List = capnp.StructList[WebSocket_close_Results] + +// NewWebSocket_close_Results creates a new list of WebSocket_close_Results. +func NewWebSocket_close_Results_List(s *capnp.Segment, sz int32) (WebSocket_close_Results_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) + return capnp.StructList[WebSocket_close_Results](l), err +} + +// WebSocket_close_Results_Future is a wrapper for a WebSocket_close_Results promised by a client call. +type WebSocket_close_Results_Future struct{ *capnp.Future } + +func (f WebSocket_close_Results_Future) Struct() (WebSocket_close_Results, error) { + p, err := f.Future.Ptr() + return WebSocket_close_Results(p.Struct()), err +} + +type HttpRequest capnp.Struct +type HttpRequest_bodySize HttpRequest +type HttpRequest_bodySize_Which uint16 + +const ( + HttpRequest_bodySize_Which_unknown HttpRequest_bodySize_Which = 0 + HttpRequest_bodySize_Which_fixed HttpRequest_bodySize_Which = 1 +) + +func (w HttpRequest_bodySize_Which) String() string { + const s = "unknownfixed" + switch w { + case HttpRequest_bodySize_Which_unknown: + return s[0:7] + case HttpRequest_bodySize_Which_fixed: + return s[7:12] + + } + return "HttpRequest_bodySize_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// HttpRequest_TypeID is the unique identifier for the type HttpRequest. +const HttpRequest_TypeID = 0xdeb08db1052a4866 + +func NewHttpRequest(s *capnp.Segment) (HttpRequest, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}) + return HttpRequest(st), err +} + +func NewRootHttpRequest(s *capnp.Segment) (HttpRequest, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}) + return HttpRequest(st), err +} + +func ReadRootHttpRequest(msg *capnp.Message) (HttpRequest, error) { + root, err := msg.Root() + return HttpRequest(root.Struct()), err +} + +func (s HttpRequest) String() string { + str, _ := text.Marshal(0xdeb08db1052a4866, capnp.Struct(s)) + return str +} + +func (s HttpRequest) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpRequest) DecodeFromPtr(p capnp.Ptr) HttpRequest { + return HttpRequest(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpRequest) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpRequest) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpRequest) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpRequest) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpRequest) Method() HttpMethod { + return HttpMethod(capnp.Struct(s).Uint16(0)) +} + +func (s HttpRequest) SetMethod(v HttpMethod) { + capnp.Struct(s).SetUint16(0, uint16(v)) +} + +func (s HttpRequest) Url() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s HttpRequest) HasUrl() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpRequest) UrlBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s HttpRequest) SetUrl(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s HttpRequest) Headers() (HttpHeader_List, error) { + p, err := capnp.Struct(s).Ptr(1) + return HttpHeader_List(p.List()), err +} + +func (s HttpRequest) HasHeaders() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpRequest) SetHeaders(v HttpHeader_List) error { + return capnp.Struct(s).SetPtr(1, v.ToPtr()) +} + +// NewHeaders sets the headers field to a newly +// allocated HttpHeader_List, preferring placement in s's segment. +func (s HttpRequest) NewHeaders(n int32) (HttpHeader_List, error) { + l, err := NewHttpHeader_List(capnp.Struct(s).Segment(), n) + if err != nil { + return HttpHeader_List{}, err + } + err = capnp.Struct(s).SetPtr(1, l.ToPtr()) + return l, err +} +func (s HttpRequest) BodySize() HttpRequest_bodySize { return HttpRequest_bodySize(s) } + +func (s HttpRequest_bodySize) Which() HttpRequest_bodySize_Which { + return HttpRequest_bodySize_Which(capnp.Struct(s).Uint16(2)) +} +func (s HttpRequest_bodySize) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpRequest_bodySize) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpRequest_bodySize) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpRequest_bodySize) SetUnknown() { + capnp.Struct(s).SetUint16(2, 0) + +} + +func (s HttpRequest_bodySize) Fixed() uint64 { + if capnp.Struct(s).Uint16(2) != 1 { + panic("Which() != fixed") + } + return capnp.Struct(s).Uint64(8) +} + +func (s HttpRequest_bodySize) SetFixed(v uint64) { + capnp.Struct(s).SetUint16(2, 1) + capnp.Struct(s).SetUint64(8, v) +} + +// HttpRequest_List is a list of HttpRequest. +type HttpRequest_List = capnp.StructList[HttpRequest] + +// NewHttpRequest creates a new list of HttpRequest. +func NewHttpRequest_List(s *capnp.Segment, sz int32) (HttpRequest_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}, sz) + return capnp.StructList[HttpRequest](l), err +} + +// HttpRequest_Future is a wrapper for a HttpRequest promised by a client call. +type HttpRequest_Future struct{ *capnp.Future } + +func (f HttpRequest_Future) Struct() (HttpRequest, error) { + p, err := f.Future.Ptr() + return HttpRequest(p.Struct()), err +} +func (p HttpRequest_Future) BodySize() HttpRequest_bodySize_Future { + return HttpRequest_bodySize_Future{p.Future} +} + +// HttpRequest_bodySize_Future is a wrapper for a HttpRequest_bodySize promised by a client call. +type HttpRequest_bodySize_Future struct{ *capnp.Future } + +func (f HttpRequest_bodySize_Future) Struct() (HttpRequest_bodySize, error) { + p, err := f.Future.Ptr() + return HttpRequest_bodySize(p.Struct()), err +} + +type HttpResponse capnp.Struct +type HttpResponse_bodySize HttpResponse +type HttpResponse_bodySize_Which uint16 + +const ( + HttpResponse_bodySize_Which_unknown HttpResponse_bodySize_Which = 0 + HttpResponse_bodySize_Which_fixed HttpResponse_bodySize_Which = 1 +) + +func (w HttpResponse_bodySize_Which) String() string { + const s = "unknownfixed" + switch w { + case HttpResponse_bodySize_Which_unknown: + return s[0:7] + case HttpResponse_bodySize_Which_fixed: + return s[7:12] + + } + return "HttpResponse_bodySize_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// HttpResponse_TypeID is the unique identifier for the type HttpResponse. +const HttpResponse_TypeID = 0xf235351cf1531299 + +func NewHttpResponse(s *capnp.Segment) (HttpResponse, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}) + return HttpResponse(st), err +} + +func NewRootHttpResponse(s *capnp.Segment) (HttpResponse, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}) + return HttpResponse(st), err +} + +func ReadRootHttpResponse(msg *capnp.Message) (HttpResponse, error) { + root, err := msg.Root() + return HttpResponse(root.Struct()), err +} + +func (s HttpResponse) String() string { + str, _ := text.Marshal(0xf235351cf1531299, capnp.Struct(s)) + return str +} + +func (s HttpResponse) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpResponse) DecodeFromPtr(p capnp.Ptr) HttpResponse { + return HttpResponse(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpResponse) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpResponse) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpResponse) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpResponse) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpResponse) StatusCode() uint16 { + return capnp.Struct(s).Uint16(0) +} + +func (s HttpResponse) SetStatusCode(v uint16) { + capnp.Struct(s).SetUint16(0, v) +} + +func (s HttpResponse) StatusText() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s HttpResponse) HasStatusText() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpResponse) StatusTextBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s HttpResponse) SetStatusText(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s HttpResponse) Headers() (HttpHeader_List, error) { + p, err := capnp.Struct(s).Ptr(1) + return HttpHeader_List(p.List()), err +} + +func (s HttpResponse) HasHeaders() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpResponse) SetHeaders(v HttpHeader_List) error { + return capnp.Struct(s).SetPtr(1, v.ToPtr()) +} + +// NewHeaders sets the headers field to a newly +// allocated HttpHeader_List, preferring placement in s's segment. +func (s HttpResponse) NewHeaders(n int32) (HttpHeader_List, error) { + l, err := NewHttpHeader_List(capnp.Struct(s).Segment(), n) + if err != nil { + return HttpHeader_List{}, err + } + err = capnp.Struct(s).SetPtr(1, l.ToPtr()) + return l, err +} +func (s HttpResponse) BodySize() HttpResponse_bodySize { return HttpResponse_bodySize(s) } + +func (s HttpResponse_bodySize) Which() HttpResponse_bodySize_Which { + return HttpResponse_bodySize_Which(capnp.Struct(s).Uint16(2)) +} +func (s HttpResponse_bodySize) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpResponse_bodySize) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpResponse_bodySize) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpResponse_bodySize) SetUnknown() { + capnp.Struct(s).SetUint16(2, 0) + +} + +func (s HttpResponse_bodySize) Fixed() uint64 { + if capnp.Struct(s).Uint16(2) != 1 { + panic("Which() != fixed") + } + return capnp.Struct(s).Uint64(8) +} + +func (s HttpResponse_bodySize) SetFixed(v uint64) { + capnp.Struct(s).SetUint16(2, 1) + capnp.Struct(s).SetUint64(8, v) +} + +// HttpResponse_List is a list of HttpResponse. +type HttpResponse_List = capnp.StructList[HttpResponse] + +// NewHttpResponse creates a new list of HttpResponse. +func NewHttpResponse_List(s *capnp.Segment, sz int32) (HttpResponse_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 2}, sz) + return capnp.StructList[HttpResponse](l), err +} + +// HttpResponse_Future is a wrapper for a HttpResponse promised by a client call. +type HttpResponse_Future struct{ *capnp.Future } + +func (f HttpResponse_Future) Struct() (HttpResponse, error) { + p, err := f.Future.Ptr() + return HttpResponse(p.Struct()), err +} +func (p HttpResponse_Future) BodySize() HttpResponse_bodySize_Future { + return HttpResponse_bodySize_Future{p.Future} +} + +// HttpResponse_bodySize_Future is a wrapper for a HttpResponse_bodySize promised by a client call. +type HttpResponse_bodySize_Future struct{ *capnp.Future } + +func (f HttpResponse_bodySize_Future) Struct() (HttpResponse_bodySize, error) { + p, err := f.Future.Ptr() + return HttpResponse_bodySize(p.Struct()), err +} + +type HttpMethod uint16 + +// HttpMethod_TypeID is the unique identifier for the type HttpMethod. +const HttpMethod_TypeID = 0x8dbd3c007383731e + +// Values of HttpMethod. +const ( + HttpMethod_get HttpMethod = 0 + HttpMethod_head HttpMethod = 1 + HttpMethod_post HttpMethod = 2 + HttpMethod_put HttpMethod = 3 + HttpMethod_delete HttpMethod = 4 + HttpMethod_patch HttpMethod = 5 + HttpMethod_purge HttpMethod = 6 + HttpMethod_options HttpMethod = 7 + HttpMethod_trace HttpMethod = 8 + HttpMethod_copy HttpMethod = 9 + HttpMethod_lock HttpMethod = 10 + HttpMethod_mkcol HttpMethod = 11 + HttpMethod_move HttpMethod = 12 + HttpMethod_propfind HttpMethod = 13 + HttpMethod_proppatch HttpMethod = 14 + HttpMethod_search HttpMethod = 15 + HttpMethod_unlock HttpMethod = 16 + HttpMethod_acl HttpMethod = 17 + HttpMethod_report HttpMethod = 18 + HttpMethod_mkactivity HttpMethod = 19 + HttpMethod_checkout HttpMethod = 20 + HttpMethod_merge HttpMethod = 21 + HttpMethod_msearch HttpMethod = 22 + HttpMethod_notify HttpMethod = 23 + HttpMethod_subscribe HttpMethod = 24 + HttpMethod_unsubscribe HttpMethod = 25 +) + +// String returns the enum's constant name. +func (c HttpMethod) String() string { + switch c { + case HttpMethod_get: + return "get" + case HttpMethod_head: + return "head" + case HttpMethod_post: + return "post" + case HttpMethod_put: + return "put" + case HttpMethod_delete: + return "delete" + case HttpMethod_patch: + return "patch" + case HttpMethod_purge: + return "purge" + case HttpMethod_options: + return "options" + case HttpMethod_trace: + return "trace" + case HttpMethod_copy: + return "copy" + case HttpMethod_lock: + return "lock" + case HttpMethod_mkcol: + return "mkcol" + case HttpMethod_move: + return "move" + case HttpMethod_propfind: + return "propfind" + case HttpMethod_proppatch: + return "proppatch" + case HttpMethod_search: + return "search" + case HttpMethod_unlock: + return "unlock" + case HttpMethod_acl: + return "acl" + case HttpMethod_report: + return "report" + case HttpMethod_mkactivity: + return "mkactivity" + case HttpMethod_checkout: + return "checkout" + case HttpMethod_merge: + return "merge" + case HttpMethod_msearch: + return "msearch" + case HttpMethod_notify: + return "notify" + case HttpMethod_subscribe: + return "subscribe" + case HttpMethod_unsubscribe: + return "unsubscribe" + + default: + return "" + } +} + +// HttpMethodFromString returns the enum value with a name, +// or the zero value if there's no such value. +func HttpMethodFromString(c string) HttpMethod { + switch c { + case "get": + return HttpMethod_get + case "head": + return HttpMethod_head + case "post": + return HttpMethod_post + case "put": + return HttpMethod_put + case "delete": + return HttpMethod_delete + case "patch": + return HttpMethod_patch + case "purge": + return HttpMethod_purge + case "options": + return HttpMethod_options + case "trace": + return HttpMethod_trace + case "copy": + return HttpMethod_copy + case "lock": + return HttpMethod_lock + case "mkcol": + return HttpMethod_mkcol + case "move": + return HttpMethod_move + case "propfind": + return HttpMethod_propfind + case "proppatch": + return HttpMethod_proppatch + case "search": + return HttpMethod_search + case "unlock": + return HttpMethod_unlock + case "acl": + return HttpMethod_acl + case "report": + return HttpMethod_report + case "mkactivity": + return HttpMethod_mkactivity + case "checkout": + return HttpMethod_checkout + case "merge": + return HttpMethod_merge + case "msearch": + return HttpMethod_msearch + case "notify": + return HttpMethod_notify + case "subscribe": + return HttpMethod_subscribe + case "unsubscribe": + return HttpMethod_unsubscribe + + default: + return 0 + } +} + +type HttpMethod_List = capnp.EnumList[HttpMethod] + +func NewHttpMethod_List(s *capnp.Segment, sz int32) (HttpMethod_List, error) { + return capnp.NewEnumList[HttpMethod](s, sz) +} + +type CommonHeaderName uint16 + +// CommonHeaderName_TypeID is the unique identifier for the type CommonHeaderName. +const CommonHeaderName_TypeID = 0xee4db03aab7fb4be + +// Values of CommonHeaderName. +const ( + CommonHeaderName_invalid CommonHeaderName = 0 + CommonHeaderName_acceptCharset CommonHeaderName = 1 + CommonHeaderName_acceptEncoding CommonHeaderName = 2 + CommonHeaderName_acceptLanguage CommonHeaderName = 3 + CommonHeaderName_acceptRanges CommonHeaderName = 4 + CommonHeaderName_accept CommonHeaderName = 5 + CommonHeaderName_accessControlAllowOrigin CommonHeaderName = 6 + CommonHeaderName_age CommonHeaderName = 7 + CommonHeaderName_allow CommonHeaderName = 8 + CommonHeaderName_authorization CommonHeaderName = 9 + CommonHeaderName_cacheControl CommonHeaderName = 10 + CommonHeaderName_contentDisposition CommonHeaderName = 11 + CommonHeaderName_contentEncoding CommonHeaderName = 12 + CommonHeaderName_contentLanguage CommonHeaderName = 13 + CommonHeaderName_contentLength CommonHeaderName = 14 + CommonHeaderName_contentLocation CommonHeaderName = 15 + CommonHeaderName_contentRange CommonHeaderName = 16 + CommonHeaderName_contentType CommonHeaderName = 17 + CommonHeaderName_cookie CommonHeaderName = 18 + CommonHeaderName_date CommonHeaderName = 19 + CommonHeaderName_etag CommonHeaderName = 20 + CommonHeaderName_expect CommonHeaderName = 21 + CommonHeaderName_expires CommonHeaderName = 22 + CommonHeaderName_from CommonHeaderName = 23 + CommonHeaderName_host CommonHeaderName = 24 + CommonHeaderName_ifMatch CommonHeaderName = 25 + CommonHeaderName_ifModifiedSince CommonHeaderName = 26 + CommonHeaderName_ifNoneMatch CommonHeaderName = 27 + CommonHeaderName_ifRange CommonHeaderName = 28 + CommonHeaderName_ifUnmodifiedSince CommonHeaderName = 29 + CommonHeaderName_lastModified CommonHeaderName = 30 + CommonHeaderName_link CommonHeaderName = 31 + CommonHeaderName_location CommonHeaderName = 32 + CommonHeaderName_maxForwards CommonHeaderName = 33 + CommonHeaderName_proxyAuthenticate CommonHeaderName = 34 + CommonHeaderName_proxyAuthorization CommonHeaderName = 35 + CommonHeaderName_range CommonHeaderName = 36 + CommonHeaderName_referer CommonHeaderName = 37 + CommonHeaderName_refresh CommonHeaderName = 38 + CommonHeaderName_retryAfter CommonHeaderName = 39 + CommonHeaderName_server CommonHeaderName = 40 + CommonHeaderName_setCookie CommonHeaderName = 41 + CommonHeaderName_strictTransportSecurity CommonHeaderName = 42 + CommonHeaderName_transferEncoding CommonHeaderName = 43 + CommonHeaderName_userAgent CommonHeaderName = 44 + CommonHeaderName_vary CommonHeaderName = 45 + CommonHeaderName_via CommonHeaderName = 46 + CommonHeaderName_wwwAuthenticate CommonHeaderName = 47 +) + +// String returns the enum's constant name. +func (c CommonHeaderName) String() string { + switch c { + case CommonHeaderName_invalid: + return "invalid" + case CommonHeaderName_acceptCharset: + return "acceptCharset" + case CommonHeaderName_acceptEncoding: + return "acceptEncoding" + case CommonHeaderName_acceptLanguage: + return "acceptLanguage" + case CommonHeaderName_acceptRanges: + return "acceptRanges" + case CommonHeaderName_accept: + return "accept" + case CommonHeaderName_accessControlAllowOrigin: + return "accessControlAllowOrigin" + case CommonHeaderName_age: + return "age" + case CommonHeaderName_allow: + return "allow" + case CommonHeaderName_authorization: + return "authorization" + case CommonHeaderName_cacheControl: + return "cacheControl" + case CommonHeaderName_contentDisposition: + return "contentDisposition" + case CommonHeaderName_contentEncoding: + return "contentEncoding" + case CommonHeaderName_contentLanguage: + return "contentLanguage" + case CommonHeaderName_contentLength: + return "contentLength" + case CommonHeaderName_contentLocation: + return "contentLocation" + case CommonHeaderName_contentRange: + return "contentRange" + case CommonHeaderName_contentType: + return "contentType" + case CommonHeaderName_cookie: + return "cookie" + case CommonHeaderName_date: + return "date" + case CommonHeaderName_etag: + return "etag" + case CommonHeaderName_expect: + return "expect" + case CommonHeaderName_expires: + return "expires" + case CommonHeaderName_from: + return "from" + case CommonHeaderName_host: + return "host" + case CommonHeaderName_ifMatch: + return "ifMatch" + case CommonHeaderName_ifModifiedSince: + return "ifModifiedSince" + case CommonHeaderName_ifNoneMatch: + return "ifNoneMatch" + case CommonHeaderName_ifRange: + return "ifRange" + case CommonHeaderName_ifUnmodifiedSince: + return "ifUnmodifiedSince" + case CommonHeaderName_lastModified: + return "lastModified" + case CommonHeaderName_link: + return "link" + case CommonHeaderName_location: + return "location" + case CommonHeaderName_maxForwards: + return "maxForwards" + case CommonHeaderName_proxyAuthenticate: + return "proxyAuthenticate" + case CommonHeaderName_proxyAuthorization: + return "proxyAuthorization" + case CommonHeaderName_range: + return "range" + case CommonHeaderName_referer: + return "referer" + case CommonHeaderName_refresh: + return "refresh" + case CommonHeaderName_retryAfter: + return "retryAfter" + case CommonHeaderName_server: + return "server" + case CommonHeaderName_setCookie: + return "setCookie" + case CommonHeaderName_strictTransportSecurity: + return "strictTransportSecurity" + case CommonHeaderName_transferEncoding: + return "transferEncoding" + case CommonHeaderName_userAgent: + return "userAgent" + case CommonHeaderName_vary: + return "vary" + case CommonHeaderName_via: + return "via" + case CommonHeaderName_wwwAuthenticate: + return "wwwAuthenticate" + + default: + return "" + } +} + +// CommonHeaderNameFromString returns the enum value with a name, +// or the zero value if there's no such value. +func CommonHeaderNameFromString(c string) CommonHeaderName { + switch c { + case "invalid": + return CommonHeaderName_invalid + case "acceptCharset": + return CommonHeaderName_acceptCharset + case "acceptEncoding": + return CommonHeaderName_acceptEncoding + case "acceptLanguage": + return CommonHeaderName_acceptLanguage + case "acceptRanges": + return CommonHeaderName_acceptRanges + case "accept": + return CommonHeaderName_accept + case "accessControlAllowOrigin": + return CommonHeaderName_accessControlAllowOrigin + case "age": + return CommonHeaderName_age + case "allow": + return CommonHeaderName_allow + case "authorization": + return CommonHeaderName_authorization + case "cacheControl": + return CommonHeaderName_cacheControl + case "contentDisposition": + return CommonHeaderName_contentDisposition + case "contentEncoding": + return CommonHeaderName_contentEncoding + case "contentLanguage": + return CommonHeaderName_contentLanguage + case "contentLength": + return CommonHeaderName_contentLength + case "contentLocation": + return CommonHeaderName_contentLocation + case "contentRange": + return CommonHeaderName_contentRange + case "contentType": + return CommonHeaderName_contentType + case "cookie": + return CommonHeaderName_cookie + case "date": + return CommonHeaderName_date + case "etag": + return CommonHeaderName_etag + case "expect": + return CommonHeaderName_expect + case "expires": + return CommonHeaderName_expires + case "from": + return CommonHeaderName_from + case "host": + return CommonHeaderName_host + case "ifMatch": + return CommonHeaderName_ifMatch + case "ifModifiedSince": + return CommonHeaderName_ifModifiedSince + case "ifNoneMatch": + return CommonHeaderName_ifNoneMatch + case "ifRange": + return CommonHeaderName_ifRange + case "ifUnmodifiedSince": + return CommonHeaderName_ifUnmodifiedSince + case "lastModified": + return CommonHeaderName_lastModified + case "link": + return CommonHeaderName_link + case "location": + return CommonHeaderName_location + case "maxForwards": + return CommonHeaderName_maxForwards + case "proxyAuthenticate": + return CommonHeaderName_proxyAuthenticate + case "proxyAuthorization": + return CommonHeaderName_proxyAuthorization + case "range": + return CommonHeaderName_range + case "referer": + return CommonHeaderName_referer + case "refresh": + return CommonHeaderName_refresh + case "retryAfter": + return CommonHeaderName_retryAfter + case "server": + return CommonHeaderName_server + case "setCookie": + return CommonHeaderName_setCookie + case "strictTransportSecurity": + return CommonHeaderName_strictTransportSecurity + case "transferEncoding": + return CommonHeaderName_transferEncoding + case "userAgent": + return CommonHeaderName_userAgent + case "vary": + return CommonHeaderName_vary + case "via": + return CommonHeaderName_via + case "wwwAuthenticate": + return CommonHeaderName_wwwAuthenticate + + default: + return 0 + } +} + +type CommonHeaderName_List = capnp.EnumList[CommonHeaderName] + +func NewCommonHeaderName_List(s *capnp.Segment, sz int32) (CommonHeaderName_List, error) { + return capnp.NewEnumList[CommonHeaderName](s, sz) +} + +type CommonHeaderValue uint16 + +// CommonHeaderValue_TypeID is the unique identifier for the type CommonHeaderValue. +const CommonHeaderValue_TypeID = 0x83e5f307c4d3785f + +// Values of CommonHeaderValue. +const ( + CommonHeaderValue_invalid CommonHeaderValue = 0 + CommonHeaderValue_gzipDeflate CommonHeaderValue = 1 +) + +// String returns the enum's constant name. +func (c CommonHeaderValue) String() string { + switch c { + case CommonHeaderValue_invalid: + return "invalid" + case CommonHeaderValue_gzipDeflate: + return "gzipDeflate" + + default: + return "" + } +} + +// CommonHeaderValueFromString returns the enum value with a name, +// or the zero value if there's no such value. +func CommonHeaderValueFromString(c string) CommonHeaderValue { + switch c { + case "invalid": + return CommonHeaderValue_invalid + case "gzipDeflate": + return CommonHeaderValue_gzipDeflate + + default: + return 0 + } +} + +type CommonHeaderValue_List = capnp.EnumList[CommonHeaderValue] + +func NewCommonHeaderValue_List(s *capnp.Segment, sz int32) (CommonHeaderValue_List, error) { + return capnp.NewEnumList[CommonHeaderValue](s, sz) +} + +type HttpHeader capnp.Struct +type HttpHeader_common HttpHeader +type HttpHeader_Which uint16 + +const ( + HttpHeader_Which_common HttpHeader_Which = 0 + HttpHeader_Which_uncommon HttpHeader_Which = 1 +) + +func (w HttpHeader_Which) String() string { + const s = "commonuncommon" + switch w { + case HttpHeader_Which_common: + return s[0:6] + case HttpHeader_Which_uncommon: + return s[6:14] + + } + return "HttpHeader_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +type HttpHeader_common_Which uint16 + +const ( + HttpHeader_common_Which_commonValue HttpHeader_common_Which = 0 + HttpHeader_common_Which_value HttpHeader_common_Which = 1 +) + +func (w HttpHeader_common_Which) String() string { + const s = "commonValuevalue" + switch w { + case HttpHeader_common_Which_commonValue: + return s[0:11] + case HttpHeader_common_Which_value: + return s[11:16] + + } + return "HttpHeader_common_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// HttpHeader_TypeID is the unique identifier for the type HttpHeader. +const HttpHeader_TypeID = 0xb39047580b6fd228 + +func NewHttpHeader(s *capnp.Segment) (HttpHeader, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}) + return HttpHeader(st), err +} + +func NewRootHttpHeader(s *capnp.Segment) (HttpHeader, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}) + return HttpHeader(st), err +} + +func ReadRootHttpHeader(msg *capnp.Message) (HttpHeader, error) { + root, err := msg.Root() + return HttpHeader(root.Struct()), err +} + +func (s HttpHeader) String() string { + str, _ := text.Marshal(0xb39047580b6fd228, capnp.Struct(s)) + return str +} + +func (s HttpHeader) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpHeader) DecodeFromPtr(p capnp.Ptr) HttpHeader { + return HttpHeader(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpHeader) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s HttpHeader) Which() HttpHeader_Which { + return HttpHeader_Which(capnp.Struct(s).Uint16(8)) +} +func (s HttpHeader) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpHeader) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpHeader) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpHeader) Common() HttpHeader_common { return HttpHeader_common(s) } + +func (s HttpHeader) SetCommon() { + capnp.Struct(s).SetUint16(8, 0) +} + +func (s HttpHeader_common) Which() HttpHeader_common_Which { + return HttpHeader_common_Which(capnp.Struct(s).Uint16(4)) +} +func (s HttpHeader_common) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpHeader_common) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpHeader_common) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpHeader_common) Name() CommonHeaderName { + return CommonHeaderName(capnp.Struct(s).Uint16(0)) +} + +func (s HttpHeader_common) SetName(v CommonHeaderName) { + capnp.Struct(s).SetUint16(0, uint16(v)) +} + +func (s HttpHeader_common) CommonValue() CommonHeaderValue { + if capnp.Struct(s).Uint16(4) != 0 { + panic("Which() != commonValue") + } + return CommonHeaderValue(capnp.Struct(s).Uint16(2)) +} + +func (s HttpHeader_common) SetCommonValue(v CommonHeaderValue) { + capnp.Struct(s).SetUint16(4, 0) + capnp.Struct(s).SetUint16(2, uint16(v)) +} + +func (s HttpHeader_common) Value() (string, error) { + if capnp.Struct(s).Uint16(4) != 1 { + panic("Which() != value") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s HttpHeader_common) HasValue() bool { + if capnp.Struct(s).Uint16(4) != 1 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpHeader_common) ValueBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s HttpHeader_common) SetValue(v string) error { + capnp.Struct(s).SetUint16(4, 1) + return capnp.Struct(s).SetText(0, v) +} + +func (s HttpHeader) Uncommon() (HttpHeader_NameValue, error) { + if capnp.Struct(s).Uint16(8) != 1 { + panic("Which() != uncommon") + } + p, err := capnp.Struct(s).Ptr(0) + return HttpHeader_NameValue(p.Struct()), err +} + +func (s HttpHeader) HasUncommon() bool { + if capnp.Struct(s).Uint16(8) != 1 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpHeader) SetUncommon(v HttpHeader_NameValue) error { + capnp.Struct(s).SetUint16(8, 1) + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewUncommon sets the uncommon field to a newly +// allocated HttpHeader_NameValue struct, preferring placement in s's segment. +func (s HttpHeader) NewUncommon() (HttpHeader_NameValue, error) { + capnp.Struct(s).SetUint16(8, 1) + ss, err := NewHttpHeader_NameValue(capnp.Struct(s).Segment()) + if err != nil { + return HttpHeader_NameValue{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// HttpHeader_List is a list of HttpHeader. +type HttpHeader_List = capnp.StructList[HttpHeader] + +// NewHttpHeader creates a new list of HttpHeader. +func NewHttpHeader_List(s *capnp.Segment, sz int32) (HttpHeader_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 1}, sz) + return capnp.StructList[HttpHeader](l), err +} + +// HttpHeader_Future is a wrapper for a HttpHeader promised by a client call. +type HttpHeader_Future struct{ *capnp.Future } + +func (f HttpHeader_Future) Struct() (HttpHeader, error) { + p, err := f.Future.Ptr() + return HttpHeader(p.Struct()), err +} +func (p HttpHeader_Future) Common() HttpHeader_common_Future { + return HttpHeader_common_Future{p.Future} +} + +// HttpHeader_common_Future is a wrapper for a HttpHeader_common promised by a client call. +type HttpHeader_common_Future struct{ *capnp.Future } + +func (f HttpHeader_common_Future) Struct() (HttpHeader_common, error) { + p, err := f.Future.Ptr() + return HttpHeader_common(p.Struct()), err +} +func (p HttpHeader_Future) Uncommon() HttpHeader_NameValue_Future { + return HttpHeader_NameValue_Future{Future: p.Future.Field(0, nil)} +} + +type HttpHeader_NameValue capnp.Struct + +// HttpHeader_NameValue_TypeID is the unique identifier for the type HttpHeader_NameValue. +const HttpHeader_NameValue_TypeID = 0xed5334c41abc0375 + +func NewHttpHeader_NameValue(s *capnp.Segment) (HttpHeader_NameValue, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpHeader_NameValue(st), err +} + +func NewRootHttpHeader_NameValue(s *capnp.Segment) (HttpHeader_NameValue, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) + return HttpHeader_NameValue(st), err +} + +func ReadRootHttpHeader_NameValue(msg *capnp.Message) (HttpHeader_NameValue, error) { + root, err := msg.Root() + return HttpHeader_NameValue(root.Struct()), err +} + +func (s HttpHeader_NameValue) String() string { + str, _ := text.Marshal(0xed5334c41abc0375, capnp.Struct(s)) + return str +} + +func (s HttpHeader_NameValue) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (HttpHeader_NameValue) DecodeFromPtr(p capnp.Ptr) HttpHeader_NameValue { + return HttpHeader_NameValue(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s HttpHeader_NameValue) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s HttpHeader_NameValue) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s HttpHeader_NameValue) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s HttpHeader_NameValue) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s HttpHeader_NameValue) Name() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s HttpHeader_NameValue) HasName() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s HttpHeader_NameValue) NameBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s HttpHeader_NameValue) SetName(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s HttpHeader_NameValue) Value() (string, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.Text(), err +} + +func (s HttpHeader_NameValue) HasValue() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s HttpHeader_NameValue) ValueBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return p.TextBytes(), err +} + +func (s HttpHeader_NameValue) SetValue(v string) error { + return capnp.Struct(s).SetText(1, v) +} + +// HttpHeader_NameValue_List is a list of HttpHeader_NameValue. +type HttpHeader_NameValue_List = capnp.StructList[HttpHeader_NameValue] + +// NewHttpHeader_NameValue creates a new list of HttpHeader_NameValue. +func NewHttpHeader_NameValue_List(s *capnp.Segment, sz int32) (HttpHeader_NameValue_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) + return capnp.StructList[HttpHeader_NameValue](l), err +} + +// HttpHeader_NameValue_Future is a wrapper for a HttpHeader_NameValue promised by a client call. +type HttpHeader_NameValue_Future struct{ *capnp.Future } + +func (f HttpHeader_NameValue_Future) Struct() (HttpHeader_NameValue, error) { + p, err := f.Future.Ptr() + return HttpHeader_NameValue(p.Struct()), err +} + +const schema_b665280aaff2e632 = "x\xda\xbcY}p\x14\xe7y\x7f\x9e\xdd\xbb[IH" + + ":\xad^\x81\x8dcx\x91\x8c\x13\x909b\xa10\xae" + + "\x15\xd3C:\xe4\x80\x06\x82V\x12\x900\x8e\xdd\xd5\xdd" + + "{\xd2\xc2i\xf7\xd8\xddC\x12S\xaa\x82K\\\xe8x" + + "\xc6fJ[\x18<\x0d\x9dx\xc6\xa4Cm\x92\xdaS" + + "\x98\x12\x87&\x1e\x8f=\xe9L!\xe3\xdaxbg\x92" + + ")qp\xc7M\xed\xd4m\xc9\x14o\xe7\xd9\xbd\xbd;" + + "\x09\xe9P\x8a\x9b?@w\xbb\xbf\xe7\xfb\xeb}\x9f\xbb" + + "?V\xb7>\xd2\xd1\xf0\x97\x0c$\xed_\xa21\xef\xfe" + + "\xa5O\x1d\xb97\xfb\xf3\x03\xa0>\x80\x00QT\x00:" + + "_\xac\x1d\x96\x00\xd9\xa5\xda$\xa0\xf7\xd8\xc4\x8f~\xa0" + + "\xfc\xea\xea\xe3\xa0.\x92\xbc5?\xff\xe8\xf9\xba\x15\xe2" + + "%\x00\xec\xfc\xb8\xb6\x07Y\xb4N\x01`X\xf7\x00\xa0" + + "\xf7\xf8\xff\xbc\xb4\x84\xf5\x8e\x1f\x02mQ\xb4f\x1a\xb4" + + "\xa3\xae\x0eY7A\x07\x1f\xaa\x93\x11\xf0\x97K\x9d\xc7" + + "\x9d\x87.<9\x93g\x82\x80\xeb\x08\xd8\xf9`\xdd\xb8" + + "\x04\xe8\xb5\x1d{{G\xff/\x92O\x83\xba\x0c\x01\"" + + "\xf4\xe6\x8d\x056B\xc4\xdb\xf5\xaf\xf7\x9d\xb9\xf1\xc5?" + + ";\x0a\xea\"y\x1a\x93\x8b\x0b\x9a\x91]Z\xf0\x00\x00" + + "k\xa8\x7f\x95\x1d\xaeW\x00\xbcko\xedx\xf6\xcdC" + + "\x8f\x1c\xab\xb4sO\xfd.\xb2\xf3\xc9z\xb2\xf3\x8b\xc9" + + "\xad?z\xf9\xb3\x7fs\x1c\xd46\xb9\xcc\x1b\xb0\xf3L" + + "\xfdyd\xaf\x10\x13v\xb1^\xa1\x7f\x00\x1e^~\xff" + + "\xe4S\xeb\xfe\xf99P\xdb\x88]\x94\xd8\x9d\xae?\x82" + + "\x80\x9d\xe7\xea9\x02zq\xf9\xf3\xa9\x97\xb6\xfe\xdd\xe9" + + "@\xf1@\xe0;\x0d\x07\x11\x90]k \x81\xef\xbe\xf2" + + "\xc9\xfd\xab\x94\xb7O\x17YH\x04\xa8m" + + "\xb3\xe3MG\x09p\xdagV\xf3\xe8\xf1\xc7\xfe %" + + "\xbd\x0e\xda=(y\xc7\x9b\x07?\xbc{\xed\xda\x8fJ" + + "\xcc^k\x1a&\xec\x1b>\xb3\xcf\xb4?\xf9\xfc\xe2\xce" + + "W\x7fX\xe9\xda\x0e\x95\xa2\xc3\xbaU\x02|\xe7\xbf\xfa" + + "&\xefy\xf9\x97\xd3\x00\xcf\xa8\xdf&\xc0\x19\x1f\xe0d" + + "\xbbj\xdf?\xfb\xfe?U\xba\xa7\xb6\xf9(\xd9\xb6\xb2" + + "\x99\xd4Y\xf1\xe6\xf7\xbf\xf9\xe0\xca\x1do\xdf\x94.[" + + "\x9a?Bf4SpD\xf3\x13\xec\x02}\xf2\xbe?" + + "\xb1c\xf5\xe1\x87\xaf\xff\xb82\x19\x9em\xf6\x93\xe1\xac" + + "\xcf\xae\xe4\x9c\xe9\xd1\x0b4\xbb\xd4\xdc\x8c\xec\xa7>\xcb" + + "w\x9a\xdf\x03\xfcI{\xdf\xbb}K\xf7\\\xd3ZQ" + + "*\xc7}\x1b\x92'\xa4\xce\xd3\xac\xc7\xe7\xcb\x9e\xa7\x10" + + "\xa4\x17<\x92\xdf\xbe\xe6\xfd\x9b\xd5l9\x8fL\xb4\x10" + + "O\xbd\xe5\x09v\x8e>y\x05\xf9\xef\xef\xfa\xc1\x17\x06" + + "?\x00\xb5\x15\xcb\x8c\x03%N\xb5\xecD\xf6\xa2Op" + + "\xb6\x85\\\xf4\xdd\xbf\x9d\xfa\xeb\xae\x17\xb6\xfc\xdbM\x8d" + + "\xa1aa\x17\xb2%\x0b\x89h\xf1\xc2'\"\x80\xe5h" + + "\xcdf\xdd\x15~\x17\xb2k\x9c\x18_\xe5\xef\x01z\x17" + + "/\xb7>\xba~\xc1\xa1\xff,\xe6\x95\x0f:\xb7\xcc/" + + "\xd57\x96\x91\xe4C\xff\xfd\xf5?\xe9\xf9\xc5\x81\xeb\xc4" + + "\x0e\xcb\xec\xfc\xe6\xd0\xdb\xba\x06\xd9\xb6V\xe2\xa6\xb5\x92" + + "g\xf7\x7f\xe9\xbe\x13'\x8e9\xbf\x0e\"\xe9c\xf6\xb4" + + "\x9e\x90 \xe2\xa5V-\x1c\x7fs\x81|\xa32\xe5\xf6" + + "\xb4\xfa)w\xc0'\xcd\x1c\xf8\xc9\xd5\x7f\xfcf\xe3'" + + "\x95I\xf0l\xebAR\xe4bk\x12~\xe5\x8d\xban" + + ">a\xed\x155v\"\xad\xe7\xcd\xfcj\xff\xff\xae\x8d" + + "\xae\x9b\x1f\x14\xf6^#-V\xa7r\x860\xdd\x01\xb1" + + "\xa7 \x1c7e\x99\xae\x98pW;\xaen\xbb\x03\xc2" + + "\xc9[\xa6#\x96\xf7\xeb\xb6\xa2\x8f9ZD\x8e\x00D" + + "\x10@m\xe8\x03\xd0\xeae\xd4\xee\x94\xd0\xb3\x8b8\x00" + + "\xc0\xa6\xb2+\x01\xb1\x09\xb0\xa4Bd\xba\x0a)kl" + + "\xcc27\x0a=#\xec\xedz\xae \xa0\x1fQ\xabA" + + "\x09@U{\x88X\xad\x1dV\x1b\xf8\x94a\xee\xd5s" + + "F\xc6\x1b\xd9g\xe47\x88l\x0e\x14\xdd\x15Z\x04\xa5" + + "\x8av\x1e\x91\xb0\xbb\x05\xb1\x1e@E\xdbG\xaeZ\x96" + + "\x11\xc0\xb39\xdd\x15\x00%\x1d\xe4\xe9:\xa4}\x1d\x86" + + "\xc4\x84\x0b$\x1d\xebA\x9a\x0bJ\x1e\xdb\"\xdcQ+" + + "\xe3C\xb5QR\x94u`\x1bi\xcaVb;\x00J" + + "\xac\xd5\xff+\xb3\xc5\xfe\xf3\x08S\xb1\x0b\x00\xa3\xac\x16" + + "\xd7\x00`\x8c\xa1\xffWQ\xaf\x93\x815\xea\x87\xf4\xad" + + "V\xbdFDu\xeaO\xe9\xcf\x02\xf5\x0a=\xacW/" + + "\xd1\xb7\x06\xf5\xb5>\x00lT_\x19\x00\xc0\xb8z\x91" + + "\xd85\xa9\xe7\xe8\x8f\xaa\x9e%!\xcd\xeai\xfa\xc6\xd4" + + "S;\x01\xb0E}\x86\x08\x16\xaa\xc7\x89\xcb\"\xf5i" + + "\x12t\x87z\x98 w\xaa\x07\x88\xcbbu\xff0\x80" + + "2\"\xdc\xf8\xa8\xd03\xf1\xbc\xe5\xb8J\xbe\xe0&3" + + "\"'\\\xc1\xf3\xba\x9b\x1e\xe5\xf9\x82=\"\xa6\xac\xbc" + + "kX\xa6\xc3][O\x8bx\xda\xcaO\xc6sVz" + + "7\x1f\xdb\x9d\xb6r\xf11k\xaf\xf0\xf2\xb6\x95\xcf\x1a" + + "f\x06\x00\xfc\xcfD\x0e8\x9at\x84n\xa7G\x93\x05" + + "\x93\x08\x14=\x9dK\xda\"o\xd9\xae7\xb6[O\xbb" + + "\xc6^\x03dw\xd2K\x8f\x8a\xf4n\xab\xe0\x02\x00\x1f" + + "\x13$r\xacHhZ\xae\x91\x9d\xf4\x9c\xc2\xb0\x93\xb6" + + "\x8da@\xe1\x15\xcc\xe0\x1b(\xc6\xb0\x98+\xafv\x88" + + "\xe1A+\xbd[\xb8\xab\xd39\xcb\x11\xcb\x07\x04w\x0a" + + "9\xd7\xa9\x16\xd8\xa0\x14Ph\xf5X\xd9\x90\xd4oU" + + "4\xd1\x85?\xab\x18\xc0K\xbe\xe5\x85e\x83a\xdd\xc4" + + "\xa9p\xbc\x94e\x9a\"\xed\xa6\xa4\x99U\xa5\xd0[\x12" + + "$\xec\x99DZ\xbd\x1c\xc5r\xcb\xc7p\xee\xaa\xda." + + "\x90\xd4M\xd4\xf7\xc2y\x81aKP\xd7\xf5\x80\xa4v" + + "((\x95&=\x86\x13J\xbd\x97\xde-V\xbcb\x15" + + "\xef\x818\x89[\x8fSv\xa0\xcfz\x9cJ\x07z\xae" + + "\xc7~\xc4O\xa9K\x0c\x08'N\x9e\xael\x13\xed\x00" + + "Z\x8d\x8cZ\x8b\x84\xf1a+3\x89\xaa\x97\xfd\xf3\xba" + + "\x1f\x7f\xe3\xad\xf7.\xfb%^\xd1\x1f\xa2s\x0b\x0f\xdd" + + "\x16\x08O\x06\xd2\xfb\x11\xfb\xe5h\xa5\xfaU8\x14\xcd" + + "\xa5N\xa6\x8f9\x00ZKI\xc7\xfd\xa4\xe3\x84\x8c\xda" + + "\x1fI\xa8\"\xb6\xd0YB=\xd0\x03\xa0\xfd\xbe\x8c\xda" + + "_H\xa8JR\x8b\xdf\x96\x8e\x11\xf2)\x19\xb5\x93\x12" + + "\xaa\xb2\xdc\x822\x80z\x9c\x90\x7f*\xa3\xf6\x0d\x09\xd5" + + "H\xa4\x05#\x00~\x11j'e\xd4\x9e\x930>j" + + "9.\xb5\x16\xac\x07\x9c\x1a\xf5\x1b\x9e\x83\x8d\x80\xfd2" + + "bSy\x88\x01\xd2\xc3x\xc6\x1a7o\xf6\x12\xc5\x8b" + + "\x8cF\xb5\x9c\x92E\xff9\xc2u\x0ds\xc4\x09\xbao" + + "i\xf2\xcc\xe8\xbe\xd1\xb9\xaa\xc4\x11ff\x83\xee\xea\xa1" + + "k\xe6\x8a^Fwul\x00\x09\x1b\xe6\x17\xb30\xf7" + + "(d\xcb\x07\x92\xc2/B\xad\xa6\xc4|\xe50\x80\xb6" + + "BF\xed\x0b\x15n\xef g\xae\x92Q\xfb\x1d\x7f\xac" + + "\xf8\xc4=\xa0\xcc\x9a8\x15.)\x15\xe6\x8c\x94\x92\xe7" + + "0\xda\xef\xe0\xf5r\xb4\xe2\xdc\x83\xe6\xd9\xef\x8dw\x9e" + + "x\xec\xb8\xaa\xf5\xf9E\x87\xe5\x03r\xf9\xdd:z\xb7" + + "\x96\x8a.<|bx\xfcWW\xae\x01I]\xa2x" + + "\xe4\xd0`\xa4\xc0z\xf4B\xf7\xfa\xdf\xb8\xdf\x92\xa6\xd7" + + "\xdc,\xed(\x18\x8a\x00Z\x04\xb1\xe2\xc4\x83\x03\xde\x97" + + "\xf51A\xc3\x12P\x90+\xeb=\x0fKg-ue" + + "\x17H\x0d\xf8\x89\x17\xe4\xa5J)\xd8$\xa3v\xb7\x84" + + "\xc9`\xd0y\x053\xf8\x10\xa4J\x89\xf3\x8cT\xa9\xad" + + "\xd2\x05\x8a\xddm\xcef\xd0k\xdb\x96M\x9d\x80\xa2\x0d" + + "\xf0\x7fl\x05\xb7h\xe9\xfdz\x9cR\xb52\x99\x88\xf9" + + "r\x19\xb5\xfb%\x0cs)\xd1UN\xb0x\xda\xca\x08" + + "T@B\x050i\x0b\xdd\xb1\xcc\xb0$o\xaf\xfb\x95" + + "t+\x0d\x9aJ\x9bwV\x9c\x92\xa8\xb0\x09\x0a\xb2\xa0" + + "\x9c-\xdd\x9d\xaa\xdbNZ\x14\xe5\xae&\xaf\x0d\x1a\xf2" + + "\xbe0\xf6A\xa0W\xf6\x94m_\x82\x9fx\x18\xb4\xa0" + + "\xc4\x9a\xb2\xf9S\x05s\xb7i\x8d\x9b\x10\xe3YcB" + + "d\xb0\x16$\xac\x85\xdf\xa8s\x061\xc5i\xe6\xddU" + + "\x0e\xa9\\\xc8\xcf?\xa0\x81Q\xc1\xd8\x08\xacR\x8c\xdf" + + "\xaeU\xc5\xdeR\x9e\x07\x15\xb9T!\xb9\xd4\x98\x12=" + + "\x15r\x8b\xc4\xd8T\xbe\x14\x05%T\xd1\x92J\xa7\x88" + + "\xf9O\xb9i\x1d\xb3\x9f\xeb3s\xfc\xffU\xaf\xdb)" + + "\xfaT\xe5p\xc5\xdb\xbc&\xc4~SExx\x1a\xd0" + + "j\xfc\x8e\x1e^\x8c1\xbcW\xa9\x1dt\x8cZI\x1d" + + "=\xbc/a\xb8\\P\x97\xec\x04I]X<*\xa5" + + ",\x13\xe2\xc1\xb1\xc8\x0b\xdb\x19\xc8\x96=\xbdcW\x1d" + + "\xa5\xd4\xf9o5J\xfdP\xcc\xec>\xf2\\u\x8f\xbe" + + "mM%V:\xf5\xb5Gd\xd4F\xcb\xbdN\xb4\x01" + + "h\xbf'\xa3\x96\xa3\xe3\x0a\x06\xc7\x15\x83r##\xa3" + + "\xf6\x87\x12\xa2\x8c\x15\xdb\x0eu\x7f\x1fH\xc91\xff:" + + "\x83\xf1p\xd5\x05\x88q@\xa5`\xe7\xe6}Z\xf1\x82" + + "\x96\xb4\x8fbZ\xad\xd8\x83\x89\xb6\xba8}\xb4\xfa\x92" + + "1\xbd\xe4\x97\xf52j\x9b\xa9\xcc=\xafh\xcf&:" + + "\x1cl\x94Q\x1b\x92\xb0A\xa2\x91F\x06iT\xfc\x9b" + + "e\xd4\xbe\"a\xdc\xd4\xc7\x04\xc6\xcbw\xfc@{/" + + "\x10\xb1]\x07%W\xa0\xf7\xa5\xe5`\xf0\x9e\xef\xa5\xab" + + "\xe6M\xce\x8f\xce\xb7\xf5\x97\xcf\x9e\xc5l\x0b\xb7\x93\x18" + + "\xae\xef\xd4\x0e;\xcc\xb6pM\x80\xe1\x1eJ]\xb2\xaf" + + "\"\xdb\x06\x84\x03\xdc\xaf\x880\xddv\x88aH\x06\xc9" + + "4=\xe5\xe6vi\xf1D \x17D\xa0\xd3l\x13\xb1" + + "\xdc-*\xbag\xe0\xc0\xa2#\xe6p\x8b<\xd7\x95=" + + ")l\x12L\"\xbf\xe7_\x84\x1f\x94\xfc+;\xeb\x90" + + "l\xb6V\xe2(\xb1m\xd2>\xf6U\x89\xa3\xcc&\xa5" + + "}l\xbf\xc41\xc2\x9e\x91v\xb1S\x12\xc7(\xbb(" + + "u\xb1\x8b\x12\xc7\x18{Gz\x9d]\x938*L\x95" + + "\xdb\x98*s\xaca\x09y\x0dK\xc8\x1ck\xd9&\xd9" + + "f[d\x8eulL\xde\xc5\xf6\xc8\x1c\x17\xb0\xa7\xe5" + + "\x13\xec\xb8\xcc\xb1\x9e]\x90\x0f\xb2\x8b2\xc7\x06vU" + + ">\xc8\xae\xc9\x1c\x1bYC\xc4fj\x84c\x9cuD" + + "\x0e\xb2\xb5\x11\x8eM\xec\xab\x91]\xeck\x11\x8e*\xdb" + + "\x1f\x19f\x07\"\x1c\x9b\xd9\xa9H\x17;\x15\xe1\xc8\xd8" + + "\x85H;\xbb\x10\xe1\xd8\xc2\xaeD\xda\xd9\x95\x08\xc7\x85" + + "\xec\xe3H\x17\xfb8\xc2q\x11S\xa3=L\x8dr\xbc" + + "\x83%\xa2\xed,\x11\xe5x'\xdb\x14mg\x9b\xa2\x1c" + + "\x173\x11\xeda\"\xca\xf1.v(z\x90\x1d\x8er" + + "\xfc\x0c;\x13\x1dfg\xa3\x1c\xeff\x97\xa2=\xecR" + + "\x94\xe3\x12\xf6a\xf4(\xbb\x1e\xe5\xb8\x94-\x89\xedb" + + "\xad1\x8e\x9cu\xc7\xdaYw\x8c\xe32\xf6\xb5X\x1f" + + "\xd3c\x1c[\xd9\x81\xd80;\x14\xe3\xd8\xc6\x9e\x8d\x1d" + + "egb\x1c\xefa\x97b'\xd8\x95\x18\xc7\xe5\xecF" + + "l\x0d\xbb\x11\xe3x/[\xac\xf4\xb0\xc5\x0a\xc7\xcf\xb2" + + "\xb5J\x0f[\xabp\xfc\x1c\xd3\x94\x9dl\x9b\xc2q\x05" + + "+(]\xac\xa0p\\\xc9\x9eV\x06\xd81\x85c;" + + "{Q\xf9\x07vA\xe1x\x1f\xbb\xaa\x1ca\x1f(\x1c" + + "W1\xb5f\x80-\xac\xe1\x98`kk\xda\xd9\xda\x1a" + + "\x8e\xab\x99V\xd3\xc6\xb4\x1a\x8e\x9fgc5\x07\xd9\x9e" + + "\x9a\xf2\x02FO\xa7E\xdeM\x8d\x02\xd7mG\xb8U" + + "V0\xfb\xbcn\x1f\x9bHAr\xd4\x07\x03\x14\xc9{" + + "MH\xa6\xad\x8ca\x8eT\xa1?\x18\xd2\xf7\xa2\x19\x80" + + "\xa1\xc4`\xb3\x0eIs\xa4\xa0\x8f\x88\xf90\xd8\x8cz" + + "\x00.3\x18\xd0!n\x8e\x08\xa7\xea\x0a\xa9H>\x00" + + "\\',@2 \x9e\x85\xa8\xa9H\xd4\x95\x0c\x88\x8a" + + "\x82\x1c'eI\xa6k[\xb9\xee\\\xce\x1a\xdfj\x1b" + + "#\x86\xe9\x9f\xe9g2\xb8\xbb\xc8\xe0g\xbeT\xc7I" + + "\xa4$\xcb'L\xf8\x94\x89\xad\xb6\xa1\xf8\xb4\xca\xecF" + + "\x87\x0a\xb4)\xddd'\xd7\x89\xaa\x0an\x0d\xf7\xf9\x92" + + "\x9e\x05w\xd4\xb2\x8d}\xc0u\xd7\xb0\xcc\xea\x1e\x99\x8e" + + "\x05\xf0\xd2zzT\xf8#\x93\x94\xadJ\x9c\"h\"" + + "e\x01\xf7\x0d#bj\xa4\xa6\xbb\x01\x0d'o9\x86" + + "k\xc8\xb3\xca\xbf\xb3\xc8\xe2\xaf\xbcT@\x90\xc0\x0dE" + + "\x0a\xa5\xa8E\xf0\xbc\x9c)U\xb8\x1c)s\xe9\x0d\xe1" + + "\x18r(\xa7\xca\xfc8l\x0e\xe1e\x0e\xc0\x859\xe2" + + "\x8eV\xad\x8c\x90\x1e\x92\x9b}p\xd9\x84\xcdh\xa5\x03" + + "\xdf\xceS\x81\x10^R`\x00\xe2\x94\xae\xd5C\x11\xca" + + "\xe7\x03\x84-\x8b\x1f\x02e2_\x8dvW\x996>" + + "4\x99\x17@\x95l\xed6D\xd5\xa2H\xf9\x10\x80x" + + "f\xf6\xb5m\x88l\x8fo\xf0w\xb5q\xe1\xea#U" + + "q\xbdC\xfa\x08@RL\xe4E\xbazA\xf6\xfa\x10" + + "\x80)1\x917\xecYK>\x04\xf7L\xf5\x06\x18\x80" + + "x\xd6\xb6\xc6\xaaj\xf0\xb0m\x8d\x01\xf8\x8b\x9d\xaa\xb8" + + "\x8d\x96C\xd2\x8d\xec\x16\xddMWK\x8b>oS6" + + "\xe1\x83\x00\xd03\xb2[\xac\x8c\x915Pd\x06\x0d3" + + "]5!\x8f\xfa\x94\x04GCd\x12\x84G\x0a\xaa\x91" + + "\xfd\xb2e\x8a-:(\xd5%\xdbDO\xd0\x04\xf0\xa2" + + "\x02SFv\xe0\x16i\xe4\xeb[\xcc\x1f\xd2w\x9b9" + + "fe\x0c\xcc\x1a\x81\xc6(\xaa\x96\xf2\xa6l\xc2'@" + + "#\x1b\xe8\xac\x90\x91\xe0\xe5t\xc7%S N\xcf\xab" + + "*\xbdYw\\2\x1b\xb8\xcf\x03 \x9e3\xcc\xddU" + + "\x83\xb1\xd90w\x93\x90\xb0jf\xed\xc5e\x03K\xd5" + + "\x05\xe8\x8d\xe9\x13\x0f[\xf6\xb8\x0e\x8a\x9dq\xaaV\xc8" + + "\x16}\"AP\x88\xebv\xc6\x09V\xe2\x13\x93\xdd\x05" + + "\x17G\x85\xe9\x1ai\xdd\xad\xea\x9b\x13^?\xe1\x13\xdd" + + "\x05t\x8b\x04\xb2\xff\x03F\x99\x0d\xf5`\xfd\xd6\xed\xb2" + + "\x82O@\x11\xb4Kn\xcf\x11\xd9\xf2p(\x86u\xca" + + "\x16Ya\x0b\xbbj\xcd\x0c\x04\x98\x00m\x0bg\xf4V" + + "h\xc2\x00x\xb6p\xed\xc9\xee\xac\x0b\xf2\xac\x02B\x7f" + + "\x0e{\x03\x04LtgAqIL\xd2\xf17\xc1U" + + "\x8b>X\x16\xd3EP\xb8~\xf3\x01\xac\x96\xca;\xbd" + + "A\xe1&\x08\x082\xf5)\xcfqm#\xed\x0e\xd9\x92" + + "n:y\xcbv\x07E\xba`\x1b\xeed\xb5\xd1}\xd9" + + "\x1b\xf4\xa9\x12C\x92]$K\x14\xe9p\x12\xc0s\xe9" + + "iV\xd8\xe5\xb1S\xbd\xa6\x87B|\xa2H\x80#\x00" + + "^\xc1\x11v\xf7\x880\x01\xdd\xaa\x06ms\x84\x9d\xa0" + + "\xb3\x80l\xba\x00\xf1\xbd\xba=Y\xb52\xb6\xeb\xf6$" + + "\x80\xb2\xd7\xd0\xab\x9e.\xb6\x1b:\x807>>NG" + + "\x01\x81A:\xdfbZ\xee\xd8\xb1#Ap\x14!\xfc" + + "\x167^'o\x99\xb2#f\\yw\x96\xaf\xb7\xe1" + + "]\xc6\xa0g\xa32jn\xc5\x95w\x0f]ys2" + + "j\x7f\\\xbc\xf2\x96~\x93W\x0f\xf5\x81D\xb7,\xb7" + + "\xe0\xa4,\x90\xcb\xeb\xc0\xe2\xc3!\x01\xf2\x84{{7" + + "\xdf\xdb\xdc \xce\xb2\xd7\x0cw>\xeb+nq\xeb\xfa" + + "\x00\xb4\x87d\xd46J\xf3\xd0\xb3\x90/\xee\xbc\x01\xaa" + + "l\x1do\xba\xe9\xf9\x9b\x96A\xe1r\xff\xb7\x05\x0aG" + + "\xc52\xa3\xab\xbc\xccH\x16\x1c1\x94s\x10AB\xfc" + + "\x94\xf7I\xfe\xcaQ\xae\xf8\xe9n\x1e\x0b\xbd\xd9\xd6\x94" + + "\xc3\xd3\x96PU\x7fT\xf8\x14\x97\xe0\xb3,\x81\xe6\xbd" + + "\x0d\xfb\xdf\x00\x00\x00\xff\xff)\xed{\xa2" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_b665280aaff2e632, + Nodes: []uint64{ + 0x81e666258a901e30, + 0x83e5f307c4d3785f, + 0x857745131db6fc83, + 0x8dbd3c007383731e, + 0x913fe85057da9522, + 0x92963bfdad2beb6a, + 0x955c85d7a557d8e9, + 0x99ae26bfd34f3f3b, + 0xa8d63d909cead201, + 0xa9b84fb6432f030f, + 0xa9da072c30fec5de, + 0xb09c33a9f4caa823, + 0xb39047580b6fd228, + 0xb92efa728643f0ed, + 0xba1fca454f465e9a, + 0xbd146efdadd86c3d, + 0xbe541ecc63c9b2ba, + 0xbf2721059c3d9248, + 0xca02437e5f995e08, + 0xccc73319af8d2a1b, + 0xccefbf23794af7b3, + 0xd0eab1ea093a6673, + 0xda572939a4c3d728, + 0xdcf946892e5778c3, + 0xdeb08db1052a4866, + 0xe971001e4ade4a2a, + 0xea3256705c0b63ba, + 0xed5334c41abc0375, + 0xee4db03aab7fb4be, + 0xf235351cf1531299, + 0xf6850b405e21d2c1, + 0xf981e8428b86f885, + 0xfa73959a9a2b477d, + 0xfd030bd777152c43, + 0xfe0ea4cde5df8164, + }, + Compressed: true, + }) +} diff --git a/std/capnp/compat/json-rpc.capnp b/std/capnp/compat/json-rpc.capnp new file mode 100644 index 00000000..ff233548 --- /dev/null +++ b/std/capnp/compat/json-rpc.capnp @@ -0,0 +1,46 @@ +@0xd04299800d6725ba; + +$import "/capnp/c++.capnp".namespace("capnp::json"); + +using Json = import "/capnp/compat/json.capnp"; + +struct RpcMessage { + jsonrpc @0 :Text; + # Must always be "2.0". + + id @1 :Json.Value; + # Correlates a request to a response. Technically must be a string or number. Our implementation + # will always use a number for calls it initiates, and will reflect IDs of any type for calls + # it receives. + # + # May be omitted when caller doesn't care about the response. The implementation will omit `id` + # and return immediately when calling methods with the annotation `@notification` (defined in + # `json.capnp`). The `@notification` annotation only matters for outgoing calls; for incoming + # calls, it's the client's decision whether it wants to receive the response. + + method @2 :Text; + # Method name. Only expected when `params` is sent. + + union { + none @3 :Void $Json.name("!missing params, result, or error"); + # Dummy default value of union, to detect when none of the fields below were received. + + params @4 :Json.Value; + # Initiates a call. + + result @5 :Json.Value; + # Completes a call. + + error @6 :Error; + # Completes a call throwing an exception. + } + + struct Error { + code @0 :Int32; + message @1 :Text; + data @2 :Json.Value; + } +} +using Go = import "/go.capnp"; +$Go.package("jsonrpc"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/jsonrpc"); diff --git a/std/capnp/compat/json-test.capnp b/std/capnp/compat/json-test.capnp new file mode 100644 index 00000000..e481a6db --- /dev/null +++ b/std/capnp/compat/json-test.capnp @@ -0,0 +1,126 @@ +# Copyright (c) 2018 Cloudflare, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +@0xc9d405cf4333e4c9; + +using Json = import "/capnp/compat/json.capnp"; + +$import "/capnp/c++.capnp".namespace("capnp"); + +struct TestJsonAnnotations { + someField @0 :Text $Json.name("names-can_contain!anything Really"); + + aGroup :group $Json.flatten() { + flatFoo @1 :UInt32; + flatBar @2 :Text; + flatBaz :group $Json.name("renamed-flatBaz") { + hello @3 :Bool; + } + doubleFlat :group $Json.flatten() { + flatQux @4 :Text; + } + } + + prefixedGroup :group $Json.flatten(prefix = "pfx.") { + foo @5 :Text; + bar @6 :UInt32 $Json.name("renamed-bar"); + baz :group { + hello @7 :Bool; + } + morePrefix :group $Json.flatten(prefix = "xfp.") { + qux @8 :Text; + } + } + + aUnion :union $Json.flatten() $Json.discriminator(name = "union-type") { + foo :group $Json.flatten() { + fooMember @9 :Text; + multiMember @10 :UInt32; + } + bar :group $Json.flatten() $Json.name("renamed-bar") { + barMember @11 :UInt32; + multiMember @12 :Text; + } + } + + dependency @13 :TestJsonAnnotations2; + # To test that dependencies are loaded even if not flattened. + + simpleGroup :group { + # To test that group types are loaded even if not flattened. + grault @14 :Text $Json.name("renamed-grault"); + } + + enums @15 :List(TestJsonAnnotatedEnum); + + innerJson @16 :Json.Value; + + customFieldHandler @17 :Text; + + testBase64 @18 :Data $Json.base64; + testHex @19 :Data $Json.hex; + + bUnion :union $Json.flatten() $Json.discriminator(valueName = "bValue") { + foo @20 :Text; + bar @21 :UInt32 $Json.name("renamed-bar"); + } + + externalUnion @22 :TestJsonAnnotations3; + + unionWithVoid :union $Json.discriminator(name = "type") { + intValue @23 :UInt32; + voidValue @24 :Void; + textValue @25 :Text; + } +} + +struct TestJsonAnnotations2 { + foo @0 :Text $Json.name("renamed-foo"); + cycle @1 :TestJsonAnnotations; +} + +struct TestJsonAnnotations3 $Json.discriminator(name = "type") { + union { + foo @0 :UInt32; + bar @1 :TestFlattenedStruct $Json.flatten(); + } +} + +struct TestFlattenedStruct { + value @0 :Text; +} + +enum TestJsonAnnotatedEnum { + foo @0; + bar @1 $Json.name("renamed-bar"); + baz @2 $Json.name("renamed-baz"); + qux @3; +} + +struct TestBase64Union { + union { + foo @0 :Data $Json.base64; + bar @1 :Text; + } +} +using Go = import "/go.capnp"; +$Go.package("jsontest"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/jsontest"); diff --git a/std/capnp/compat/json.capnp b/std/capnp/compat/json.capnp index 31662bd9..9ed99167 100644 --- a/std/capnp/compat/json.capnp +++ b/std/capnp/compat/json.capnp @@ -125,7 +125,6 @@ annotation hex @0xf061e22f0ae5c7b5 (field) :Void; annotation notification @0xa0a054dea32fd98c (method) :Void; # Indicates that this method is a JSON-RPC "notification", meaning it expects no response. - using Go = import "/go.capnp"; $Go.package("json"); $Go.import("capnproto.org/go/capnp/v3/std/capnp/json"); diff --git a/std/capnp/compat/json/json.capnp.go b/std/capnp/compat/json/json.capnp.go index 6911c4a3..63085f9d 100644 --- a/std/capnp/compat/json/json.capnp.go +++ b/std/capnp/compat/json/json.capnp.go @@ -10,12 +10,12 @@ import ( strconv "strconv" ) -const Name_ = uint64(0xfa5b1fd61c2e7c3d) -const Flatten_ = uint64(0x82d3e852af0336bf) -const Discriminator_ = uint64(0xcfa794e8d19a0162) -const Base64_ = uint64(0xd7d879450a253e4b) -const Hex_ = uint64(0xf061e22f0ae5c7b5) -const Notification_ = uint64(0xa0a054dea32fd98c) +const Name = uint64(0xfa5b1fd61c2e7c3d) +const Flatten = uint64(0x82d3e852af0336bf) +const Discriminator = uint64(0xcfa794e8d19a0162) +const Base64 = uint64(0xd7d879450a253e4b) +const Hex = uint64(0xf061e22f0ae5c7b5) +const Notification = uint64(0xa0a054dea32fd98c) type Value capnp.Struct type Value_Which uint16 @@ -24,7 +24,7 @@ const ( Value_Which_null Value_Which = 0 Value_Which_boolean Value_Which = 1 Value_Which_number Value_Which = 2 - Value_Which_string_ Value_Which = 3 + Value_Which_string Value_Which = 3 Value_Which_array Value_Which = 4 Value_Which_object Value_Which = 5 Value_Which_call Value_Which = 6 @@ -32,7 +32,7 @@ const ( ) func (w Value_Which) String() string { - const s = "nullbooleannumberstring_arrayobjectcallraw" + const s = "nullbooleannumberstringarrayobjectcallraw" switch w { case Value_Which_null: return s[0:4] @@ -40,16 +40,16 @@ func (w Value_Which) String() string { return s[4:11] case Value_Which_number: return s[11:17] - case Value_Which_string_: - return s[17:24] + case Value_Which_string: + return s[17:23] case Value_Which_array: - return s[24:29] + return s[23:28] case Value_Which_object: - return s[29:35] + return s[28:34] case Value_Which_call: - return s[35:39] + return s[34:38] case Value_Which_raw: - return s[39:42] + return s[38:41] } return "Value_Which(" + strconv.FormatUint(uint64(w), 10) + ")" @@ -133,27 +133,27 @@ func (s Value) SetNumber(v float64) { capnp.Struct(s).SetUint64(8, math.Float64bits(v)) } -func (s Value) String_() (string, error) { +func (s Value) String() (string, error) { if capnp.Struct(s).Uint16(0) != 3 { - panic("Which() != string_") + panic("Which() != string") } p, err := capnp.Struct(s).Ptr(0) return p.Text(), err } -func (s Value) HasString_() bool { +func (s Value) HasString() bool { if capnp.Struct(s).Uint16(0) != 3 { return false } return capnp.Struct(s).HasPtr(0) } -func (s Value) String_Bytes() ([]byte, error) { +func (s Value) StringBytes() ([]byte, error) { p, err := capnp.Struct(s).Ptr(0) return p.TextBytes(), err } -func (s Value) SetString_(v string) error { +func (s Value) SetString(v string) error { capnp.Struct(s).SetUint16(0, 3) return capnp.Struct(s).SetText(0, v) } diff --git a/std/capnp/compat/jsonrpc/json-rpc.capnp.go b/std/capnp/compat/jsonrpc/json-rpc.capnp.go new file mode 100644 index 00000000..2d3eadae --- /dev/null +++ b/std/capnp/compat/jsonrpc/json-rpc.capnp.go @@ -0,0 +1,435 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package jsonrpc + +import ( + capnp "capnproto.org/go/capnp/v3" + text "capnproto.org/go/capnp/v3/encoding/text" + schemas "capnproto.org/go/capnp/v3/schemas" + json "capnproto.org/go/capnp/v3/std/capnp/json" + strconv "strconv" +) + +type RpcMessage capnp.Struct +type RpcMessage_Which uint16 + +const ( + RpcMessage_Which_none RpcMessage_Which = 0 + RpcMessage_Which_params RpcMessage_Which = 1 + RpcMessage_Which_result RpcMessage_Which = 2 + RpcMessage_Which_error RpcMessage_Which = 3 +) + +func (w RpcMessage_Which) String() string { + const s = "noneparamsresulterror" + switch w { + case RpcMessage_Which_none: + return s[0:4] + case RpcMessage_Which_params: + return s[4:10] + case RpcMessage_Which_result: + return s[10:16] + case RpcMessage_Which_error: + return s[16:21] + + } + return "RpcMessage_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// RpcMessage_TypeID is the unique identifier for the type RpcMessage. +const RpcMessage_TypeID = 0xd3a68cd48aa056ca + +func NewRpcMessage(s *capnp.Segment) (RpcMessage, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}) + return RpcMessage(st), err +} + +func NewRootRpcMessage(s *capnp.Segment) (RpcMessage, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}) + return RpcMessage(st), err +} + +func ReadRootRpcMessage(msg *capnp.Message) (RpcMessage, error) { + root, err := msg.Root() + return RpcMessage(root.Struct()), err +} + +func (s RpcMessage) String() string { + str, _ := text.Marshal(0xd3a68cd48aa056ca, capnp.Struct(s)) + return str +} + +func (s RpcMessage) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (RpcMessage) DecodeFromPtr(p capnp.Ptr) RpcMessage { + return RpcMessage(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s RpcMessage) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s RpcMessage) Which() RpcMessage_Which { + return RpcMessage_Which(capnp.Struct(s).Uint16(0)) +} +func (s RpcMessage) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s RpcMessage) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s RpcMessage) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s RpcMessage) Jsonrpc() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s RpcMessage) HasJsonrpc() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s RpcMessage) JsonrpcBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s RpcMessage) SetJsonrpc(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s RpcMessage) Id() (json.Value, error) { + p, err := capnp.Struct(s).Ptr(1) + return json.Value(p.Struct()), err +} + +func (s RpcMessage) HasId() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s RpcMessage) SetId(v json.Value) error { + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewId sets the id field to a newly +// allocated json.Value struct, preferring placement in s's segment. +func (s RpcMessage) NewId() (json.Value, error) { + ss, err := json.NewValue(capnp.Struct(s).Segment()) + if err != nil { + return json.Value{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s RpcMessage) Method() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s RpcMessage) HasMethod() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s RpcMessage) MethodBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s RpcMessage) SetMethod(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s RpcMessage) SetNone() { + capnp.Struct(s).SetUint16(0, 0) + +} + +func (s RpcMessage) Params() (json.Value, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != params") + } + p, err := capnp.Struct(s).Ptr(3) + return json.Value(p.Struct()), err +} + +func (s RpcMessage) HasParams() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(3) +} + +func (s RpcMessage) SetParams(v json.Value) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetPtr(3, capnp.Struct(v).ToPtr()) +} + +// NewParams sets the params field to a newly +// allocated json.Value struct, preferring placement in s's segment. +func (s RpcMessage) NewParams() (json.Value, error) { + capnp.Struct(s).SetUint16(0, 1) + ss, err := json.NewValue(capnp.Struct(s).Segment()) + if err != nil { + return json.Value{}, err + } + err = capnp.Struct(s).SetPtr(3, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s RpcMessage) Result() (json.Value, error) { + if capnp.Struct(s).Uint16(0) != 2 { + panic("Which() != result") + } + p, err := capnp.Struct(s).Ptr(3) + return json.Value(p.Struct()), err +} + +func (s RpcMessage) HasResult() bool { + if capnp.Struct(s).Uint16(0) != 2 { + return false + } + return capnp.Struct(s).HasPtr(3) +} + +func (s RpcMessage) SetResult(v json.Value) error { + capnp.Struct(s).SetUint16(0, 2) + return capnp.Struct(s).SetPtr(3, capnp.Struct(v).ToPtr()) +} + +// NewResult sets the result field to a newly +// allocated json.Value struct, preferring placement in s's segment. +func (s RpcMessage) NewResult() (json.Value, error) { + capnp.Struct(s).SetUint16(0, 2) + ss, err := json.NewValue(capnp.Struct(s).Segment()) + if err != nil { + return json.Value{}, err + } + err = capnp.Struct(s).SetPtr(3, capnp.Struct(ss).ToPtr()) + return ss, err +} + +func (s RpcMessage) Error() (RpcMessage_Error, error) { + if capnp.Struct(s).Uint16(0) != 3 { + panic("Which() != error") + } + p, err := capnp.Struct(s).Ptr(3) + return RpcMessage_Error(p.Struct()), err +} + +func (s RpcMessage) HasError() bool { + if capnp.Struct(s).Uint16(0) != 3 { + return false + } + return capnp.Struct(s).HasPtr(3) +} + +func (s RpcMessage) SetError(v RpcMessage_Error) error { + capnp.Struct(s).SetUint16(0, 3) + return capnp.Struct(s).SetPtr(3, capnp.Struct(v).ToPtr()) +} + +// NewError sets the error field to a newly +// allocated RpcMessage_Error struct, preferring placement in s's segment. +func (s RpcMessage) NewError() (RpcMessage_Error, error) { + capnp.Struct(s).SetUint16(0, 3) + ss, err := NewRpcMessage_Error(capnp.Struct(s).Segment()) + if err != nil { + return RpcMessage_Error{}, err + } + err = capnp.Struct(s).SetPtr(3, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// RpcMessage_List is a list of RpcMessage. +type RpcMessage_List = capnp.StructList[RpcMessage] + +// NewRpcMessage creates a new list of RpcMessage. +func NewRpcMessage_List(s *capnp.Segment, sz int32) (RpcMessage_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 4}, sz) + return capnp.StructList[RpcMessage](l), err +} + +// RpcMessage_Future is a wrapper for a RpcMessage promised by a client call. +type RpcMessage_Future struct{ *capnp.Future } + +func (f RpcMessage_Future) Struct() (RpcMessage, error) { + p, err := f.Future.Ptr() + return RpcMessage(p.Struct()), err +} +func (p RpcMessage_Future) Id() json.Value_Future { + return json.Value_Future{Future: p.Future.Field(1, nil)} +} +func (p RpcMessage_Future) Params() json.Value_Future { + return json.Value_Future{Future: p.Future.Field(3, nil)} +} +func (p RpcMessage_Future) Result() json.Value_Future { + return json.Value_Future{Future: p.Future.Field(3, nil)} +} +func (p RpcMessage_Future) Error() RpcMessage_Error_Future { + return RpcMessage_Error_Future{Future: p.Future.Field(3, nil)} +} + +type RpcMessage_Error capnp.Struct + +// RpcMessage_Error_TypeID is the unique identifier for the type RpcMessage_Error. +const RpcMessage_Error_TypeID = 0xd0dd80fa25c37644 + +func NewRpcMessage_Error(s *capnp.Segment) (RpcMessage_Error, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return RpcMessage_Error(st), err +} + +func NewRootRpcMessage_Error(s *capnp.Segment) (RpcMessage_Error, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + return RpcMessage_Error(st), err +} + +func ReadRootRpcMessage_Error(msg *capnp.Message) (RpcMessage_Error, error) { + root, err := msg.Root() + return RpcMessage_Error(root.Struct()), err +} + +func (s RpcMessage_Error) String() string { + str, _ := text.Marshal(0xd0dd80fa25c37644, capnp.Struct(s)) + return str +} + +func (s RpcMessage_Error) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (RpcMessage_Error) DecodeFromPtr(p capnp.Ptr) RpcMessage_Error { + return RpcMessage_Error(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s RpcMessage_Error) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s RpcMessage_Error) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s RpcMessage_Error) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s RpcMessage_Error) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s RpcMessage_Error) Code() int32 { + return int32(capnp.Struct(s).Uint32(0)) +} + +func (s RpcMessage_Error) SetCode(v int32) { + capnp.Struct(s).SetUint32(0, uint32(v)) +} + +func (s RpcMessage_Error) Message() (string, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s RpcMessage_Error) HasMessage() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s RpcMessage_Error) MessageBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s RpcMessage_Error) SetMessage(v string) error { + return capnp.Struct(s).SetText(0, v) +} + +func (s RpcMessage_Error) Data() (json.Value, error) { + p, err := capnp.Struct(s).Ptr(1) + return json.Value(p.Struct()), err +} + +func (s RpcMessage_Error) HasData() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s RpcMessage_Error) SetData(v json.Value) error { + return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) +} + +// NewData sets the data field to a newly +// allocated json.Value struct, preferring placement in s's segment. +func (s RpcMessage_Error) NewData() (json.Value, error) { + ss, err := json.NewValue(capnp.Struct(s).Segment()) + if err != nil { + return json.Value{}, err + } + err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) + return ss, err +} + +// RpcMessage_Error_List is a list of RpcMessage_Error. +type RpcMessage_Error_List = capnp.StructList[RpcMessage_Error] + +// NewRpcMessage_Error creates a new list of RpcMessage_Error. +func NewRpcMessage_Error_List(s *capnp.Segment, sz int32) (RpcMessage_Error_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) + return capnp.StructList[RpcMessage_Error](l), err +} + +// RpcMessage_Error_Future is a wrapper for a RpcMessage_Error promised by a client call. +type RpcMessage_Error_Future struct{ *capnp.Future } + +func (f RpcMessage_Error_Future) Struct() (RpcMessage_Error, error) { + p, err := f.Future.Ptr() + return RpcMessage_Error(p.Struct()), err +} +func (p RpcMessage_Error_Future) Data() json.Value_Future { + return json.Value_Future{Future: p.Future.Field(1, nil)} +} + +const schema_d04299800d6725ba = "x\xdal\x90\xbfkS_\x18\xc6\x9f\xe7='\xedw" + + "HH\xee7\x01\xb1\xb4$\x0eYJ\x1bL\xebT\x90" + + "\xd6\xd2\xa0\x82\x85\x9eV\\\x9c.\xc9%FL\xee\xe5" + + "\xdc(\"B\x0an\"8\xbb\x09\x82\xab\x0e\x0a*\x0a" + + "\x16uq\xaa?\x10\x1c\xfa?88\xd8\x90z\xe5\x18" + + "\x9a\x8au;|\xde\xf7\x9c\xf3y\x9e\xe3\xa7\xb9\xa4\xab" + + "\x99\x9e\x86\x98\x13\xa9\xb1d\xe5\xda\x9br\x7fsg\x1b" + + "f\x82L\xde_\xb8\x7f\xfb\xf3\x9d\x87\x9f\x90\x92q`" + + "\xbe,\xc2|\xd5\x1d\xf3\xb3\xf2\x08\x7f\xccM\x96L^" + + "\x94\x9b\x99\xcd{\xcb\xdb\xa8\xe9q\x0d\xe4\xdf\xc9\xc7\xfc" + + "\x079\x02\xcc\x7f\x95\xbb\xc4\x8d\xe4r\x1cvfmT" + + "W\x95\xba\x1fu\xa2\x85\xf5\xa8\xbe\x1a\xc4\xb1\xdf\x0c*" + + "5kC\x8b5\xd2\xa4\x95\x064\x01\xaf6\x0d\x98%" + + "EsNH\x16\xe8\xd8\xd9e\xc0\xac(\x9a5\xa1'" + + ",P\x00o\xd5-\x9eQ4\xe7\x85\xd9z\xd8\x08\xa8" + + "!\xd4`\xaf=|\x9ei\x08\xd3`\xb6\xe1w}\xe6" + + "\x92[;Gwk\xd7\xfb\x0f\x002\x07\x8e\xc4\xe4o" + + "1\x06F\x93\x07\xadx\x9c+\xfeV5\x93#\xcd\xa7" + + "N\xe9\xb1\xa2y)\xf4\xf6=\x9fO\x00\xe6\x89\xa2y" + + "\xed5\x82\x00\xe9\xbf\x86\xe6\x10P\xbb\x1az\x0c0\xd8" + + "4oG\xc5S\xbe\xba\xfb\xe2m\xcf\xe9\xa7`R\x8d" + + " C\x9e\xfeLx\x8al\x0ba\xb2=\xfd\xea3/" + + "\xef\xf9\xf7\xbeo\xdc`\xdbt{5\xfcu2\xed\x89" + + "\xbc\x05\x18l\x9a**\xde\xf97\xd3\x1f\xbd\x18z\xf5" + + "<\x84\xd4\x08YF\x92\xa8\xf5D\xe9\xdfPt5\x07" + + "\xf4>\x99{&\x13\xfb\x80q\xa6k\x14\xd1\xf4\xfd1" + + "?\x8a\xc9\x18E\xf1\xe4;\xcf\xfd\xe8\xcd\xccw\xce6" + + "\x92\xbb\xfc\xad\x81S\xfb3\xeb\x7f\xdd\x8a\xe2\xf7\xb1\xe3" + + "d\xfa\xa7X\x06\xd0\xfb\xd7\xf3C\xe6\x9f\x8f\xfd\xea," + + "\x08\x15;\x82@:\xb9'\x9eDmm<\x02\xa0\xf5" + + "\xc5\xc9\xf8\xd8\xfc\xf5C\xb1\xfb\xbe\xfc\xb3\xee~\xb7\xc7" + + "_ \xbf#\xbe\xe9\x95\x9d\xaf\x1b\xf3\x17\x9e~\x19\xcc" + + "\x01T\x02X\x9a\xa62~\x85L\xeb\xbe\xe9\x89\xbb\xf7" + + "\xf1\xa1\x17\xdf\xf9e\x97\xcc8\xf6\xa4\xbf\x19\xf7A;" + + "\x1d?\x03\x18\x9c\xd9\x15\xdf\xd1\x95>\x08\x0f\xae$|" + + "_{c\xff\xf6\xd5\x13\x0f\xbe\xd2=\x82\x91\x84\x1f\xec" + + "d\x82\"x\xf8\xf0\xe3\x17\xe4\x96\xec%*E\x07\x0a" + + "#\x18a\xc8\xd2\xb5\xc4f\xd4\x8e$\"\xda\x91\x84\xa1" + + "=\x9f \x80\xd3\xe5\xaf\xdd\xff\xd2Gv_\xee\x1eF" + + "J=L\xbe\xefV\xc9w\xef\xb7\x7fp\xf2\xa7\xa9G" + + "\xde\xe8\xe2\x1b \xfd9\x95\xa1\xf6\x15*\xb9\xf6%\x95" + + "<\xff0\xf5\xc2\xbb\xf7:'\xff\x02Be\x815`" + + ":$\x06P\xeb\x13d)\xc4\x01@\xef\xe9\xfcKW" + + "\xe6O<\xfb\xf7\xee\x1d|D\xf8\x1d|T\x90\xd3{" + + "\xf4\x07>{\xed\xdd\xf7\xff\xf3\x86\"3*\xf2?\xc4" + + "f\xd4B\xab\xc8/\xaez\x0c^\xf4\x1e\xa9:v\xca" + + "\x95U\xc5\xed\x9f\xb6\xcavypBV\xdd\xbdU\xc7" + + "\x1e\xb2m\xc7\xb5\xdc\x82cW\xfb\xadI\xbb\x90q\xec" + + "\xfe\x19\xc71\xa3\\QC:\xf6\x00\x88M\xe3\x00\xe6" + + "\x1d\x1c\xcdm\x0c\x05r\x1d{\x01\xc4\xd6\x1c\x80\xb9\x85" + + "\xa3y\x0fCo\xc6qFe)'\x01+\x18\x03\x86" + + "1@\xafT+\xba\x85QY\x82HNV0\x0a\x0c" + + "\xa3\x80K\x8f\x83;6\xc5\x10\xf3<\xc4\x80\xd7bS" + + "Rl2\x00\xe3x\x9d\xd6\xdbh\x89\xedI\xb1\xfd." + + "\xc0\x08\x85\xae \xf3~\xbc\x83\x9f\x19\x7f\xfb7\x87\xc1" + + "T\x18\x0e\xa9\x88*\xc0N\x04\x8c\xe4\xac\x8a\x19]`" + + "\xa02\x1cZ\x87\xde\xbd\x8f\xf7\xaf\xfb\xad\xf1\xe9k`" + + "\xaea8tG\xfb\x0b\x8c\x01\x08\xccy\x15i[%" + + "\x99O\x01\xb9\x00hg\x12Z,\x93rE\xce\x14f" + + "e~w\xc5\xa9a\xd9T\xb9\xa2r\x1dC\x00\xc2J" + + "\x02\x98\x0fq4\x0f\x12\xa8L\xc70\x80\x90I!\x0d" + + "\xf3\x8b\x1c\xcdc\x0c\x91aG\xbf\x8b\xa3I`\xc8\xb1" + + "\x83\x84\xa2>%\x9e0\x1aI\xb7`\xf7\xf3#\x00\x82" + + "t\x08\x00\xfdVi\xb4\x0a\x13\xc9Ys^\xc9\xa9\xc8" + + "\xb1\x8a\x9c\x01^\x98\xed\x82\xa2\xde\xc4D\xe0\xe6\xc4\xec" + + "L\xb9\xbf\x03\x04~+\x10\"\x8e]\x1dC4?\xcc" + + "\x15\x00\x05\x01\xb4:\x8ekO\xa0\x91\xfd.r\xcc~" + + "\x9f\x92D\xec\x90\x00\xed\x1c\x0ej\xe7\xd0\x80F\xfem" + + "\x86k?\xc1\x8a\xf6s\x7f\x9d@h3C\xbb\x84\x83" + + "\xda%\xbc\x0bP(a\x1d\xe3\x00Z\x9cM\x01dc" + + "\x8ccv\x0dc\x88!\xec\xe0\xb6\xd6\xc7r\xc0D8" + + "\xaac\x82\xd8\xc1\x06\x00\xb2\xff\xc1\xa6\xad\x88\xf4\xe8\x94" + + "\xa4\xd6\xc7\xc6\x01\xb2:\xf9\xd8@\xeb\xd1^\x1d\x05\x80" + + "\xb6\x9e\x1d\x07\xc8n\xa0\xf5;i\xbdg\x85\x8e\xab\x00" + + "\xb4MlJK1#\xbb\x87v&h\xa77\xa6\xa3" + + "\x06\xa0\x99lX3\x99\x91-\xd2\xce,\xc5\xb3\x02;" + + "\x84_\xab\xb1A\xad\xc6(\xfe\xd8J\x1do\x03\xd0N" + + "\xb3\x0a@\xf6\x14\xd9\x7f\x8f\xec\xe3\xd8!\xa7\xdaYV" + + "\xd1\xce1\x03\xd0\xab:%\xb9\xab \x8b\x80\xf9.%" + + "\xdf\xe0\x97|+\xaeB\x8f*^MM[\xdc~x" + + "\xda\xb1]\xab`o\xb4\xec\xba{\xb0`\x1f\xd80." + + "\xadb\x11\xeb\x00\xad\x0e\xcaX\xd4\xac\xe5EY\xe4\xb5" + + "\xfa\x1a\x8c[\x19w6Kyf\xb6\x1f C\xb4&" + + "Vwc_\x0e\x8f\xbf\xf2\xf6\xb1\x93\x17\x1b\xec\xdb\x12" + + "\xb0\x8f\xfe2\x11\x9a\x02\xf0j\xf4y\xca\xad\x03/K" + + "\x00//\xcb\xd2\xceK\x1b\xf8t\x1d\xd5@\x0e\xfd\x8f" + + "\xd0\xab\x16J\xe5\xa2\xdc]\x81\x88S+\x1b\xd2\xae\x95" + + "\xaa\xb8\x12p\x8c#&\x02A\x06\xa4E\xaf`\xdb\xb2" + + "\xb2\xb7\xea\x00\xda\xa8z\x9f\x7fm\xed\xd5\x91\xd9k\xcf" + + "\xb6\\M\xd7\xaa\xaeS\xdaU@Y\xcc\xef\xb1\xec|" + + "\x91\xcb@\xe7\\Yu\x87\xad\xaa\x04\xbec\x9b\x8f\xc3" + + "\xc7\xef{_\xefH\xfdw\x97\x1b8\xc4\x108\xc6\x81" + + "a\x1c\xf0)\xb2\xdd#\x1b\xdc:\xf7\x8b?\xf6~\xe8" + + "u\xebo7\x9berK\x06\xea\xce\x1b\x80\"\x8e\x0f" + + "fr\xfb\xacb\x8d \x92\xb3\xae\xac\xd8V\x11\x0c\xdf" + + "#\xaa\xc1Pl\xa6\xe6c\xfa\xa9\x82\x0b\xc6\xc1}N" + + "\xa1\xd1G\xc1\x11\x14\xd9\x9av\x0d6\x03$\xdc\xba\x8f" + + "\xfd\x92d<\x17\xc8\xf8:\xcf\x8b\xeb\xa8\xd30!\xdd" + + "\xbb\x9d\xa3\xb9\x85\xe1z\xbc\xee\x85t\xec\x03\x10\xa9\xa4" + + "H\x19\xe6\x18G\xf3!\xf6\x9e\x08\xda\xd2\xf4\xb9\xd1\xeb" + + "\xfd3E\xcb\x1d\xe6\xd6\x9c\xa9pE\xdd\xa0#\x07\x10" + + "\xf1\x01\x003\xca\xd1\xd4\x19\x1a\x07e\xb1\xe8 \x02C" + + "\xecp\xbd@\xf5v\x15-\xd7\x95\xb6\xccg\xddJ\xa4" + + "6\xed\x92\xea)-\xd5[\xe8\xedQ*O\xbb\x81\x96" + + "\x13h\xde\xa9\xe5\x8a\x86\xa4\xb3\xfcX\x99\x8e\x0ay\x1f" + + "\x0e\xbc?E\xc9\x98\xb5\xd9\x9b\xfc\x87\x97:\xa8\xca\xfd" + + "\x8dA\x90\xa0%\xff\x18E\xc7(\x1d\x93\x0c\x8e\x89\x1c" + + "\xear\xc4\xa2)\xb4Z\x8d\x1a\x0d\xf3f\xcc\xef\x8a\xb0" + + "\x8e\xab\x01\xc4\xc8^\x00\xf3c\x1c\xcd1\xe6\xcfv\x1d" + + "\xd7\x00\x88Q\xbax|\x82\xa3\xf9\x00\xc3\xf5\xec\xbf^" + + "B\xc7\xb5\x00b\x92\x96'8\x9a\xfb\x191\xd7mv" + + "{P\xfaG\x9dB\x9e\x16\x01%\x84=W\xce\xba\xcd" + + "_7\x05\xac\xfc?\xccy\xcd\x9f\xda\x00:R\x19\xad" + + "\xe1\xce\xa9\x8d:\x12\xe3$-\xee\xe7h\x16\x9bC\xbb" + + "}S\x17\x85aQh\x8d\xac\xf6=\xbb5\xb7\xfdJ" + + "\xedr\x9cV\xdc\xfe\xefa\xab--\xcd\xdfs\x8b\xb4" + + "\xff\xe1v\xfbc\xd3\x18H\x19\xa9K\xe4\xae\"pj" + + "\x93\xc5t|\xd9\x97\x18\xa3\xdc\x9fk\xf2d\xa3N\xef" + + "\x89e\xf3\xa4\xd3{\xc2\xb1\xabi\x9f(K\x92\x9d\xe6" + + "\x85\xd0'T\xa7\x8e4:\x06\xdb2\xd2l\x19_F" + + "\x82\xfbMeQ(P\x0d^MMm\\\x128\xad" + + "1\xe3\xd4\xca\xe0\xc3\x12\xd1q%\xc12(\xe2F\xeb" + + "\x82\x9c9P\xb1jEw\x91B\xce\x05:\xd64\x0e" + + "&rw\x1ci\xe6\xec\xd8\xe6\xeb:\x10\x84\x0b\xb0\x11" + + "\x9b\x8c\x85t\xa2\xe5Q\x82l\x0fGs\x82\x05\x17\xe5" + + "[O+\x82l\xf1\x10:\xb0\x90F~\xc4\xae\x95(" + + "\x10\xd5'\x05\xd5\x07QlL\x8a\x8d\x0621\x94\x14" + + "C\x06r\xff\xdaKg/W\xd6#\xb9Ey\xb0\xd0" + + "~\x0e\x80\xe4iy\x8f\x1e\xffa\xd0\xb8\x9f\xaf\xb8\xe9" + + "\xd1\x13\xd2\xfds\x16\xfdi\xa0\x1b\x90\x7f\xe5\x9b\xd2K\x99+\xbf{\x1a" + + "\x8c\x06d\xfc;\x7f\xf1g/}\xe9\xc6o\xbf\x02[" + + "+\x14\x94\x00\xb4\xc3\x81\x9b\x80\xda\xd1\xc0\xb7\x00\xf9k" + + "W\xb7\xdc\xdb\xb4\xaf\xf9\xaf\xc0\x98\x81\x92o\xb7\x8f)" + + "3\x00\xb4\xf6\xe0\x0f\xb4?\x0a\xce\x02\xe8\xec\x0b~I" + + "\x02\xe4\xdf\xdf\xf6\xfc\x97\x9b\xe7=\xfc\xe5\x12\xcbu\x15" + + "\x0a\x02t\xaaU\x0c\x01\xb5\xba\xaa\xcf\x03\xf2\x91\xf9w" + + "w\x07\xbfv\xeb\x10Yf\xbee\x99\xdc|\xbc\xea_" + + "5\xab\x8a>\x99U\xe4\xc5\xae\xd6\xe7\xff\xb6\xfbD\xe5" + + "\x110\x1a\x02\xcd\xbeY\xc0\xce\xbbU\xbd\xa8\x85\xaa\x15" + + "\x80hE\xb5\x84\x80>;\xd9n_\x852\x0fQ\xab" + + "\xac~E\xab\xab\xfe,@\xa7Y\xfd\xa9J@~k" + + "\xe9\xab\x7f\xb3rO\xe3\xf1rn\xac\xae\xbb\xa9\xf5\xd5" + + "\xd1\xa7\x9e:r\xe3\x9fW\xb0\xdb7\x0f-9^\xfe" + + "\xd7\xfdG\xdd<\xfau\xaf\xd7Q\x88\xc7\xa5c\xed\xce" + + "\x1b\x17N\x94_Z?s\x09\x02v\xb6\xcc\xbc\xc6\x00" + + "\xf9\xe3\x9dc\xa15\xd7\x17}\x03\x8cz\x94\xfc\x88\xd7" + + "1\xb1vS\xbd\x08\x9aQOA\xdbs\xed\xdc\x9a\xd4" + + "\xea7\xbeY~\xe9\xb3\xf5dV{A,\xad\x09\xfd" + + "\xf8\xe0\x92\x8e\xf5\xcf\x97\xf7`a\x83\xb0\xba\xb8\x81\x96" + + "\xfeh\xce\xbf\x8c\xedq\xde)]\xda\x87\x8a\x04\xd0\xf9" + + "\xc5\x86y\xa8\x1dmP\x00:\x0f7D(\xc4\x19\xe3" + + "\xd5\xc1}\x07\xe6\x7f\x0f\x8c\x16d\xfc\xc2\xa5Y\xaf>" + + ":\xfb\xab\xbf\x12\xf9\xc30\xd8ya\xce\x06\xb2}y" + + "\x0e\xd9\xfe\xc6\xbf\xbd\xd6\xf0\xf7\xeb\xd8\x15\xf2\xb8(\x9d" + + "\xfa\x98\xc2\x00\xb4\x85\x8d\xefi\xed\x8d\x14\xe1\xd6F\x8a" + + "\xf0\xa1\xc1'3?yZ\xbeJ\x9e\x14\x1de\x80\xd1" + + "\xee\x97\x1b\x9fD\xedgb\xf5O\x1b\xc9v\xe4\xe8\xac" + + "_4\xfd\xdd?]\x05\xa3\x19\x99\x9f{y?\xea\x9a" + + "F\xc9\x8f\x96&Z\x9b\xbd\xde\xf8\xad\xb5\xea\x8d\x9f\x96" + + "Z\xa6\x0b\xd2\xb9\xafi\x03j\x87\x9b\xc8\xf2\xc1&\xf2" + + "\xe3\xd1\x9bO\xdd\xad\xeb\xab}\xdd\xb3|\xf6\x95\xaf~" + + "\xed\xeb\x15\xf78l\x95\x15d\x00\x9d\x8b\xe7\x0a\xcb+" + + "\xe6\x92\xe5\xd8O\x16[/\xcc\xdcv\x832h\xca\xd5" + + ";<\xf7\x15\xed\xe4\\\xfat|.\x19\xfe\xf1\xd2{" + + "\xd5\x13\xb1\xf6_\x96?\x95\x15\x11q*\xab#\x94B" + + "\x85\xb8\x96]\xfax\xa4\x8a\x96\x9a\x11r\xe1\xdd\xd1k" + + "O\xfc\xec7\xdb\xdf\x07c\x19\x16\x05q+\xf3\xdc=" + + "\x1d\xf96\xad}N\xac-\xfc\x98\xc9f\x03\x94\xf1\x9d" + + "j3C\xad\xa9\x99>\xd67\x7f\x16\xe13|$m" + + "&\x12f\xba\x8d\x0d\x99)'\xd55`\xa63Vl" + + "\x9d\x1d\xb7\x00\x06\x10\x0dY\x92\x01d\x04PCK\x00" + + "\x8c\x0a\x09\x0d\x9da8\x9dL\xbaX[|S\xb1\x96" + + "\xee\xfcdck\xad\xa1\xb8\x996];\x19v\xda\xec" + + "\x98Q#\xc95\x9c\xebH\xe6\xfa\x06\x01\x8c\xb5\x12\x1a" + + "\x03\x0c\x9b\xf0\x1eG\x9d~\x8a\xbai\x1e\x80\xb1^B" + + "c\x0b\xc3&v\x97`\x09@5z\x01\x8c\x8d\x12\x1a" + + "\xdb\x18\xf2\xac\x93IYC\xf60(\xb6\x15\x83\xa0\x92" + + "\xb5cX\xeb_t\xcf\x97\xf1d:f;f|*" + + "S\xeae\xdf\xeeT\xda\xcad\xec\xa4\x03`\xc8X\x94" + + "\xd2*vD\x06\xcc\xb4\x990\xd6\x08\xcf)\x0e\xdas" + + "\xd8\x0b\x10}\x06%\x8c\xbe\x88\x05\xdf\x89y\x01\x07\x01" + + "\xa2\xe7\x89\xb9\x84\x05\xf7\xe9\x1a|W0\x17\x89\xf9>" + + "1\xd2\x07\xb9\x1f\xa6]\xc6\x0e\x80\xe8%b~\x88\x0c" + + "C\xf2\xfb\\G\x19@\xbb\x82]\xda\x15\x8cD\x7fM" + + "\xd4\x1d\xa2\x82\xefq\x1d\x03\x00\xda\xdb8\x0a\x10}\x0b" + + "%\xdc\xcc\x18\x86\xaa\xde\xe5:\x06\x01\xb4\xbb\xb8\x04 " + + "z\x87\xfe@'\xa2\xfa\x0e\xd7E\x92\xaa\x8c6\xa9a" + + "\x12F\x171\x86\xea\x0c\xd4\xb1\x82n'\xdb\x0c\x10]" + + "@\xf82\xc2\xc3\xb2\x8e\x95tW\x19\xfd\xc4E\x84/" + + "'C\x81\xff\xe5:VQ=`]\x00\xd1\xa5D\xac" + + "\"\xa2\xe6\x1d\x8eE\xa2\xa5\xad`\x83\xc0B\xa1\xb7\x09" + + "-\xa8\x9e\xd6\xc2\xba\x80\x85\x94\xb7\xb8\x8ea\x00\xad\x92" + + "\x91\xfb\x15,\xeff\xc5m\xaec\xadp\xb3+\xef\xe6" + + "l\"*oq\x1dU\x00\xadN\xf8_KD#c" + + "8\x9euv9\xc9\xcf;\x10\xe4\xa9d\xc6v\xed\xcf" + + "Y\xa0\xf4;.V\x02C\xd2|\xc7\x1a1\xa7\xa0\x91" + + "\xe1x\xd2t\xb1\x1a\x18V\x03vg\xdc\xb4\xed\x8c\x18" + + "22\xfe\xe6\xc1O\xcezh\xc7\x85\x7f\x00Cf\xd8" + + "\xa3#\xd6\x00\xa88\xc8\xbd%\x8f\x99\xa0\xc4\xb3\x16\x00" + + "\xd6\x00\xc3\x1a@\x9e\xb6\xe2\x9e\xf9\xf0g\xcc\x84\x85\xb5" + + "\xbeBx\x09\x16\x8e\xdb\x19\x17g\x00\x0eH\x88\xb5\xbe" + + "&\x02\x12\x18q\xb3\xa9\xb8\xe5\xd3\x85l\xf3h\x9eq" + + "\xcd\xb4\xdb;\xe6\x02ZX\x01\x0c+\x00\xc7-'\xd6" + + ";\xe6\x16\xbew\x0f\xda\x8e\x99\x1e\xc3\x100\x0c\x01r" + + "3\x95\x8a\xdbC\xa6\x0b\x8a\x9dt\xba\x13Vb\xd0J" + + "ss0\x93\x8cg\xddi\xbd\xec\xb6\x13\xa9d\xda\x9d" + + "JD\xe8\xefcS\xf1\xc2\xbd\x91Jo\xb7\xd36l" + + "[\xf1\x18\xc9\x83\\\x1b\x10\x87\xa9.&\xb9X \xa1" + + "\xb1\x8c!\xfd\xe7\x8b\xb9\xda:\x0a,\xec\x8e\xa5\xac\x92" + + "\xe0\xd0\x1e1k\xd8\xcc\xc6\xdd\xc7 l\xc6\xb3V\xe9" + + "U\xdd\x98\x1c2]+\xb6.\x9e\x94L\x97\xe4\xa9\xa6" + + " O}\x1d\x00\xc6\x1a\x09\x8d\x8d\x0cUd\x9e\xc8\xf4" + + "o\xf6\xd5De\x92'1\xc5Z\x12\xf9\x1cm\x93O" + + "\x8a\x07\x89}\xc1%yj\x14\x06\xb3v\xdc\xb5\x1d!" + + "\x19\x19\x92O\xff\x94\x0b\xe5\xe9~*\x89\x8e\xa1cQ" + + ")S[\xf6\xf8b\xaf\xb6|\xdb\xef\x93\xd4\x85i\xbf" + + "\xaa\xab\x0b7\xfb\xaa\xaf.\xec\xe0\xbdi\xd3\x89\x0d\x98" + + "i\xe86\x13\x96k\xa5y\x8f\xe3$]\xd3\xb51\xe9" + + "\xf4\x88\\\x89\x08\x87y\xdea\x88\x08\x97\xb9\xf0|\xa3" + + "\x9d\x01ts\xc27\x91\x0f\xb0\xf6\xb4L\xea\xb2_\x96" + + "0zH\xce\x9di\xa1\xd1\xd4\x0e\xca\x0d\xc0T\x89y" + + "\xe2\x95\x95I\xef\xdc\xfcZU\x96<\xe5:(\xf0\x03" + + "\x84O\x10\x1e@O\xb9\xce\xca$Dg\x08?Gx" + + "\x90y\xc2\xf5\xacLB4A\xf8y\xc2\x15\xd9\x13\xae" + + "\xe7\xe4\xed\x00\xd1s\x84_\x94IB\xa8\xaa\x90r]" + + "\x10N\x9e'\xe2\x12\x11\x95\xf7H\x8a\x0aEY\xfb\xae" + + "\xdc\x01,Tu\x97\xd0B\x03\xa5\x9d\x15h\xf5\x07\\" + + "\xc7\x90\xf0\x92\x8c\x96\xc2[!L\x82Y" + + "\x0a?\x0aa\xd2\xcfR\xb8\x1fsjjM\xddx\x13" + + "D\x84\xbc\x96\xe2\x03\x10\xa6\xfb\\\x0a\xf7`N\x85\x93" + + "\xe8\xef^\x92\x9b\xfe\x04\xdf\xe6\x0d?b\x12\x01\x10\xed" + + "\x9c\xba\xb8\xcb\x9fDTD\xd1\xca\xa9\xad4\x9e,\x92" + + "\xd0X\xce\xb0;e\xa6-\xc7\x9dz\x14\xd3\x14\xbf\xfb" + + "l\x9f\x9b\xc4\xbc\xab\x91\xf3\xa1\x9a|\xd8\xe0o'|" + + "\xa0\x11\xb3\x9d\x1c[*\xa1\xb1\x9e!\x1f\xce:C\xa2" + + "z\x00Lu\xa4[H]f\xfa\xa1\xf1>\x97U\x94" + + "\xc4\xc2hV]2\x9a\xa9\x18\xf4\x9ci\xed\xf0=\x9c" + + "&3sR55c\xef\xb3\xbb7QP\x15 \xb1" + + "\xd4\x0b\xcf(\xea>\x12\xc6\xbd\x12\x1a\xc7\x18\x86\xf0^" + + "\xeeU\xe8(\xb9vHB\xe3\x04\xe9A\xeeM\xe88" + + "-=&\xa1q\x86\xc4\x80y/B\xa7ICOH" + + "hL0\x0c\xb1\xbb\xde\xab\x89z\x96BzJB\xe3" + + "\x19F\x859a\xc5\xbci\xc6\x8f\\aP\xf2\"7" + + "\xdd%|\x90)<\xe3\xa6-3QT%\xca\x8c\x84" + + "^+\xd1\x96\xb62\xd9\xb8\x9b\x11/h\xde\x1b\xd8\xac" + + "\x92\x83h\xc2{<\xa8\xe3l:\x8a\x0d\xb9\xbcXE" + + "\xfdW\xd2\xb1\xa8\x97\xd9M\x89e\xbb^z\x14F\xbf" + + "\x0f{\xd1\xea\xf6\x0e W\xa8\xf2\xb1\xef\xeb\xf5+\x95" + + "\x1f\xfb\xfe\x0e\xffENe\xf9\xf7\xb8\x0e\xbf~\x8dg" + + "\x1d\x11R\x08F\xc4\xff\xcb<\x1d|X\x86\x04\xa6F" + + "(?\x9b\xe6GS\xaf\x87\"\x8f+\x0a\xa5u\xcac" + + "B\xe1A\x94\xf2\x96\xe5\xefi\xd9|\xbd\xdf\xe9\x88V" + + "\xb0-\xff\xe6 \x9e\x1c\x0a\x07\xa4\x96?\xa0\x87J\xef" + + "\x8aw@\x1f\xfa\xcb\xcb\xec\x9e\x1f\xd3\xbd!\xdd{o" + + "-j'\x96\xf8\x87\x84X\xae\x9b\xc0\xa9\xdd\x84\x17\x89" + + "\xfcC\xd5\xff\xf39C\xb86Mt\xa42\xd1\x91\xbc" + + ";\xf8q\xa23\xb9\xbf\xdab\xed\xc6\xfb<\xef@\xee\xfd_\x00\x00\x00\xff\xff`\xa7\xf2\xef" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_c56be168dcbbc3c6, + Nodes: []uint64{ + 0x84e4f3f5a807605c, + 0x89f0c973c103ae96, + 0x8e207d4dfe54d0de, + 0x8f2622208fb358c8, + 0x90f2a60678fd2367, + 0x94099c3f9eb32d6b, + 0x96efe787c17e83bb, + 0x991c7a3693d62cf2, + 0x992a90eaf30235d3, + 0x9cb9e86e3198037f, + 0xaa28e1400d793359, + 0xaee8397040b0df7a, + 0xb348322a8dcf0d0c, + 0xb3f66e7a79d81bcd, + 0xc6238c7d62d65173, + 0xc90246b71adedbaa, + 0xd00489d473826290, + 0xd0d1a21de617951f, + 0xd5e71144af1ce175, + 0xe5104515fd88ea47, + 0xe75816b56529d464, + 0xe93164a80bfe2ccf, + 0xeb971847d617c0b9, + 0xfb5aeed95cdf6af9, + 0xfffe08a9a697d2a5, + }, + Compressed: true, + }) +} diff --git a/std/capnp/compiler/lexer.capnp b/std/capnp/compiler/lexer.capnp new file mode 100644 index 00000000..202e359c --- /dev/null +++ b/std/capnp/compiler/lexer.capnp @@ -0,0 +1,70 @@ +# Copyright (c) 2013-2014 Sandstorm Development Group, Inc. and contributors +# Licensed under the MIT License: +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +@0xa73956d2621fc3ee; + +using Cxx = import "/capnp/c++.capnp"; + +$Cxx.namespace("capnp::compiler"); + +struct Token { + union { + identifier @0 :Text; + stringLiteral @1 :Text; + binaryLiteral @9 :Data; + integerLiteral @2 :UInt64; + floatLiteral @3 :Float64; + operator @4 :Text; + parenthesizedList @5 :List(List(Token)); + bracketedList @6 :List(List(Token)); + } + + startByte @7 :UInt32; + endByte @8 :UInt32; +} + +struct Statement { + tokens @0 :List(Token); + union { + line @1 :Void; + block @2 :List(Statement); + } + + docComment @3 :Text; + + startByte @4 :UInt32; + endByte @5 :UInt32; +} + +struct LexedTokens { + # Lexer output when asked to parse tokens that don't form statements. + + tokens @0 :List(Token); +} + +struct LexedStatements { + # Lexer output when asked to parse statements. + + statements @0 :List(Statement); +} +using Go = import "/go.capnp"; +$Go.package("lexer"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/lexer"); diff --git a/std/capnp/compiler/lexer/lexer.capnp.go b/std/capnp/compiler/lexer/lexer.capnp.go new file mode 100644 index 00000000..fedcb5fe --- /dev/null +++ b/std/capnp/compiler/lexer/lexer.capnp.go @@ -0,0 +1,727 @@ +// Code generated by capnpc-go. DO NOT EDIT. + +package lexer + +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 Token capnp.Struct +type Token_Which uint16 + +const ( + Token_Which_identifier Token_Which = 0 + Token_Which_stringLiteral Token_Which = 1 + Token_Which_binaryLiteral Token_Which = 7 + Token_Which_integerLiteral Token_Which = 2 + Token_Which_floatLiteral Token_Which = 3 + Token_Which_operator Token_Which = 4 + Token_Which_parenthesizedList Token_Which = 5 + Token_Which_bracketedList Token_Which = 6 +) + +func (w Token_Which) String() string { + const s = "identifierstringLiteralbinaryLiteralintegerLiteralfloatLiteraloperatorparenthesizedListbracketedList" + switch w { + case Token_Which_identifier: + return s[0:10] + case Token_Which_stringLiteral: + return s[10:23] + case Token_Which_binaryLiteral: + return s[23:36] + case Token_Which_integerLiteral: + return s[36:50] + case Token_Which_floatLiteral: + return s[50:62] + case Token_Which_operator: + return s[62:70] + case Token_Which_parenthesizedList: + return s[70:87] + case Token_Which_bracketedList: + return s[87:100] + + } + return "Token_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// Token_TypeID is the unique identifier for the type Token. +const Token_TypeID = 0x91cc55cd57de5419 + +func NewToken(s *capnp.Segment) (Token, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 24, PointerCount: 1}) + return Token(st), err +} + +func NewRootToken(s *capnp.Segment) (Token, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 24, PointerCount: 1}) + return Token(st), err +} + +func ReadRootToken(msg *capnp.Message) (Token, error) { + root, err := msg.Root() + return Token(root.Struct()), err +} + +func (s Token) String() string { + str, _ := text.Marshal(0x91cc55cd57de5419, capnp.Struct(s)) + return str +} + +func (s Token) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Token) DecodeFromPtr(p capnp.Ptr) Token { + return Token(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Token) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s Token) Which() Token_Which { + return Token_Which(capnp.Struct(s).Uint16(0)) +} +func (s Token) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Token) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Token) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Token) Identifier() (string, error) { + if capnp.Struct(s).Uint16(0) != 0 { + panic("Which() != identifier") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Token) HasIdentifier() bool { + if capnp.Struct(s).Uint16(0) != 0 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) IdentifierBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Token) SetIdentifier(v string) error { + capnp.Struct(s).SetUint16(0, 0) + return capnp.Struct(s).SetText(0, v) +} + +func (s Token) StringLiteral() (string, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != stringLiteral") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Token) HasStringLiteral() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) StringLiteralBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Token) SetStringLiteral(v string) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetText(0, v) +} + +func (s Token) BinaryLiteral() ([]byte, error) { + if capnp.Struct(s).Uint16(0) != 7 { + panic("Which() != binaryLiteral") + } + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s Token) HasBinaryLiteral() bool { + if capnp.Struct(s).Uint16(0) != 7 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) SetBinaryLiteral(v []byte) error { + capnp.Struct(s).SetUint16(0, 7) + return capnp.Struct(s).SetData(0, v) +} + +func (s Token) IntegerLiteral() uint64 { + if capnp.Struct(s).Uint16(0) != 2 { + panic("Which() != integerLiteral") + } + return capnp.Struct(s).Uint64(8) +} + +func (s Token) SetIntegerLiteral(v uint64) { + capnp.Struct(s).SetUint16(0, 2) + capnp.Struct(s).SetUint64(8, v) +} + +func (s Token) FloatLiteral() float64 { + if capnp.Struct(s).Uint16(0) != 3 { + panic("Which() != floatLiteral") + } + return math.Float64frombits(capnp.Struct(s).Uint64(8)) +} + +func (s Token) SetFloatLiteral(v float64) { + capnp.Struct(s).SetUint16(0, 3) + capnp.Struct(s).SetUint64(8, math.Float64bits(v)) +} + +func (s Token) Operator() (string, error) { + if capnp.Struct(s).Uint16(0) != 4 { + panic("Which() != operator") + } + p, err := capnp.Struct(s).Ptr(0) + return p.Text(), err +} + +func (s Token) HasOperator() bool { + if capnp.Struct(s).Uint16(0) != 4 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) OperatorBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return p.TextBytes(), err +} + +func (s Token) SetOperator(v string) error { + capnp.Struct(s).SetUint16(0, 4) + return capnp.Struct(s).SetText(0, v) +} + +func (s Token) ParenthesizedList() (capnp.PointerList, error) { + if capnp.Struct(s).Uint16(0) != 5 { + panic("Which() != parenthesizedList") + } + p, err := capnp.Struct(s).Ptr(0) + return capnp.PointerList(p.List()), err +} + +func (s Token) HasParenthesizedList() bool { + if capnp.Struct(s).Uint16(0) != 5 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) SetParenthesizedList(v capnp.PointerList) error { + capnp.Struct(s).SetUint16(0, 5) + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewParenthesizedList sets the parenthesizedList field to a newly +// allocated capnp.PointerList, preferring placement in s's segment. +func (s Token) NewParenthesizedList(n int32) (capnp.PointerList, error) { + capnp.Struct(s).SetUint16(0, 5) + l, err := capnp.NewPointerList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.PointerList{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s Token) BracketedList() (capnp.PointerList, error) { + if capnp.Struct(s).Uint16(0) != 6 { + panic("Which() != bracketedList") + } + p, err := capnp.Struct(s).Ptr(0) + return capnp.PointerList(p.List()), err +} + +func (s Token) HasBracketedList() bool { + if capnp.Struct(s).Uint16(0) != 6 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Token) SetBracketedList(v capnp.PointerList) error { + capnp.Struct(s).SetUint16(0, 6) + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewBracketedList sets the bracketedList field to a newly +// allocated capnp.PointerList, preferring placement in s's segment. +func (s Token) NewBracketedList(n int32) (capnp.PointerList, error) { + capnp.Struct(s).SetUint16(0, 6) + l, err := capnp.NewPointerList(capnp.Struct(s).Segment(), n) + if err != nil { + return capnp.PointerList{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s Token) StartByte() uint32 { + return capnp.Struct(s).Uint32(4) +} + +func (s Token) SetStartByte(v uint32) { + capnp.Struct(s).SetUint32(4, v) +} + +func (s Token) EndByte() uint32 { + return capnp.Struct(s).Uint32(16) +} + +func (s Token) SetEndByte(v uint32) { + capnp.Struct(s).SetUint32(16, v) +} + +// Token_List is a list of Token. +type Token_List = capnp.StructList[Token] + +// NewToken creates a new list of Token. +func NewToken_List(s *capnp.Segment, sz int32) (Token_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 24, PointerCount: 1}, sz) + return capnp.StructList[Token](l), err +} + +// Token_Future is a wrapper for a Token promised by a client call. +type Token_Future struct{ *capnp.Future } + +func (f Token_Future) Struct() (Token, error) { + p, err := f.Future.Ptr() + return Token(p.Struct()), err +} + +type Statement capnp.Struct +type Statement_Which uint16 + +const ( + Statement_Which_line Statement_Which = 0 + Statement_Which_block Statement_Which = 1 +) + +func (w Statement_Which) String() string { + const s = "lineblock" + switch w { + case Statement_Which_line: + return s[0:4] + case Statement_Which_block: + return s[4:9] + + } + return "Statement_Which(" + strconv.FormatUint(uint64(w), 10) + ")" +} + +// Statement_TypeID is the unique identifier for the type Statement. +const Statement_TypeID = 0xc6725e678d60fa37 + +func NewStatement(s *capnp.Segment) (Statement, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 3}) + return Statement(st), err +} + +func NewRootStatement(s *capnp.Segment) (Statement, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 16, PointerCount: 3}) + return Statement(st), err +} + +func ReadRootStatement(msg *capnp.Message) (Statement, error) { + root, err := msg.Root() + return Statement(root.Struct()), err +} + +func (s Statement) String() string { + str, _ := text.Marshal(0xc6725e678d60fa37, capnp.Struct(s)) + return str +} + +func (s Statement) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Statement) DecodeFromPtr(p capnp.Ptr) Statement { + return Statement(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Statement) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} + +func (s Statement) Which() Statement_Which { + return Statement_Which(capnp.Struct(s).Uint16(0)) +} +func (s Statement) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Statement) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Statement) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Statement) Tokens() (Token_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return Token_List(p.List()), err +} + +func (s Statement) HasTokens() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Statement) SetTokens(v Token_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewTokens sets the tokens field to a newly +// allocated Token_List, preferring placement in s's segment. +func (s Statement) NewTokens(n int32) (Token_List, error) { + l, err := NewToken_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Token_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} +func (s Statement) SetLine() { + capnp.Struct(s).SetUint16(0, 0) + +} + +func (s Statement) Block() (Statement_List, error) { + if capnp.Struct(s).Uint16(0) != 1 { + panic("Which() != block") + } + p, err := capnp.Struct(s).Ptr(1) + return Statement_List(p.List()), err +} + +func (s Statement) HasBlock() bool { + if capnp.Struct(s).Uint16(0) != 1 { + return false + } + return capnp.Struct(s).HasPtr(1) +} + +func (s Statement) SetBlock(v Statement_List) error { + capnp.Struct(s).SetUint16(0, 1) + return capnp.Struct(s).SetPtr(1, v.ToPtr()) +} + +// NewBlock sets the block field to a newly +// allocated Statement_List, preferring placement in s's segment. +func (s Statement) NewBlock(n int32) (Statement_List, error) { + capnp.Struct(s).SetUint16(0, 1) + l, err := NewStatement_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Statement_List{}, err + } + err = capnp.Struct(s).SetPtr(1, l.ToPtr()) + return l, err +} +func (s Statement) DocComment() (string, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.Text(), err +} + +func (s Statement) HasDocComment() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Statement) DocCommentBytes() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(2) + return p.TextBytes(), err +} + +func (s Statement) SetDocComment(v string) error { + return capnp.Struct(s).SetText(2, v) +} + +func (s Statement) StartByte() uint32 { + return capnp.Struct(s).Uint32(4) +} + +func (s Statement) SetStartByte(v uint32) { + capnp.Struct(s).SetUint32(4, v) +} + +func (s Statement) EndByte() uint32 { + return capnp.Struct(s).Uint32(8) +} + +func (s Statement) SetEndByte(v uint32) { + capnp.Struct(s).SetUint32(8, v) +} + +// Statement_List is a list of Statement. +type Statement_List = capnp.StructList[Statement] + +// NewStatement creates a new list of Statement. +func NewStatement_List(s *capnp.Segment, sz int32) (Statement_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 16, PointerCount: 3}, sz) + return capnp.StructList[Statement](l), err +} + +// Statement_Future is a wrapper for a Statement promised by a client call. +type Statement_Future struct{ *capnp.Future } + +func (f Statement_Future) Struct() (Statement, error) { + p, err := f.Future.Ptr() + return Statement(p.Struct()), err +} + +type LexedTokens capnp.Struct + +// LexedTokens_TypeID is the unique identifier for the type LexedTokens. +const LexedTokens_TypeID = 0x9e69a92512b19d18 + +func NewLexedTokens(s *capnp.Segment) (LexedTokens, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return LexedTokens(st), err +} + +func NewRootLexedTokens(s *capnp.Segment) (LexedTokens, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return LexedTokens(st), err +} + +func ReadRootLexedTokens(msg *capnp.Message) (LexedTokens, error) { + root, err := msg.Root() + return LexedTokens(root.Struct()), err +} + +func (s LexedTokens) String() string { + str, _ := text.Marshal(0x9e69a92512b19d18, capnp.Struct(s)) + return str +} + +func (s LexedTokens) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (LexedTokens) DecodeFromPtr(p capnp.Ptr) LexedTokens { + return LexedTokens(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s LexedTokens) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s LexedTokens) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s LexedTokens) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s LexedTokens) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s LexedTokens) Tokens() (Token_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return Token_List(p.List()), err +} + +func (s LexedTokens) HasTokens() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s LexedTokens) SetTokens(v Token_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewTokens sets the tokens field to a newly +// allocated Token_List, preferring placement in s's segment. +func (s LexedTokens) NewTokens(n int32) (Token_List, error) { + l, err := NewToken_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Token_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} + +// LexedTokens_List is a list of LexedTokens. +type LexedTokens_List = capnp.StructList[LexedTokens] + +// NewLexedTokens creates a new list of LexedTokens. +func NewLexedTokens_List(s *capnp.Segment, sz int32) (LexedTokens_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[LexedTokens](l), err +} + +// LexedTokens_Future is a wrapper for a LexedTokens promised by a client call. +type LexedTokens_Future struct{ *capnp.Future } + +func (f LexedTokens_Future) Struct() (LexedTokens, error) { + p, err := f.Future.Ptr() + return LexedTokens(p.Struct()), err +} + +type LexedStatements capnp.Struct + +// LexedStatements_TypeID is the unique identifier for the type LexedStatements. +const LexedStatements_TypeID = 0xa11f97b9d6c73dd4 + +func NewLexedStatements(s *capnp.Segment) (LexedStatements, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return LexedStatements(st), err +} + +func NewRootLexedStatements(s *capnp.Segment) (LexedStatements, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) + return LexedStatements(st), err +} + +func ReadRootLexedStatements(msg *capnp.Message) (LexedStatements, error) { + root, err := msg.Root() + return LexedStatements(root.Struct()), err +} + +func (s LexedStatements) String() string { + str, _ := text.Marshal(0xa11f97b9d6c73dd4, capnp.Struct(s)) + return str +} + +func (s LexedStatements) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (LexedStatements) DecodeFromPtr(p capnp.Ptr) LexedStatements { + return LexedStatements(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s LexedStatements) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s LexedStatements) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s LexedStatements) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s LexedStatements) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s LexedStatements) Statements() (Statement_List, error) { + p, err := capnp.Struct(s).Ptr(0) + return Statement_List(p.List()), err +} + +func (s LexedStatements) HasStatements() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s LexedStatements) SetStatements(v Statement_List) error { + return capnp.Struct(s).SetPtr(0, v.ToPtr()) +} + +// NewStatements sets the statements field to a newly +// allocated Statement_List, preferring placement in s's segment. +func (s LexedStatements) NewStatements(n int32) (Statement_List, error) { + l, err := NewStatement_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Statement_List{}, err + } + err = capnp.Struct(s).SetPtr(0, l.ToPtr()) + return l, err +} + +// LexedStatements_List is a list of LexedStatements. +type LexedStatements_List = capnp.StructList[LexedStatements] + +// NewLexedStatements creates a new list of LexedStatements. +func NewLexedStatements_List(s *capnp.Segment, sz int32) (LexedStatements_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) + return capnp.StructList[LexedStatements](l), err +} + +// LexedStatements_Future is a wrapper for a LexedStatements promised by a client call. +type LexedStatements_Future struct{ *capnp.Future } + +func (f LexedStatements_Future) Struct() (LexedStatements, error) { + p, err := f.Future.Ptr() + return LexedStatements(p.Struct()), err +} + +const schema_a73956d2621fc3ee = "x\xda\x84\x92\xcf\x8b\x1cE\x1c\xc5\xdf\xab\xea\xf9Ef" + + "L\xda\xee\xc3\x06\x0c\xa3\x10a\x14\x11c\x02\xc1\x80\xac" + + "L\xf0\xa0\x8c\x90JG\x03A%=3\x95\xb5\xdd\xd9" + + "\x9e\xa1\xa7\xc0l@\xbc\x18\x88\x87@\x12\x02\"\xa8\x90" + + "\x83h@\xc1\x88\x97\x1c<\xa8\xf1\xc7!\x81 *\x1e" + + "\xc4\x83\x7f\x80g]uK\xbe\xbd:\xbb\xacY\xf64" + + "\xd3\xef\xbdz\xf5\xad\xaa\xcf#7\xf8D\xb0\xaf\xf5\x8a" + + "\x862\x9dJ\xd5\xef>\xf6\xcb\xf1[\xcf\xde\xbc\x08\xd3" + + "\xa4\xf6\xbf}\xd9\xee\x7f\xf7\xdcc\xef\xe3I\xd6\xea@" + + "t\x85\x97\xa2\xab\xac\x01\xfb\xdf\xe3A\x05\xfa\xb9w\xae" + + "\xdd}\xff\xd5\xec]\x84M\xae\xa7+\x12\x89\x9e\x0a\xbe" + + "\x88L \xff\x9e\x09\xe6A\xff\xfd\xe3\xdf\xfcx\xfd\xcd" + + "\xf6\x95;e_\x0d~\x8d\xde(\xb3g\xcb\xec\xc1\x95" + + "\x93\xe7\x17^,\xbe\x961\xd4\x861tM\x01\xd1\xf5" + + "\xe0\x93\xe8sI\xef\xff,8N\x1c\xf6#{\xda\x16" + + "\x0f\x0fRN\xf2\xc9\xa1c\xe3E\xcb\xfc\x08i::" + + "hz\x1f\x10\x88\x1a<\x01$uj&1\x15[\\" + + "\xf51\xc5\x08Y\x00\xc9.1\xee\xa1\xe2\x1e\xfd\xb7g" + + "L\xd9e7\xcf\x00\xc9\x9c8{\xc5\x09\xfe\x12G\x03" + + "\xd1}|\x19H\xee\x15\xe7!)\xab\xfc\xe9c\x06@" + + "\xf4\x00\x9f\x06\x92\x8e\x18\x07\xc4\xa8\xae\xf8\x98\x15 \xda" + + "\xc7K@r@\x8c\x93b\xd4\xfe\xf01\xab@\xf4B" + + "\xb9\xfd\xf3b\x9c\xa3bXg\\^\xc8Y\x1e\x05\x92" + + "\xd7E\xbf z#\x88)/p\x9e] 9'\xfa" + + "e)R\xbf\xfb\x98\x0d \xbaX\x16]\x10\xe3m*" + + "\xfalhs\x97\x9d\xca\xa0m\xc1&\x14\x9b\xa0\x9f\xba" + + "\"\xcb\x17z\x19\xda\xce\x16\xe9h\xa6g\xb9\xb3\x0b\xb6" + + "\xe8a>[3\x1aPl\x80\xfe\xd4h\x9c\xba^\xe6" + + "\xb0\xb3\x94w@q\x07\xe8\xc7\x13[\xa4n\\\x00\x98" + + "uL\xd2\xc2\xe6\xee%\xcbiv\xc6\x0e{\xd9\x94\x8e" + + "w\x81G4\xff\xfb\xd9\xb5N\x17J\xd1\xf7\x8bt\xb0" + + "h\x9dE[\x16l\x9f\x9f\xba\xb4p\xdde\x07Z\xd6" + + "\xa1X\x07_\xb3\xf9\xb0\xbb\xecf\xdf\xbe\x9f\xe5i\xb1" + + "\xbc~\xc6\x16\x14[\xe0\x8c\x11%\x8c\xf4\xeci;\x14" + + "P\xf2)\x84\x94@\x07\x80\x80\x12\xb6\x0e\x01\xa6\xaei" + + "\xf6*\xce\xbb2\xb1\xf5<\xff\xefL\\\xea\xec\x92\xad" + + "\xe5n\xba\xa9\xf7\x04`\x9a\x9a\xa6\xa3\xcasH*\x87" + + "v\x1b\xdag\xd0oj/\xa9\x96\xe2\xb6\xacq\xd2;" + + "7\xeb}K\xe6\xbd\xaci>\x16\xaa\xfd\x1a\xd5\xe1G" + + "\x0f\x02\xe6\x03M\xf3\xa9\xe2\x1e\xb5\xfa/\xd2\xe1\xb5G" + + "\x01\xf3\xa1\xa6\xf9V1\xd4\xaa\xa49\xfcJ&\xbb\xa1" + + "in+\x86\x01K\x92\xc3[G\x01sS\xd3\xfc\xa4" + + "\x18VTIq\xf8C\x170\xb75\xcd\xcf\xdb\xdf\xcd" + + "\xceQ\x96[T\xdb\xfd\xd1x\xb0\xb8\xf5\x19\x87\xe3\xc1" + + "\xe1\xf1\xd2\x92\x85\xce\xdd\x06L\xb7}\xe6\x7f\x02\x00\x00" + + "\xff\xff\xd9\xe9\x1d\x8b" + +func RegisterSchema(reg *schemas.Registry) { + reg.Register(&schemas.Schema{ + String: schema_a73956d2621fc3ee, + Nodes: []uint64{ + 0x91cc55cd57de5419, + 0x9e69a92512b19d18, + 0xa11f97b9d6c73dd4, + 0xc6725e678d60fa37, + }, + Compressed: true, + }) +} diff --git a/std/capnp/cxx/c++.capnp.go b/std/capnp/cxx/c++.capnp.go index fd7fcdfe..dc754fac 100644 --- a/std/capnp/cxx/c++.capnp.go +++ b/std/capnp/cxx/c++.capnp.go @@ -6,9 +6,9 @@ import ( schemas "capnproto.org/go/capnp/v3/schemas" ) -const Namespace_ = uint64(0xb9c6f99ebf805f2c) -const Name_ = uint64(0xf264a779fef191ce) -const AllowCancellation_ = uint64(0xac7096ff8cfc9dce) +const Namespace = uint64(0xb9c6f99ebf805f2c) +const Name = uint64(0xf264a779fef191ce) +const AllowCancellation = uint64(0xac7096ff8cfc9dce) const schema_bdf87d7bb8304e81 = "x\xda\x12\xc8v`1\xe4\xcdgb`\x0a\x94ae" + "\xfb\x7fn\xee\x9f\x9e\xff\xd3\x0a\xd60\\\xe4bed" + "\xfe\xdf\xe8g\xb0\xa3\xba\xf6\xc7^\x06\x06FaY\xc6" + diff --git a/std/capnp/persistent.capnp b/std/capnp/persistent.capnp index bdc5c010..9d353c9e 100644 --- a/std/capnp/persistent.capnp +++ b/std/capnp/persistent.capnp @@ -120,7 +120,6 @@ annotation persistent(interface, field) :Void; # # Note that absence of the $persistent annotation doesn't mean a capability of that type isn't # persistent; it just means not *all* such capabilities are persistent. - using Go = import "/go.capnp"; $Go.package("persistent"); $Go.import("capnproto.org/go/capnp/v3/std/capnp/persistent"); diff --git a/std/capnp/rpc-twoparty.capnp b/std/capnp/rpc-twoparty.capnp index 3a5f89de..f2c65b89 100644 --- a/std/capnp/rpc-twoparty.capnp +++ b/std/capnp/rpc-twoparty.capnp @@ -97,17 +97,17 @@ struct VatId { side @0 :Side; } -struct ProvisionId { +struct ThirdPartyCompletion { # Only used for joins, since three-way introductions never happen on a two-party network. joinId @0 :UInt32; # The ID from `JoinKeyPart`. } -struct RecipientId {} +struct ThirdPartyToAwait {} # Never used, because there are only two parties. -struct ThirdPartyCapId {} +struct ThirdPartyToContact {} # Never used, because there is no third party. struct JoinKeyPart { diff --git a/std/capnp/rpc.capnp b/std/capnp/rpc.capnp index 60bc810b..bc8ad6e0 100644 --- a/std/capnp/rpc.capnp +++ b/std/capnp/rpc.capnp @@ -266,6 +266,7 @@ struct Message { provide @10 :Provide; # Provide a capability to a third party. accept @11 :Accept; # Accept a capability provided by a third party. + thirdPartyAnswer @14 :ThirdPartyAnswer; # Call handed off from a third party. # Level 4 features ----------------------------------------------- @@ -287,8 +288,9 @@ struct Bootstrap { # # We call this a "bootstrap" because in an ideal Cap'n Proto world, bootstrap interfaces would # never be used. In such a world, any time you connect to a new vat, you do so because you - # received an introduction from some other vat (see `ThirdPartyCapId`). Thus, the first message - # you send is `Accept`, and further communications derive from there. `Bootstrap` is not used. + # received an introduction from some other vat (see `ThirdPartyToContact`). Thus, the first + # message you send is `Accept`, and further communications derive from there. `Bootstrap` is not + # used. # # In such an ideal world, DNS itself would support Cap'n Proto -- performing a DNS lookup would # actually return a new Cap'n Proto capability, thus introducing you to the target system via @@ -311,7 +313,7 @@ struct Bootstrap { # containing the restored capability. deprecatedObjectId @1 :AnyPointer; - # ** DEPRECATED ** + # ** OBSOLETE ** # # A Vat may export multiple bootstrap interfaces. In this case, `deprecatedObjectId` specifies # which one to return. If this pointer is null, then the default bootstrap interface is returned. @@ -320,6 +322,8 @@ struct Bootstrap { # bootstrap interfaces, it should instead define a single bootstrap interface that has methods # that return each of the other interfaces. # + # As of version 2.0, this field is no longer implemented at all. + # # **History** # # In the first version of Cap'n Proto RPC (0.4.x) the `Bootstrap` message was called `Restore`. @@ -412,7 +416,7 @@ struct Call { allowThirdPartyTailCall @8 :Bool = false; # Indicates whether or not the receiver is allowed to send a `Return` containing - # `acceptFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee + # `awaitFromThirdParty`. Level 3 implementations should set this true. Otherwise, the callee # will have to proxy the return in the case of a tail call to a third-party vat. noPromisePipelining @9 :Bool = false; @@ -421,7 +425,7 @@ struct Call { # calls. # # The receiver may use this as an optimization, by skipping the bookkeeping needed for pipelining - # when no pipelined calls are expected. The sender typically sets this to false when the method's + # when no pipelined calls are expected. The sender typically sets this to true when the method's # schema does not specify any return capabilities. onlyPromisePipeline @10 :Bool = false; @@ -487,18 +491,18 @@ struct Call { # - Vat A sends a `Finish` for the bar() call to Vat B. # - Vat B receives the `Finish` for bar() and sends a `Finish` for bar'(). - thirdParty @7 :RecipientId; + thirdParty @7 :ThirdPartyToContact; # **(level 3)** # - # The call's result should be returned to a different vat. The receiver (the callee) expects - # to receive an `Accept` message from the indicated vat, and should return the call's result - # to it, rather than to the sender of the `Call`. + # The call's result should be returned to a different vat. The receiver (the callee) should + # connect to the given vat and sent it a ThirdPartyAnswer, followed by a Return to deliver the + # eventual result. # # This operates much like `yourself`, above, except that Carol is in a separate Vat C. `Call` # messages are sent from Vat A -> Vat B and Vat B -> Vat C. A `Return` message is sent from - # Vat B -> Vat A that contains `acceptFromThirdParty` in place of results. When Vat A sends - # an `Accept` to Vat C, it receives back a `Return` containing the call's actual result. Vat C - # also sends a `Return` to Vat B with `resultsSentElsewhere`. + # Vat B -> Vat A that contains `awaitFromThirdParty` in place of results. Vat C sends a + # `ThirdPartyAnswer` directly to Vat A, and also sends a `Return` to `Vat B` with + # `resultsSentElsewhere`. } } @@ -557,12 +561,12 @@ struct Return { # `sendResultsTo.yourself` set, and the results of that other call should be used as the # results here. `takeFromOtherQuestion` can only used once per question. - acceptFromThirdParty @7 :ThirdPartyCapId; + awaitFromThirdParty @7 :ThirdPartyToAwait; # **(level 3)** # - # The caller should contact a third-party vat to pick up the results. An `Accept` message - # sent to the vat will return the result. This pairs with `Call.sendResultsTo.thirdParty`. - # It should only be used if the corresponding `Call` had `allowThirdPartyTailCall` set. + # The caller should expect to receive a `ThirdPartyAnswer` from some other vat. This pairs + # with `Call.sendResultsTo.thirdParty`. It should only be used if the corresponding `Call` + # had `allowThirdPartyTailCall` set. } } @@ -598,7 +602,7 @@ struct Finish { requireEarlyCancellationWorkaround @2 :Bool = true; # If true, if the RPC system receives this Finish message before the original call has even been - # delivered, it should defer cancellation util after delivery. In particular, this gives the + # delivered, it should defer cancellation until after delivery. In particular, this gives the # destination object a chance to opt out of cancellation, e.g. as controlled by the # `allowCancellation` annotation defined in `c++.capnp`. # @@ -671,6 +675,12 @@ struct Resolve { } } +# TODO(someday): There may be use cases for a `ResolvePipeline` method, which is very similar to +# `Return` but provides provisional results for pipelining purposes, used when `setPipeline()` +# is invoked by the callee. This would be particularly improtant when setPipeline() is given +# capabilities that could potentially be shortened before the call actually finishes. So far, +# though, we haven't seen a real-life use case. + struct Release { # **(level 1)** # @@ -763,6 +773,10 @@ struct Disembargo { using EmbargoId = UInt32; # Used in `senderLoopback` and `receiverLoopback`, below. + using ThirdPartyEmbargoId = Data; + # Used in `accept`, below, to embago a capability received via three-party handoff. Must be a + # globally-unique string, typically chosen at random with enough entropy to guarantee uniqueness. + context :union { senderLoopback @1 :EmbargoId; # The sender is requesting a disembargo on a promise that is known to resolve back to a @@ -779,25 +793,25 @@ struct Disembargo { # The receiver previously sent a `senderLoopback` Disembargo towards a promise resolving to # this capability, and that Disembargo is now being echoed back. - accept @3 :Void; + accept @3 :ThirdPartyEmbargoId; # **(level 3)** # # The sender is requesting a disembargo on a promise that is known to resolve to a third-party # capability that the sender is currently in the process of accepting (using `Accept`). - # The receiver of this `Disembargo` has an outstanding `Provide` on said capability. The - # receiver should now send a `Disembargo` with `provide` set to the question ID of that - # `Provide` message. # - # See `Accept.embargo` for an example. - - provide @4 :QuestionId; - # **(level 3)** + # If `target` is the variant `importedCap`, then this `Disembargo` is addressed to an import + # representing a vine leading towards where the three-party handoff began. + # + # If `target` is the variant `promisedAnswer`, then it specifies the `QuestionId` of the + # `Provide` operation which initiated this handoff. A corresponding `Accept` will be waiting + # on the `Disembargo`. + # + # The value uniquely identifies this particular embargo among all embargoes requested against + # the same `Provide` operation. The same ID will be sent in `Accept.embago`. The embargo ID is + # necessary because forwarding allows the same provision to be accepted multiple times. If a + # VatNetwork does not allow forwarding, the embargo ID can be omitted. # - # The sender is requesting a disembargo on a capability currently being provided to a third - # party. The question ID identifies the `Provide` message previously sent by the sender to - # this capability. On receipt, the receiver (the capability host) shall release the embargo - # on the `Accept` message that it has received from the third party. See `Accept.embargo` for - # an example. + # See `Accept.embargo` for an example. } } @@ -818,15 +832,24 @@ struct Provide { # every vat. In Cap'n Proto, we bake this into the core protocol.) questionId @0 :QuestionId; - # Question ID to be held open until the recipient has received the capability. A result will be - # returned once the third party has successfully received the capability. The sender must at some - # point send a `Finish` message as with any other call, and that message can be used to cancel the - # whole operation. + # Question ID to be held open until the recipient has received the capability. No `Return` + # message will be sent, similarly to a `Call` that has `onlyPromisePipeline = true`. The sender + # must at some point send a `Finish` message as with any other call, which unregisters the + # provision. Typically, the sender would send such a `Finish` message once it has received + # confirmation from the third party that the capability has been successfully accepted, or that + # the third party is no longer trying to accept it. Specifically, the sender learns this when the + # third party drops the "vine" capability passed along with the ThirdPartyCapDescriptor -- the + # vine must be held until the `Accept` has completed. + # + # More than one party can accept the provision. The recipient will offer the capability to + # anyone who sends a matching `Accept` message. This is particularly useful when the VatNetwork + # supports forwarding, as a capability may be forwarded to many parties before any of them + # actually connects back to the host to accept it. target @1 :MessageTarget; # What is to be provided to the third party. - recipient @2 :RecipientId; + recipient @2 :ThirdPartyToAwait; # Identity of the third party that is expected to pick up the capability. } @@ -835,24 +858,22 @@ struct Accept { # # Message type sent to pick up a capability hosted by the receiving vat and provided by a third # party. The third party previously designated the capability using `Provide`. - # - # This message is also used to pick up a redirected return -- see `Return.acceptFromThirdParty`. questionId @0 :QuestionId; # A new question ID identifying this accept message, which will eventually receive a Return # message containing the provided capability (or the call result in the case of a redirected # return). - provision @1 :ProvisionId; + provision @1 :ThirdPartyCompletion; # Identifies the provided object to be picked up. - embargo @2 :Bool; - # If true, this accept shall be temporarily embargoed. The resulting `Return` will not be sent, - # and any pipelined calls will not be delivered, until the embargo is released. The receiver - # (the capability host) will expect the provider (the vat that sent the `Provide` message) to - # eventually send a `Disembargo` message with the field `context.provide` set to the question ID - # of the original `Provide` message. At that point, the embargo is released and the queued - # messages are delivered. + embargo @2 :Disembargo.ThirdPartyEmbargoId; + # If non-null, this accept shall be temporarily embargoed. The resulting `Return` will not be + # sent, and any pipelined calls will not be delivered, until the embargo is released. The + # receiver (the capability host) will expect the provider (the vat that sent the `Provide` + # message) to eventually send a `Disembargo` message with the field `context.accept` set to a + # byte string matching the one specified here. At that point, the embargo is released and the + # queued messages are delivered. # # For example: # - Alice, in Vat A, holds a promise P, which currently points toward Vat B. @@ -860,11 +881,13 @@ struct Accept { # - The promise P in Vat B ends up resolving to Carol, in Vat C. # - Vat B sends a `Provide` message to Vat C, identifying Vat A as the recipient. # - Vat B sends a `Resolve` message to Vat A, indicating that the promise has resolved to a - # `ThirdPartyCapId` identifying Carol in Vat C. - # - Vat A sends an `Accept` message to Vat C to pick up the capability. Since Vat A knows that - # it has an outstanding call to the promise, it sets `embargo` to `true` in the `Accept` - # message. - # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set. + # `ThirdPartyToContact` identifying Carol in Vat C. + # - Since Vat A knows that it has an outstanding call to the promise, it knows it needs to use + # an embargo. Vat A chooses a random byte string to be the embargo ID. + # - Vat A sends an `Accept` message to Vat C to pick up the capability, setting `embargo` to the + # embargo ID. + # - Vat A sends a `Disembargo` message to Vat B on promise P, with `context.accept` set to + # the embargo ID. # - Alice makes a call bar() to promise P, which is now pointing towards Vat C. Alice doesn't # know anything about the mechanics of promise resolution happening under the hood, but she # expects that bar() will be delivered after foo() because that is the order in which she @@ -873,14 +896,51 @@ struct Accept { # hasn't returned yet, due to the embargo). Since calls to the newly-accepted capability # are embargoed, Vat C does not deliver the call yet. # - At some point, Vat B forwards the foo() call from the beginning of this example on to Vat C. - # - Vat B forwards the `Disembargo` from Vat A on to vat C. It sets `context.provide` to the - # question ID of the `Provide` message it had sent previously. + # - Vat B forwards the `Disembargo` from Vat A on to vat C. # - Vat C receives foo() before `Disembargo`, thus allowing it to correctly deliver foo() # before delivering bar(). # - Vat C receives `Disembargo` from Vat B. It can now send a `Return` for the `Accept` from # Vat A, as well as deliver bar(). } +struct ThirdPartyAnswer { + # **(level 3)** + # + # When a call has `sendResultsTo.thirdParty`, the callee directly connects to the given third + # party and sends it a `ThirdPartyAnswer` in order to adopt the call into its connection. + + completion @0 :ThirdPartyCompletion; + # Information needed to identify which call is being returned. + # + # The introducer should have sent a `Return` message previously containing + # `awaitFromThirdParty`, directing the callee to wait for a `ThirdPartyAnswer` containing the + # final results. (Of course, it's possible that the `ThirdPartyAnswer` arrives before the + # original `Return`, in which case the recipient must wait to receive the corresponding + # `Return` message.) + + answerId @1 :AnswerId; + # The answer ID which will now represent this call on this connection. + # + # The sender (callee) will follow up later with a `Return` message referencing the same ID. In + # the meantime, the receiver (caller) can begin sending pipelined requests directly to the + # sender, and must eventually send a `Finish` message. + # + # Normally, callers choose question IDs -- and answer IDs strictly match the question ID chosen + # by the caller. In this case, the callee is choosing an answer ID on its own. In theory, this + # is a bad design: we should be using an export ID here instead. However, we would then have to + # go around to all the types that reference `QuestionId` or `AnswerId` and make them be able to + # use `ImportId` / `ExportId` instead. In retrospect, questions and exports probably should have + # been in the same ID space from the beginning, with a convention for which parts of the ID + # space can be allocated by which side. Unfortunately, that ship has sailed. + # + # Instead, we introduce a hack: Answer IDs introduced by `ThirdPartyAnswer` must be in the range + # [2^30,2^31), that is, they have bit 30 set, but not bit 31. We designate this range as + # callee-allocated; callers will never allocate in this range. This hack should be + # backwards-compatible given that implementations traditionally always use the lowest-numbered + # ID available. However, note that we don't use the range [2^31,2^32) because this has already + # been designated for use with `onlyPromisePipeline` (another hack). +} + # Level 4 message types ---------------------------------------------- struct Join { @@ -1146,7 +1206,7 @@ struct ThirdPartyCapDescriptor { # # Identifies a capability in a third-party vat that the sender wants the receiver to pick up. - id @0 :ThirdPartyCapId; + id @0 :ThirdPartyToContact; # Identifies the third-party host and the specific capability to accept from it. vineId @1 :ExportId; @@ -1255,6 +1315,23 @@ struct Exception { # Stack trace text from the remote server. The format is not specified. By default, # implementations do not provide stack traces; the application must explicitly enable them # when desired. + + details @5 :List(Detail); + # Arbitrary extra information can be added to an exception. Applications can define any kind of + # detail they want. It is expected that exceptions will rarely have more than one or two details. + # + # The main use case for details is to be able to tunnel exceptions of a different type through + # KJ / Cap'n Proto. In particular, Cloudflare Workers commonly has to convert a JavaScript + # exception to KJ and back. The exception is serialized using V8 serialization. + + struct Detail { + detailId @0 :UInt64; + # Every type of detail should have a unique ID, which is a 64-bit integer. It's suggested that + # you use `capnp id` to generate these. + + data @1 :Data; + # The arbitrary extra information. + } } # ======================================================================================== @@ -1350,43 +1427,186 @@ using SturdyRef = AnyPointer; # In this case, the entire contents of SturdyRef might be opaque, because they are intended only # to be forwarded to the restorer service. -using ProvisionId = AnyPointer; +using ThirdPartyCompletion = AnyPointer; # **(level 3)** # -# The information that must be sent in an `Accept` message to identify the object being accepted. +# Used to express "I am the third party whom you are waiting for to complete an operation". +# +# In particular, this is given in an `Accept` message to identify the object being accepted. # # In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the provider vat along with a nonce matching the one in the `RecipientId` used -# in the `Provide` message sent from that provider. +# fingerprint of the provider vat along with a nonce matching the one in the `ThirdPartyToAwait` +# used in the `Provide` message sent from that provider. -using RecipientId = AnyPointer; +using ThirdPartyToAwait = AnyPointer; # **(level 3)** # -# The information that must be sent in a `Provide` message to identify the recipient of the -# capability. +# Used to express "expect that some other vat will connect to you to complete this operation". +# +# In particular, this is given in a `Provide` message to identify the recipient of the capability. +# The recipient will call the host directly to "pick up" the capability. # # In a network where each vat has a public/private key pair, this could simply be the public key -# fingerprint of the recipient along with a nonce matching the one in the `ProvisionId`. +# fingerprint of the recipient along with a nonce matching the one in the `ThirdPartyCompletion`. # # As another example, when communicating between processes on the same machine over Unix sockets, -# RecipientId could simply refer to a file descriptor attached to the message via SCM_RIGHTS. +# ThirdPartyToAwait could simply refer to a file descriptor attached to the message via SCM_RIGHTS. # This file descriptor would be one end of a newly-created socketpair, with the other end having -# been sent to the capability's recipient in ThirdPartyCapId. +# been sent to the capability's recipient in ThirdPartyToContact. -using ThirdPartyCapId = AnyPointer; +using ThirdPartyToContact = AnyPointer; # **(level 3)** # -# The information needed to connect to a third party and accept a capability from it. +# The information needed to connect to a third party to complete an operation, e.g. to accept a +# capability from it. # # In a network where each vat has a public/private key pair, this could be a combination of the # third party's public key fingerprint, hints on how to connect to the third party (e.g. an IP -# address), and the nonce used in the corresponding `Provide` message's `RecipientId` as sent +# address), and the nonce used in the corresponding `Provide` message's `ThirdPartyToAwait` as sent # to that third party (used to identify which capability to pick up). # # As another example, when communicating between processes on the same machine over Unix sockets, -# ThirdPartyCapId could simply refer to a file descriptor attached to the message via SCM_RIGHTS. -# This file descriptor would be one end of a newly-created socketpair, with the other end having -# been sent to the process hosting the capability in RecipientId. +# ThirdPartyToContact could simply refer to a file descriptor attached to the message via +# SCM_RIGHTS. This file descriptor would be one end of a newly-created socketpair, with the other +# end having been sent to the process hosting the capability in ThirdPartyToAwait. +# +# Some VatNetworks, as an optimization, may permit ThirdPartyToContact to be forwarded across +# multiple vats. For example, imagine Alice sends a capability to Bob, who passes it along to Carol, +# who further pass it to Dave. Bob will send a `Provide` message to Alice telling her to expect the +# capability to be picked up by Carol, and then will pass Carol a `ThirdPartyToContact` pointing to +# Alice. If `ThirdPartyToContact` is non-forwartable, then Carol must form a connection to Alice, +# send an `Accept` to receive the capability, and then immediately send a `Provide` to provide it +# to Dave, before then being able to give a `ThirdPartyToContact` to Dave which points to Alice. +# This is a bit of a waste. If `ThirdPartyToContact` is forwardable, then Carol can simply pass +# it along to Dave without making any connection to Alice. Some VatNetwork implementations may +# require that Carol add a signature to the `ThirdPartyToContact` authenticating that she really +# did forward it to Dave, which Dave will then present back to Alice. Other implementations may +# simply pass along an unguessable token and instruct Alice that whoever presents the token should +# receive the capability. A VatNetwork may choose not to allow forwarding if it doesn't want its +# security to be dependent on secret bearer tokens nor cryptographic signatures. + +# The following are some examples showing possible ways that the above types could be defined for +# various VatNetwork implementations. +# +# struct SimpleExample { +# # In this example, three-party handoff is authenticated merely by a bearer token. +# +# struct ThirdPartyToContact { +# contactAddress :IpAddress; +# secretToken :Data; +# +# # Note: ThirdPartyToContact can freely be forwarded across several vats before being +# # redeemed. +# } +# +# struct ThirdPartyToAwait { +# secretToken :Data; +# } +# +# struct ThirdPartyCompletion { +# secretToken :Data; +# } +# } +# +# struct NoSecretsExample { +# # In this example, three-party handoff is accomplished without any secret values. It is +# # assumed, however, that the system is able to securely authenticate the party on the other +# # end of each connection matches some `VatId`. While this would commonly be accomplished with +# # cryptography, which involves secrets, there do exist systems where no secrets are needed at +# # all, for example processes communicating over Unix sockets using SCM_CREDENTIALS or similar. +# +# struct ThirdPartyToContact { +# contactId :VatId; +# # Who to contact (identity which can be authenticated by the VatNetwork). +# +# contactAddress :VatPath; +# # How to reach them (e.g. an IP address). +# +# nonce :UInt64; +# # A number representing this particular three-party handoff, unique among all handoffs +# # initiated by the same introducer. This may be generated by a simple counter, i.e. it +# # is guessable, but it will only be accepted when the vat trying to redeem it is actually +# # the one that the introducer specified. +# +# # Note: This ThirdPartyToContact cannot be forwarded since only the specific vat that it was +# # given to is authorized to redeem it. +# } +# +# struct ThirdPartyToAwait { +# expectedId :VatId; +# # Who to expect a contact from. ONLY this Vat is permitted to redeem the nonce. +# +# nonce :UInt64; +# # The nonce identifing the specific handoff. See above. +# } +# +# struct ThirdPartyCompletion { +# introducer :VatId; +# # Who initiated this three-party handoff? Note that the nonce is only unique among nonces +# # from the same introducer. +# +# nonce :UInt64; +# # The nonce identifying the handoff. +# } +# } +# +# struct PublicKeyExample { +# # In this example, we assume vats have a public/private key pair identifying them. +# +# struct ThirdPartyToContact { +# contactVat :PublicKey; +# # Public key of the vat to contact. +# +# contactAddress :IpAddress; +# # Address at which `contactVat` can be reached. +# +# introducer :PublicKey; +# nonce :UInt64; +# # Nonce, unique among all handoffs initiated by `introducer`. As with NoSecretsExample, this +# # can be guessable. +# +# forwards :List(Forward); +# # This ThirdPartyToContact can be forwarded from vat to vat, but each vat must add a signature +# # proving that they approved this forwarding. This way, no secrets are ever sent over the +# # network which, if leaked, would allow an attacker to hijack the handoff. +# +# struct Forward { +# to :PublicKey; +# # Public key of the recipient of the forward. +# +# by :PublicKey; +# # Public key of vat that chose to forward the ThirdPartyContact. +# +# signed :Signature; +# # Signs the tuple of (introducer, nonce, to) using the private key corresponding to `by`. +# } +# } +# +# struct ThirdPartyToAwait { +# expectVat :PublicKey; +# # Public key of the vat to expect to hear from (or, if the ThirdPartyToContact is forwarded, +# # who should be the first signer in the forwarding chain). +# +# nonce :UInt64; +# # Nonce identifying the handoff. +# } +# +# struct ThirdPartyCompletion { +# introducer :PublicKey; +# nonce :UInt64; +# +# forwards :List(ThirdPartyToContact.Forward); +# # Chain of vats through which this completion was forwarded, with signatures proving that the +# # forwards were authorized. +# # +# # If empty, then the sender of this `ThirdPartyCompletion` should exactly match +# # `ThirdPartyToAwait.expectVat`. +# # +# # If `forwards` is non-empty, then the sender matches `forward.to` of the last forward in the +# # list, and each `by` matches the previous forward, with the first forward matching +# # `ThirdPartyToAwait.expectVat`, and all signatures are valid. +# } +# } using JoinKeyPart = AnyPointer; # **(level 4)** @@ -1474,17 +1694,18 @@ using JoinResult = AnyPointer; # # Add a JoinResult received in response to one of the `Join` messages. All `JoinResult`s # # returned from all paths must be added before trying to connect. # -# connect() :ConnectionAndProvisionId; +# connect() :ConnectionAndThirdPartyCompletion; # # Try to form a connection to the joined capability's host, verifying that it has received # # all of the JoinKeyParts. Once the connection is formed, the caller should send an `Accept` -# # message on it with the specified `ProvisionId` in order to receive the final capability. +# # message on it with the specified `ThirdPartyCompletion` in order to receive the final +# # capability. # } # # acceptConnectionFromJoiner(parts :List(JoinKeyPart), paths :List(VatPath)) -# :ConnectionAndProvisionId; +# :ConnectionAndThirdPartyCompletion; # # Called on a joined capability's host to receive the connection from the joiner, once all # # key parts have arrived. The caller should expect to receive an `Accept` message over the -# # connection with the given ProvisionId. +# # connection with the given ThirdPartyCompletion. # } # # interface Connection { @@ -1502,31 +1723,42 @@ using JoinResult = AnyPointer; # # introduceTo(recipient :Connection) :IntroductionInfo; # # Call before starting a three-way introduction, assuming a `Provide` message is to be sent on -# # this connection and a `ThirdPartyCapId` is to be sent to `recipient`. +# # this connection and a `ThirdPartyToContact` is to be sent to `recipient`. # # struct IntroductionInfo { -# sendToRecipient :ThirdPartyCapId; -# sendToTarget :RecipientId; +# sendToRecipient :ThirdPartyToContact; +# sendToTarget :ThirdPartyToAwait; # } # -# connectToIntroduced(capId :ThirdPartyCapId) :ConnectionAndProvisionId; -# # Given a ThirdPartyCapId received over this connection, connect to the third party. The +# connectToIntroduced(capId :ThirdPartyToContact) :ConnectionAndThirdPartyCompletion; +# # Given a ThirdPartyToContact received over this connection, connect to the third party. The # # caller should then send an `Accept` message over the new connection. # -# acceptIntroducedConnection(recipientId :RecipientId) :Connection; -# # Given a RecipientId received in a `Provide` message on this `Connection`, wait for the -# # recipient to connect, and return the connection formed. Usually, the first message received -# # on the new connection will be an `Accept` message. +# awaitThirdParty(party: ThirdPartyToAwait, value :Any) :Any; +# completeThirdParty(completion: ThirdPartyCompletion, value :Any) :Any; +# # Complete a third-party handoff that is supposed to rendezvous at this node. +# # +# # Each method is called on the corresponding connection that received a `ThirdPartyToAwait` or +# # `ThirdPartyCompletion`. Once both are called, both return the `value` that was passed to the +# # other, allowing the RPC system to complete the handoff. +# +# forwardThirdPartyToContact(original :ThirdPartyToContact, destination :Connection) +# :Maybe(ThirdPartyToContact); +# # Given a `ThirdPartyToContact` value received from *this* connection, add any necessary +# # information to allow it to be forwarded to `destination`. A VatNetwork could choose to add +# # some sort of signature to authenticate that this Vat really did choose to forward this +# # value. Returns null if forwarding is not permitted, in which case this vat will have to +# # directly contact the third party in order to complete this handoff and start a new one. # } # -# struct ConnectionAndProvisionId { +# struct ConnectionAndThirdPartyCompletion { # # **(level 3)** # # connection :Connection; # # Connection on which to issue `Accept` message. # -# provision :ProvisionId; -# # `ProvisionId` to send in the `Accept` message. +# provision :ThirdPartyCompletion; +# # `ThirdPartyCompletion` to send in the `Accept` message. # } using Go = import "/go.capnp"; $Go.package("rpc"); diff --git a/std/capnp/rpc/rpc.capnp.go b/std/capnp/rpc/rpc.capnp.go index 5ce1cdc7..b3109bf4 100644 --- a/std/capnp/rpc/rpc.capnp.go +++ b/std/capnp/rpc/rpc.capnp.go @@ -13,24 +13,25 @@ type Message capnp.Struct type Message_Which uint16 const ( - Message_Which_unimplemented Message_Which = 0 - Message_Which_abort Message_Which = 1 - Message_Which_bootstrap Message_Which = 8 - Message_Which_call Message_Which = 2 - Message_Which_return Message_Which = 3 - Message_Which_finish Message_Which = 4 - Message_Which_resolve Message_Which = 5 - Message_Which_release Message_Which = 6 - Message_Which_disembargo Message_Which = 13 - Message_Which_obsoleteSave Message_Which = 7 - Message_Which_obsoleteDelete Message_Which = 9 - Message_Which_provide Message_Which = 10 - Message_Which_accept Message_Which = 11 - Message_Which_join Message_Which = 12 + Message_Which_unimplemented Message_Which = 0 + Message_Which_abort Message_Which = 1 + Message_Which_bootstrap Message_Which = 8 + Message_Which_call Message_Which = 2 + Message_Which_return Message_Which = 3 + Message_Which_finish Message_Which = 4 + Message_Which_resolve Message_Which = 5 + Message_Which_release Message_Which = 6 + Message_Which_disembargo Message_Which = 13 + Message_Which_obsoleteSave Message_Which = 7 + Message_Which_obsoleteDelete Message_Which = 9 + Message_Which_provide Message_Which = 10 + Message_Which_accept Message_Which = 11 + Message_Which_thirdPartyAnswer Message_Which = 14 + Message_Which_join Message_Which = 12 ) func (w Message_Which) String() string { - const s = "unimplementedabortbootstrapcallreturnfinishresolvereleasedisembargoobsoleteSaveobsoleteDeleteprovideacceptjoin" + const s = "unimplementedabortbootstrapcallreturnfinishresolvereleasedisembargoobsoleteSaveobsoleteDeleteprovideacceptthirdPartyAnswerjoin" switch w { case Message_Which_unimplemented: return s[0:13] @@ -58,8 +59,10 @@ func (w Message_Which) String() string { return s[93:100] case Message_Which_accept: return s[100:106] + case Message_Which_thirdPartyAnswer: + return s[106:122] case Message_Which_join: - return s[106:110] + return s[122:126] } return "Message_Which(" + strconv.FormatUint(uint64(w), 10) + ")" @@ -502,6 +505,38 @@ func (s Message) NewAccept() (Accept, error) { return ss, err } +func (s Message) ThirdPartyAnswer() (ThirdPartyAnswer, error) { + if capnp.Struct(s).Uint16(0) != 14 { + panic("Which() != thirdPartyAnswer") + } + p, err := capnp.Struct(s).Ptr(0) + return ThirdPartyAnswer(p.Struct()), err +} + +func (s Message) HasThirdPartyAnswer() bool { + if capnp.Struct(s).Uint16(0) != 14 { + return false + } + return capnp.Struct(s).HasPtr(0) +} + +func (s Message) SetThirdPartyAnswer(v ThirdPartyAnswer) error { + capnp.Struct(s).SetUint16(0, 14) + return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) +} + +// NewThirdPartyAnswer sets the thirdPartyAnswer field to a newly +// allocated ThirdPartyAnswer struct, preferring placement in s's segment. +func (s Message) NewThirdPartyAnswer() (ThirdPartyAnswer, error) { + capnp.Struct(s).SetUint16(0, 14) + ss, err := NewThirdPartyAnswer(capnp.Struct(s).Segment()) + if err != nil { + return ThirdPartyAnswer{}, err + } + err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) + return ss, err +} + func (s Message) Join() (Join, error) { if capnp.Struct(s).Uint16(0) != 12 { panic("Which() != join") @@ -589,6 +624,9 @@ func (p Message_Future) Provide() Provide_Future { func (p Message_Future) Accept() Accept_Future { return Accept_Future{Future: p.Future.Field(0, nil)} } +func (p Message_Future) ThirdPartyAnswer() ThirdPartyAnswer_Future { + return ThirdPartyAnswer_Future{Future: p.Future.Field(0, nil)} +} func (p Message_Future) Join() Join_Future { return Join_Future{Future: p.Future.Field(0, nil)} } @@ -936,11 +974,11 @@ const ( Return_Which_canceled Return_Which = 2 Return_Which_resultsSentElsewhere Return_Which = 3 Return_Which_takeFromOtherQuestion Return_Which = 4 - Return_Which_acceptFromThirdParty Return_Which = 5 + Return_Which_awaitFromThirdParty Return_Which = 5 ) func (w Return_Which) String() string { - const s = "resultsexceptioncanceledresultsSentElsewheretakeFromOtherQuestionacceptFromThirdParty" + const s = "resultsexceptioncanceledresultsSentElsewheretakeFromOtherQuestionawaitFromThirdParty" switch w { case Return_Which_results: return s[0:7] @@ -952,8 +990,8 @@ func (w Return_Which) String() string { return s[24:44] case Return_Which_takeFromOtherQuestion: return s[44:65] - case Return_Which_acceptFromThirdParty: - return s[65:85] + case Return_Which_awaitFromThirdParty: + return s[65:84] } return "Return_Which(" + strconv.FormatUint(uint64(w), 10) + ")" @@ -1118,21 +1156,21 @@ func (s Return) SetTakeFromOtherQuestion(v uint32) { capnp.Struct(s).SetUint32(8, v) } -func (s Return) AcceptFromThirdParty() (capnp.Ptr, error) { +func (s Return) AwaitFromThirdParty() (capnp.Ptr, error) { if capnp.Struct(s).Uint16(6) != 5 { - panic("Which() != acceptFromThirdParty") + panic("Which() != awaitFromThirdParty") } return capnp.Struct(s).Ptr(0) } -func (s Return) HasAcceptFromThirdParty() bool { +func (s Return) HasAwaitFromThirdParty() bool { if capnp.Struct(s).Uint16(6) != 5 { return false } return capnp.Struct(s).HasPtr(0) } -func (s Return) SetAcceptFromThirdParty(v capnp.Ptr) error { +func (s Return) SetAwaitFromThirdParty(v capnp.Ptr) error { capnp.Struct(s).SetUint16(6, 5) return capnp.Struct(s).SetPtr(0, v) } @@ -1159,7 +1197,7 @@ func (p Return_Future) Results() Payload_Future { func (p Return_Future) Exception() Exception_Future { return Exception_Future{Future: p.Future.Field(0, nil)} } -func (p Return_Future) AcceptFromThirdParty() *capnp.Future { +func (p Return_Future) AwaitFromThirdParty() *capnp.Future { return p.Future.Field(0, nil) } @@ -1503,11 +1541,10 @@ const ( Disembargo_context_Which_senderLoopback Disembargo_context_Which = 0 Disembargo_context_Which_receiverLoopback Disembargo_context_Which = 1 Disembargo_context_Which_accept Disembargo_context_Which = 2 - Disembargo_context_Which_provide Disembargo_context_Which = 3 ) func (w Disembargo_context_Which) String() string { - const s = "senderLoopbackreceiverLoopbackacceptprovide" + const s = "senderLoopbackreceiverLoopbackaccept" switch w { case Disembargo_context_Which_senderLoopback: return s[0:14] @@ -1515,8 +1552,6 @@ func (w Disembargo_context_Which) String() string { return s[14:30] case Disembargo_context_Which_accept: return s[30:36] - case Disembargo_context_Which_provide: - return s[36:43] } return "Disembargo_context_Which(" + strconv.FormatUint(uint64(w), 10) + ")" @@ -1526,12 +1561,12 @@ func (w Disembargo_context_Which) String() string { const Disembargo_TypeID = 0xf964368b0fbd3711 func NewDisembargo(s *capnp.Segment) (Disembargo, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) return Disembargo(st), err } func NewRootDisembargo(s *capnp.Segment) (Disembargo, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) return Disembargo(st), err } @@ -1631,21 +1666,24 @@ func (s Disembargo_context) SetReceiverLoopback(v uint32) { capnp.Struct(s).SetUint32(0, v) } -func (s Disembargo_context) SetAccept() { - capnp.Struct(s).SetUint16(4, 2) - +func (s Disembargo_context) Accept() ([]byte, error) { + if capnp.Struct(s).Uint16(4) != 2 { + panic("Which() != accept") + } + p, err := capnp.Struct(s).Ptr(1) + return []byte(p.Data()), err } -func (s Disembargo_context) Provide() uint32 { - if capnp.Struct(s).Uint16(4) != 3 { - panic("Which() != provide") +func (s Disembargo_context) HasAccept() bool { + if capnp.Struct(s).Uint16(4) != 2 { + return false } - return capnp.Struct(s).Uint32(0) + return capnp.Struct(s).HasPtr(1) } -func (s Disembargo_context) SetProvide(v uint32) { - capnp.Struct(s).SetUint16(4, 3) - capnp.Struct(s).SetUint32(0, v) +func (s Disembargo_context) SetAccept(v []byte) error { + capnp.Struct(s).SetUint16(4, 2) + return capnp.Struct(s).SetData(1, v) } // Disembargo_List is a list of Disembargo. @@ -1653,7 +1691,7 @@ type Disembargo_List = capnp.StructList[Disembargo] // NewDisembargo creates a new list of Disembargo. func NewDisembargo_List(s *capnp.Segment, sz int32) (Disembargo_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) return capnp.StructList[Disembargo](l), err } @@ -1799,12 +1837,12 @@ type Accept capnp.Struct const Accept_TypeID = 0xd4c9b56290554016 func NewAccept(s *capnp.Segment) (Accept, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) return Accept(st), err } func NewRootAccept(s *capnp.Segment) (Accept, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) return Accept(st), err } @@ -1859,12 +1897,17 @@ func (s Accept) HasProvision() bool { func (s Accept) SetProvision(v capnp.Ptr) error { return capnp.Struct(s).SetPtr(0, v) } -func (s Accept) Embargo() bool { - return capnp.Struct(s).Bit(32) +func (s Accept) Embargo() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(1) + return []byte(p.Data()), err } -func (s Accept) SetEmbargo(v bool) { - capnp.Struct(s).SetBit(32, v) +func (s Accept) HasEmbargo() bool { + return capnp.Struct(s).HasPtr(1) +} + +func (s Accept) SetEmbargo(v []byte) error { + return capnp.Struct(s).SetData(1, v) } // Accept_List is a list of Accept. @@ -1872,7 +1915,7 @@ type Accept_List = capnp.StructList[Accept] // NewAccept creates a new list of Accept. func NewAccept_List(s *capnp.Segment, sz int32) (Accept_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) return capnp.StructList[Accept](l), err } @@ -1887,6 +1930,92 @@ func (p Accept_Future) Provision() *capnp.Future { return p.Future.Field(0, nil) } +type ThirdPartyAnswer capnp.Struct + +// ThirdPartyAnswer_TypeID is the unique identifier for the type ThirdPartyAnswer. +const ThirdPartyAnswer_TypeID = 0xb6511ce6c5f0e58c + +func NewThirdPartyAnswer(s *capnp.Segment) (ThirdPartyAnswer, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ThirdPartyAnswer(st), err +} + +func NewRootThirdPartyAnswer(s *capnp.Segment) (ThirdPartyAnswer, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return ThirdPartyAnswer(st), err +} + +func ReadRootThirdPartyAnswer(msg *capnp.Message) (ThirdPartyAnswer, error) { + root, err := msg.Root() + return ThirdPartyAnswer(root.Struct()), err +} + +func (s ThirdPartyAnswer) String() string { + str, _ := text.Marshal(0xb6511ce6c5f0e58c, capnp.Struct(s)) + return str +} + +func (s ThirdPartyAnswer) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (ThirdPartyAnswer) DecodeFromPtr(p capnp.Ptr) ThirdPartyAnswer { + return ThirdPartyAnswer(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s ThirdPartyAnswer) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s ThirdPartyAnswer) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s ThirdPartyAnswer) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s ThirdPartyAnswer) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s ThirdPartyAnswer) Completion() (capnp.Ptr, error) { + return capnp.Struct(s).Ptr(0) +} + +func (s ThirdPartyAnswer) HasCompletion() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s ThirdPartyAnswer) SetCompletion(v capnp.Ptr) error { + return capnp.Struct(s).SetPtr(0, v) +} +func (s ThirdPartyAnswer) AnswerId() uint32 { + return capnp.Struct(s).Uint32(0) +} + +func (s ThirdPartyAnswer) SetAnswerId(v uint32) { + capnp.Struct(s).SetUint32(0, v) +} + +// ThirdPartyAnswer_List is a list of ThirdPartyAnswer. +type ThirdPartyAnswer_List = capnp.StructList[ThirdPartyAnswer] + +// NewThirdPartyAnswer creates a new list of ThirdPartyAnswer. +func NewThirdPartyAnswer_List(s *capnp.Segment, sz int32) (ThirdPartyAnswer_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[ThirdPartyAnswer](l), err +} + +// ThirdPartyAnswer_Future is a wrapper for a ThirdPartyAnswer promised by a client call. +type ThirdPartyAnswer_Future struct{ *capnp.Future } + +func (f ThirdPartyAnswer_Future) Struct() (ThirdPartyAnswer, error) { + p, err := f.Future.Ptr() + return ThirdPartyAnswer(p.Struct()), err +} +func (p ThirdPartyAnswer_Future) Completion() *capnp.Future { + return p.Future.Field(0, nil) +} + type Join capnp.Struct // Join_TypeID is the unique identifier for the type Join. @@ -2744,12 +2873,12 @@ type Exception capnp.Struct const Exception_TypeID = 0xd625b7063acf691a func NewException(s *capnp.Segment) (Exception, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}) return Exception(st), err } func NewRootException(s *capnp.Segment) (Exception, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}) + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}) return Exception(st), err } @@ -2845,12 +2974,36 @@ func (s Exception) SetTrace(v string) error { return capnp.Struct(s).SetText(1, v) } +func (s Exception) Details() (Exception_Detail_List, error) { + p, err := capnp.Struct(s).Ptr(2) + return Exception_Detail_List(p.List()), err +} + +func (s Exception) HasDetails() bool { + return capnp.Struct(s).HasPtr(2) +} + +func (s Exception) SetDetails(v Exception_Detail_List) error { + return capnp.Struct(s).SetPtr(2, v.ToPtr()) +} + +// NewDetails sets the details field to a newly +// allocated Exception_Detail_List, preferring placement in s's segment. +func (s Exception) NewDetails(n int32) (Exception_Detail_List, error) { + l, err := NewException_Detail_List(capnp.Struct(s).Segment(), n) + if err != nil { + return Exception_Detail_List{}, err + } + err = capnp.Struct(s).SetPtr(2, l.ToPtr()) + return l, err +} + // Exception_List is a list of Exception. type Exception_List = capnp.StructList[Exception] // NewException creates a new list of Exception. func NewException_List(s *capnp.Segment, sz int32) (Exception_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 2}, sz) + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 3}, sz) return capnp.StructList[Exception](l), err } @@ -2916,176 +3069,269 @@ func NewException_Type_List(s *capnp.Segment, sz int32) (Exception_Type_List, er return capnp.NewEnumList[Exception_Type](s, sz) } -const schema_b312981b2552a250 = "x\xda\x9cX}l\x1c\xd5\xb5?\xe7\xde\xf5\xae\x9dx" + - "\xb3;\x99\x89\x03yD&\xbc \xbdD/Q\x02\xe8" + - "=p\x896\x1fv\x14GN\xe3\xebu\x0a\xa4\xad\xda" + - "\xf1\xee\x8d=\xcexf\x98\x1d'\xde\x88(\x09M*" + - "\x92b\xd5D@\x13DZ\x88\xa8T(\x15!\x80\x80" + - "6\x08\x88\xf8\x03P[\xa8\xf8P\xa9\x88ZPQ\xa1" + - "*\x12\x94\x86&\xe4c\xaa33;\xb3\xb1\xd7E\xf4" + - "/\x8f\xee\xef\xec\xbd\xe7\x9e\x8f\xdf\xef\\/{>\xbd" + - "2\xb5<\xbb\xb1\x05\x980\x9b\xd2\xfe\x9b=G\xc6~" + - "[\x1c\xfe\x1e\x88\x19\xc8\xfd\xde\xa3}W\xff\xd7\xa1\xd9" + - "O@\x13\xcf\x00\xa8\xe3\xa9\x1d\xea]\xa9\x0c\xc0\xb5\xe3" + - ")\x1f\x01\xfdc\xcf|\x7f\xe6K\xa7\xfe{\x1fYc" + - "b\xdd\x85\x994\x80z8}R}0M\xe6G\xd2" + - "?$\xf3k\x8e\x8d\xefn\xff\xc9\xd3wM5\x9f\x05" + - "\xa0\xaej>\xa8v7\x93yW\xf3\\\x0e\xe8\xbfx" + - "N\xbd\xb9_;q\xcfTs\x86L\xdd7\xf3\xa4:" + - ">\x93\xdc\xda?s;\xa0\xff5\xef\xde\x15W\xe9\xb3" + - "\xee\x03eF\x9dq\x13#\x8b\x8fg\x1eTO\x07\xb6" + - "\x9f\x06\xb6\x9b\x1f}\xf1\xdc\xd6\xd4\xf0\xfd\x93v\x0e\x8d" + - "\xf5\xd6\x83\xaa\xd1J_\xb2\xf51@\xbf\xe3\xa6'V" + - "\x8c\x1f\xbf\xfc\xc7d\xcc.\xbd$r\xb5){@\xcd" + - "f\xc9\xeb\x96l\x10\x93\x1fy\xaf\xef\xcc\x9a\xf3~1" + - "io\x0a\x9bzC\xee\xa0\xba*G_+r\xe4\xc7" + - "\xcd\xcf\xf5\x14\xde\xbf\xf7\xce\xe3\xa0h\xcc\x9fg\xbc\xd6" + - "\x91~\xfa\xea\xb7\x01P=\x92{U}80\xfci" + - "n\x10\xd0\xb7\x9a\xf7\x7f\xb1\xe9\xde\x93\xbfj\x1c\x8a\xb7" + - "r\x07\xd5S\x81\xf5;9\xf2x'\xfb\xe4\xbd\x0b\x19" + - "\xe7\x8d\xc9\xd7Cr\xb3\x9a\x9f\x8d\xea\xfe\xfc\x03\x88\x1c\xf2\xa4\xba7\xf1" + - "\x0cr\xe4\xea;\x1a\xf9pJ#w_\xb2\xe6.\xdf" + - "\xfdZ\xcfG\x0d\xef\xb6s\xceQu\xdf\x1c\xfa\xda3" + - "\x87\xf6\xdd3\xf1\x8d9\x9dw\xb7}\x06\xe2r\x8c\x1d" + - "\xea\xcc0\x00\xf5\xa39\xef\xab\xa7\x03\xd3O\x03\xd3\xf8" + - "\xe2\x0d\xfdm{D\xbd\xa5\x8d\xbe6\xb5\x91\xf1c\xf8" + - "\xa7\x89\xd4\xa1\xf7\xce5\x0c\xc4=m;\xd4\xc3m\xe1" + - "\xd7c\xb0\xc6w\x9d\xd2\xd2\x92\xeeXPp:\xd6\xe8" + - "\xa6\xd9\x8b(\x16\xf2\x14@\x0a\x01\x94\x8f7\x03\x88\xbf" + - "q\x14g\x18\"jHk\xa7;\x00\xc4'\x1c\xc5y" + - "\x86\x0aC\x0d\x19\x80rv\x00@\x9c\xe1XL!C" + - "\x853\x0d9\x80\x8a\xb8\x1e\xa0\x0f9\x16[i9\x83" + - "\x1a\xa6\x00\xd4\x16\xec\x00(\xa6h=\x8f\x0c\xb1\x19\xeb" + - "\x82\xacf\xd1\x05\xa6\xa4vk\xb4\xae\x9c=\x09 \xce" + - "s,6\xd3\x0eM{4lAT\x9b\xf0(@\xb1" + - "\x99v\xd0h=}\xbb\x863\x10U%X\xd7h\xfd" + - "Jd\xe8\xdf:*+\x9ea[\xc0\xbb\xcb\xd8\x0c\x0c" + - "\x9b\x01\x0b\x9e\xee\x0eJ\x0f\xf3\x099\x00b\x1e\xd07" + - ",O\xba[\xf4\x12ddw\x19[\x80a\x0b\xa0?" + - "\"\xbd!\xbb\xdc]\x06\x00\xcc\x00\xc3\x0c`\xc1\xd1]" + - "}\xa4\x82\xf9\x841\xa2-*\xd2*\xf7\xc9\xca(\xb4" + - "\x9b^\xa5\xdf\xf6u\xd3\xb4\xb7\xf7\x0f\x19\xcc-\xf7\xea" + - "\xaeW\xed\xd7\x0d\x93\xc2\x0c\x88\xc0\x90z\xdd\xb2{]" + - "{\xc4\xa8\xa0\xec5\x1ci\x1aV\xc6\xb0\x06c\xd4\xb6" + - "\xcc*\xe1hTB\xb5\x18@\x1c\xe3(N0\x9c\x8f\x17\xfd(" + - "\x93\xcf\x0e\x03\x88g8\x8a\x97\x18\xceg\x17\xfc(\x97" + - "/\xba\x00\xe2\x05\x8e\xe2\xd7\x0c\xe7\xf3\xf3\xb4\xcc\x01\x94" + - "Wv\x00\x88\x979\x8a7\x19fS\xe7\xfc \x97\xca" + - "\xefh\xf5u\x8e\xe2]\x86\xd9\xa6/|\x0d\x9b\x00\x94" + - "w\x0e\x00\x88w9\x8a\x0f)9L\xc34\xa2\xf2\x01" + - "\x15\xd3\x9f9\x8aO\x18\xe6,\xdb\x92\x90\x0e\xe2%\xdd" + - "u6\xe4*\x9e\x8cS\x14-\xf7\xba\xd0N\xa1\x91\xf1" + - "\xba+K\xd2\xd8&](\xac\xb3/\xf9A\x02\xac\xb2" + - "*\xdb\xa5\x8b\xf9ZCE\x89\xf1\x86\x8c \x05\xe8U" + - "\xc3\x9f\x02`>a\xb9\xc8J\xf7<\xbd4$\xcb\xc0" + - "\xd7\x961\x0d\xac)\xed\xd7\x85\x19\x9d\x8e\x0d\xb2R\xd1" + - "\x07QR\x80\xaf\x8f\x03\xacV\xd1\x05(\x8eQ\xdd\xed" + - "E\x86Y\xbc\xe8\x07!V\xf7\xe05\x00\xc5\xdb\x08\xb8" + - "\x83\x00~\xc1\x0f\x82\xac\xee\xc3\xc5\x00\xc5\xdd\x04\xdcI" + - "@\xea\xbc\x1f\xf6\xcc\xfe\xa09\xf6\x120A@S\x14" + - "iu<\x00\xee \xe0n\x02\xd2Q\xb0\xd5\xbbp5" + - "@\xf1N\x02\x0e\x11\x909\xebkH\xe2yO\x00L" + - "\x10p?\x01-g|-dY\x1c\x06(\x1e\"\xe0" + - "!\x02\xd8?}\x0d\x9b\x01\xd4\x07\xb1\x0f\xa0\xf8\x00\x01" + - "\x8f\x120\xe3s_\xc3\x16\x00\xf5a\xdc\x01P\xfc\x19" + - "\x01O\x120\xf3\xb4\xaf\xe1\x0c\x00\xf5\xf1\xe0\x8cG\x09" + - "x\x86\x80\xd6\x7f\xf8\x1a\xce\x04P\x9f\x0a\xdc=F\xc0" + - "\x09\x02\xb2\x9f\xf9\x1a\xb6\x02\xa8\xcf\x067\x7f\x92\x80\x17" + - "\x08h\xfe\xbb\xafa\x16@}\x0e7\x03\x14O\x10\xf0" + - "25\xef\xa8e\x8c8\xa6\x1c\x81viQ\xae\xf3\x89" + - "\xf8\x87\xe9j\xd7\x07l\x97\x1a\xb9N\xf6h=W\xd2" + - "M\x13\xf3\x09U\x87\xcb\x05Wz\xa3\xae\x85\xf9D\x8e" + - "#`\x8ba\x19\x95!\xcc':\x16\x02\xbb\\Y\xb1" + - "\xcdm\x12\xf3\x89z\xc6\x88)\xf5\x0a!\xb1XG5" + - "d\x0fTlSz\x12rE}\x9b\xc4\xd9\xc0p6" + - "\xa0?`\xdb^\xc5su@\x07\xf3\x89PL\xfeQ" + - "\xa1S\xd2\xdf\xda\xcfv9\xae\xbd\xcd(\xd39\xf1\xc0" + - "\x119\xad\x97J\xd2\xa1\xdb\xc7\x82\x1a\xdd~\xd86\xe8" + - "\x92\xb1\x0cDG\x94\x8d\x8a\x1c\x19\xd0]\xe0\x836\xe6" + - "\x13I\x89\xe0:.\x09\x8b\\\xf6\x07<\x19pIs" + - "\xc2%\x8b\x88\xe9\xff\x87\xa3\xb8\xae\xae\xce\x95\xe5D\x03" + - "\xcb8\x8a\x1b\x19\xfa\xc6\x88c\xbb\xd4b\x995\xba\x13" + - "\xb7\xa8\x13\xd0\x9c,O\xdb\xa2um\xd6\xabWM[" + - "\xc7rtv\xa4F\x8bV\x03\x88\x85\x1c\xc52\x86J" + - "M\x8e\x96\xac\x07\x10\xff\xcbQ\xacc\xb8\xabd[\x9e" + - "\xb4\xbc8\xe8%\xdd\xe9\xd7\x07LI\xdc=\x0b\xb0\x97" + - "#\xe6\x93\x89\x13\x90\x16/97\x88v\xd8\xde\xad\xf1" + - "\xb9]D\\\x9d\x1cEo\xa2\x82\x1bH\x05\xd7q\x14" + - "\xfdu*(\xfa\x00D/G\xf1\xad\xaf\xac=\xae," + - "\x19\x8e!-\xc0\xc4\xfb:\xc7\xfa\x82\xd2\x05\x98$\xcf" + - "\xeb\x13yV\xf0J\x0d\x11Q9}\xa0N\x8a\xb3\xdc" + - "\x8f\x08\x07\xa9Qc%\xcd\xa6.F|\xd3\x14\xb4|" + - ",\xc6\xd9\xa6\x0b\x11\xdfdI\xbc\x8b\xad\x04\\\x16\xf0" + - "\xcd\xf9\x88o\xe6\xe0#\x00\xc5\xcb\x08X\x88\x0c\xe7g" + - "\xce\xf9,$\x9c\x05x\x1c\xa0\xb8\x90\x90eAk\x7f" + - "\x11\x11\xce\x92\xe0'\xcb\x08\xb8\x91\xf4\x9a-\x08\xd4]" + - "\xbd!\xa0\x95\xebi\xbd\x93Z^\x0f*#\xd4\xda\x84" + - "\xda\x83N\xebE\xd2\xdc5\xbaS\x81@<\x9bH\x01" + - "\xa9AGM\xaf\x91\x12\xcb1j\x0f\xc3\x06\xb4\xa62" + - "\x84_\xd2\xad\x924I\x052~\xb4G\x11\xa5\xe5u" + - "\x99\x15\xb9=7$]\x12'O\xdf*\xd7\x92\xf8n" + - "\xf4\x86\xa4+Fe{\x90\xd0\xd8\xb3\xb0\x03\xd7\xbah" + - "\x8f\xf4\x07\xf2\x92#\x89\x8f\xd3g\xd9k\x03^\x81\xc2" + - "\xd7\xa5,\xcb\xf2\x14\xd9\x0e\xf2J\x97\x0b\x0b\xae\xae\xd0" + - "\xe75*\xf4\x1dQ\xa1_\xcf\x90\x1b\xf5\xd2\xb7E\xba" + - "\xd2*AA\xae\xb1G-/\x01\x92\x8e\xee\x8a\x82a" + - "-\xed\xaf:2,\xa3|P\xb2\x8b:($\xca\x82" + - "\xcd\x00\xc8\x94\xf9\xc3\x00\xc8\x95\xcb]\x80\xc2\x16\xdd0" + - "e\xd9\xb7\xb7I\xd7\xb4\xf52pY&\x0e)\xd9\x96" + - "%!W\xf2dy2C_z1b\xce)\x9d\xd4" + - "\x97tR\x16\xfd\x88<6\\\x95\xf4R\x96]\xf4\x1b" + - "4SD\x1e\xdd\x80\xf1\xc53%\xdd\x99\xd4\xcd_\x9e" + - "\xf7\x9a\x87\xdc\xe9\xe8\x8f&\x02\xafZ?;\xa1;}" + - "*\xe2Lt$\x14H\x99\x88\x12^\xd8fX\xb2\xbb" + - "<%\xfe\xe8tD\x85\x00\xd3\xf3J\xdc\xbe\x1b\x0e&" + - "\xd7\x0e\xfa\x84!.\xbfe\x1e\x02\x882G\xe1L\xc3" + - ",\xb56\xe9\xc3\xa0\x9a\x89x+q\x9b\xf8\xae\xbcu" + - "\xd4pe\x17\xd7]\xb3\xba&\xa8}S\xa7-n\xb2" + - "\xdd\xad\xbak\x8fr\xab\\g\x9d8\xbe*(\xf1\x7f" + - "\xe7xL\x88\x94\xae\x1e\x8e\xe2f\xf2\xfb\xca0\x87\x9b" + - "V\x7f\x09!\xfa\x81\xbeU\xc2t\xd54/\x90\xa9A" + - "\xbb\xd1\x98\xdb\x19\x89\xd8\xa0\xbd\xb4d[9O\x8ey" + - "\"\x1f\x88S\xe8\x85NM\xf2]\x8e\xc2\xac\xa9\x13\xb9" + - "a\x10%\x9a\x1c\xc5\x18\x15\xd8\x85\x90\xf9\x94QJ\xa3" + - "\xc3Q\xdcF\x1ah\xab\xe4\xb2\xc7Q\xecf" + - "\xb59\xb4\xc7\x86\x82\xed\x0c\xe8\xa5\xadS\xe6M\xec\xb1" + - "C$!\xacH\x98!\x1dkw\x83\x82\x08\x1b2c" + - "\xd8\x96Ha\xfd#\x1e\x17\xe7\xa8E\x85\x16\x07{'" + - "\xb99\xc6Q\xece\x88,\xbc\xe6\x9e_\x02\x88\xbd\x1c" + - "\xc5\x04\xbd\xb6\"\xf5\x19\xbf\x0f@Lp\x14\xf7S9" + - "\x85O0\xe50\x8d\xfews\x14\x0f0TR\xe1\x03" + - "L9r\x0d\x808\xc4Q<\xc4h*\xd2+\xb6\x85" + - "\xad\xc0\xb0\xb5n\x12\xc1\xee\x0a=T\xa4[\xa8\xac\xd5" + - "GM/y\x92\xd4\x0c:G]}\xc00\x0d\xeeU" + - "k\x0f\xa3\x9cWu$\xe6\x92\xfb\x00b\x0e\xb0\xdds" + - "\xf5\x92\x8c\x8f\xa8\xcbgo4\x14\x84#\x01@\x10\x8d" + - "\xf8a\xac\xe0<\xbe\xd1\xa9\xef\xc6\xcdI\xe7\xd5\x0ao" + - "y_4z\xf4LWc\x9e\xab[\x95-\xb6\x0b8" + - "\x92L\x01\xf1!\x93\xa6\x00\x16\xbe\x83\x97\xd6^rf" + - "\x8e\x1erT\xfcA\x91\xd1\xeb\xa6\x8b2\xb22<1" + - ",\xb24\x80\xd2\xbd>a1zM\xb1@\xfa\x14\xb1" + - "9i\x81B)\x88(\xa4\xfd\xaa=\xeaV\xa4\xb9\x85" + - "\xf4\xa7\xf64\x01^'\x1eu\xb5\xb2:\x98\x1c3\xae" + - "\xeeL\xa2\xa6F\xc1\xa0\x1a\xb8\x8e\xa3X9]0\xca" + - "\xd2qeI\xf7P\x967\x0e\x0c\xcb\x92G\xe0\xe4S" + - "\xa7d&\xb3t\xa33y\x10\\\x9c0c\xdd\xa3r" + - "\xc9\xed\x89L\xe5,\xdbv \xed\x0fJ\xaf\xd76," + - "\x0f\xa5\xbb\xd6\x90f9~H\xd7_3l\xed\x1c\xf5" + - "\xf6\xa4{v\xd4S0\xd6\xfdSHY\xb2\x1a\xd8\xb4" + - "3U8\x0d\x8ey\x97\xfc\x8fc\xbdmX\xff\xe9t" + - "\xb7:a\xb8\xaf6\xdd\xed\xda*\xab\xa44\xb58\xff" + - "+\x00\x00\xff\xffo\xa6F\xe8" +type Exception_Detail capnp.Struct + +// Exception_Detail_TypeID is the unique identifier for the type Exception_Detail. +const Exception_Detail_TypeID = 0xd6c14f121d44f8dd + +func NewException_Detail(s *capnp.Segment) (Exception_Detail, error) { + st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return Exception_Detail(st), err +} + +func NewRootException_Detail(s *capnp.Segment) (Exception_Detail, error) { + st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) + return Exception_Detail(st), err +} + +func ReadRootException_Detail(msg *capnp.Message) (Exception_Detail, error) { + root, err := msg.Root() + return Exception_Detail(root.Struct()), err +} + +func (s Exception_Detail) String() string { + str, _ := text.Marshal(0xd6c14f121d44f8dd, capnp.Struct(s)) + return str +} + +func (s Exception_Detail) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { + return capnp.Struct(s).EncodeAsPtr(seg) +} + +func (Exception_Detail) DecodeFromPtr(p capnp.Ptr) Exception_Detail { + return Exception_Detail(capnp.Struct{}.DecodeFromPtr(p)) +} + +func (s Exception_Detail) ToPtr() capnp.Ptr { + return capnp.Struct(s).ToPtr() +} +func (s Exception_Detail) IsValid() bool { + return capnp.Struct(s).IsValid() +} + +func (s Exception_Detail) Message() *capnp.Message { + return capnp.Struct(s).Message() +} + +func (s Exception_Detail) Segment() *capnp.Segment { + return capnp.Struct(s).Segment() +} +func (s Exception_Detail) DetailId() uint64 { + return capnp.Struct(s).Uint64(0) +} + +func (s Exception_Detail) SetDetailId(v uint64) { + capnp.Struct(s).SetUint64(0, v) +} + +func (s Exception_Detail) Data() ([]byte, error) { + p, err := capnp.Struct(s).Ptr(0) + return []byte(p.Data()), err +} + +func (s Exception_Detail) HasData() bool { + return capnp.Struct(s).HasPtr(0) +} + +func (s Exception_Detail) SetData(v []byte) error { + return capnp.Struct(s).SetData(0, v) +} + +// Exception_Detail_List is a list of Exception_Detail. +type Exception_Detail_List = capnp.StructList[Exception_Detail] + +// NewException_Detail creates a new list of Exception_Detail. +func NewException_Detail_List(s *capnp.Segment, sz int32) (Exception_Detail_List, error) { + l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) + return capnp.StructList[Exception_Detail](l), err +} + +// Exception_Detail_Future is a wrapper for a Exception_Detail promised by a client call. +type Exception_Detail_Future struct{ *capnp.Future } + +func (f Exception_Detail_Future) Struct() (Exception_Detail, error) { + p, err := f.Future.Ptr() + return Exception_Detail(p.Struct()), err +} + +const schema_b312981b2552a250 = "x\xda\x9cX}\x8c\x15\xd5\x15?\xe7\xde\xf7\xb1\x8b\xef" + + "\xf1\xde\xec\xbc\x05\xa4\x12\xc4BZH! \xa6\xd5\xad" + + "\xe6!\xec\x12\x96@\xd9\xd9\xb7T\xa5M\xda\xd9\xf7." + + "\xcb\xc0\xec\xcc83\x0b,\x09Al\xdaD\xaa\xa9\x12" + + "\xb5j\xa4\x05\xa2\x89X\x8c\x88X\xb1\x95T\x08&j" + + "\xb4bD\xa3F\xd2b\xa4\x91\xa6&X\x8b\x05\xf9\x98" + + "\xe6\xcc\xcc\x9b\x99}\xfb\xb6\xd6\xfe\xb5\x93\xfb;{\xef" + + "\xb9\xe7\xe3\xf7;\xf7\xcd\xbd>\xbb 5/\xef\xb5\x02" + + "S\xdct\xc6;\xbel\xc7\xc6?W\xd6\xfe\x0c\x94q" + + "\xc8\xbd\x9e\xdd\xbd3\xbe\xf1P\xdb\xb3\x90\xe6Y\x00\xf9" + + "Tj\x93|:\x95\x05\x98\x7f*\xe5!\xa0\xb7\xef\xe0" + + "/\xae8z\xe2\x9b?'k\x8c\xad\xbb0\x9b\x01\x90" + + "?\xcb\x1c\x91\xcfg\xc8\xfcl\xe6Wd~\xed\xbe{" + + "\xee\x98\xfa\xdb\xe7\xef\x1bm^\x00\x90\x1fn\xd9.\xef" + + "j!\xf3\x1d-+8\xa0w\xf8\x82|k_\xe9\xc5" + + "\x07F\x9b3d\xf2\xb4\xdc\x11yf\x8e\xdc\x9a\x91\xdb" + + "\x00\xe8}\xdf}\xf0\xa6k\xd4\xf1\x8f\x804.a\x9c" + + "fdqWn\xbb|\x9fo{\x8fo\xbbj\xef\xe1" + + "\x0b\xebRk\x1fm\xd890\xbe\x94\xdb.\xa7\xf3\xf4" + + "\x85\xf9\xa7\x01\xbd\x8e[\x9e\xbd\xe9\x9e\xfdW\xfe\x86\x8c" + + "\xd9\xc8K\"\x97w\xe5\xb7\xc9{\xc8z\xfe\xe3y?" + + "&\xbfv\x8fm\xce\xeb\x93\x9fj\xd8\x9b\xc2&\xbfS" + + "\xd8.\x9f(\xd0\xd7\xfb\x05\xf2\xe3\xd6C\xcb\xca\x1f=" + + "x\xf7~\x90J\xcc\x9b\xac\xbd\xd9\x91y~\xc6\xbb\x00" + + "(\xdfP|M\xee*\x92\xe1\xcd\xc5\x01@\xef\xeeS" + + "g^\xfe\xdbU\xca\xef\x1b\x1dF2\xb9\xbd\xf8\x81\xbc" + + "\xd97\x1e.\xd2\xaeF\xcb]_\xae|\xf0\xc8\x1f\x9b" + + "\xc7\xedDq\xbb|\xca\xb7>Y\xa4\xebmfgN" + + "^\xcaZo7\xdbz\xfeV\xa9\x0d\xe5\xfb$?r" + + "\x12\xed]\x1d\x7f\xee\xc8\xfe9\x9b\xdfnv\xbb\xd3\xd2" + + "6\xf93\xdf\xf6S\x89v\x9e\xb0`\xe5\xbd\xfd\xcf\xbd" + + "z\xbci\x94w\xb5m\x93\xf7\xb4\xd1\xd7\xe3md\xbc" + + "\xfc\xc4\x8f\xc4_\x0e\xf4\xbf\x03J;\xa2'}\xefP" + + "\xe1\x97\xdf\xad\x9d\x87\x95,\x8b\x1c\x99\xdc%\xff\x1dP" + + "\xee\x96\xc94\x0aT\xc3\xbe~\x8d~*\xef\x96\xcf\xca" + + "\xdf\x02\x98\xdfZ\xba\x85\xf2q\xe2\\\xe7\x94\xb6\x15\x87" + + "\xdf\x05\xa5\x84\x89\xff\x0dB7\xd4\xfe\x81\xbc\xb5\x9d\xbe" + + "6\xb7o\x00\xfc\xd3\xce\xab\xcc7\xde}\xe6\xbdfQ" + + ">\xd1\xfe\x9a|\xba}\"\xd55\x99z\x0f\xff\xe4w" + + "\x93\xbf\xd8\xf7\xc9\x07\xa0\x14\x90\xc7}\xb3\x92\x93\xc3\\" + + "\x16\x13\xc8am\x029|\xd4\x988\xef\x8e7\x97\x9d" + + "n\x9a\xbd\xd6\x89\xbbei\"}\xe5'\xd2\xbe[\xef" + + "\xfda{\xe7\xfd\x13>\x07\xe5J\x8c\x1c\xea\xcc2\xf2" + + "v\xe2G\xf2V\xdft\xb3o\x1aE\xa9Y\x80OL" + + "|R>\xe5\x1b\x9f\xf4\x8d\x9f\xc6\xbf\xde\x9bz\xe8\xe4" + + "\x85\xa6\xc6\xd3&m\x92gL\x0a\xbe\x9e\x86E\x9em" + + "U\xe7TU\xcb\x80\xb2\xd5\xb1H\xd5\xf5\x1eDe:" + + "O\x01\xa4\x10@\xfat\x15\x80\xf2\x0f\x8e\xca9\x86\x88" + + "%\xa4\xb5\xb3\x1d\x00\xca\x19\x8e\xcaE\x86\x12\xc3\x122" + + "\x00\xe9|?\x80r\x8ec%\x85\x0c%\xceJ\xc8\xa9" + + "\xadp)@/r\xac\xe4h9\x8b%LQ \xb0" + + "\x03\xa0\x92\xa2\xf5\"2\xc4\x16L\x04Y\xce\xa3\x0dL" + + "J\xddQ\xa2u\xe9\xfc\x11\x00\xe5\"\xc7J\x0b\xed\x90" + + "\xdeZ\xc2VD9\x8d\xbb\x01*-\xb4C\x89\xd63" + + "w\x96p\x1c\xa2,\xf9\xeb%Z\xbf\x1a\x19z\xb7\x0f" + + "\x09\xc7\xd5L\x03xw\x0d[\x80a\x0b`\xd9U\xed" + + "\x01\xe1b1\xa6\x1d@,\x02z\x9a\xe1\x0a{\xb5Z" + + "\x85\xac\xe8\xaea+0l\x05\xf4\x06\x85\xbb\xc6\xacu" + + "\xd7\x00\x00\xb3\xc00\x0bX\xb6T[\x1dt\xb0\x18s" + + "Q\xb8\x85#\x8cZ\xafp\x86`\xaa\xee:}\xa6\xa7" + + "\xea\xba\xb9\xa1o\x8d\xc6\xecZ\x8fj\xbb\xc3}\xaa\xa6" + + "S\x98\x01\x11\x18R\xd5\x1af\x8fm\x0ej\x0e\x8a\x1e" + + "\xcd\x12\xbafd5c BMC\x1f&\x1c5'" + + "\xc0\xb3\x9a!\"\xb4\x9e\xfd\xa5W\xc24\x80\xf4\xfe6\x00\xe5C" + + "\x8e\xca'\x94\x1cV\xc2\x0c\xa2t\x8a\x8a\xe9c\x8e\xca" + + "\x19\x86\x05\xc34\x04d\xfcx\x09{\x89\x09\x05\xc7\x15" + + "Q\x8a\xc2\xe5\x1e\x1b\xa6RhD\xb4n\x8b\xaa\xd0\xd6" + + "\x0b\x1b\xcaK\xcc\x11\xff\x10\x037\x1b\xce\x06ac\xb1" + + "\xdePab\xdc5\x9a\x9f\x02t\x87\x83\x7f\x05\xc0b" + + "L\x89\xa1\x95\xea\xbaju\x8d\xa8\x01_\\\xc3\x0c\xb0" + + "t\xc6K\x84\x19\xad\x8e\xe5\xc2q\xd4\x01\x14\x14\xe0\x1b" + + "\xa3\x00\xcb\x0f\xa0\x0dP\xb9\x9f\xean'2\xcc\xe3e" + + "\xcf\x0f\xb1\xbc\x03\xaf\x05\xa8\xcd\xfaT\xd4\x12S\xd1L\x12\x8aosT\xaeK" + + "\xb4\x894\x8fXd.G\xe5F\x86\x9e6h\x996" + + "uhv\x91jE\x1dn\xf9,)jcvx\xa2" + + "K{\xd4a\xddT\xb1\x16\x9e\x1d\x8a\xd9\xcc\x85\x00\xca" + + "t\x8e\xca\\\x86R]\xcdf/\x05P\xbe\xc3QY" + + "\xc2pK\xd54\\a\xb8Qj\xaa\xaa\xd5\xa7\xf6\xeb" + + "\x82\xa8\x7f<`\x0fG,\xc6\xa30 -\x8e8\xd7" + + "\xcfI\xc0\x0e\xb9\xe8\xdc.\xe2\xbdN\x8eJO,\xa2" + + "\xcbID\x97pT\xfa\x12\"\xaa\xf4\x02(=\x1c\x95" + + "\x1f\x7fm\xe9\xb2EU\xb34a\x00\xc6\xde'\x1c\xeb" + + "\xf5\x0b\x1c\xa0A\xdd\x97\xc6\xea.\xe1\xd5%DD\xe9" + + "\xec\xb6\x84\x92\xe7\xb9\x17\xf2\x15R\x9fGB\x9cO]" + + "\x0e\xe9*\xed3F\xa4\xe5\xf9\xf4\xa5\x90\xae\xf2\xa4\xfd" + + "\x95\x1c\x01\x93|\xba\xba\x18\xd2U;>\x09P\x99D" + + "\xc0td8%{\xc1c\x01_M\xc3\xfd\x00\x95\xe9" + + "\x84\xcc\xf5\x99\xe1\xcb\x90\xaff\xfb\xb2>\x97\x80\x1bI" + + "\xee\xd94\x7f8\x90o\xf0Y\xe9zZ\xef$bP" + + "\xfd\xca\x08\xa4:V\x06\xbf\x1f{\x90${\x91j9" + + "\xe0ko\x9a\x04\x94\xdaxHw\x9b\x09\xb9\xd8HM" + + "\xa4\x99\x80\xc6h\x1e\xf1\xaa\xaaQ\x15:\x89H\xd6\x0b" + + "\xf7\xa8\xa00\xdc.\xdd\x11\x1b\x0ak\x84M\xda\xe6\xaa" + + "\xeb\xc4b\xd2\xee\x15\xee\x1aa+Cb\xaa\x9f\xd0\xc8" + + "3u\x83\xaa\xb9\x8bm\x13\x07\xfb\x82\x16\xcb\xda\xeep" + + "\x94=\xc3\\\xec\x93\x0f\x94\x7f DM\xd4F\x89\xbe" + + "\x9fV\xba[Po\x89:\x9f\xdc\xac\xce7\x85u~" + + "=C\xae%\x85s\xb5\xb0\x85Q\x85\xb2Xd\x0e\x19" + + "n\x0c\xc4\x0d\xdd\x15\xc6\xc2\x98\xd37l\x89\xa0\x8a\x8a" + + "~\xc5\xce\xec\xa0\x88H\xd3V\x01 \x93\xa6\xac\x05@" + + ".]i\x03\x94W\xab\x9a.j\x9e\xb9^\xd8\xba\xa9" + + "\xd6\x80\x8b\x1a\x11M\xd54\x0c\x01\x85\xaa+j\x8d4" + + "\x9e<1\x0c\x88\x1dP\x0e\x17v\xc3\x0dW\xc5$R" + + "\xbf\xe0\xbc\xa5\x09\x0a\xa9\x9a\xb4\xb3\xab\x017\x8d(\xa2" + + "M\xab#\x19L\xa2\xf4Q\xcd\xdb\x1b7o\x1e\xbd\x90" + + "\xaf\x96_\x13\xb7o\x9e]\xf6\x9a\xf4o\xc8W\xdd\x80" + + "Q\xb0\xb3U\xd5j \x90\xaf.\xb5\xba\x87<\x19\x95" + + "\xe4\xb4\x87\xf6\xd8\xe9\x8f\xb2\xdf\x11\x07\x8c\xb2\x1f\x86\xa4" + + "\xbc^3Dw\xadY4\xc2\xe2\x83\xb1\xa9,b\x8c" + + "\xe5\xdb\xe3k\xfb\xad\xc9\x10\xe7\xdd6\x19\x01\x94\x1aG" + + "\xc5\x1a\x83\xcc\xea\x9d\xd9\x8b~\x03\x11\xd7;Qgz" + + "\xb6\xb8}H\xb3E\x17Wm}x\x91\xdfn\xbaJ" + + "[\xdcb\xda\xebT\xdb\x1c\xe2F-a\x1d;~\xb3" + + "\xaf~\xff\xcd\xf1\x88\x83)]\xcb8*\xb7&8x" + + "\xe5\xc2\xaf\xe0`\xcf\x17^'HW]\x8c}\xfd\x1c" + + "01\x0f\x0c\xf3#\x9b\xa73T\xd7\x01sN\xd54" + + "\x0a\xae\xd8\xe8\x92_\xb9z)umJ\x16X\xbd\x94" + + "\x96o\x8b\xdd\x08Gs\x9a\xc1o\xa3<\xf6qT~" + + "\xca\xeaC\xf22\x13\xca\xa6\xd5\xafV\xd7\x8d\x1a\x86q" + + "\x99\x19 q\xc1\xd7\x87\x83FG\xb1\xde\xe5Y\xcd4" + + "\x14z\x90\xc5\xbfX\xb4\xce\x8a\x9f\xd6R\xba\xa3@$" + + "P\xee\x14\xae\xaa\xe9\xca\xa4(\xc2\x0f\x93k\xf7sT" + + "v2D\x16\xdcm\xc7\x1f\x00\x94\x9d\x1c\x95\xbd\xf4(" + + "\x0c#\xbc\xe7\x11\x00e/G\xe5 \xd5P\xf0R\x1c" + + "\xf1B\x91R\xc1;Qz\xe1Z\x00\xe5\x00G\xe5%" + + "z\xfa\xb1\xe0iqha\xf8h9\xcehpS\x1d" + + "\xd3\xc0\x1c0\xcc%\x86%\xecv\xe8\x91%\xec\xb2\xb3" + + "X\x1d\xd2\xdd\xf89U7\xe8\x1c\xb2\xd5~M\xd7\xb8" + + ";\\\x7f\xd4\x15\xdcaK`!\xbe8 \x16\x00\xa7" + + "\xba\xb6Z\x15\xf5#\xb6\xd4\xfc{;\xf18\x10\x85\xa6" + + "a\x1c\x18\xc1\x9b\x14-\xae\xe9\x0d\x8d\xba\xb4\x09\x8b\xcd" + + "\x8ai\xda\x0b\xce\x0a\x08+|\x8d\x16j\xaa\xab6+" + + "\xb3\x9ep<\xaa\x8fhJ\x0a\x13\xbf0H8\x99\xaf" + + "\xb0\xbe\x8aA{C\x06]6V\xe9\xbb\xb6j8\xab" + + "M\x1bp0\x0e@t\xc8\xe8\x00P\x12\xe6\xd4\x9f\xc4" + + "z\x81^\xc4Q\xedS.\xbb\xa8f\x16\x04'\x06\xb5" + + "\x9f\x01\x90\xba\x97\xc6\xe4J\xb5\xcf\xfc!@RV\xc5" + + "-Q\xae\xfa\xe9\x85\x8c7l\x0e\xd9\x8e\xd0W\x93\x12" + + "\xd7'U\xe0\x09\x1dMT\xf8B\x7f\xd2\xce\xda\xaa\xf5" + + "?\xc8\x09U\xe9u\x1c\x95\x05c\x05\xa3&,[T" + + "U\x17EmE\xffZQu\x09l\xef\xcd\x8c\x9b" + - "\xa8j\x13\xa5\xb6FL\x9e\x1e\xd9\x95}\xbe[\xfd\xfd" + - "ni{\x89t\x81lm\xeb\xe7\xf5\x87\xdf\xee\xaf\x91" + - "V \x12GXGL\xb0\x02\xf1\xec\xdeF{tf" + - "\xf9\xf5\x13\x92\x02\xbdT\x89u\xc4~\xa6\xbe\xf6\xb2\x97" + - "\x84l\xf3\xd7\xfb\xf13\xc6\xd1\x95\x1ev\x04\x0ay\xc5" + - "\xb6\xc4\xa7\x1c^\xcf\xe1g\x0b\xeb\x0f>>\xff\xb1J" + - "\xba`]\x96 \xa6\xf9\x171\xcb\x158\xc3\xcf\x12\xb2" + - "\x95\xb7\xc7o\xb4\xac\xf6\x9b~\xcdS\xb3\xfc\x00\xc4<" + - "W\x9e\xfb\x9en\x7f}1\xfa\xe8\xc3 O\x8bw\xc4" + - "t\x9e(\xb9I\xc8\x1e\x1b\xc9\xe6\xea\xf2\xee\xef\x83\xd8" + - "\x05\xbe!\xee\xe4l\x8b\x9bT\xcb\xe2\xc89\x91\xde\x0e" + - "#f\xc7i\xeb\xa4cGAd4<\xc7\x8fL\xdf" + - "\x0bR\xcb\xad\x03\x03\x99\x8b\xa1\x1f\\2\xbdV\xdd\x8e" + - "\xd3: \xf7p\x8dH\x03\x91~\xde \x92U\x0e9" + - "\xc9\xa0\x83U\xa0\x8aV\x83H^\xe0\x90S\x0c:\xe3" + - "\x150\"]\x9e#\x92\x93\x1c\xf2\x1a\x83y+\xf4\x03" + - "\xcbE\x91\x18\x8a\x84,\xb2\xe3\xb4\x166\x03B\x8a\x02" + - "1\x14\x08mU\xbb\xdc\x9c\xff\xfb?\xd4\xabq\xd0K" + - "\x9as\xff\xd5:\xd4\xaf\xa5Ts\xab\xc3\xc3\xad\x92\xa6" + - "\xe3x\x9e\xeb\x11\\\x80\x18@(8v\x841\x8d\x13" + - "06\xc4\xe9\x8a\xefz\xa4l\x8a\xf9\x01\xbaA\x04\xe8" + - "\xa3\x06\x91\x99x\xf1\xa2\x17\x9b\xce\x9c\xda\xf6N3\xff" + - "\xa7y\xea\xa6\x1f\xbbj\xcb\xad\x9a\x1d\xf1\xe1\x17R\x8f" + - "\xc3E\xdfL\xfc0\xc8\x19\xa9\xedL^R\x93\x179" + - "d\xa5\x7f\xa0AIW\xed\xd4r\x89zB\x8euC" + - "\xca\x89\xefz(w\x9f8\x01e\xc2\x9f\x00\x00\x00\xff" + - "\xff\xbe\xb4\xf3\xbd" +const schema_a184c7885cdaf2a1 = "x\xda|\x92=h\x14]\x14\x86\xcf{\xef\xe4\x9b\x0d" + + "\x9fa\x99\xdcm,\xc4\x1fP0\xa0F\xe2\x0f\x8e\xc5" + + "$Y\x02\xae\x06\xd9\x89\x8b\x181\xc50s\xc1\x91\xdd" + + "\x99\xc9\xec\xac!\x88l\xa1\xa0 J\x9a-\xc4\x9f%" + + "\x9d\x9d \x84 h\xa1 BJ\x0b\x8b\xb46\x06!" + + "EJ\x9b\x91;\xe0n\xd8\xec\xda\xcd\x1c\x9e\xfb\xde\xe7" + + "\x9c{\xc6\xa70\xa9\x9d\x1eij\xc4\xec3C\xff\xa5" + + "\x0b7\xdf\xa4O\xa2\x0b-2\x04\xd2\xd5\x9d\xcd[\x8f" + + "\xbf>\\%M'\x9a8\xca\xc6 \xce2\x9dx\xfa" + + "`\xa39<\xbf\xf2\xaeE\xb6@\x0f&\x0c\xf6[\x1c" + + "`\xeak?{KH\xb7\x7f\xad\x8f\x9f3\x8f\xbd\xea" + + "a\x87\xa0\x905\xb6#>e\xf0\xc7\x0c~\xb9\xf8\xfe" + + "\xd1\x87\xd7\xdf\xdbd\x08\xd6e\x09b\x9e\x7f\x16\x0eW" + + "\xe0\x02?OH\xef\xbb\x9b\xa7\xb6\x8e\xffX\xefc0" + + "\xe1\xf0i\x88\xc5\x0c\xaeq\x8b\x90>3\xeb\xdb\xed\x95" + + "\xff\xbf\xf5\xd3}\xca7\xc4\xf3\x8cme\xec\xe1\x17Z" + + "\xfb\xe2\xbd\xad\x9f}\x06\xb0\xc6M\x88/\\\xa7\x994" + + "\x8e\xdc\x13\xc9R\x18q'N\x96O\xbaN\x14Df" + + "\xe5\xb6\x1f{eU\xa8\x84S\xf9%\xc7O\xca@\x87" + + "d\xbb\xc8\xcb\xa1\x1f\\\xb1\xe4\xb2\x82\xcb\x80\xbd\x8fk" + + "D\x1a\x88\x8c\x19\x93\xc8\x9e\xe4\xb0g\x19\x0c\xb0\x02T" + + "\xb14Gd_\xe2\xb0+\x0c\x06\xe3\x050\"\xc3\x9e" + + "&\xb2g9\xec\x1b\x0c\xd6\x9d\xd0\x0fJ\x1er\xc4\x90" + + "#\xa4\x91\x13'\xc5\xb0\x11\x10\x12\xe8\xc4\xa0\x13\x9a\xaa" + + "v\xb5Q\xfb\xfb?\xd0k\xee\xa0\xac7\xaa\xff\xd4:" + + "\xb4WK\xa9fVG\x06[\xd5\x1b\xae+\xa5'\x09" + + "\x1e@\x0c \xe8\xae\x13aT\xe3\x04\x8c\x0ep\xba\xe6" + + "{\x92\x94M.\xbb\xc00\x89\x00c\xd8$\xb2\xea2" + + "\xbe+c\xcb\xad\xfa2H:\x87\xb5\xbeOR\x0ck" + + "QU&~\x18daZ\xa7\xb5\x11\xd5Z\x8e\xc3." + + "\xec5\xee\xe7s\xddIJ\x1e\xf5\x86\x8cuC\xf2u" + + "\xdf\x93\xc8wW\x99\x80\xfc\xae\xb0A+S\xb4\xc2 " + + "q\\5\xf9?\x01\x00\x00\xff\xff\x9e\xc7\xfb\x05" func RegisterSchema(reg *schemas.Registry) { reg.Register(&schemas.Schema{ String: schema_a184c7885cdaf2a1, Nodes: []uint64{ - 0x89f389b6fd4082c1, + 0x9539708bffa85a5d, 0x95b29059097fca83, 0x9d263a3630b7ebee, 0x9fd69ebc87b9719c, - 0xb47f4979672cb59d, - 0xb88d09a9c5f39817, + 0xb7e329e92fda637d, 0xd20b909fee733a8e, + 0xe8e97b3b9f049b21, }, Compressed: true, }) diff --git a/std/go/go.capnp.go b/std/go/go.capnp.go index 1537b5aa..f93b51bd 100644 --- a/std/go/go.capnp.go +++ b/std/go/go.capnp.go @@ -6,13 +6,13 @@ import ( schemas "capnproto.org/go/capnp/v3/schemas" ) -const Package_ = uint64(0xbea97f1023792be0) -const Import_ = uint64(0xe130b601260e44b5) -const Doc_ = uint64(0xc58ad6bd519f935e) -const Tag_ = uint64(0xa574b41924caefc7) -const Notag_ = uint64(0xc8768679ec52e012) -const Customtype_ = uint64(0xfa10659ae02f2093) -const Name_ = uint64(0xc2b96012172f8df1) +const Package = uint64(0xbea97f1023792be0) +const Import = uint64(0xe130b601260e44b5) +const Doc = uint64(0xc58ad6bd519f935e) +const Tag = uint64(0xa574b41924caefc7) +const Notag = uint64(0xc8768679ec52e012) +const Customtype = uint64(0xfa10659ae02f2093) +const Name = uint64(0xc2b96012172f8df1) const schema_d12a1c51fedd6c88 = "x\xda\x12\x98\xe8\xc0b\xc8{\x9c\x89\x81)P\x81\x95" + "\xed\xff\xf1\xf7\xa7T$\xb7\x94,e\x08\xe4d\xe5\xf8" + "\xdf\x91s\xf7_\xa0\x8c\xd6E\x06\x06FaO\xc6," + From 521c99173a2558348d35335127ed8201df18c5da Mon Sep 17 00:00:00 2001 From: Semisol Date: Sat, 12 Oct 2024 15:40:18 +0300 Subject: [PATCH 2/4] Update network.go to prepare for 3PH --- rpc/network.go | 102 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 29 deletions(-) diff --git a/rpc/network.go b/rpc/network.go index f1494b72..3dd2ade7 100644 --- a/rpc/network.go +++ b/rpc/network.go @@ -27,7 +27,25 @@ type PeerID struct { // attached to the message via SCM_RIGHTS. This file descriptor would be one // end of a newly-created socketpair, with the other end having been sent to the // process hosting the capability in RecipientId. -type ThirdPartyCapID capnp.Ptr +// +// Some networks, as an optimization, may permit ThirdPartyToContact to be +// forwarded across multiple vats. For example, imagine Alice sends a capability +// to Bob, who passes it along to Carol, who further pass it to Dave. Bob will send +// a `Provide` message to Alice telling her to expect the capability to be picked +// up by Carol, and then will pass Carol a `ThirdPartyToContact` pointing to Alice. +// If `ThirdPartyToContact` is non-forwardable, then Carol must form a connection +// to Alice, send an `Accept` to receive the capability, and then immediately send +// a `Provide` to provide it to Dave, before then being able to give a +// `ThirdPartyToContact` to Dave which points to Alice. This is a bit of a waste. +// If `ThirdPartyToContact` is forwardable, then Carol can simply pass it along to +// Dave without making any connection to Alice. Some VatNetwork implementations may +// require that Carol add a signature to the `ThirdPartyToContact` authenticating +// that she really did forward it to Dave, which Dave will then present back to +// Alice. Other implementations may simply pass along an unguessable token and +// instruct Alice that whoever presents the token should receive the capability. +// A VatNetwork may choose not to allow forwarding if it doesn't want its security +// to be dependent on secret bearer tokens nor cryptographic signatures. +type ThirdPartyToContact capnp.Ptr // The information that must be sent in a `Provide` message to identify the // recipient of the capability. @@ -41,7 +59,7 @@ type ThirdPartyCapID capnp.Ptr // attached to the message via SCM_RIGHTS. This file descriptor would be one // end of a newly-created socketpair, with the other end having been sent to the // capability's recipient in ThirdPartyCapId. -type RecipientID capnp.Ptr +type ThirdPartyToAwait capnp.Ptr // The information that must be sent in an `Accept` message to identify the // object being accepted. @@ -50,46 +68,72 @@ type RecipientID capnp.Ptr // be the public key fingerprint of the provider vat along with a nonce matching // the one in the `RecipientId` used in the `Provide` message sent from that // provider. -type ProvisionID capnp.Ptr +type ThirdPartyCompletion capnp.Ptr -// Data needed to perform a third-party handoff, returned by -// Newtork.Introduce. +// Data needed to perform a third-party handoff. type IntroductionInfo struct { - SendToRecipient ThirdPartyCapID - SendToProvider RecipientID + SendToProvider ThirdPartyToAwait + SendToRecipient ThirdPartyToContact } // A Network is a reference to a multi-party (generally >= 3) network // of Cap'n Proto peers. Use this instead of NewConn when establishing // connections outside a point-to-point setting. +// +// In addition to satisfying the method set, a correct implementation +// of Network must be comparable. type Network interface { // Return the identifier for caller on this network. LocalID() PeerID - // Connect to another peer by ID. The supplied Options are used - // for the connection, with the values for RemotePeerID and Network - // overridden by the Network. - Dial(PeerID, *Options) (*Conn, error) + // Connect to another peer by ID. Re-uses any existing connection + // to the peer. + Dial(PeerID) (*Conn, error) + + // Accept and handle incoming connections on the network until + // the context is canceled. + Serve(context.Context) error +} - // Accept the next incoming connection on the network, using the - // supplied Options for the connection. Generally, callers will - // want to invoke this in a loop when launching a server. - Accept(context.Context, *Options) (*Conn, error) +// A Network3PH is a Network which supports three-party handoff of capabilities. +// TODO(before merge): could this interface be named better? +type Network3PH interface { + // Introduces both connections for a three-party handoff. After this, + // the `ThirdPartyToAwait` will be sent to the `provider` and the + // `ThirdPartyToContact` will be sent to the `recipient`. + // + // An error indicates introduction is not possible between the two `Conn`s. + Introduce(provider *Conn, recipient *Conn) (IntroductionInfo, error) - // Introduce the two connections, in preparation for a third party - // handoff. Afterwards, a Provide messsage should be sent to - // provider, and a ThirdPartyCapId should be sent to recipient. - Introduce(provider, recipient *Conn) (IntroductionInfo, error) + // Attempts forwarding of a `ThirdPartyToContact` received from `from` to + // `destination`, with both vats being in this Network. This method + // return a `ThirdPartyToContact` to send to `destination`. + // + // An error indicates forwarding is not possible. + Forward(from *Conn, destination *Conn, info ThirdPartyToContact) (ThirdPartyToContact, error) - // Given a ThirdPartyCapID, received from introducedBy, connect - // to the third party. The caller should then send an Accept - // message over the returned Connection. - DialIntroduced(capID ThirdPartyCapID, introducedBy *Conn) (*Conn, ProvisionID, error) + // Completes a three-party handoff. + // + // The provided `completion` has been received from `conn` in an `Accept`. + // + // This method blocks until there is a matching `AwaitThirdParty`, if there is + // none currently, and returns the `value` passed to it. + // + // An error indicates that this completion can never succeed, for example due + // to a `completion` that is malformed. The error will be sent in response to the + // `Accept`. + CompleteThirdParty(ctx context.Context, conn *Conn, completion ThirdPartyCompletion) (any, error) - // Given a RecipientID received in a Provide message via - // introducedBy, wait for the recipient to connect, and - // return the connection formed. If there is already an - // established connection to the relevant Peer, this - // SHOULD return the existing connection immediately. - AcceptIntroduced(recipientID RecipientID, introducedBy *Conn) (*Conn, error) + // Awaits for completion of a three-party handoff. + // + // The provided `await` has been received from `conn`. + // + // While the context is valid, any `CompleteThirdParty` calls that match + // the provided `await` should return `value`. + // + // After the context is canceled, future calls to `CompleteThirdParty` are + // not required to return the provided `value`. + // + // This method SHOULD not block. + AwaitThirdParty(ctx context.Context, conn *Conn, await ThirdPartyToAwait, value any) } From 7493af7d5e338aa1769d0edf7afe5cdba306ba97 Mon Sep 17 00:00:00 2001 From: Semisol Date: Sat, 12 Oct 2024 15:46:14 +0300 Subject: [PATCH 3/4] Update rpc.go with changes from rpc.capnp --- rpc/rpc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/rpc.go b/rpc/rpc.go index a557ba8b..0f5a6504 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -1303,7 +1303,7 @@ func (c *lockedConn) parseReturn(dq *deferred.Queue, ret rpccp.Return, called [] return parsedReturn{err: rpcerr.WrapFailed("parse return", err), parseFailed: true} } return parsedReturn{err: exc.New(exc.Type(e.Type()), "", reason)} - case rpccp.Return_Which_acceptFromThirdParty: + case rpccp.Return_Which_awaitFromThirdParty: // TODO: 3PH. Can wait until after the MVP, because we can keep // setting allowThirdPartyTailCall = false fallthrough @@ -1742,7 +1742,7 @@ func (c *Conn) handleDisembargo(ctx context.Context, in transport.IncomingMessag }) }) - case rpccp.Disembargo_context_Which_accept, rpccp.Disembargo_context_Which_provide: + case rpccp.Disembargo_context_Which_accept: if c.network != nil { panic("TODO: 3PH") } From a1ef2e9a305cb3a49f6d3c1a255211f8793bde68 Mon Sep 17 00:00:00 2001 From: Semisol Date: Wed, 16 Oct 2024 20:07:53 +0300 Subject: [PATCH 4/4] Fix std schema package names, remove json-test.capnp This commit fixes the package names generated by `gen.sh import`, and removes `json-test.capnp` as it is unnecessary. --- std/capnp/compat/byte-stream.capnp | 2 +- std/capnp/compat/http-over-capnp.capnp | 2 +- .../httpovercapnp/http-over-capnp.capnp.go | 2 +- std/capnp/compat/json-rpc.capnp | 4 +- std/capnp/compat/json-test.capnp | 126 -- std/capnp/compat/json.capnp | 4 +- std/capnp/compat/json/json.capnp.go | 152 +- std/capnp/compat/jsonrpc/json-rpc.capnp.go | 72 +- std/capnp/compat/jsontest/json-test.capnp.go | 1556 ----------------- 9 files changed, 121 insertions(+), 1799 deletions(-) delete mode 100644 std/capnp/compat/json-test.capnp delete mode 100644 std/capnp/compat/jsontest/json-test.capnp.go diff --git a/std/capnp/compat/byte-stream.capnp b/std/capnp/compat/byte-stream.capnp index 51177e23..70fe423e 100644 --- a/std/capnp/compat/byte-stream.capnp +++ b/std/capnp/compat/byte-stream.capnp @@ -45,4 +45,4 @@ interface ByteStream { } using Go = import "/go.capnp"; $Go.package("bytestream"); -$Go.import("capnproto.org/go/capnp/v3/std/capnp/bytestream"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/compat/bytestream"); diff --git a/std/capnp/compat/http-over-capnp.capnp b/std/capnp/compat/http-over-capnp.capnp index dbbb624a..4ad31c23 100644 --- a/std/capnp/compat/http-over-capnp.capnp +++ b/std/capnp/compat/http-over-capnp.capnp @@ -268,4 +268,4 @@ struct HttpHeader { } using Go = import "/go.capnp"; $Go.package("httpovercapnp"); -$Go.import("capnproto.org/go/capnp/v3/std/capnp/httpovercapnp"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/compat/httpovercapnp"); diff --git a/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go b/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go index c15422ac..ef98b265 100644 --- a/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go +++ b/std/capnp/compat/httpovercapnp/http-over-capnp.capnp.go @@ -8,7 +8,7 @@ import ( fc "capnproto.org/go/capnp/v3/flowcontrol" schemas "capnproto.org/go/capnp/v3/schemas" server "capnproto.org/go/capnp/v3/server" - bytestream "capnproto.org/go/capnp/v3/std/capnp/bytestream" + bytestream "capnproto.org/go/capnp/v3/std/capnp/compat/bytestream" stream "capnproto.org/go/capnp/v3/std/capnp/stream" context "context" strconv "strconv" diff --git a/std/capnp/compat/json-rpc.capnp b/std/capnp/compat/json-rpc.capnp index ff233548..84b51a7f 100644 --- a/std/capnp/compat/json-rpc.capnp +++ b/std/capnp/compat/json-rpc.capnp @@ -37,10 +37,10 @@ struct RpcMessage { struct Error { code @0 :Int32; - message @1 :Text; + message @1 :Text $Go.name("messageValue"); data @2 :Json.Value; } } using Go = import "/go.capnp"; $Go.package("jsonrpc"); -$Go.import("capnproto.org/go/capnp/v3/std/capnp/jsonrpc"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/compat/jsonrpc"); diff --git a/std/capnp/compat/json-test.capnp b/std/capnp/compat/json-test.capnp deleted file mode 100644 index e481a6db..00000000 --- a/std/capnp/compat/json-test.capnp +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2018 Cloudflare, Inc. and contributors -# Licensed under the MIT License: -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -@0xc9d405cf4333e4c9; - -using Json = import "/capnp/compat/json.capnp"; - -$import "/capnp/c++.capnp".namespace("capnp"); - -struct TestJsonAnnotations { - someField @0 :Text $Json.name("names-can_contain!anything Really"); - - aGroup :group $Json.flatten() { - flatFoo @1 :UInt32; - flatBar @2 :Text; - flatBaz :group $Json.name("renamed-flatBaz") { - hello @3 :Bool; - } - doubleFlat :group $Json.flatten() { - flatQux @4 :Text; - } - } - - prefixedGroup :group $Json.flatten(prefix = "pfx.") { - foo @5 :Text; - bar @6 :UInt32 $Json.name("renamed-bar"); - baz :group { - hello @7 :Bool; - } - morePrefix :group $Json.flatten(prefix = "xfp.") { - qux @8 :Text; - } - } - - aUnion :union $Json.flatten() $Json.discriminator(name = "union-type") { - foo :group $Json.flatten() { - fooMember @9 :Text; - multiMember @10 :UInt32; - } - bar :group $Json.flatten() $Json.name("renamed-bar") { - barMember @11 :UInt32; - multiMember @12 :Text; - } - } - - dependency @13 :TestJsonAnnotations2; - # To test that dependencies are loaded even if not flattened. - - simpleGroup :group { - # To test that group types are loaded even if not flattened. - grault @14 :Text $Json.name("renamed-grault"); - } - - enums @15 :List(TestJsonAnnotatedEnum); - - innerJson @16 :Json.Value; - - customFieldHandler @17 :Text; - - testBase64 @18 :Data $Json.base64; - testHex @19 :Data $Json.hex; - - bUnion :union $Json.flatten() $Json.discriminator(valueName = "bValue") { - foo @20 :Text; - bar @21 :UInt32 $Json.name("renamed-bar"); - } - - externalUnion @22 :TestJsonAnnotations3; - - unionWithVoid :union $Json.discriminator(name = "type") { - intValue @23 :UInt32; - voidValue @24 :Void; - textValue @25 :Text; - } -} - -struct TestJsonAnnotations2 { - foo @0 :Text $Json.name("renamed-foo"); - cycle @1 :TestJsonAnnotations; -} - -struct TestJsonAnnotations3 $Json.discriminator(name = "type") { - union { - foo @0 :UInt32; - bar @1 :TestFlattenedStruct $Json.flatten(); - } -} - -struct TestFlattenedStruct { - value @0 :Text; -} - -enum TestJsonAnnotatedEnum { - foo @0; - bar @1 $Json.name("renamed-bar"); - baz @2 $Json.name("renamed-baz"); - qux @3; -} - -struct TestBase64Union { - union { - foo @0 :Data $Json.base64; - bar @1 :Text; - } -} -using Go = import "/go.capnp"; -$Go.package("jsontest"); -$Go.import("capnproto.org/go/capnp/v3/std/capnp/jsontest"); diff --git a/std/capnp/compat/json.capnp b/std/capnp/compat/json.capnp index 9ed99167..679fb328 100644 --- a/std/capnp/compat/json.capnp +++ b/std/capnp/compat/json.capnp @@ -28,7 +28,7 @@ struct Value { null @0 :Void; boolean @1 :Bool; number @2 :Float64; - string @3 :Text; + string @3 :Text $Go.name("stringValue"); array @4 :List(Value); object @5 :List(Field); # Standard JSON values. @@ -127,4 +127,4 @@ annotation notification @0xa0a054dea32fd98c (method) :Void; # Indicates that this method is a JSON-RPC "notification", meaning it expects no response. using Go = import "/go.capnp"; $Go.package("json"); -$Go.import("capnproto.org/go/capnp/v3/std/capnp/json"); +$Go.import("capnproto.org/go/capnp/v3/std/capnp/compat/json"); diff --git a/std/capnp/compat/json/json.capnp.go b/std/capnp/compat/json/json.capnp.go index 63085f9d..5434849f 100644 --- a/std/capnp/compat/json/json.capnp.go +++ b/std/capnp/compat/json/json.capnp.go @@ -21,18 +21,18 @@ type Value capnp.Struct type Value_Which uint16 const ( - Value_Which_null Value_Which = 0 - Value_Which_boolean Value_Which = 1 - Value_Which_number Value_Which = 2 - Value_Which_string Value_Which = 3 - Value_Which_array Value_Which = 4 - Value_Which_object Value_Which = 5 - Value_Which_call Value_Which = 6 - Value_Which_raw Value_Which = 7 + Value_Which_null Value_Which = 0 + Value_Which_boolean Value_Which = 1 + Value_Which_number Value_Which = 2 + Value_Which_stringValue Value_Which = 3 + Value_Which_array Value_Which = 4 + Value_Which_object Value_Which = 5 + Value_Which_call Value_Which = 6 + Value_Which_raw Value_Which = 7 ) func (w Value_Which) String() string { - const s = "nullbooleannumberstringarrayobjectcallraw" + const s = "nullbooleannumberstringValuearrayobjectcallraw" switch w { case Value_Which_null: return s[0:4] @@ -40,16 +40,16 @@ func (w Value_Which) String() string { return s[4:11] case Value_Which_number: return s[11:17] - case Value_Which_string: - return s[17:23] + case Value_Which_stringValue: + return s[17:28] case Value_Which_array: - return s[23:28] + return s[28:33] case Value_Which_object: - return s[28:34] + return s[33:39] case Value_Which_call: - return s[34:38] + return s[39:43] case Value_Which_raw: - return s[38:41] + return s[43:46] } return "Value_Which(" + strconv.FormatUint(uint64(w), 10) + ")" @@ -133,27 +133,27 @@ func (s Value) SetNumber(v float64) { capnp.Struct(s).SetUint64(8, math.Float64bits(v)) } -func (s Value) String() (string, error) { +func (s Value) StringValue() (string, error) { if capnp.Struct(s).Uint16(0) != 3 { - panic("Which() != string") + panic("Which() != stringValue") } p, err := capnp.Struct(s).Ptr(0) return p.Text(), err } -func (s Value) HasString() bool { +func (s Value) HasStringValue() bool { if capnp.Struct(s).Uint16(0) != 3 { return false } return capnp.Struct(s).HasPtr(0) } -func (s Value) StringBytes() ([]byte, error) { +func (s Value) StringValueBytes() ([]byte, error) { p, err := capnp.Struct(s).Ptr(0) return p.TextBytes(), err } -func (s Value) SetString(v string) error { +func (s Value) SetStringValue(v string) error { capnp.Struct(s).SetUint16(0, 3) return capnp.Struct(s).SetText(0, v) } @@ -694,61 +694,63 @@ func (f DiscriminatorOptions_Future) Struct() (DiscriminatorOptions, error) { return DiscriminatorOptions(p.Struct()), err } -const schema_8ef99297a43a5e34 = "x\xda\x8cT]h[e\x18~\x9e\xef\xcb\x97vM" + - "bs8\xf1b\xe0\xc8\x10\xa7\xaeh\xb7vu\xb8@" + - "\x17q\xeb\x18\x8a\x9a\xaf\x11o\x04\xe1$;\xd5\x8c\x93" + - "\x93\x90\xa4\xaeSA\x98w\"\x82C\x10\x07B\xc7\x14" + - "/Ea\x17\x0aC-\x961\x19h\xd4\xcd\x16V;" + - "\xff\xb0\x88\x17\xbbQ\xda\xfas\xe4;\xd9\xf2\xd3:\xf0" + - "\xee\xf0\xbd\x0f\xcf\xfb\xbc\xcf\xfb\xbcg7\xc5\x03\x91\x91" + - "\xc4\xb2\x82\xd0\x07U4\xf8x\xaf|or\xe5\xeb\x13" + - "\xd01u5\x18{*\xf3\xf6\x1b'\xd7^\x05h_" + - "\x12\xa7\xec%\xd1\x07\xe4\x17\x84$\x18\xbc\xb2\xb8\xeb\xcc" + - "w\x8f\xcf\xce\xe2\xb5\x98\x12=\xd0\x0bb\xcen\x86\xd0" + - "\x8b-\xe8\xe1\xf1\x0b\xa7\x7f\xfbcq\x16\x96\xc5\xe0\xa5" + - "\xa5\xadk\x133\xebg\xa0\x0c\xc4>'>\xb0\xe7\xc3" + - "\xafO\xc51t\x95u\x8c]\xb4\x13\xec\xeb\x07\xec\x11" + - "\xf9\xb2\xbdO\xde\x05\xecyD\x9e7\xd4[\xf3\xfbw" + - "\xc6\xe7V\xe7`\xc5\xd8A\x87\xd4{F\x94\xa0=\xae" + - "\x0c\xf7>e\xb8\x9d_\xe7\x9e\xdfa/\x7f\xb6\x01L" + - "\x83xS}e\xbf\x13bO\xab,\x18\x14x\xaa\xb9" + - "\xf2\xfa\xbb_\x18'r=\xe3\xcd\xab\xcf\xed\xa6\x0a\xc7" + - "S\xe1x\x0f\xef\xdf10q|\xe1[\x03\xdd\xde\x03" + - "=\xa7N\xda\xf3!\xf4\x93\x16t\xf9\xad\xcb\xf7\xfdr" + - "g\xf2\xc7\xffr\xe2}\xf5\x91\xfda\xa8\xe0l\xa8\xf6" + - "\xec\xf9\x9f\x07v\xfd\xe0\\\xdbLkE\x9f\xb3o\x8d" + - "\x1a\xdad4\xa4\x1d\x7fa\xf8\xb6\xcb\xe9'\xd7\xd1\x8c" + - "\xa9\x95\xdee0z\xc2V\x06;i\xa0\x07\x82\xa3\xf5" + - "\x8a?\\t\xaa\xf4\xab\x99)\xcfi4\xa4\xeb\xe7H" + - "&;\xee\x80m\x94\xf0\xab\x19\xbf\xd2(M\x95\x8aN" + - "\xa3T\xf1\x91#!{H\x9ep\xbci7=|\xc0" + - "\xf1\xbc\x1c\xa9\xfbe\x04\x88\x10\xb0v>\x04\xe8\xbb%" + - "\xf5\x98\xa0E\xa6h\x1eG2\x80\xbeGR\x1f\x16\x0c" + - "\xa6\xa6\xfdb\xc8\x0a0\x0e\xc18\x98\xad:5\xa7\\" + - "\xe7-`N\x1aUm\x93@\xf3\xb8\xb95\xa0\xfb\xd9" + - "\xed\xec\x96\xd1\xae\xc0\xa9\xa1\xf4\xa1\x92\xeb\x1d\x194\xfa" + - "\xf4v\x19\x89\x07A\xa8\xae9\x04\xe8\x8b\x92zAp" + - "\x1b\xff\x09\x92-}\x97\x1e\x04\xf4\x97\x92\xfa\x8a\xe06" + - "\xf1w\xc0\x14\x05`-\x1a\xd9\xdfH\xea\xab\x82\x09\xf9" + - "W\x90\xa2\x04\xac%\xf3\xba \xa9\x7f\x12LD\xfe\x0c" + - "R\x8c\x00\xd6\xf7\xa3\x80\xbe\"\xa9W\x05\x13j=H" + - "Q\x01\xd6\xef\x06{M2\x1f\xa7`\"\xba\x16\xa4\x18" + - "\x05\xec-\x1c\x02\xf2\x11J\xe6\x93\xa6\xd0\xb7\x1a\xa4\xc2" + - "<&x;\x90\xef7\x85\x14\x05\x07\xfdi\xcfC\xf4" + - "\xc5B\xa5\xe2\xb9\x8eOB\x90`\xd6\x9f.\x17\xdc\x1a" + - "c\x10\x8c\x81\xd9z\xa3V\xf2\x9f\xbeaf\xda\xa9\xd5" + - "\x9c\xe37\xf52[)\x1cu\x8b\x8dN\xbd\xeda\xab" + - ">Xt<\x8f\xc9\x8e\x9b \x93`_\xcd9v\xa3" + - "C{\x1d\xd2\xaff\x0e\x96\xea\xc5Z\xa9\\\xf2\x9dF" + - "\xa5\xf6X\xd5l\xb6\x8e\x0d\x990\xae\xdf!\xa9ww" + - "e\xe2\xde\xc9\xeb\x99\xb8\xdf\xcc\xe9\x94\xdd6\xfb\xb3f" + - "\xc1\x8f:e\xd0\xdd\xd4\xd1D\xf3\x90\x09\xb0\xeb\xb7z" + - "\xb1nzEZ\xbdH+a\x1c\xef\x97\xd4)\xc1l" + - "\xb5\xe6N\x95f\xae\x93\xc0\xe2\x00\xd0\xc3t\xa4[;" + - "\xd0\xba\x88\xf6\xcfeC\xee\x0aN\xdd\xdd\xcb\xb1\x9b\xdc" + - "Bv8L\xdc\xff\x19|\xb4s!=\x83\xa7\xc3\xc1" + - "7l,\xd9\xa5\x02Y\xbf\x9ay\xc6\x9d\xd9,\xc1\xd0" + - "\x84\xf2\xe3\x10\xff\x06\x00\x00\xff\xff\xb9?\x99\x93" +const schema_8ef99297a43a5e34 = "x\xda\x8cT]h\x1cU\x18\xfd\xce\xbd3\x93\x9f\xdd" + + "5;\xce\xa0\x06\x0c\x1b\xc4\xa8\x0d5\x7fMkYl" + + "\xd7\xbf\x94\xa0P\xf7fkAD\xf1\xeef\xa2Sf" + + "g\x97\xdd\x8dMT\x10*\xbe\x88\x15Z\x04\xa1 D" + + "*\xf8(\x08>\xe8\x8b\xb0\x08E\x114\xfe\xd4\x06\x8c" + + "-\x8a\x18E\xc1>T\x92h\xbdrg\xdb\xfdI," + + "\xf4m\x99s8\xdf\xf9\xcew\xee\x8e\xdd\xc4\xee3\xc6" + + "\x13\xf7X\xc4\xc4\xb4i\xa9\x8f\xf7\xf0\xf7f\xd6\xbe>" + + "F\"f^P\x93O\xa5\xdfy\xf3\xe4\xc6\xebDp" + + "\xc0O9=\xbc\x8b(gp\x0e\x82zme\xf4\xf4" + + "\x0f\x87\x96\x96\xe8D\xccd\x1d\xd4K\xac\xee\\f\x9a" + + "\xba\xce\"\xea\xf4\xbeO\xdf\xfe\xfd\xaf\x95%\xb2m\xa8" + + "\x97W\xfb7\xa6\x166O\x93\xa9)\xce\xaf\xec}\xe7" + + "b\xf4\xeb\x0fv\x94\xda`\x11C\x9b\xec\x14\xba\xba\x89" + + "\x9c'\xf9\xab\x8e\xc7\xef$\xda\xb5\xc8\xcfh\xe9\xfe\xdc" + + "\xfe\x1d\xf1\xfaz\x9d\xec\x18Z\xecHz\xd7+&\x83" + + "s\xc2\xd4\xda\xc7M\xad-\x7f\xab\xbf0\xe4\x9c\xffd" + + "\x0b\x19\xd1t\xf3+g#\xe2^23\x04\x95\xc7\xa9" + + "\xe5\xb57\xde\xfdB'\x91\xedX\xaf\xdf\xfa\xcc\x19\xb2" + + "\xf4z\x83V\xb4\xde#\xfb\x87z\xa7\x16\xcf}\xa7\xa9" + + "\x83\x1dT\xdb:\xe9\xf4GT\xb7A=\xff\xd6\xd9\xdd" + + "\xbf\xdc\x91\xfc\xe9\xff\x920\xad\x8f\x9c\x84&;=\x96" + + "v\xfb\xc1\x99\x9f{G\x7f\x94\x7fn\x97\xf5\xac\xe7\x1d" + + "?\x92\x9dm\xc8\xee{q\xe4\xd6\xb3\xa9'6i9" + + "f\xaeu\x1e\xe31\xeb\x98\xf3x\xc4=\xa4\xb9\x07\xd5" + + "\x91j)\x1c)\xc82\xc2rz.\x90\xb5\x1a\xf7\xc2" + + ",\x80d+\x1eB\x93\xc5\xc2r:,\xd5\xfc9\xbf" + + " k~)\xa4,@\xbcC\xe4\xb0\x0c\xe6\xbd\xd4\xc8" + + "\x832\x08\xb2\x80\xe8\xe6\x06\x91\x01\"{\xc7\xc3D\xe2" + + ".\x0e1\xc9`\x03.\xf4\xc7\xf14\x91\xd8\xc9!\xa6" + + "\x19\xd4\xdc|X\x88T\x89\x10'\x868!S\x96\x15" + + "Y\xac\xe2\x06B\x96kW\xcd\x94\x08\xfa\xe3\xf6\xd1D" + + "\xa2\x1b\xed\xd1\xf6L\xb45\xce\x1cN\x1d\xf0\xbd`\xb6" + + "O\xfb\x13\x83\xdc\x88+\x15\xb9[\x1e&\x12\x9fs\x88" + + "s\x0c\x03\xf8W%\x1b\xfe\xbe}\x80H|\xc9!\xbe" + + "g\x18`\x97\x15\\0\"{E\xdb\xfe\x86C\\`" + + "H\xf0\x7f\x94\x0bNd\xaf\xa6\xed\xd5\xd4\x0c8rq" + + "0$\x8c\xbf\x95\x0bC\x1f\x10\x13\xfa\xa1h`P\x03" + + "\xe6\xa6ra\x129\x03H\x13\xe5n\xd1\xc0\xa4\x06\xac" + + "\x0d\xe5\xc2\"r\xc61L\x94\xdb\xa9\x81\xbd\x1a\xe8Z" + + "Wn\xd4\xcb\xdd\xb8\x8d(7\xa6\x81{\xc1\xd0\x17\xce" + + "\x07\x01Y/\xe5K\xa5\xc0\x93!@\x0c d\xc2\xf9" + + "b\xde\xab F\x0c1B\xa6Z\xab\xf8\xe13\xc2\x00" + + "S\x17\x8f\x8f\xde|\xe3\xd3\x1f\xd6I\x18\x0c\xf7\xbb@" + + "\x9c\xc8F^5(\x87%uE\x19^\xcd?%+" + + "\x15\xb9x\xcd\xf83\xa5\xfc\x11\xafPk\xe1\xcd\xd8\x1b" + + "x_A\x06\x01\x92\xad\x03\x10\x90$tU\xe4\xd1\xab" + + "\x13\x9a\x17\xe4a9\xfd\x90_-T\xfc\xa2\x1f\xcaZ" + + "\xa9\xf2hY\x97\xa1J[j\xa4\x0fu;\x87\x18k" + + "\xab\xd1\xdd3Wj\xb4Wg\"\x8b^S\xfd9\xdd" + + "\x89\x83\xb2H\xf0\xb6M\xd4m>\xa0;\xef\x85\x8dY" + + "\xa8\xeaYFc\x16`'\xf4\x99\xbb9\x84\xcb\x90)" + + "W\xbc9\x7f\xe1\x8a\x08\xd9\xe8%\xeaP\x9am\xf7N" + + "\xd4xD\xcd?\xa4-U\xcd\xcb\xaa\xb7\x07\x93\xd7x" + + ">\x99\x91\xa8\xa4\xd7\xb3\xf8D\xebQu,\x9e\x8a\x16" + + "\xdfr\xb1d\x9b\x0b\xca\x84\xe5\xf4\xb3\xde\xc2v\x0bZ" + + "&\xb2\x1f'\xf6_\x00\x00\x00\xff\xff\x15\\\x9e3" func RegisterSchema(reg *schemas.Registry) { reg.Register(&schemas.Schema{ diff --git a/std/capnp/compat/jsonrpc/json-rpc.capnp.go b/std/capnp/compat/jsonrpc/json-rpc.capnp.go index 2d3eadae..ae265271 100644 --- a/std/capnp/compat/jsonrpc/json-rpc.capnp.go +++ b/std/capnp/compat/jsonrpc/json-rpc.capnp.go @@ -6,7 +6,7 @@ import ( capnp "capnproto.org/go/capnp/v3" text "capnproto.org/go/capnp/v3/encoding/text" schemas "capnproto.org/go/capnp/v3/schemas" - json "capnproto.org/go/capnp/v3/std/capnp/json" + json "capnproto.org/go/capnp/v3/std/capnp/compat/json" strconv "strconv" ) @@ -330,21 +330,21 @@ func (s RpcMessage_Error) SetCode(v int32) { capnp.Struct(s).SetUint32(0, uint32(v)) } -func (s RpcMessage_Error) Message() (string, error) { +func (s RpcMessage_Error) MessageValue() (string, error) { p, err := capnp.Struct(s).Ptr(0) return p.Text(), err } -func (s RpcMessage_Error) HasMessage() bool { +func (s RpcMessage_Error) HasMessageValue() bool { return capnp.Struct(s).HasPtr(0) } -func (s RpcMessage_Error) MessageBytes() ([]byte, error) { +func (s RpcMessage_Error) MessageValueBytes() ([]byte, error) { p, err := capnp.Struct(s).Ptr(0) return p.TextBytes(), err } -func (s RpcMessage_Error) SetMessage(v string) error { +func (s RpcMessage_Error) SetMessageValue(v string) error { return capnp.Struct(s).SetText(0, v) } @@ -392,36 +392,38 @@ func (p RpcMessage_Error_Future) Data() json.Value_Future { return json.Value_Future{Future: p.Future.Field(1, nil)} } -const schema_d04299800d6725ba = "x\xdal\x90\xbfkS_\x18\xc6\x9f\xe7='\xedw" + - "HH\xee7\x01\xb1\xb4$\x0eYJ\x1bL\xebT\x90" + - "\xd6\xd2\xa0\x82\x85\x9eV\\\x9c.\xc9%FL\xee\xe5" + - "\xdc(\"B\x0an\"8\xbb\x09\x82\xab\x0e\x0a*\x0a" + - "\x16uq\xaa?\x10\x1c\xfa?88\xd8\x90z\xe5\x18" + - "\x9a\x8au;|\xde\xf7\x9c\xf3y\x9e\xe3\xa7\xb9\xa4\xab" + - "\x99\x9e\x86\x98\x13\xa9\xb1d\xe5\xda\x9br\x7fsg\x1b" + - "f\x82L\xde_\xb8\x7f\xfb\xf3\x9d\x87\x9f\x90\x92q`" + - "\xbe,\xc2|\xd5\x1d\xf3\xb3\xf2\x08\x7f\xccM\x96L^" + - "\x94\x9b\x99\xcd{\xcb\xdb\xa8\xe9q\x0d\xe4\xdf\xc9\xc7\xfc" + - "\x079\x02\xcc\x7f\x95\xbb\xc4\x8d\xe4r\x1cvfmT" + - "W\x95\xba\x1fu\xa2\x85\xf5\xa8\xbe\x1a\xc4\xb1\xdf\x0c*" + - "5kC\x8b5\xd2\xa4\x95\x064\x01\xaf6\x0d\x98%" + - "EsNH\x16\xe8\xd8\xd9e\xc0\xac(\x9a5\xa1'" + - ",P\x00o\xd5-\x9eQ4\xe7\x85\xd9z\xd8\x08\xa8" + - "!\xd4`\xaf=|\x9ei\x08\xd3`\xb6\xe1w}\xe6" + - "\x92[;Gwk\xd7\xfb\x0f\x002\x07\x8e\xc4\xe4o" + - "1\x06F\x93\x07\xadx\x9c+\xfeV5\x93#\xcd\xa7" + - "N\xe9\xb1\xa2y)\xf4\xf6=\x9fO\x00\xe6\x89\xa2y" + - "\xedA\xc1\x0d\x8bd\x82\xf2!\xb9\xac" + + "U\x8es\xcf7\xbc\xd6\x0d\xbf\xd2\xb3\xd3\xf4\x9b\xb1\xd7" + + "\xb3\xeb\x85\xb1/\xd9+\x9d\xd8k\xee\xc0\xeb4\x87\x18" + + "\x9dl\xd4\xc2\xb0\xd6\xac\xca\\\xe0\x1a\xb7\x11N\xe6\x8c" + + "\x17\xb6\xeb\xad\xc9\x9cor\x9e1>\x0d\xfa\xe7\xe3\xee" + + "?\xf7\xe2\xf1\xf1\"k\x7f5\x1c<\x12\x1d\xe7\xbf\x03" + + "\x00\x00\xff\xff\x8c'\xbah" func RegisterSchema(reg *schemas.Registry) { reg.Register(&schemas.Schema{ diff --git a/std/capnp/compat/jsontest/json-test.capnp.go b/std/capnp/compat/jsontest/json-test.capnp.go deleted file mode 100644 index c9dcebe0..00000000 --- a/std/capnp/compat/jsontest/json-test.capnp.go +++ /dev/null @@ -1,1556 +0,0 @@ -// Code generated by capnpc-go. DO NOT EDIT. - -package jsontest - -import ( - capnp "capnproto.org/go/capnp/v3" - text "capnproto.org/go/capnp/v3/encoding/text" - schemas "capnproto.org/go/capnp/v3/schemas" - json "capnproto.org/go/capnp/v3/std/capnp/json" - strconv "strconv" -) - -type TestJsonAnnotations capnp.Struct -type TestJsonAnnotations_aGroup TestJsonAnnotations -type TestJsonAnnotations_aGroup_flatBaz TestJsonAnnotations -type TestJsonAnnotations_aGroup_doubleFlat TestJsonAnnotations -type TestJsonAnnotations_prefixedGroup TestJsonAnnotations -type TestJsonAnnotations_prefixedGroup_baz TestJsonAnnotations -type TestJsonAnnotations_prefixedGroup_morePrefix TestJsonAnnotations -type TestJsonAnnotations_aUnion TestJsonAnnotations -type TestJsonAnnotations_aUnion_foo TestJsonAnnotations -type TestJsonAnnotations_aUnion_bar TestJsonAnnotations -type TestJsonAnnotations_simpleGroup TestJsonAnnotations -type TestJsonAnnotations_bUnion TestJsonAnnotations -type TestJsonAnnotations_unionWithVoid TestJsonAnnotations -type TestJsonAnnotations_aUnion_Which uint16 - -const ( - TestJsonAnnotations_aUnion_Which_foo TestJsonAnnotations_aUnion_Which = 0 - TestJsonAnnotations_aUnion_Which_bar TestJsonAnnotations_aUnion_Which = 1 -) - -func (w TestJsonAnnotations_aUnion_Which) String() string { - const s = "foobar" - switch w { - case TestJsonAnnotations_aUnion_Which_foo: - return s[0:3] - case TestJsonAnnotations_aUnion_Which_bar: - return s[3:6] - - } - return "TestJsonAnnotations_aUnion_Which(" + strconv.FormatUint(uint64(w), 10) + ")" -} - -type TestJsonAnnotations_bUnion_Which uint16 - -const ( - TestJsonAnnotations_bUnion_Which_foo TestJsonAnnotations_bUnion_Which = 0 - TestJsonAnnotations_bUnion_Which_bar TestJsonAnnotations_bUnion_Which = 1 -) - -func (w TestJsonAnnotations_bUnion_Which) String() string { - const s = "foobar" - switch w { - case TestJsonAnnotations_bUnion_Which_foo: - return s[0:3] - case TestJsonAnnotations_bUnion_Which_bar: - return s[3:6] - - } - return "TestJsonAnnotations_bUnion_Which(" + strconv.FormatUint(uint64(w), 10) + ")" -} - -type TestJsonAnnotations_unionWithVoid_Which uint16 - -const ( - TestJsonAnnotations_unionWithVoid_Which_intValue TestJsonAnnotations_unionWithVoid_Which = 0 - TestJsonAnnotations_unionWithVoid_Which_voidValue TestJsonAnnotations_unionWithVoid_Which = 1 - TestJsonAnnotations_unionWithVoid_Which_textValue TestJsonAnnotations_unionWithVoid_Which = 2 -) - -func (w TestJsonAnnotations_unionWithVoid_Which) String() string { - const s = "intValuevoidValuetextValue" - switch w { - case TestJsonAnnotations_unionWithVoid_Which_intValue: - return s[0:8] - case TestJsonAnnotations_unionWithVoid_Which_voidValue: - return s[8:17] - case TestJsonAnnotations_unionWithVoid_Which_textValue: - return s[17:26] - - } - return "TestJsonAnnotations_unionWithVoid_Which(" + strconv.FormatUint(uint64(w), 10) + ")" -} - -// TestJsonAnnotations_TypeID is the unique identifier for the type TestJsonAnnotations. -const TestJsonAnnotations_TypeID = 0xa814a516cf478f04 - -func NewTestJsonAnnotations(s *capnp.Segment) (TestJsonAnnotations, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 32, PointerCount: 16}) - return TestJsonAnnotations(st), err -} - -func NewRootTestJsonAnnotations(s *capnp.Segment) (TestJsonAnnotations, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 32, PointerCount: 16}) - return TestJsonAnnotations(st), err -} - -func ReadRootTestJsonAnnotations(msg *capnp.Message) (TestJsonAnnotations, error) { - root, err := msg.Root() - return TestJsonAnnotations(root.Struct()), err -} - -func (s TestJsonAnnotations) String() string { - str, _ := text.Marshal(0xa814a516cf478f04, capnp.Struct(s)) - return str -} - -func (s TestJsonAnnotations) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (TestJsonAnnotations) DecodeFromPtr(p capnp.Ptr) TestJsonAnnotations { - return TestJsonAnnotations(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s TestJsonAnnotations) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s TestJsonAnnotations) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations) SomeField() (string, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.Text(), err -} - -func (s TestJsonAnnotations) HasSomeField() bool { - return capnp.Struct(s).HasPtr(0) -} - -func (s TestJsonAnnotations) SomeFieldBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations) SetSomeField(v string) error { - return capnp.Struct(s).SetText(0, v) -} - -func (s TestJsonAnnotations) AGroup() TestJsonAnnotations_aGroup { - return TestJsonAnnotations_aGroup(s) -} - -func (s TestJsonAnnotations_aGroup) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aGroup) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aGroup) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aGroup) FlatFoo() uint32 { - return capnp.Struct(s).Uint32(0) -} - -func (s TestJsonAnnotations_aGroup) SetFlatFoo(v uint32) { - capnp.Struct(s).SetUint32(0, v) -} - -func (s TestJsonAnnotations_aGroup) FlatBar() (string, error) { - p, err := capnp.Struct(s).Ptr(1) - return p.Text(), err -} - -func (s TestJsonAnnotations_aGroup) HasFlatBar() bool { - return capnp.Struct(s).HasPtr(1) -} - -func (s TestJsonAnnotations_aGroup) FlatBarBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(1) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_aGroup) SetFlatBar(v string) error { - return capnp.Struct(s).SetText(1, v) -} - -func (s TestJsonAnnotations_aGroup) FlatBaz() TestJsonAnnotations_aGroup_flatBaz { - return TestJsonAnnotations_aGroup_flatBaz(s) -} - -func (s TestJsonAnnotations_aGroup_flatBaz) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aGroup_flatBaz) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aGroup_flatBaz) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aGroup_flatBaz) Hello() bool { - return capnp.Struct(s).Bit(32) -} - -func (s TestJsonAnnotations_aGroup_flatBaz) SetHello(v bool) { - capnp.Struct(s).SetBit(32, v) -} - -func (s TestJsonAnnotations_aGroup) DoubleFlat() TestJsonAnnotations_aGroup_doubleFlat { - return TestJsonAnnotations_aGroup_doubleFlat(s) -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aGroup_doubleFlat) FlatQux() (string, error) { - p, err := capnp.Struct(s).Ptr(2) - return p.Text(), err -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) HasFlatQux() bool { - return capnp.Struct(s).HasPtr(2) -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) FlatQuxBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(2) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_aGroup_doubleFlat) SetFlatQux(v string) error { - return capnp.Struct(s).SetText(2, v) -} - -func (s TestJsonAnnotations) PrefixedGroup() TestJsonAnnotations_prefixedGroup { - return TestJsonAnnotations_prefixedGroup(s) -} - -func (s TestJsonAnnotations_prefixedGroup) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_prefixedGroup) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_prefixedGroup) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_prefixedGroup) Foo() (string, error) { - p, err := capnp.Struct(s).Ptr(3) - return p.Text(), err -} - -func (s TestJsonAnnotations_prefixedGroup) HasFoo() bool { - return capnp.Struct(s).HasPtr(3) -} - -func (s TestJsonAnnotations_prefixedGroup) FooBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(3) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_prefixedGroup) SetFoo(v string) error { - return capnp.Struct(s).SetText(3, v) -} - -func (s TestJsonAnnotations_prefixedGroup) Bar() uint32 { - return capnp.Struct(s).Uint32(8) -} - -func (s TestJsonAnnotations_prefixedGroup) SetBar(v uint32) { - capnp.Struct(s).SetUint32(8, v) -} - -func (s TestJsonAnnotations_prefixedGroup) Baz() TestJsonAnnotations_prefixedGroup_baz { - return TestJsonAnnotations_prefixedGroup_baz(s) -} - -func (s TestJsonAnnotations_prefixedGroup_baz) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_prefixedGroup_baz) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_prefixedGroup_baz) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_prefixedGroup_baz) Hello() bool { - return capnp.Struct(s).Bit(33) -} - -func (s TestJsonAnnotations_prefixedGroup_baz) SetHello(v bool) { - capnp.Struct(s).SetBit(33, v) -} - -func (s TestJsonAnnotations_prefixedGroup) MorePrefix() TestJsonAnnotations_prefixedGroup_morePrefix { - return TestJsonAnnotations_prefixedGroup_morePrefix(s) -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_prefixedGroup_morePrefix) Qux() (string, error) { - p, err := capnp.Struct(s).Ptr(4) - return p.Text(), err -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) HasQux() bool { - return capnp.Struct(s).HasPtr(4) -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) QuxBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(4) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_prefixedGroup_morePrefix) SetQux(v string) error { - return capnp.Struct(s).SetText(4, v) -} - -func (s TestJsonAnnotations) AUnion() TestJsonAnnotations_aUnion { - return TestJsonAnnotations_aUnion(s) -} - -func (s TestJsonAnnotations_aUnion) Which() TestJsonAnnotations_aUnion_Which { - return TestJsonAnnotations_aUnion_Which(capnp.Struct(s).Uint16(6)) -} -func (s TestJsonAnnotations_aUnion) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aUnion) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aUnion) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aUnion) Foo() TestJsonAnnotations_aUnion_foo { - return TestJsonAnnotations_aUnion_foo(s) -} - -func (s TestJsonAnnotations_aUnion) SetFoo() { - capnp.Struct(s).SetUint16(6, 0) -} - -func (s TestJsonAnnotations_aUnion_foo) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aUnion_foo) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aUnion_foo) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aUnion_foo) FooMember() (string, error) { - p, err := capnp.Struct(s).Ptr(5) - return p.Text(), err -} - -func (s TestJsonAnnotations_aUnion_foo) HasFooMember() bool { - return capnp.Struct(s).HasPtr(5) -} - -func (s TestJsonAnnotations_aUnion_foo) FooMemberBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(5) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_aUnion_foo) SetFooMember(v string) error { - return capnp.Struct(s).SetText(5, v) -} - -func (s TestJsonAnnotations_aUnion_foo) MultiMember() uint32 { - return capnp.Struct(s).Uint32(12) -} - -func (s TestJsonAnnotations_aUnion_foo) SetMultiMember(v uint32) { - capnp.Struct(s).SetUint32(12, v) -} - -func (s TestJsonAnnotations_aUnion) Bar() TestJsonAnnotations_aUnion_bar { - return TestJsonAnnotations_aUnion_bar(s) -} - -func (s TestJsonAnnotations_aUnion) SetBar() { - capnp.Struct(s).SetUint16(6, 1) -} - -func (s TestJsonAnnotations_aUnion_bar) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_aUnion_bar) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_aUnion_bar) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_aUnion_bar) BarMember() uint32 { - return capnp.Struct(s).Uint32(12) -} - -func (s TestJsonAnnotations_aUnion_bar) SetBarMember(v uint32) { - capnp.Struct(s).SetUint32(12, v) -} - -func (s TestJsonAnnotations_aUnion_bar) MultiMember() (string, error) { - p, err := capnp.Struct(s).Ptr(5) - return p.Text(), err -} - -func (s TestJsonAnnotations_aUnion_bar) HasMultiMember() bool { - return capnp.Struct(s).HasPtr(5) -} - -func (s TestJsonAnnotations_aUnion_bar) MultiMemberBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(5) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_aUnion_bar) SetMultiMember(v string) error { - return capnp.Struct(s).SetText(5, v) -} - -func (s TestJsonAnnotations) Dependency() (TestJsonAnnotations2, error) { - p, err := capnp.Struct(s).Ptr(6) - return TestJsonAnnotations2(p.Struct()), err -} - -func (s TestJsonAnnotations) HasDependency() bool { - return capnp.Struct(s).HasPtr(6) -} - -func (s TestJsonAnnotations) SetDependency(v TestJsonAnnotations2) error { - return capnp.Struct(s).SetPtr(6, capnp.Struct(v).ToPtr()) -} - -// NewDependency sets the dependency field to a newly -// allocated TestJsonAnnotations2 struct, preferring placement in s's segment. -func (s TestJsonAnnotations) NewDependency() (TestJsonAnnotations2, error) { - ss, err := NewTestJsonAnnotations2(capnp.Struct(s).Segment()) - if err != nil { - return TestJsonAnnotations2{}, err - } - err = capnp.Struct(s).SetPtr(6, capnp.Struct(ss).ToPtr()) - return ss, err -} - -func (s TestJsonAnnotations) SimpleGroup() TestJsonAnnotations_simpleGroup { - return TestJsonAnnotations_simpleGroup(s) -} - -func (s TestJsonAnnotations_simpleGroup) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_simpleGroup) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_simpleGroup) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_simpleGroup) Grault() (string, error) { - p, err := capnp.Struct(s).Ptr(7) - return p.Text(), err -} - -func (s TestJsonAnnotations_simpleGroup) HasGrault() bool { - return capnp.Struct(s).HasPtr(7) -} - -func (s TestJsonAnnotations_simpleGroup) GraultBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(7) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_simpleGroup) SetGrault(v string) error { - return capnp.Struct(s).SetText(7, v) -} - -func (s TestJsonAnnotations) Enums() (TestJsonAnnotatedEnum_List, error) { - p, err := capnp.Struct(s).Ptr(8) - return TestJsonAnnotatedEnum_List(p.List()), err -} - -func (s TestJsonAnnotations) HasEnums() bool { - return capnp.Struct(s).HasPtr(8) -} - -func (s TestJsonAnnotations) SetEnums(v TestJsonAnnotatedEnum_List) error { - return capnp.Struct(s).SetPtr(8, v.ToPtr()) -} - -// NewEnums sets the enums field to a newly -// allocated TestJsonAnnotatedEnum_List, preferring placement in s's segment. -func (s TestJsonAnnotations) NewEnums(n int32) (TestJsonAnnotatedEnum_List, error) { - l, err := NewTestJsonAnnotatedEnum_List(capnp.Struct(s).Segment(), n) - if err != nil { - return TestJsonAnnotatedEnum_List{}, err - } - err = capnp.Struct(s).SetPtr(8, l.ToPtr()) - return l, err -} -func (s TestJsonAnnotations) InnerJson() (json.Value, error) { - p, err := capnp.Struct(s).Ptr(9) - return json.Value(p.Struct()), err -} - -func (s TestJsonAnnotations) HasInnerJson() bool { - return capnp.Struct(s).HasPtr(9) -} - -func (s TestJsonAnnotations) SetInnerJson(v json.Value) error { - return capnp.Struct(s).SetPtr(9, capnp.Struct(v).ToPtr()) -} - -// NewInnerJson sets the innerJson field to a newly -// allocated json.Value struct, preferring placement in s's segment. -func (s TestJsonAnnotations) NewInnerJson() (json.Value, error) { - ss, err := json.NewValue(capnp.Struct(s).Segment()) - if err != nil { - return json.Value{}, err - } - err = capnp.Struct(s).SetPtr(9, capnp.Struct(ss).ToPtr()) - return ss, err -} - -func (s TestJsonAnnotations) CustomFieldHandler() (string, error) { - p, err := capnp.Struct(s).Ptr(10) - return p.Text(), err -} - -func (s TestJsonAnnotations) HasCustomFieldHandler() bool { - return capnp.Struct(s).HasPtr(10) -} - -func (s TestJsonAnnotations) CustomFieldHandlerBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(10) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations) SetCustomFieldHandler(v string) error { - return capnp.Struct(s).SetText(10, v) -} - -func (s TestJsonAnnotations) TestBase64() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(11) - return []byte(p.Data()), err -} - -func (s TestJsonAnnotations) HasTestBase64() bool { - return capnp.Struct(s).HasPtr(11) -} - -func (s TestJsonAnnotations) SetTestBase64(v []byte) error { - return capnp.Struct(s).SetData(11, v) -} - -func (s TestJsonAnnotations) TestHex() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(12) - return []byte(p.Data()), err -} - -func (s TestJsonAnnotations) HasTestHex() bool { - return capnp.Struct(s).HasPtr(12) -} - -func (s TestJsonAnnotations) SetTestHex(v []byte) error { - return capnp.Struct(s).SetData(12, v) -} - -func (s TestJsonAnnotations) BUnion() TestJsonAnnotations_bUnion { - return TestJsonAnnotations_bUnion(s) -} - -func (s TestJsonAnnotations_bUnion) Which() TestJsonAnnotations_bUnion_Which { - return TestJsonAnnotations_bUnion_Which(capnp.Struct(s).Uint16(16)) -} -func (s TestJsonAnnotations_bUnion) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_bUnion) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_bUnion) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_bUnion) Foo() (string, error) { - if capnp.Struct(s).Uint16(16) != 0 { - panic("Which() != foo") - } - p, err := capnp.Struct(s).Ptr(13) - return p.Text(), err -} - -func (s TestJsonAnnotations_bUnion) HasFoo() bool { - if capnp.Struct(s).Uint16(16) != 0 { - return false - } - return capnp.Struct(s).HasPtr(13) -} - -func (s TestJsonAnnotations_bUnion) FooBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(13) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_bUnion) SetFoo(v string) error { - capnp.Struct(s).SetUint16(16, 0) - return capnp.Struct(s).SetText(13, v) -} - -func (s TestJsonAnnotations_bUnion) Bar() uint32 { - if capnp.Struct(s).Uint16(16) != 1 { - panic("Which() != bar") - } - return capnp.Struct(s).Uint32(20) -} - -func (s TestJsonAnnotations_bUnion) SetBar(v uint32) { - capnp.Struct(s).SetUint16(16, 1) - capnp.Struct(s).SetUint32(20, v) -} - -func (s TestJsonAnnotations) ExternalUnion() (TestJsonAnnotations3, error) { - p, err := capnp.Struct(s).Ptr(14) - return TestJsonAnnotations3(p.Struct()), err -} - -func (s TestJsonAnnotations) HasExternalUnion() bool { - return capnp.Struct(s).HasPtr(14) -} - -func (s TestJsonAnnotations) SetExternalUnion(v TestJsonAnnotations3) error { - return capnp.Struct(s).SetPtr(14, capnp.Struct(v).ToPtr()) -} - -// NewExternalUnion sets the externalUnion field to a newly -// allocated TestJsonAnnotations3 struct, preferring placement in s's segment. -func (s TestJsonAnnotations) NewExternalUnion() (TestJsonAnnotations3, error) { - ss, err := NewTestJsonAnnotations3(capnp.Struct(s).Segment()) - if err != nil { - return TestJsonAnnotations3{}, err - } - err = capnp.Struct(s).SetPtr(14, capnp.Struct(ss).ToPtr()) - return ss, err -} - -func (s TestJsonAnnotations) UnionWithVoid() TestJsonAnnotations_unionWithVoid { - return TestJsonAnnotations_unionWithVoid(s) -} - -func (s TestJsonAnnotations_unionWithVoid) Which() TestJsonAnnotations_unionWithVoid_Which { - return TestJsonAnnotations_unionWithVoid_Which(capnp.Struct(s).Uint16(18)) -} -func (s TestJsonAnnotations_unionWithVoid) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations_unionWithVoid) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations_unionWithVoid) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations_unionWithVoid) IntValue() uint32 { - if capnp.Struct(s).Uint16(18) != 0 { - panic("Which() != intValue") - } - return capnp.Struct(s).Uint32(24) -} - -func (s TestJsonAnnotations_unionWithVoid) SetIntValue(v uint32) { - capnp.Struct(s).SetUint16(18, 0) - capnp.Struct(s).SetUint32(24, v) -} - -func (s TestJsonAnnotations_unionWithVoid) SetVoidValue() { - capnp.Struct(s).SetUint16(18, 1) - -} - -func (s TestJsonAnnotations_unionWithVoid) TextValue() (string, error) { - if capnp.Struct(s).Uint16(18) != 2 { - panic("Which() != textValue") - } - p, err := capnp.Struct(s).Ptr(15) - return p.Text(), err -} - -func (s TestJsonAnnotations_unionWithVoid) HasTextValue() bool { - if capnp.Struct(s).Uint16(18) != 2 { - return false - } - return capnp.Struct(s).HasPtr(15) -} - -func (s TestJsonAnnotations_unionWithVoid) TextValueBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(15) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations_unionWithVoid) SetTextValue(v string) error { - capnp.Struct(s).SetUint16(18, 2) - return capnp.Struct(s).SetText(15, v) -} - -// TestJsonAnnotations_List is a list of TestJsonAnnotations. -type TestJsonAnnotations_List = capnp.StructList[TestJsonAnnotations] - -// NewTestJsonAnnotations creates a new list of TestJsonAnnotations. -func NewTestJsonAnnotations_List(s *capnp.Segment, sz int32) (TestJsonAnnotations_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 32, PointerCount: 16}, sz) - return capnp.StructList[TestJsonAnnotations](l), err -} - -// TestJsonAnnotations_Future is a wrapper for a TestJsonAnnotations promised by a client call. -type TestJsonAnnotations_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_Future) Struct() (TestJsonAnnotations, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations(p.Struct()), err -} -func (p TestJsonAnnotations_Future) AGroup() TestJsonAnnotations_aGroup_Future { - return TestJsonAnnotations_aGroup_Future{p.Future} -} - -// TestJsonAnnotations_aGroup_Future is a wrapper for a TestJsonAnnotations_aGroup promised by a client call. -type TestJsonAnnotations_aGroup_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aGroup_Future) Struct() (TestJsonAnnotations_aGroup, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aGroup(p.Struct()), err -} -func (p TestJsonAnnotations_aGroup_Future) FlatBaz() TestJsonAnnotations_aGroup_flatBaz_Future { - return TestJsonAnnotations_aGroup_flatBaz_Future{p.Future} -} - -// TestJsonAnnotations_aGroup_flatBaz_Future is a wrapper for a TestJsonAnnotations_aGroup_flatBaz promised by a client call. -type TestJsonAnnotations_aGroup_flatBaz_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aGroup_flatBaz_Future) Struct() (TestJsonAnnotations_aGroup_flatBaz, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aGroup_flatBaz(p.Struct()), err -} -func (p TestJsonAnnotations_aGroup_Future) DoubleFlat() TestJsonAnnotations_aGroup_doubleFlat_Future { - return TestJsonAnnotations_aGroup_doubleFlat_Future{p.Future} -} - -// TestJsonAnnotations_aGroup_doubleFlat_Future is a wrapper for a TestJsonAnnotations_aGroup_doubleFlat promised by a client call. -type TestJsonAnnotations_aGroup_doubleFlat_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aGroup_doubleFlat_Future) Struct() (TestJsonAnnotations_aGroup_doubleFlat, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aGroup_doubleFlat(p.Struct()), err -} -func (p TestJsonAnnotations_Future) PrefixedGroup() TestJsonAnnotations_prefixedGroup_Future { - return TestJsonAnnotations_prefixedGroup_Future{p.Future} -} - -// TestJsonAnnotations_prefixedGroup_Future is a wrapper for a TestJsonAnnotations_prefixedGroup promised by a client call. -type TestJsonAnnotations_prefixedGroup_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_prefixedGroup_Future) Struct() (TestJsonAnnotations_prefixedGroup, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_prefixedGroup(p.Struct()), err -} -func (p TestJsonAnnotations_prefixedGroup_Future) Baz() TestJsonAnnotations_prefixedGroup_baz_Future { - return TestJsonAnnotations_prefixedGroup_baz_Future{p.Future} -} - -// TestJsonAnnotations_prefixedGroup_baz_Future is a wrapper for a TestJsonAnnotations_prefixedGroup_baz promised by a client call. -type TestJsonAnnotations_prefixedGroup_baz_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_prefixedGroup_baz_Future) Struct() (TestJsonAnnotations_prefixedGroup_baz, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_prefixedGroup_baz(p.Struct()), err -} -func (p TestJsonAnnotations_prefixedGroup_Future) MorePrefix() TestJsonAnnotations_prefixedGroup_morePrefix_Future { - return TestJsonAnnotations_prefixedGroup_morePrefix_Future{p.Future} -} - -// TestJsonAnnotations_prefixedGroup_morePrefix_Future is a wrapper for a TestJsonAnnotations_prefixedGroup_morePrefix promised by a client call. -type TestJsonAnnotations_prefixedGroup_morePrefix_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_prefixedGroup_morePrefix_Future) Struct() (TestJsonAnnotations_prefixedGroup_morePrefix, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_prefixedGroup_morePrefix(p.Struct()), err -} -func (p TestJsonAnnotations_Future) AUnion() TestJsonAnnotations_aUnion_Future { - return TestJsonAnnotations_aUnion_Future{p.Future} -} - -// TestJsonAnnotations_aUnion_Future is a wrapper for a TestJsonAnnotations_aUnion promised by a client call. -type TestJsonAnnotations_aUnion_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aUnion_Future) Struct() (TestJsonAnnotations_aUnion, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aUnion(p.Struct()), err -} -func (p TestJsonAnnotations_aUnion_Future) Foo() TestJsonAnnotations_aUnion_foo_Future { - return TestJsonAnnotations_aUnion_foo_Future{p.Future} -} - -// TestJsonAnnotations_aUnion_foo_Future is a wrapper for a TestJsonAnnotations_aUnion_foo promised by a client call. -type TestJsonAnnotations_aUnion_foo_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aUnion_foo_Future) Struct() (TestJsonAnnotations_aUnion_foo, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aUnion_foo(p.Struct()), err -} -func (p TestJsonAnnotations_aUnion_Future) Bar() TestJsonAnnotations_aUnion_bar_Future { - return TestJsonAnnotations_aUnion_bar_Future{p.Future} -} - -// TestJsonAnnotations_aUnion_bar_Future is a wrapper for a TestJsonAnnotations_aUnion_bar promised by a client call. -type TestJsonAnnotations_aUnion_bar_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_aUnion_bar_Future) Struct() (TestJsonAnnotations_aUnion_bar, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_aUnion_bar(p.Struct()), err -} -func (p TestJsonAnnotations_Future) Dependency() TestJsonAnnotations2_Future { - return TestJsonAnnotations2_Future{Future: p.Future.Field(6, nil)} -} -func (p TestJsonAnnotations_Future) SimpleGroup() TestJsonAnnotations_simpleGroup_Future { - return TestJsonAnnotations_simpleGroup_Future{p.Future} -} - -// TestJsonAnnotations_simpleGroup_Future is a wrapper for a TestJsonAnnotations_simpleGroup promised by a client call. -type TestJsonAnnotations_simpleGroup_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_simpleGroup_Future) Struct() (TestJsonAnnotations_simpleGroup, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_simpleGroup(p.Struct()), err -} -func (p TestJsonAnnotations_Future) InnerJson() json.Value_Future { - return json.Value_Future{Future: p.Future.Field(9, nil)} -} -func (p TestJsonAnnotations_Future) BUnion() TestJsonAnnotations_bUnion_Future { - return TestJsonAnnotations_bUnion_Future{p.Future} -} - -// TestJsonAnnotations_bUnion_Future is a wrapper for a TestJsonAnnotations_bUnion promised by a client call. -type TestJsonAnnotations_bUnion_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_bUnion_Future) Struct() (TestJsonAnnotations_bUnion, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_bUnion(p.Struct()), err -} -func (p TestJsonAnnotations_Future) ExternalUnion() TestJsonAnnotations3_Future { - return TestJsonAnnotations3_Future{Future: p.Future.Field(14, nil)} -} -func (p TestJsonAnnotations_Future) UnionWithVoid() TestJsonAnnotations_unionWithVoid_Future { - return TestJsonAnnotations_unionWithVoid_Future{p.Future} -} - -// TestJsonAnnotations_unionWithVoid_Future is a wrapper for a TestJsonAnnotations_unionWithVoid promised by a client call. -type TestJsonAnnotations_unionWithVoid_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations_unionWithVoid_Future) Struct() (TestJsonAnnotations_unionWithVoid, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations_unionWithVoid(p.Struct()), err -} - -type TestJsonAnnotations2 capnp.Struct - -// TestJsonAnnotations2_TypeID is the unique identifier for the type TestJsonAnnotations2. -const TestJsonAnnotations2_TypeID = 0xf726f6fa6b58143c - -func NewTestJsonAnnotations2(s *capnp.Segment) (TestJsonAnnotations2, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) - return TestJsonAnnotations2(st), err -} - -func NewRootTestJsonAnnotations2(s *capnp.Segment) (TestJsonAnnotations2, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}) - return TestJsonAnnotations2(st), err -} - -func ReadRootTestJsonAnnotations2(msg *capnp.Message) (TestJsonAnnotations2, error) { - root, err := msg.Root() - return TestJsonAnnotations2(root.Struct()), err -} - -func (s TestJsonAnnotations2) String() string { - str, _ := text.Marshal(0xf726f6fa6b58143c, capnp.Struct(s)) - return str -} - -func (s TestJsonAnnotations2) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (TestJsonAnnotations2) DecodeFromPtr(p capnp.Ptr) TestJsonAnnotations2 { - return TestJsonAnnotations2(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s TestJsonAnnotations2) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s TestJsonAnnotations2) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations2) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations2) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations2) Foo() (string, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.Text(), err -} - -func (s TestJsonAnnotations2) HasFoo() bool { - return capnp.Struct(s).HasPtr(0) -} - -func (s TestJsonAnnotations2) FooBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.TextBytes(), err -} - -func (s TestJsonAnnotations2) SetFoo(v string) error { - return capnp.Struct(s).SetText(0, v) -} - -func (s TestJsonAnnotations2) Cycle() (TestJsonAnnotations, error) { - p, err := capnp.Struct(s).Ptr(1) - return TestJsonAnnotations(p.Struct()), err -} - -func (s TestJsonAnnotations2) HasCycle() bool { - return capnp.Struct(s).HasPtr(1) -} - -func (s TestJsonAnnotations2) SetCycle(v TestJsonAnnotations) error { - return capnp.Struct(s).SetPtr(1, capnp.Struct(v).ToPtr()) -} - -// NewCycle sets the cycle field to a newly -// allocated TestJsonAnnotations struct, preferring placement in s's segment. -func (s TestJsonAnnotations2) NewCycle() (TestJsonAnnotations, error) { - ss, err := NewTestJsonAnnotations(capnp.Struct(s).Segment()) - if err != nil { - return TestJsonAnnotations{}, err - } - err = capnp.Struct(s).SetPtr(1, capnp.Struct(ss).ToPtr()) - return ss, err -} - -// TestJsonAnnotations2_List is a list of TestJsonAnnotations2. -type TestJsonAnnotations2_List = capnp.StructList[TestJsonAnnotations2] - -// NewTestJsonAnnotations2 creates a new list of TestJsonAnnotations2. -func NewTestJsonAnnotations2_List(s *capnp.Segment, sz int32) (TestJsonAnnotations2_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 2}, sz) - return capnp.StructList[TestJsonAnnotations2](l), err -} - -// TestJsonAnnotations2_Future is a wrapper for a TestJsonAnnotations2 promised by a client call. -type TestJsonAnnotations2_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations2_Future) Struct() (TestJsonAnnotations2, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations2(p.Struct()), err -} -func (p TestJsonAnnotations2_Future) Cycle() TestJsonAnnotations_Future { - return TestJsonAnnotations_Future{Future: p.Future.Field(1, nil)} -} - -type TestJsonAnnotations3 capnp.Struct -type TestJsonAnnotations3_Which uint16 - -const ( - TestJsonAnnotations3_Which_foo TestJsonAnnotations3_Which = 0 - TestJsonAnnotations3_Which_bar TestJsonAnnotations3_Which = 1 -) - -func (w TestJsonAnnotations3_Which) String() string { - const s = "foobar" - switch w { - case TestJsonAnnotations3_Which_foo: - return s[0:3] - case TestJsonAnnotations3_Which_bar: - return s[3:6] - - } - return "TestJsonAnnotations3_Which(" + strconv.FormatUint(uint64(w), 10) + ")" -} - -// TestJsonAnnotations3_TypeID is the unique identifier for the type TestJsonAnnotations3. -const TestJsonAnnotations3_TypeID = 0xd5533065ce7c825f - -func NewTestJsonAnnotations3(s *capnp.Segment) (TestJsonAnnotations3, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) - return TestJsonAnnotations3(st), err -} - -func NewRootTestJsonAnnotations3(s *capnp.Segment) (TestJsonAnnotations3, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) - return TestJsonAnnotations3(st), err -} - -func ReadRootTestJsonAnnotations3(msg *capnp.Message) (TestJsonAnnotations3, error) { - root, err := msg.Root() - return TestJsonAnnotations3(root.Struct()), err -} - -func (s TestJsonAnnotations3) String() string { - str, _ := text.Marshal(0xd5533065ce7c825f, capnp.Struct(s)) - return str -} - -func (s TestJsonAnnotations3) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (TestJsonAnnotations3) DecodeFromPtr(p capnp.Ptr) TestJsonAnnotations3 { - return TestJsonAnnotations3(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s TestJsonAnnotations3) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} - -func (s TestJsonAnnotations3) Which() TestJsonAnnotations3_Which { - return TestJsonAnnotations3_Which(capnp.Struct(s).Uint16(4)) -} -func (s TestJsonAnnotations3) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestJsonAnnotations3) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestJsonAnnotations3) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestJsonAnnotations3) Foo() uint32 { - if capnp.Struct(s).Uint16(4) != 0 { - panic("Which() != foo") - } - return capnp.Struct(s).Uint32(0) -} - -func (s TestJsonAnnotations3) SetFoo(v uint32) { - capnp.Struct(s).SetUint16(4, 0) - capnp.Struct(s).SetUint32(0, v) -} - -func (s TestJsonAnnotations3) Bar() (TestFlattenedStruct, error) { - if capnp.Struct(s).Uint16(4) != 1 { - panic("Which() != bar") - } - p, err := capnp.Struct(s).Ptr(0) - return TestFlattenedStruct(p.Struct()), err -} - -func (s TestJsonAnnotations3) HasBar() bool { - if capnp.Struct(s).Uint16(4) != 1 { - return false - } - return capnp.Struct(s).HasPtr(0) -} - -func (s TestJsonAnnotations3) SetBar(v TestFlattenedStruct) error { - capnp.Struct(s).SetUint16(4, 1) - return capnp.Struct(s).SetPtr(0, capnp.Struct(v).ToPtr()) -} - -// NewBar sets the bar field to a newly -// allocated TestFlattenedStruct struct, preferring placement in s's segment. -func (s TestJsonAnnotations3) NewBar() (TestFlattenedStruct, error) { - capnp.Struct(s).SetUint16(4, 1) - ss, err := NewTestFlattenedStruct(capnp.Struct(s).Segment()) - if err != nil { - return TestFlattenedStruct{}, err - } - err = capnp.Struct(s).SetPtr(0, capnp.Struct(ss).ToPtr()) - return ss, err -} - -// TestJsonAnnotations3_List is a list of TestJsonAnnotations3. -type TestJsonAnnotations3_List = capnp.StructList[TestJsonAnnotations3] - -// NewTestJsonAnnotations3 creates a new list of TestJsonAnnotations3. -func NewTestJsonAnnotations3_List(s *capnp.Segment, sz int32) (TestJsonAnnotations3_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) - return capnp.StructList[TestJsonAnnotations3](l), err -} - -// TestJsonAnnotations3_Future is a wrapper for a TestJsonAnnotations3 promised by a client call. -type TestJsonAnnotations3_Future struct{ *capnp.Future } - -func (f TestJsonAnnotations3_Future) Struct() (TestJsonAnnotations3, error) { - p, err := f.Future.Ptr() - return TestJsonAnnotations3(p.Struct()), err -} -func (p TestJsonAnnotations3_Future) Bar() TestFlattenedStruct_Future { - return TestFlattenedStruct_Future{Future: p.Future.Field(0, nil)} -} - -type TestFlattenedStruct capnp.Struct - -// TestFlattenedStruct_TypeID is the unique identifier for the type TestFlattenedStruct. -const TestFlattenedStruct_TypeID = 0xb1cc94eb5141adf8 - -func NewTestFlattenedStruct(s *capnp.Segment) (TestFlattenedStruct, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) - return TestFlattenedStruct(st), err -} - -func NewRootTestFlattenedStruct(s *capnp.Segment) (TestFlattenedStruct, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) - return TestFlattenedStruct(st), err -} - -func ReadRootTestFlattenedStruct(msg *capnp.Message) (TestFlattenedStruct, error) { - root, err := msg.Root() - return TestFlattenedStruct(root.Struct()), err -} - -func (s TestFlattenedStruct) String() string { - str, _ := text.Marshal(0xb1cc94eb5141adf8, capnp.Struct(s)) - return str -} - -func (s TestFlattenedStruct) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (TestFlattenedStruct) DecodeFromPtr(p capnp.Ptr) TestFlattenedStruct { - return TestFlattenedStruct(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s TestFlattenedStruct) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s TestFlattenedStruct) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestFlattenedStruct) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestFlattenedStruct) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestFlattenedStruct) Value() (string, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.Text(), err -} - -func (s TestFlattenedStruct) HasValue() bool { - return capnp.Struct(s).HasPtr(0) -} - -func (s TestFlattenedStruct) ValueBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.TextBytes(), err -} - -func (s TestFlattenedStruct) SetValue(v string) error { - return capnp.Struct(s).SetText(0, v) -} - -// TestFlattenedStruct_List is a list of TestFlattenedStruct. -type TestFlattenedStruct_List = capnp.StructList[TestFlattenedStruct] - -// NewTestFlattenedStruct creates a new list of TestFlattenedStruct. -func NewTestFlattenedStruct_List(s *capnp.Segment, sz int32) (TestFlattenedStruct_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) - return capnp.StructList[TestFlattenedStruct](l), err -} - -// TestFlattenedStruct_Future is a wrapper for a TestFlattenedStruct promised by a client call. -type TestFlattenedStruct_Future struct{ *capnp.Future } - -func (f TestFlattenedStruct_Future) Struct() (TestFlattenedStruct, error) { - p, err := f.Future.Ptr() - return TestFlattenedStruct(p.Struct()), err -} - -type TestJsonAnnotatedEnum uint16 - -// TestJsonAnnotatedEnum_TypeID is the unique identifier for the type TestJsonAnnotatedEnum. -const TestJsonAnnotatedEnum_TypeID = 0xeca76f3df6b22dbb - -// Values of TestJsonAnnotatedEnum. -const ( - TestJsonAnnotatedEnum_foo TestJsonAnnotatedEnum = 0 - TestJsonAnnotatedEnum_bar TestJsonAnnotatedEnum = 1 - TestJsonAnnotatedEnum_baz TestJsonAnnotatedEnum = 2 - TestJsonAnnotatedEnum_qux TestJsonAnnotatedEnum = 3 -) - -// String returns the enum's constant name. -func (c TestJsonAnnotatedEnum) String() string { - switch c { - case TestJsonAnnotatedEnum_foo: - return "foo" - case TestJsonAnnotatedEnum_bar: - return "bar" - case TestJsonAnnotatedEnum_baz: - return "baz" - case TestJsonAnnotatedEnum_qux: - return "qux" - - default: - return "" - } -} - -// TestJsonAnnotatedEnumFromString returns the enum value with a name, -// or the zero value if there's no such value. -func TestJsonAnnotatedEnumFromString(c string) TestJsonAnnotatedEnum { - switch c { - case "foo": - return TestJsonAnnotatedEnum_foo - case "bar": - return TestJsonAnnotatedEnum_bar - case "baz": - return TestJsonAnnotatedEnum_baz - case "qux": - return TestJsonAnnotatedEnum_qux - - default: - return 0 - } -} - -type TestJsonAnnotatedEnum_List = capnp.EnumList[TestJsonAnnotatedEnum] - -func NewTestJsonAnnotatedEnum_List(s *capnp.Segment, sz int32) (TestJsonAnnotatedEnum_List, error) { - return capnp.NewEnumList[TestJsonAnnotatedEnum](s, sz) -} - -type TestBase64Union capnp.Struct -type TestBase64Union_Which uint16 - -const ( - TestBase64Union_Which_foo TestBase64Union_Which = 0 - TestBase64Union_Which_bar TestBase64Union_Which = 1 -) - -func (w TestBase64Union_Which) String() string { - const s = "foobar" - switch w { - case TestBase64Union_Which_foo: - return s[0:3] - case TestBase64Union_Which_bar: - return s[3:6] - - } - return "TestBase64Union_Which(" + strconv.FormatUint(uint64(w), 10) + ")" -} - -// TestBase64Union_TypeID is the unique identifier for the type TestBase64Union. -const TestBase64Union_TypeID = 0xe36a2dc2a7ba9f0a - -func NewTestBase64Union(s *capnp.Segment) (TestBase64Union, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) - return TestBase64Union(st), err -} - -func NewRootTestBase64Union(s *capnp.Segment) (TestBase64Union, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}) - return TestBase64Union(st), err -} - -func ReadRootTestBase64Union(msg *capnp.Message) (TestBase64Union, error) { - root, err := msg.Root() - return TestBase64Union(root.Struct()), err -} - -func (s TestBase64Union) String() string { - str, _ := text.Marshal(0xe36a2dc2a7ba9f0a, capnp.Struct(s)) - return str -} - -func (s TestBase64Union) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (TestBase64Union) DecodeFromPtr(p capnp.Ptr) TestBase64Union { - return TestBase64Union(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s TestBase64Union) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} - -func (s TestBase64Union) Which() TestBase64Union_Which { - return TestBase64Union_Which(capnp.Struct(s).Uint16(0)) -} -func (s TestBase64Union) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s TestBase64Union) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s TestBase64Union) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s TestBase64Union) Foo() ([]byte, error) { - if capnp.Struct(s).Uint16(0) != 0 { - panic("Which() != foo") - } - p, err := capnp.Struct(s).Ptr(0) - return []byte(p.Data()), err -} - -func (s TestBase64Union) HasFoo() bool { - if capnp.Struct(s).Uint16(0) != 0 { - return false - } - return capnp.Struct(s).HasPtr(0) -} - -func (s TestBase64Union) SetFoo(v []byte) error { - capnp.Struct(s).SetUint16(0, 0) - return capnp.Struct(s).SetData(0, v) -} - -func (s TestBase64Union) Bar() (string, error) { - if capnp.Struct(s).Uint16(0) != 1 { - panic("Which() != bar") - } - p, err := capnp.Struct(s).Ptr(0) - return p.Text(), err -} - -func (s TestBase64Union) HasBar() bool { - if capnp.Struct(s).Uint16(0) != 1 { - return false - } - return capnp.Struct(s).HasPtr(0) -} - -func (s TestBase64Union) BarBytes() ([]byte, error) { - p, err := capnp.Struct(s).Ptr(0) - return p.TextBytes(), err -} - -func (s TestBase64Union) SetBar(v string) error { - capnp.Struct(s).SetUint16(0, 1) - return capnp.Struct(s).SetText(0, v) -} - -// TestBase64Union_List is a list of TestBase64Union. -type TestBase64Union_List = capnp.StructList[TestBase64Union] - -// NewTestBase64Union creates a new list of TestBase64Union. -func NewTestBase64Union_List(s *capnp.Segment, sz int32) (TestBase64Union_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 8, PointerCount: 1}, sz) - return capnp.StructList[TestBase64Union](l), err -} - -// TestBase64Union_Future is a wrapper for a TestBase64Union promised by a client call. -type TestBase64Union_Future struct{ *capnp.Future } - -func (f TestBase64Union_Future) Struct() (TestBase64Union, error) { - p, err := f.Future.Ptr() - return TestBase64Union(p.Struct()), err -} - -const schema_c9d405cf4333e4c9 = "x\xda\xacWo\x8cTW\x15?\xe7\xde7\x7fv\x99" + - "a\xde\xe5\xbd-\x90@\x1eL\xaa\x16\xec\xac\xb0\x03\xd4" + - "\xaem\x87]]\xa0\xe8\x9a};\xbb\xd8\xae5\xe5\xcd" + - "\xce]\x98:\xf3\xde0\xf3\xa6\xdd\xd9\xf4ODI\xd5" + - "\xacQ\x0c1\x15?\xf8\xa14@\xb4!4\x92\x18\xad" + - "5j\x8d\xc1(\xa4\xb1\x88~\xe8\x07\xdb\x9aV\xd4\xc6" + - "\x98X\x05\x95g\xce\x9b?o\x16\x86u7\xe9\xa7\xdd" + - "\xb9\xf7\xbcs\xcf\xf9\x9d\xf3\xfb\x9d{\xb7TC;\x95" + - "\xad\xf1D\x0c\x989\x1f\x0a{\xea\xba\xb7.\x9c?\xf1" + - "\xe4<\x98\x1fD\xc5\xfb\x82\xb5\xed\x0f\x87\x06\xb7\x1f\x85" + - ">5\x82\x00\xe9\xbf\x86\xe6\x10P\xbb\x1az\x0c0\xd8" + - "4oG\xc5S\xbe\xba\xfb\xe2m\xcf\xe9\xa7`R\x8d" + - " C\x9e\xfeLx\x8al\x0ba\xb2=\xfd\xea3/" + - "\xef\xf9\xf7\xbeo\xdc`\xdbt{5\xfcu2\xed\x89" + - "\xbc\x05\x18l\x9a**\xde\xf97\xd3\x1f\xbd\x18z\xf5" + - "<\x84\xd4\x08YF\x92\xa8\xf5D\xe9\xdfPt5\x07" + - "\xf4>\x99{&\x13\xfb\x80q\xa6k\x14\xd1\xf4\xfd1" + - "?\x8a\xc9\x18E\xf1\xe4;\xcf\xfd\xe8\xcd\xccw\xce6" + - "\x92\xbb\xfc\xad\x81S\xfb3\xeb\x7f\xdd\x8a\xe2\xf7\xb1\xe3" + - "d\xfa\xa7X\x06\xd0\xfb\xd7\xf3C\xe6\x9f\x8f\xfd\xea," + - "\x08\x15;\x82@:\xb9'\x9eDmm<\x02\xa0\xf5" + - "\xc5\xc9\xf8\xd8\xfc\xf5C\xb1\xfb\xbe\xfc\xb3\xee~\xb7\xc7" + - "_ \xbf#\xbe\xe9\x95\x9d\xaf\x1b\xf3\x17\x9e~\x19\xcc" + - "\x01T\x02X\x9a\xa62~\x85L\xeb\xbe\xe9\x89\xbb\xf7" + - "\xf1\xa1\x17\xdf\xf9e\x97\xcc8\xf6\xa4\xbf\x19\xf7A;" + - "\x1d?\x03\x18\x9c\xd9\x15\xdf\xd1\x95>\x08\x0f\xae$|" + - "_{c\xff\xf6\xd5\x13\x0f\xbe\xd2=\x82\x91\x84\x1f\xec" + - "d\x82\"x\xf8\xf0\xe3\x17\xe4\x96\xec%*E\x07\x0a" + - "#\x18a\xc8\xd2\xb5\xc4f\xd4\x8e$\"\xda\x91\x84\xa1" + - "=\x9f \x80\xd3\xe5\xaf\xdd\xff\xd2Gv_\xee\x1eF" + - "J=L\xbe\xefV\xc9w\xef\xb7\x7fp\xf2\xa7\xa9G" + - "\xde\xe8\xe2\x1b \xfd9\x95\xa1\xf6\x15*\xb9\xf6%\x95" + - "<\xff0\xf5\xc2\xbb\xf7:'\xff\x02Be\x815`" + - ":$\x06P\xeb\x13d)\xc4\x01@\xef\xe9\xfcKW" + - "\xe6O<\xfb\xf7\xee\x1d|D\xf8\x1d|T\x90\xd3{" + - "\xf4\x07>{\xed\xdd\xf7\xff\xf3\x86\"3*\xf2?\xc4" + - "f\xd4B\xab\xc8/\xaez\x0c^\xf4\x1e\xa9:v\xca" + - "\x95U\xc5\xed\x9f\xb6\xcavypBV\xdd\xbdU\xc7" + - "\x1e\xb2m\xc7\xb5\xdc\x82cW\xfb\xadI\xbb\x90q\xec" + - "\xfe\x19\xc71\xa3\\QC:\xf6\x00\x88M\xe3\x00\xe6" + - "\x1d\x1c\xcdm\x0c\x05r\x1d{\x01\xc4\xd6\x1c\x80\xb9\x85" + - "\xa3y\x0fCo\xc6qFe)'\x01+\x18\x03\x86" + - "1@\xafT+\xba\x85QY\x82HNV0\x0a\x0c" + - "\xa3\x80K\x8f\x83;6\xc5\x10\xf3<\xc4\x80\xd7bS" + - "Rl2\x00\xe3x\x9d\xd6\xdbh\x89\xedI\xb1\xfd." + - "\xc0\x08\x85\xae \xf3~\xbc\x83\x9f\x19\x7f\xfb7\x87\xc1" + - "T\x18\x0e\xa9\x88*\xc0N\x04\x8c\xe4\xac\x8a\x19]`" + - "\xa02\x1cZ\x87\xde\xbd\x8f\xf7\xaf\xfb\xad\xf1\xe9k`" + - "\xaea8tG\xfb\x0b\x8c\x01\x08\xccy\x15i[%" + - "\x99O\x01\xb9\x00hg\x12Z,\x93rE\xce\x14f" + - "e~w\xc5\xa9a\xd9T\xb9\xa2r\x1dC\x00\xc2J" + - "\x02\x98\x0fq4\x0f\x12\xa8L\xc70\x80\x90I!\x0d" + - "\xf3\x8b\x1c\xcdc\x0c\x91aG\xbf\x8b\xa3I`\xc8\xb1" + - "\x83\x84\xa2>%\x9e0\x1aI\xb7`\xf7\xf3#\x00\x82" + - "t\x08\x00\xfdVi\xb4\x0a\x13\xc9Ys^\xc9\xa9\xc8" + - "\xb1\x8a\x9c\x01^\x98\xed\x82\xa2\xde\xc4D\xe0\xe6\xc4\xec" + - "L\xb9\xbf\x03\x04~+\x10\"\x8e]\x1dC4?\xcc" + - "\x15\x00\x05\x01\xb4:\x8ekO\xa0\x91\xfd.r\xcc~" + - "\x9f\x92D\xec\x90\x00\xed\x1c\x0ej\xe7\xd0\x80F\xfem" + - "\x86k?\xc1\x8a\xf6s\x7f\x9d@h3C\xbb\x84\x83" + - "\xda%\xbc\x0bP(a\x1d\xe3\x00Z\x9cM\x01dc" + - "\x8ccv\x0dc\x88!\xec\xe0\xb6\xd6\xc7r\xc0D8" + - "\xaac\x82\xd8\xc1\x06\x00\xb2\xff\xc1\xa6\xad\x88\xf4\xe8\x94" + - "\xa4\xd6\xc7\xc6\x01\xb2:\xf9\xd8@\xeb\xd1^\x1d\x05\x80" + - "\xb6\x9e\x1d\x07\xc8n\xa0\xf5;i\xbdg\x85\x8e\xab\x00" + - "\xb4MlJK1#\xbb\x87v&h\xa77\xa6\xa3" + - "\x06\xa0\x99lX3\x99\x91-\xd2\xce,\xc5\xb3\x02;" + - "\x84_\xab\xb1A\xad\xc6(\xfe\xd8J\x1do\x03\xd0N" + - "\xb3\x0a@\xf6\x14\xd9\x7f\x8f\xec\xe3\xd8!\xa7\xdaYV" + - "\xd1\xce1\x03\xd0\xab:%\xb9\xab \x8b\x80\xf9.%" + - "\xdf\xe0\x97|+\xaeB\x8f*^MM[\xdc~x" + - "\xda\xb1]\xab`o\xb4\xec\xba{\xb0`\x1f\xd80." + - "\xadb\x11\xeb\x00\xad\x0e\xcaX\xd4\xac\xe5EY\xe4\xb5" + - "\xfa\x1a\x8c[\x19w6Kyf\xb6\x1f C\xb4&" + - "Vwc_\x0e\x8f\xbf\xf2\xf6\xb1\x93\x17\x1b\xec\xdb\x12" + - "\xb0\x8f\xfe2\x11\x9a\x02\xf0j\xf4y\xca\xad\x03/K" + - "\x00//\xcb\xd2\xceK\x1b\xf8t\x1d\xd5@\x0e\xfd\x8f" + - "\xd0\xab\x16J\xe5\xa2\xdc]\x81\x88S+\x1b\xd2\xae\x95" + - "\xaa\xb8\x12p\x8c#&\x02A\x06\xa4E\xaf`\xdb\xb2" + - "\xb2\xb7\xea\x00\xda\xa8z\x9f\x7fm\xed\xd5\x91\xd9k\xcf" + - "\xb6\\M\xd7\xaa\xaeS\xdaU@Y\xcc\xef\xb1\xec|" + - "\x91\xcb@\xe7\\Yu\x87\xad\xaa\x04\xbec\x9b\x8f\xc3" + - "\xc7\xef{_\xefH\xfdw\x97\x1b8\xc4\x108\xc6\x81" + - "a\x1c\xf0)\xb2\xdd#\x1b\xdc:\xf7\x8b?\xf6~\xe8" + - "u\xebo7\x9berK\x06\xea\xce\x1b\x80\"\x8e\x0f" + - "fr\xfb\xacb\x8d \x92\xb3\xae\xac\xd8V\x11\x0c\xdf" + - "#\xaa\xc1Pl\xa6\xe6c\xfa\xa9\x82\x0b\xc6\xc1}N" + - "\xa1\xd1G\xc1\x11\x14\xd9\x9av\x0d6\x03$\xdc\xba\x8f" + - "\xfd\x92d<\x17\xc8\xf8:\xcf\x8b\xeb\xa8\xd30!\xdd" + - "\xbb\x9d\xa3\xb9\x85\xe1z\xbc\xee\x85t\xec\x03\x10\xa9\xa4" + - "H\x19\xe6\x18G\xf3!\xf6\x9e\x08\xda\xd2\xf4\xb9\xd1\xeb" + - "\xfd3E\xcb\x1d\xe6\xd6\x9c\xa9pE\xdd\xa0#\x07\x10" + - "\xf1\x01\x003\xca\xd1\xd4\x19\x1a\x07e\xb1\xe8 \x02C" + - "\xecp\xbd@\xf5v\x15-\xd7\x95\xb6\xccg\xddJ\xa4" + - "6\xed\x92\xea)-\xd5[\xe8\xedQ*O\xbb\x81\x96" + - "\x13h\xde\xa9\xe5\x8a\x86\xa4\xb3\xfcX\x99\x8e\x0ay\x1f" + - "\x0e\xbc?E\xc9\x98\xb5\xd9\x9b\xfc\x87\x97:\xa8\xca\xfd" + - "\x8dA\x90\xa0%\xff\x18E\xc7(\x1d\x93\x0c\x8e\x89\x1c" + - "\xear\xc4\xa2)\xb4Z\x8d\x1a\x0d\xf3f\xcc\xef\x8a\xb0" + - "\x8e\xab\x01\xc4\xc8^\x00\xf3c\x1c\xcd1\xe6\xcfv\x1d" + - "\xd7\x00\x88Q\xbax|\x82\xa3\xf9\x00\xc3\xf5\xec\xbf^" + - "B\xc7\xb5\x00b\x92\x96'8\x9a\xfb\x191\xd7mv" + - "{P\xfaG\x9dB\x9e\x16\x01%\x84=W\xce\xba\xcd" + - "_7\x05\xac\xfc?\xccy\xcd\x9f\xda\x00:R\x19\xad" + - "\xe1\xce\xa9\x8d:\x12\xe3$-\xee\xe7h\x16\x9bC\xbb" + - "}S\x17\x85aQh\x8d\xac\xf6=\xbb5\xb7\xfdJ" + - "\xedr\x9cV\xdc\xfe\xefa\xab--\xcd\xdfs\x8b\xb4" + - "\xff\xe1v\xfbc\xd3\x18H\x19\xa9K\xe4\xae\"pj" + - "\x93\xc5t|\xd9\x97\x18\xa3\xdc\x9fk\xf2d\xa3N\xef" + - "\x89e\xf3\xa4\xd3{\xc2\xb1\xabi\x9f(K\x92\x9d\xe6" + - "\x85\xd0'T\xa7\x8e4:\x06\xdb2\xd2l\x19_F" + - "\x82\xfbMeQ(P\x0d^MMm\\\x128\xad" + - "1\xe3\xd4\xca\xe0\xc3\x12\xd1q%\xc12(\xe2F\xeb" + - "\x82\x9c9P\xb1jEw\x91B\xce\x05:\xd64\x0e" + - "&rw\x1ci\xe6\xec\xd8\xe6\xeb:\x10\x84\x0b\xb0\x11" + - "\x9b\x8c\x85t\xa2\xe5Q\x82l\x0fGs\x82\x05\x17\xe5" + - "[O+\x82l\xf1\x10:\xb0\x90F~\xc4\xae\x95(" + - "\x10\xd5'\x05\xd5\x07QlL\x8a\x8d\x0621\x94\x14" + - "C\x06r\xff\xdaKg/W\xd6#\xb9Ey\xb0\xd0" + - "~\x0e\x80\xe4iy\x8f\x1e\xffa\xd0\xb8\x9f\xaf\xb8\xe9" + - "\xd1\x13\xd2\xfds\x16