diff --git a/api/channel.capnp b/api/channel.capnp index 39c6f795..ad9126e9 100644 --- a/api/channel.capnp +++ b/api/channel.capnp @@ -16,17 +16,10 @@ interface Sender(T) { } -interface Peeker(T) { - peek @0 () -> (value :T); -} - - interface Recver(T) { recv @0 () -> (value :T); } interface SendCloser(T) extends(Sender(T), Closer) {} -interface PeekRecver(T) extends(Peeker(T), Recver(T)) {} interface Chan(T) extends(SendCloser(T), Recver(T)) {} -interface PeekableChan(T) extends(SendCloser(T), PeekRecver(T)) {} diff --git a/go.sum b/go.sum index ab9db9f8..8c28bd47 100644 --- a/go.sum +++ b/go.sum @@ -505,8 +505,6 @@ github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49u github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0 h1:GDDkbFiaK8jsSDJfjId/PEGEShv6ugrt4kYsC5UIDaQ= github.com/warpfork/go-wish v0.0.0-20220906213052-39a1cc7a02d0/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw= -github.com/wetware/casm v0.0.0-20230221204520-1957fd184f20 h1:TYrOgmbPbxUO4PqjwRF2foxpKoqDdu2fRvmAd1ptKTI= -github.com/wetware/casm v0.0.0-20230221204520-1957fd184f20/go.mod h1:POhb5OT6s9paBkfl2/GVEUPYFx0WVLy1t9u9KprDMOU= github.com/wetware/casm v0.0.0-20230224203443-f715090fc92c h1:vOxUhNnjyzBuIq0/nhdlyoVj8gug4SQlgtojo0Pg8Bo= github.com/wetware/casm v0.0.0-20230224203443-f715090fc92c/go.mod h1:POhb5OT6s9paBkfl2/GVEUPYFx0WVLy1t9u9KprDMOU= github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k= diff --git a/internal/api/channel/channel.capnp.go b/internal/api/channel/channel.capnp.go index 45ad89eb..615a9434 100644 --- a/internal/api/channel/channel.capnp.go +++ b/internal/api/channel/channel.capnp.go @@ -526,302 +526,6 @@ func (p Sender_send_Params_Future) Value() *capnp.Future { return p.Future.Field(0, nil) } -type Peeker capnp.Client - -// Peeker_TypeID is the unique identifier for the type Peeker. -const Peeker_TypeID = 0xe95c7f9f41bf520a - -func (c Peeker) Peek(ctx context.Context, params func(Peeker_peek_Params) error) (Peeker_peek_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Peeker_peek_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Peeker_peek_Results_Future{Future: ans.Future()}, release -} - -// 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 Peeker) String() string { - return fmt.Sprintf("%T(%v)", c, capnp.Client(c)) -} - -// 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 Peeker) AddRef() Peeker { - return Peeker(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 Peeker) Release() { - capnp.Client(c).Release() -} - -// Resolve blocks until the capability is fully resolved or the Context -// expires. -func (c Peeker) Resolve(ctx context.Context) error { - return capnp.Client(c).Resolve(ctx) -} - -func (c Peeker) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Client(c).EncodeAsPtr(seg) -} - -func (Peeker) DecodeFromPtr(p capnp.Ptr) Peeker { - return Peeker(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 Peeker) 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 Peeker) IsSame(other Peeker) 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 Peeker) SetFlowLimiter(lim fc.FlowLimiter) { - capnp.Client(c).SetFlowLimiter(lim) -} - -// Get the current flowcontrol.FlowLimiter used to manage flow control -// for this client. -func (c Peeker) GetFlowLimiter() fc.FlowLimiter { - return capnp.Client(c).GetFlowLimiter() -} // A Peeker_Server is a Peeker with a local implementation. -type Peeker_Server interface { - Peek(context.Context, Peeker_peek) error -} - -// Peeker_NewServer creates a new Server from an implementation of Peeker_Server. -func Peeker_NewServer(s Peeker_Server) *server.Server { - c, _ := s.(server.Shutdowner) - return server.New(Peeker_Methods(nil, s), s, c) -} - -// Peeker_ServerToClient creates a new Client from an implementation of Peeker_Server. -// The caller is responsible for calling Release on the returned Client. -func Peeker_ServerToClient(s Peeker_Server) Peeker { - return Peeker(capnp.NewClient(Peeker_NewServer(s))) -} - -// Peeker_Methods appends Methods to a slice that invoke the methods on s. -// This can be used to create a more complicated Server. -func Peeker_Methods(methods []server.Method, s Peeker_Server) []server.Method { - if cap(methods) == 0 { - methods = make([]server.Method, 0, 1) - } - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Peek(ctx, Peeker_peek{call}) - }, - }) - - return methods -} - -// Peeker_peek holds the state for a server call to Peeker.peek. -// See server.Call for documentation. -type Peeker_peek struct { - *server.Call -} - -// Args returns the call's arguments. -func (c Peeker_peek) Args() Peeker_peek_Params { - return Peeker_peek_Params(c.Call.Args()) -} - -// AllocResults allocates the results struct. -func (c Peeker_peek) AllocResults() (Peeker_peek_Results, error) { - r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 1}) - return Peeker_peek_Results(r), err -} - -// Peeker_List is a list of Peeker. -type Peeker_List = capnp.CapList[Peeker] - -// NewPeeker creates a new list of Peeker. -func NewPeeker_List(s *capnp.Segment, sz int32) (Peeker_List, error) { - l, err := capnp.NewPointerList(s, sz) - return capnp.CapList[Peeker](l), err -} - -type Peeker_peek_Params capnp.Struct - -// Peeker_peek_Params_TypeID is the unique identifier for the type Peeker_peek_Params. -const Peeker_peek_Params_TypeID = 0xaf261efa7a102288 - -func NewPeeker_peek_Params(s *capnp.Segment) (Peeker_peek_Params, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) - return Peeker_peek_Params(st), err -} - -func NewRootPeeker_peek_Params(s *capnp.Segment) (Peeker_peek_Params, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) - return Peeker_peek_Params(st), err -} - -func ReadRootPeeker_peek_Params(msg *capnp.Message) (Peeker_peek_Params, error) { - root, err := msg.Root() - return Peeker_peek_Params(root.Struct()), err -} - -func (s Peeker_peek_Params) String() string { - str, _ := text.Marshal(0xaf261efa7a102288, capnp.Struct(s)) - return str -} - -func (s Peeker_peek_Params) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (Peeker_peek_Params) DecodeFromPtr(p capnp.Ptr) Peeker_peek_Params { - return Peeker_peek_Params(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s Peeker_peek_Params) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s Peeker_peek_Params) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s Peeker_peek_Params) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s Peeker_peek_Params) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} - -// Peeker_peek_Params_List is a list of Peeker_peek_Params. -type Peeker_peek_Params_List = capnp.StructList[Peeker_peek_Params] - -// NewPeeker_peek_Params creates a new list of Peeker_peek_Params. -func NewPeeker_peek_Params_List(s *capnp.Segment, sz int32) (Peeker_peek_Params_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) - return capnp.StructList[Peeker_peek_Params](l), err -} - -// Peeker_peek_Params_Future is a wrapper for a Peeker_peek_Params promised by a client call. -type Peeker_peek_Params_Future struct{ *capnp.Future } - -func (f Peeker_peek_Params_Future) Struct() (Peeker_peek_Params, error) { - p, err := f.Future.Ptr() - return Peeker_peek_Params(p.Struct()), err -} - -type Peeker_peek_Results capnp.Struct - -// Peeker_peek_Results_TypeID is the unique identifier for the type Peeker_peek_Results. -const Peeker_peek_Results_TypeID = 0xb42eee8bed32bea0 - -func NewPeeker_peek_Results(s *capnp.Segment) (Peeker_peek_Results, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) - return Peeker_peek_Results(st), err -} - -func NewRootPeeker_peek_Results(s *capnp.Segment) (Peeker_peek_Results, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}) - return Peeker_peek_Results(st), err -} - -func ReadRootPeeker_peek_Results(msg *capnp.Message) (Peeker_peek_Results, error) { - root, err := msg.Root() - return Peeker_peek_Results(root.Struct()), err -} - -func (s Peeker_peek_Results) String() string { - str, _ := text.Marshal(0xb42eee8bed32bea0, capnp.Struct(s)) - return str -} - -func (s Peeker_peek_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (Peeker_peek_Results) DecodeFromPtr(p capnp.Ptr) Peeker_peek_Results { - return Peeker_peek_Results(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s Peeker_peek_Results) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s Peeker_peek_Results) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s Peeker_peek_Results) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s Peeker_peek_Results) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} -func (s Peeker_peek_Results) Value() (capnp.Ptr, error) { - return capnp.Struct(s).Ptr(0) -} - -func (s Peeker_peek_Results) HasValue() bool { - return capnp.Struct(s).HasPtr(0) -} - -func (s Peeker_peek_Results) SetValue(v capnp.Ptr) error { - return capnp.Struct(s).SetPtr(0, v) -} - -// Peeker_peek_Results_List is a list of Peeker_peek_Results. -type Peeker_peek_Results_List = capnp.StructList[Peeker_peek_Results] - -// NewPeeker_peek_Results creates a new list of Peeker_peek_Results. -func NewPeeker_peek_Results_List(s *capnp.Segment, sz int32) (Peeker_peek_Results_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 1}, sz) - return capnp.StructList[Peeker_peek_Results](l), err -} - -// Peeker_peek_Results_Future is a wrapper for a Peeker_peek_Results promised by a client call. -type Peeker_peek_Results_Future struct{ *capnp.Future } - -func (f Peeker_peek_Results_Future) Struct() (Peeker_peek_Results, error) { - p, err := f.Future.Ptr() - return Peeker_peek_Results(p.Struct()), err -} -func (p Peeker_peek_Results_Future) Value() *capnp.Future { - return p.Future.Field(0, nil) -} - type Recver capnp.Client // Recver_TypeID is the unique identifier for the type Recver. @@ -1283,171 +987,6 @@ func NewSendCloser_List(s *capnp.Segment, sz int32) (SendCloser_List, error) { return capnp.CapList[SendCloser](l), err } -type PeekRecver capnp.Client - -// PeekRecver_TypeID is the unique identifier for the type PeekRecver. -const PeekRecver_TypeID = 0x9a4abff8ccb5093c - -func (c PeekRecver) Peek(ctx context.Context, params func(Peeker_peek_Params) error) (Peeker_peek_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Peeker_peek_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Peeker_peek_Results_Future{Future: ans.Future()}, release -} -func (c PeekRecver) Recv(ctx context.Context, params func(Recver_recv_Params) error) (Recver_recv_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xdf05a90d671c0c07, - MethodID: 0, - InterfaceName: "channel.capnp:Recver", - MethodName: "recv", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Recver_recv_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Recver_recv_Results_Future{Future: ans.Future()}, release -} - -// 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 PeekRecver) String() string { - return fmt.Sprintf("%T(%v)", c, capnp.Client(c)) -} - -// 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 PeekRecver) AddRef() PeekRecver { - return PeekRecver(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 PeekRecver) Release() { - capnp.Client(c).Release() -} - -// Resolve blocks until the capability is fully resolved or the Context -// expires. -func (c PeekRecver) Resolve(ctx context.Context) error { - return capnp.Client(c).Resolve(ctx) -} - -func (c PeekRecver) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Client(c).EncodeAsPtr(seg) -} - -func (PeekRecver) DecodeFromPtr(p capnp.Ptr) PeekRecver { - return PeekRecver(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 PeekRecver) 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 PeekRecver) IsSame(other PeekRecver) 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 PeekRecver) SetFlowLimiter(lim fc.FlowLimiter) { - capnp.Client(c).SetFlowLimiter(lim) -} - -// Get the current flowcontrol.FlowLimiter used to manage flow control -// for this client. -func (c PeekRecver) GetFlowLimiter() fc.FlowLimiter { - return capnp.Client(c).GetFlowLimiter() -} // A PeekRecver_Server is a PeekRecver with a local implementation. -type PeekRecver_Server interface { - Peek(context.Context, Peeker_peek) error - - Recv(context.Context, Recver_recv) error -} - -// PeekRecver_NewServer creates a new Server from an implementation of PeekRecver_Server. -func PeekRecver_NewServer(s PeekRecver_Server) *server.Server { - c, _ := s.(server.Shutdowner) - return server.New(PeekRecver_Methods(nil, s), s, c) -} - -// PeekRecver_ServerToClient creates a new Client from an implementation of PeekRecver_Server. -// The caller is responsible for calling Release on the returned Client. -func PeekRecver_ServerToClient(s PeekRecver_Server) PeekRecver { - return PeekRecver(capnp.NewClient(PeekRecver_NewServer(s))) -} - -// PeekRecver_Methods appends Methods to a slice that invoke the methods on s. -// This can be used to create a more complicated Server. -func PeekRecver_Methods(methods []server.Method, s PeekRecver_Server) []server.Method { - if cap(methods) == 0 { - methods = make([]server.Method, 0, 2) - } - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Peek(ctx, Peeker_peek{call}) - }, - }) - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xdf05a90d671c0c07, - MethodID: 0, - InterfaceName: "channel.capnp:Recver", - MethodName: "recv", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Recv(ctx, Recver_recv{call}) - }, - }) - - return methods -} - -// PeekRecver_List is a list of PeekRecver. -type PeekRecver_List = capnp.CapList[PeekRecver] - -// NewPeekRecver creates a new list of PeekRecver. -func NewPeekRecver_List(s *capnp.Segment, sz int32) (PeekRecver_List, error) { - l, err := capnp.NewPointerList(s, sz) - return capnp.CapList[PeekRecver](l), err -} - type Chan capnp.Client // Chan_TypeID is the unique identifier for the type Chan. @@ -1643,300 +1182,56 @@ func NewChan_List(s *capnp.Segment, sz int32) (Chan_List, error) { return capnp.CapList[Chan](l), err } -type PeekableChan capnp.Client - -// PeekableChan_TypeID is the unique identifier for the type PeekableChan. -const PeekableChan_TypeID = 0xb527cbca9bbd8178 - -func (c PeekableChan) Send(ctx context.Context, params func(Sender_send_Params) error) (stream.StreamResult_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xe8bbed1438ea16ee, - MethodID: 0, - InterfaceName: "channel.capnp:Sender", - MethodName: "send", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 1} - s.PlaceArgs = func(s capnp.Struct) error { return params(Sender_send_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return stream.StreamResult_Future{Future: ans.Future()}, release -} -func (c PeekableChan) Close(ctx context.Context, params func(Closer_close_Params) error) (Closer_close_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xfad0e4b80d3779c3, - MethodID: 0, - InterfaceName: "channel.capnp:Closer", - MethodName: "close", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Closer_close_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Closer_close_Results_Future{Future: ans.Future()}, release -} -func (c PeekableChan) Peek(ctx context.Context, params func(Peeker_peek_Params) error) (Peeker_peek_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Peeker_peek_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Peeker_peek_Results_Future{Future: ans.Future()}, release -} -func (c PeekableChan) Recv(ctx context.Context, params func(Recver_recv_Params) error) (Recver_recv_Results_Future, capnp.ReleaseFunc) { - s := capnp.Send{ - Method: capnp.Method{ - InterfaceID: 0xdf05a90d671c0c07, - MethodID: 0, - InterfaceName: "channel.capnp:Recver", - MethodName: "recv", - }, - } - if params != nil { - s.ArgsSize = capnp.ObjectSize{DataSize: 0, PointerCount: 0} - s.PlaceArgs = func(s capnp.Struct) error { return params(Recver_recv_Params(s)) } - } - ans, release := capnp.Client(c).SendCall(ctx, s) - return Recver_recv_Results_Future{Future: ans.Future()}, release -} - -// 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 PeekableChan) String() string { - return fmt.Sprintf("%T(%v)", c, capnp.Client(c)) -} - -// 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 PeekableChan) AddRef() PeekableChan { - return PeekableChan(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 PeekableChan) Release() { - capnp.Client(c).Release() -} - -// Resolve blocks until the capability is fully resolved or the Context -// expires. -func (c PeekableChan) Resolve(ctx context.Context) error { - return capnp.Client(c).Resolve(ctx) -} - -func (c PeekableChan) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Client(c).EncodeAsPtr(seg) -} - -func (PeekableChan) DecodeFromPtr(p capnp.Ptr) PeekableChan { - return PeekableChan(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 PeekableChan) 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 PeekableChan) IsSame(other PeekableChan) 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 PeekableChan) SetFlowLimiter(lim fc.FlowLimiter) { - capnp.Client(c).SetFlowLimiter(lim) -} - -// Get the current flowcontrol.FlowLimiter used to manage flow control -// for this client. -func (c PeekableChan) GetFlowLimiter() fc.FlowLimiter { - return capnp.Client(c).GetFlowLimiter() -} // A PeekableChan_Server is a PeekableChan with a local implementation. -type PeekableChan_Server interface { - Send(context.Context, Sender_send) error - - Close(context.Context, Closer_close) error - - Peek(context.Context, Peeker_peek) error - - Recv(context.Context, Recver_recv) error -} - -// PeekableChan_NewServer creates a new Server from an implementation of PeekableChan_Server. -func PeekableChan_NewServer(s PeekableChan_Server) *server.Server { - c, _ := s.(server.Shutdowner) - return server.New(PeekableChan_Methods(nil, s), s, c) -} - -// PeekableChan_ServerToClient creates a new Client from an implementation of PeekableChan_Server. -// The caller is responsible for calling Release on the returned Client. -func PeekableChan_ServerToClient(s PeekableChan_Server) PeekableChan { - return PeekableChan(capnp.NewClient(PeekableChan_NewServer(s))) -} - -// PeekableChan_Methods appends Methods to a slice that invoke the methods on s. -// This can be used to create a more complicated Server. -func PeekableChan_Methods(methods []server.Method, s PeekableChan_Server) []server.Method { - if cap(methods) == 0 { - methods = make([]server.Method, 0, 4) - } - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xe8bbed1438ea16ee, - MethodID: 0, - InterfaceName: "channel.capnp:Sender", - MethodName: "send", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Send(ctx, Sender_send{call}) - }, - }) - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xfad0e4b80d3779c3, - MethodID: 0, - InterfaceName: "channel.capnp:Closer", - MethodName: "close", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Close(ctx, Closer_close{call}) - }, - }) - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xe95c7f9f41bf520a, - MethodID: 0, - InterfaceName: "channel.capnp:Peeker", - MethodName: "peek", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Peek(ctx, Peeker_peek{call}) - }, - }) - - methods = append(methods, server.Method{ - Method: capnp.Method{ - InterfaceID: 0xdf05a90d671c0c07, - MethodID: 0, - InterfaceName: "channel.capnp:Recver", - MethodName: "recv", - }, - Impl: func(ctx context.Context, call *server.Call) error { - return s.Recv(ctx, Recver_recv{call}) - }, - }) - - return methods -} - -// PeekableChan_List is a list of PeekableChan. -type PeekableChan_List = capnp.CapList[PeekableChan] - -// NewPeekableChan creates a new list of PeekableChan. -func NewPeekableChan_List(s *capnp.Segment, sz int32) (PeekableChan_List, error) { - l, err := capnp.NewPointerList(s, sz) - return capnp.CapList[PeekableChan](l), err -} - -const schema_872a451f9aa74ebf = "x\xda\x8cU]h#U\x14>'s\xefL\x1b6" + - "N'\xb7\xaeD\xb6\x06\xa4l`\xc1\xb0\xb6\xe0\xca\xb2" + - "\xe2\x86 \x01\xa1K\xa6ZP\x08\xc8\x98\xdeZh\x1a" + - "K\xd2\xd4\xa6P\xa4O*}\xf0\xc5>4*\xb5O" + - "\xc5\xbcT\xc1\x82\xe0O\x15_lZ\xc1>\x14\xacX" + - "|\xb1\xd8\x16Z\x11\x04\xa5 \xb3\xdc\x19\xe6'\xcd$" + - "\xedS\xcb\xe4;\xe7\xfb\xce9\xdf9\xf7v:t\x9f" + - "<\x1d\xf9K\x81\x90\x9e\xa3\xb2\xd9\x98=}\xee\xa3\xaf" + - "\xc7\x16@{\x14\x01(*=8x \x85\x11\x90\x1d" + - "J\xcf\x03\x9a\xfa\xbfc\xfb\x7f\xae\xfc\xb8\x04\xda#\x92" + - "\xb9\xf9`\xad\x16\x7f\xe1\xd6;\x00\xd0\x83\x8c\x92\x1a\x8b" + - "\x10\x05\x80u\x13\x85u\x93\x04\xab\x12\xd5\xbc\xd7\xbd\xb1" + - "\xf3\xdf\xe6\x8b\xb5\x80\x80I\xd2`U+\xa0B\x14V" + - "!\x09vHT\xf3\xdd'{\xe6\xce\x9f\xb8\xb9nK" + - " B\xc1>\x09#\x10\xf3\x83\xebw\xc3C\xef\x1f}" + - "\xe6\x17\xf7=\x89\x0aq[D\x88\xfb\xe4\xdb\x81\xd3\xc5" + - "\xb3\xe4\x17~\xc0\xb1\x0d\xf8\xdb\x02\xcc.|\xf3ac" + - ";\xb1\x11 F\xa3\xbf\xb2>*\xc4\xc4\xa8\xc2b4" + - "\xc1\xde\xa3\xaay\xf2\xcf\xdc\xe2z\xeel\xdb\x11\x030" + - "8O\x1f\x17bNn\xf6G~\x9b\xbfs\xe0\x93\xc9" + - "\xa9%S\xb9v\xe3\x8d\xc8\xa7\xf4\xf7\x00\x92!Zg" + - "#\x16\x89N3l\x95*l\x95\xaa\xe6\xd9\xf5\x93g" + - "{O\xbf:\x0a\x08X\xa2u\xf6\xb1\x15\xb0L3l" + - "\x8f*l\x8f\xaafxx3\xb5\xf2v\xee8 `" + - "\x8b\xd6\xd9\xae\x15\xf0\x13\xcd\xb0>Ya}\xb2j>" + - "8\xee\x9d\xaf\xed\xae\x05\x05hrC\xc0D\xdd\xb2\xc2" + - "br\x82\xbd*\xab\xe6\x0f\xd5;\x91/\xff\xf8\xf9\xfc" + - "B\x00\xb2!\xb9\xceF,\xb8.gXU\xfcg\xde" + - "{\xe5\x99\x9d\xd5_\x94\xff}M2\xe4(B\xce\xcc" + - "\x8f\x1b\xc5\"/$\xa5\xbc1U\x9c\xba\xfb\x12/\x8e" + - "\xf2R\xb2\xcc\x8b\xa3\xfdY\xa3dL\x96\x01t\"\x11" + - "\x00\x82\x00Zd\x00@\xef\x92P\xef\x0da|\xc6(" + - "T8F\x11\xbd\xf6\x00`\x14\xd0M\x8av\xd2\xf4\xb8" + - "d\x14\xb3\x88Y\x89\xea]\x88^\xad\xa9.\xf4f\x91" + - "\xba\x8d\x1a\xc6u\x12\xf2\x01\x004|L'\x88\"\x18" + - "-.\xd7\xde\xe27\x1b\xee\xa6\xe8\x0cO\x11\xd40\x8a" + - "/\xbb\xf2B\xb6\xbc,\xe7\x13\xc3" + - "\x95\xee\x08\xdb\xa9t\x01\x01\xb4\xeeN]M\xa5\x0f\xde" + - "\xa2R\xf2T\xf2Rr\x8a\xf3\x09w2\x171v\x15" + - "\xc9\x12\xcf\xcf\xf4\x0f\xf3r\xa50\x8d\xe5\xcb\xa7\xe7\x13" + - "\xd64\xbd\x00\xe2\xab'\xf55\xa7)\xa9\xaf\xe7\xc6\xeb" + - "\x05\xde\xd1\x1anW\xaeh\x0d\xf7vxMo\x9aC" + - "{x\xbb\xa6\xa7\x0bo\x96y)\x99\x17\x7f\xec\xe2\xa5" + - "\xe9r\xa7\xae\xb7L\x06\x1d\x8c*@YD\x9dH\x14" + - "\xc0=N\xe8\x9cLM\xbb\x05\x90\xba\x86\xa9\x1b\xa8=" + - "\xa5\xa8\"[\x8bs\x10\x03\xec$>\xde\xc7,bK" + - "\x11\xe8\xec\xb4*\x96\xda\xe3v\x9e\x10,~\xfe\xdd[" + - "\x83\xb5\xd7\x96\x1dn\x00-\xa6\xa8b\xf9\x1d\x16w\xb3" + - "/e\xc9rU\xf8\xc4cq^\x09tn\xfe\x85\x0a" + - "\x85\xa1ZV\xc9_a\xd3\xc7`\xee\x90w\xb5\xecQ" + - "5m\xb0+^\x98\xc9\xbd\x97\x1e\x81\xefl\xb5\x98\xc3" + - "\xe7\xb3v\x15\xa7\x0b\xaa\xa0\xf4*v\xae,:o\x92" + - "\xa6\x0d@H\xa3J\xdc2\x90UBG\x87Y\xee\xc1" + - "\xf2\xc3\x00\x00\x00\xff\xffJJ5\xbb" +const schema_872a451f9aa74ebf = "x\xda\x84TOHT]\x1c\xfd\x9d\xb9\xf7\xf9\xfc\xc4" + + "\xf7=\xef\\??\xbe\x0fa6\x92$8\xa8\x03\x19" + + "R\xe4 b-\x94yV\xd0B\x88a|\xe6b|" + + "\xc9<\xb5?\xe0\xa2UHD\x08\xb5p(\xc2\x95\xe4" + + "\xa6\xda\x15\x05\x05m\xc2Z\xe4\"HH\xda\x04\xa9\xa0" + + "\xab \x08\xe2\xc5}\xd3\xfb\x93\x8e\xb6\x9aa\xee\xf9\x9d" + + "s\xcf\xf9\x9d;\x1ds\xe8\xe5\x9dFw\x0d%\xac\x93" + + "Z\x8d\xb7ry\xfb\xf8\xdd\xe7c\xd7H\xfc\x03\"\x0d" + + "z\x032`u \xc8\xbf\xd8\x09\x82g}\x1b[\xfb" + + "r\xff\xf5\x1d\x12\x7f3\xef\xc5\xd0R9\xd5\xdfv\x9d" + + "\x88\x1a \x0f\xb3\xb2\xecd:\x91lg\xbalg\xad" + + "\xf2\x1e3\xbd\xdbM=u\x83\xb76\x1e\xc5\x19\xe7Y" + + "R1.\xf8\x8c[_\xaf\xdex8\xb2\xf3\xa6\x02\xe0" + + ":Q\xe6)\xfb\x1f\xc4\xbd\xadC-\xc6\xc7\xd9\xee\xf5" + + "\xe0\xa4\x01\x99Eu\x17\xee\xe9\xf5\xcd\x17\x8c\x07\xda\xa7" + + "*\xb7\x98c\xcbr\xde\xbf\xc5M6 \xd7\x99.\xd7" + + "\x99\xe9\xed4m\x1dm\xdc~\xb6Qe`\x95-\xcb" + + "5\x7f\xe0=\x1b\x90\x82\xebRp\xd3\x1b\xdal\x9c-" + + "\xaf.mV\x19\xd0\xf8\x8a\x82\x11I\x83\xeb\xd2\xe0\xad" + + "r\x90\x9b\xde\xab+\xdd\xc6\x93\xcf\xef\xbe\xef\x1a\x80\xcc" + + "\xf2ey\xca\x87\xf7\xf3\x019\xa1\xbey\xc7\xce\x1dy" + + "\xbb\xf8A\xff\x11\xf3|\x96'A#^a<\xef8" + + "v1\xcd\x0a\xf9Ig\xb2\xe7\xb4\xed\x8c\xda\xa5\xb4k" + + ";\xa3-\xb9|)?\xe1\x12Y\x9cq\"\x0e\"a" + + "t\x11Y\xb5\x0cVc\x02\xa9\x99|q\xdaF\x12\x88" + + "\xdc\x12!I\x08IQ!\xed\x1bgy'\x07\xe4\x98" + + "f\xd5\x02\x91\xd7l-\xa2h\xb3\x1d\x10HY<\x11" + + "\x03\x10\x09\xfckq@\x0d\xc3\xd7\x0a\x0b\xa1\xce*\xf0" + + "\x90\xe2`x\x96C \x893\xbb=\x0f\xdb\x85\x19\xbb" + + "\x94.\xd9\x85\x99\x96a\xdb\x9d.N\xc1\xfd\xb3\xe7\x98" + + "\xe8o\x9e\x7f\x91\xf6\x15/\xbav)]P\x1f\x15V" + + "6\xe5\x1e\xa4\x1c\xa4\xbd;\xbca\xdbT\xa0\x1c`q" + + "\xa6\x11\x85-E\xd0t!\xda\x88\xb2\xf5\xc86C\xb4" + + "\xeb\xa6b\xdb\x93\x0cP%.\xf5c/r\xc0\x9ed" + + "\x10\xb4\xc1Tu\x88\xb4\x83\xe7\x0a\xe7\xf1\xcbK\x99\xf2" + + "\xf9\x85@\x9bH\xfc\xa7\x9b\xaa6\x81J\xd8\x89\xfdU" + + "\x12Q\xe7*q\x11\xc5Z\x12\x12\xa8\x96\x84m\x8fl" + + "\xc4J\xb7g\xeb\xb1\x02\xed\xe7\xad\xafh*\xc9\xc8[" + + "\xf0F\x10\xfcA\x08\xd1E\x09\xa1\xe9)\x7f\x89\xbe\x85" + + "\x03\xb7\xeco\x10\xee\xcf\x00\x00\x00\xff\xff<\x8e\\|" func init() { schemas.Register(schema_872a451f9aa74ebf, 0x8166bc9c3ded78ca, 0x95c89fe7d966f751, - 0x9a4abff8ccb5093c, - 0xaf261efa7a102288, 0xb0e88f4d0a3a1694, - 0xb42eee8bed32bea0, - 0xb527cbca9bbd8178, 0xcbee5caf8b7af4ea, 0xdd377ddc0d2426ea, 0xdf05a90d671c0c07, 0xe8bbed1438ea16ee, - 0xe95c7f9f41bf520a, 0xe9a7d19a7d14e94e, 0xfad0e4b80d3779c3, 0xfd07d8a1cc36583c) diff --git a/internal/mock/pkg/csp/chan.go b/internal/mock/pkg/csp/chan.go index 0f6c1b77..96e86028 100644 --- a/internal/mock/pkg/csp/chan.go +++ b/internal/mock/pkg/csp/chan.go @@ -123,43 +123,6 @@ func (mr *MockRecvServerMockRecorder) Recv(arg0, arg1 interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockRecvServer)(nil).Recv), arg0, arg1) } -// MockPeekServer is a mock of PeekServer interface. -type MockPeekServer struct { - ctrl *gomock.Controller - recorder *MockPeekServerMockRecorder -} - -// MockPeekServerMockRecorder is the mock recorder for MockPeekServer. -type MockPeekServerMockRecorder struct { - mock *MockPeekServer -} - -// NewMockPeekServer creates a new mock instance. -func NewMockPeekServer(ctrl *gomock.Controller) *MockPeekServer { - mock := &MockPeekServer{ctrl: ctrl} - mock.recorder = &MockPeekServerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeekServer) EXPECT() *MockPeekServerMockRecorder { - return m.recorder -} - -// Peek mocks base method. -func (m *MockPeekServer) Peek(arg0 context.Context, arg1 csp.MethodPeek) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Peek indicates an expected call of Peek. -func (mr *MockPeekServerMockRecorder) Peek(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPeekServer)(nil).Peek), arg0, arg1) -} - // MockSendCloseServer is a mock of SendCloseServer interface. type MockSendCloseServer struct { ctrl *gomock.Controller @@ -211,57 +174,6 @@ func (mr *MockSendCloseServerMockRecorder) Send(arg0, arg1 interface{}) *gomock. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSendCloseServer)(nil).Send), arg0, arg1) } -// MockPeekRecvServer is a mock of PeekRecvServer interface. -type MockPeekRecvServer struct { - ctrl *gomock.Controller - recorder *MockPeekRecvServerMockRecorder -} - -// MockPeekRecvServerMockRecorder is the mock recorder for MockPeekRecvServer. -type MockPeekRecvServerMockRecorder struct { - mock *MockPeekRecvServer -} - -// NewMockPeekRecvServer creates a new mock instance. -func NewMockPeekRecvServer(ctrl *gomock.Controller) *MockPeekRecvServer { - mock := &MockPeekRecvServer{ctrl: ctrl} - mock.recorder = &MockPeekRecvServerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeekRecvServer) EXPECT() *MockPeekRecvServerMockRecorder { - return m.recorder -} - -// Peek mocks base method. -func (m *MockPeekRecvServer) Peek(arg0 context.Context, arg1 csp.MethodPeek) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Peek indicates an expected call of Peek. -func (mr *MockPeekRecvServerMockRecorder) Peek(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPeekRecvServer)(nil).Peek), arg0, arg1) -} - -// Recv mocks base method. -func (m *MockPeekRecvServer) Recv(arg0 context.Context, arg1 csp.MethodRecv) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Recv indicates an expected call of Recv. -func (mr *MockPeekRecvServerMockRecorder) Recv(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPeekRecvServer)(nil).Recv), arg0, arg1) -} - // MockChanServer is a mock of ChanServer interface. type MockChanServer struct { ctrl *gomock.Controller @@ -326,82 +238,3 @@ func (mr *MockChanServerMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockChanServer)(nil).Send), arg0, arg1) } - -// MockPeekableServer is a mock of PeekableServer interface. -type MockPeekableServer struct { - ctrl *gomock.Controller - recorder *MockPeekableServerMockRecorder -} - -// MockPeekableServerMockRecorder is the mock recorder for MockPeekableServer. -type MockPeekableServerMockRecorder struct { - mock *MockPeekableServer -} - -// NewMockPeekableServer creates a new mock instance. -func NewMockPeekableServer(ctrl *gomock.Controller) *MockPeekableServer { - mock := &MockPeekableServer{ctrl: ctrl} - mock.recorder = &MockPeekableServerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockPeekableServer) EXPECT() *MockPeekableServerMockRecorder { - return m.recorder -} - -// Close mocks base method. -func (m *MockPeekableServer) Close(arg0 context.Context, arg1 csp.MethodClose) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Close", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Close indicates an expected call of Close. -func (mr *MockPeekableServerMockRecorder) Close(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPeekableServer)(nil).Close), arg0, arg1) -} - -// Peek mocks base method. -func (m *MockPeekableServer) Peek(arg0 context.Context, arg1 csp.MethodPeek) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Peek", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Peek indicates an expected call of Peek. -func (mr *MockPeekableServerMockRecorder) Peek(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Peek", reflect.TypeOf((*MockPeekableServer)(nil).Peek), arg0, arg1) -} - -// Recv mocks base method. -func (m *MockPeekableServer) Recv(arg0 context.Context, arg1 csp.MethodRecv) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Recv", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Recv indicates an expected call of Recv. -func (mr *MockPeekableServerMockRecorder) Recv(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockPeekableServer)(nil).Recv), arg0, arg1) -} - -// Send mocks base method. -func (m *MockPeekableServer) Send(arg0 context.Context, arg1 csp.MethodSend) error { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Send", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Send indicates an expected call of Send. -func (mr *MockPeekableServerMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockPeekableServer)(nil).Send), arg0, arg1) -} diff --git a/pkg/csp/chan.go b/pkg/csp/chan.go index 3cfe3194..461cc923 100644 --- a/pkg/csp/chan.go +++ b/pkg/csp/chan.go @@ -22,7 +22,6 @@ type ( MethodClose = channel.Closer_close MethodSend = channel.Sender_send MethodRecv = channel.Recver_recv - MethodPeek = channel.Peeker_peek ) type CloseServer interface { @@ -37,31 +36,17 @@ type RecvServer interface { Recv(context.Context, MethodRecv) error } -type PeekServer interface { - Peek(context.Context, MethodPeek) error -} - type SendCloseServer interface { SendServer CloseServer } -type PeekRecvServer interface { - PeekServer - RecvServer -} - type ChanServer interface { CloseServer SendServer RecvServer } -type PeekableServer interface { - ChanServer - PeekServer -} - type Value func(channel.Sender_send_Params) error // Ptr takes any capnp pointer and converts it into a value @@ -198,32 +183,6 @@ func (c Chan) Release() { capnp.Client(c).Release() } -type PeekableChan channel.Chan - -func (c PeekableChan) Close(ctx context.Context) error { - return Closer(c).Close(ctx) -} - -func NewPeekableChan(s PeekableServer) PeekableChan { - return PeekableChan(channel.PeekableChan_ServerToClient(s)) -} - -func (c PeekableChan) Send(ctx context.Context, v Value) (casm.Future, capnp.ReleaseFunc) { - return Sender(c).Send(ctx, v) -} - -func (c PeekableChan) Recv(ctx context.Context) (Future, capnp.ReleaseFunc) { - return Recver(c).Recv(ctx) -} - -func (c PeekableChan) AddRef() PeekableChan { - return PeekableChan(capnp.Client(c).AddRef()) -} - -func (c PeekableChan) Release() { - capnp.Client(c).Release() -} - type SendCloser Chan func NewSendCloser(sc SendCloseServer) SendCloser { @@ -253,28 +212,6 @@ func (sc SendCloser) Release() { capnp.Client(sc).Release() } -type PeekRecver Chan - -func NewPeekRecver(pr PeekRecvServer) PeekRecver { - return PeekRecver(channel.PeekRecver_ServerToClient(pr)) -} - -func (pr PeekRecver) Peek(ctx context.Context) (Future, capnp.ReleaseFunc) { - return Peeker(pr).Peek(ctx) -} - -func (pr PeekRecver) Recv(ctx context.Context) (Future, capnp.ReleaseFunc) { - return Recver(pr).Recv(ctx) -} - -func (pr PeekRecver) AddRef() PeekRecver { - return PeekRecver(capnp.Client(pr).AddRef()) -} - -func (pr PeekRecver) Release() { - capnp.Client(pr).Release() -} - type Sender Chan func NewSender(s SendServer) Sender { @@ -307,25 +244,6 @@ func (s Sender) Release() { capnp.Client(s).Release() } -type Peeker Chan - -func NewPeeker(p PeekServer) Peeker { - return Peeker(channel.Peeker_ServerToClient(p)) -} - -func (p Peeker) Peek(ctx context.Context) (Future, capnp.ReleaseFunc) { - f, release := channel.Peeker(p).Peek(ctx, nil) - return Future(f), release -} - -func (p Peeker) AddRef() Peeker { - return Peeker(capnp.Client(p).AddRef()) -} - -func (p Peeker) Release() { - capnp.Client(p).Release() -} - type Recver Chan func NewRecver(r RecvServer) Recver {