diff --git a/api/pubsub.capnp b/api/pubsub.capnp index 0f43e7a5..8d1580fb 100644 --- a/api/pubsub.capnp +++ b/api/pubsub.capnp @@ -7,10 +7,11 @@ $Go.import("github.com/wetware/ww/internal/api/pubsub"); interface Topic { - publish @0 (msg :Data) -> (); + publish @0 (msg :Data) -> stream; subscribe @1 (chan :Sender(Data), buf :UInt16 = 32) -> (); name @2 () -> (name :Text); + using Sender = import "channel.capnp".Sender; } diff --git a/internal/api/cluster/cluster.capnp.go b/internal/api/cluster/cluster.capnp.go index 40bc0ff0..864f4ca2 100644 --- a/internal/api/cluster/cluster.capnp.go +++ b/internal/api/cluster/cluster.capnp.go @@ -907,39 +907,39 @@ func (p Host_debug_Results_Future) Debugger() capnp.Client { return p.Future.Field(0, nil).Client() } -const schema_fcf6ac08e448a6ac = "x\xda\x8c\x92Mh\x13A\x14\xc7\xdf\x7ff\xb2\xdb\xd6" + - "\xa6q\xb2\x1e*\xa2B\xcd\xc1\xf4P\xadR\xd4\\\x12" + - "\x0f\x85\xe2\x07d\xedA\x05A\x93t)B51\xbb" + - "[/\x9e\x84\x82\"D\x10=\xe8M(\x82R\xbc\x88" + - "\x88\x88\x11<\x0a\x1eD=\x08\xe2)\xf5$\xc5\x0f*" + - "T\x02#\xb3\xc9&k\xad\xd8\xdb\xc2\xfb\xed\xff\xbd\xf7" + - "{\xb3{\x17\xcb\x89\xd1\xf8\x8b~b\xf6\xcd\x98\xa1\xea" + - "O\x96\x16w\xec\xbcv\x99\xa4\x05\"a\x12Y\xe3\xc6" + - "/\x12\xeaG\xe9\xfb\xd7m\xb5/W\xbb\x85\xbdi\x83" + - "\x81\x84Z~wd\xaev\xe3\xc4\xf5V%\x06]\x8a" + - "\xeb\x12,id\x09\xca|{z\xaaY\xbft\x8b\xe4" + - "\x00W\x0b\xf7&\x1a=\x0b?\x9bD\xb0F\x8d;\xd6" + - "\x01C\xf3c\x86\x09\xeb\xbd\xfeT\x8d\xa7\xfe\xe4\xe1\x97" + - "b>2\xc1\xf3`\x82\xb4H<\xe4g\x06\xeb\xd1>" + - "w\x8d>\xdd\xe7~\xd0g\xc3\xf8\xf1\xf9\xb9S\xcf^" + - "E\x81\xd7\xadA\xde\x04\xc0\xd2@\xef\xb2\xbfr\xe5c" + - "\x14\xf8f$5\xb0\x12\x00\xb7\x1f4c\xfe\xd0\xe3\xc5" + - "\xc8\x92\x9b\xcd>\x90\xa2\xfd\xaa4\xe3\xbb\x9eS\x1da" + - "\xa5B\xe5|%3Qv\xbd\x91j\xb9\xec\xa5\xb2\xf9" + - "B\xb5p\xce\xed\x00f\x04\x98r\x8a\xfet\xaa\x05P" + - "\x08D\xea\xb3g\x9d\x8b\xa9c\x8e\xeb\xcfx.\xd9\x82" + - "\x0b\"\x01\"\x19\x1f&\xb2{8\xecM\x0c\x09\x0d!" + - ")8\x01IB\xa7\x0f\xc2\x1c\xeezy\xc0\xde\xc8c" + - "\x11}\x08\xcf\"/\x0c\x13\x93\x8e\x89\xeez\x08E\xc8" + - "\x93\x19b\xf2\xa8\x09\xd69\xe0'F\x1a\xf1>" + + "\x81\xb9J\xf79o\xea>\xab\xf7\x1e\x9e\x9f;\xf6\xf4" + + "E\x1c\xb8m\x86\x83\xdc\x09\x81\xc5\xe1\xc1\xa5\xe0\xfb\xc5" + + "\xb7q\xe0\xb9\x99\xd2\xc0\xcb\x10\xb8y\xbfm\x04\xa3\x8f" + + "Z\xb1%?\xe9\x0e\x8a\xb6\xaa\xd2L\xe0\xf9nm\x82" + + "\x95\x0a\xd5\xd3\xd5\xccd\xc5\xf3'j\x95\x8a\x9f\xce\xe6" + + "\x0b\xb5\xc2)\xaf\x07X1`\xda-\x06\xe5t\x07\xa0" + + "\x08\x88\xd5gO\xbag\xd3\x87\\/\x98\xf1=r\x04" + + "\x17D\x02D21N\xe4\x0cp8k\x19\x92\x1aB" + + "Jp\x02R\x84^\x1fD9\xdc\xf3\xf3\x80\xb3\x86\x1b" + + "1}\x88\xce\"\xcf\x8c\x13\x93\xae\x85\xfez\x88D\xc8" + + "\xa3\x19b\xf2\xa0\x05\xd6;<\"\x8br\x8f\xfeo\x97" + + "\x05\xde\xbb=\xa2\x13\xc8\xb1\x1d\xc4\xe4\x06+\x1c-\x87" + + "l5(N\x05\xc5\x1c\x92ZH\x0e\x9b\xc2\xb5s\xc8" + + "\x03+j\x0b\xb7^\xae\x8d\xff\xa1-\xf2\xf2\x9b\x98}" + + "D\xce\x10\x873\xc2\xa0B\xac\xec\xd6\x88h\x05?|" + + "\xf9\xa1\xfe\xe5YC\x90j\xf4M}\xb0\xb9;\xd5$" + + "\x02\xe4_\xf2:\x0bw\x13\xe1\xc5\x133\xfd\xc4\xae\x17" + + "H\x95\xa9\xcc\xae\xff\xf00\xff\xee?2\xbb\x8f\x85~" + + "\x05\x00\x00\xff\xff\xc3#\x08\xbf" func init() { schemas.Register(schema_fcf6ac08e448a6ac, diff --git a/internal/api/pubsub/pubsub.capnp.go b/internal/api/pubsub/pubsub.capnp.go index 3409ffb3..ce6fe08a 100644 --- a/internal/api/pubsub/pubsub.capnp.go +++ b/internal/api/pubsub/pubsub.capnp.go @@ -8,6 +8,7 @@ import ( 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" fmt "fmt" channel "github.com/wetware/ww/internal/api/channel" @@ -18,7 +19,7 @@ type Topic capnp.Client // Topic_TypeID is the unique identifier for the type Topic. const Topic_TypeID = 0x986ea9282f106bb0 -func (c Topic) Publish(ctx context.Context, params func(Topic_publish_Params) error) (Topic_publish_Results_Future, capnp.ReleaseFunc) { +func (c Topic) Publish(ctx context.Context, params func(Topic_publish_Params) error) (stream.StreamResult_Future, capnp.ReleaseFunc) { s := capnp.Send{ Method: capnp.Method{ InterfaceID: 0x986ea9282f106bb0, @@ -32,7 +33,7 @@ func (c Topic) Publish(ctx context.Context, params func(Topic_publish_Params) er s.PlaceArgs = func(s capnp.Struct) error { return params(Topic_publish_Params(s)) } } ans, release := capnp.Client(c).SendCall(ctx, s) - return Topic_publish_Results_Future{Future: ans.Future()}, release + return stream.StreamResult_Future{Future: ans.Future()}, release } func (c Topic) Subscribe(ctx context.Context, params func(Topic_subscribe_Params) error) (Topic_subscribe_Results_Future, capnp.ReleaseFunc) { s := capnp.Send{ @@ -211,9 +212,9 @@ func (c Topic_publish) Args() Topic_publish_Params { } // AllocResults allocates the results struct. -func (c Topic_publish) AllocResults() (Topic_publish_Results, error) { +func (c Topic_publish) AllocResults() (stream.StreamResult, error) { r, err := c.Call.AllocResults(capnp.ObjectSize{DataSize: 0, PointerCount: 0}) - return Topic_publish_Results(r), err + return stream.StreamResult(r), err } // Topic_subscribe holds the state for a server call to Topic.subscribe. @@ -336,71 +337,6 @@ func (f Topic_publish_Params_Future) Struct() (Topic_publish_Params, error) { return Topic_publish_Params(p.Struct()), err } -type Topic_publish_Results capnp.Struct - -// Topic_publish_Results_TypeID is the unique identifier for the type Topic_publish_Results. -const Topic_publish_Results_TypeID = 0x9d3775c65b79b54c - -func NewTopic_publish_Results(s *capnp.Segment) (Topic_publish_Results, error) { - st, err := capnp.NewStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) - return Topic_publish_Results(st), err -} - -func NewRootTopic_publish_Results(s *capnp.Segment) (Topic_publish_Results, error) { - st, err := capnp.NewRootStruct(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}) - return Topic_publish_Results(st), err -} - -func ReadRootTopic_publish_Results(msg *capnp.Message) (Topic_publish_Results, error) { - root, err := msg.Root() - return Topic_publish_Results(root.Struct()), err -} - -func (s Topic_publish_Results) String() string { - str, _ := text.Marshal(0x9d3775c65b79b54c, capnp.Struct(s)) - return str -} - -func (s Topic_publish_Results) EncodeAsPtr(seg *capnp.Segment) capnp.Ptr { - return capnp.Struct(s).EncodeAsPtr(seg) -} - -func (Topic_publish_Results) DecodeFromPtr(p capnp.Ptr) Topic_publish_Results { - return Topic_publish_Results(capnp.Struct{}.DecodeFromPtr(p)) -} - -func (s Topic_publish_Results) ToPtr() capnp.Ptr { - return capnp.Struct(s).ToPtr() -} -func (s Topic_publish_Results) IsValid() bool { - return capnp.Struct(s).IsValid() -} - -func (s Topic_publish_Results) Message() *capnp.Message { - return capnp.Struct(s).Message() -} - -func (s Topic_publish_Results) Segment() *capnp.Segment { - return capnp.Struct(s).Segment() -} - -// Topic_publish_Results_List is a list of Topic_publish_Results. -type Topic_publish_Results_List = capnp.StructList[Topic_publish_Results] - -// NewTopic_publish_Results creates a new list of Topic_publish_Results. -func NewTopic_publish_Results_List(s *capnp.Segment, sz int32) (Topic_publish_Results_List, error) { - l, err := capnp.NewCompositeList(s, capnp.ObjectSize{DataSize: 0, PointerCount: 0}, sz) - return capnp.StructList[Topic_publish_Results](l), err -} - -// Topic_publish_Results_Future is a wrapper for a Topic_publish_Results promised by a client call. -type Topic_publish_Results_Future struct{ *capnp.Future } - -func (f Topic_publish_Results_Future) Struct() (Topic_publish_Results, error) { - p, err := f.Future.Ptr() - return Topic_publish_Results(p.Struct()), err -} - type Topic_subscribe_Params capnp.Struct // Topic_subscribe_Params_TypeID is the unique identifier for the type Topic_subscribe_Params. @@ -1025,53 +961,51 @@ func (p Router_join_Results_Future) Topic() Topic { return Topic(p.Future.Field(0, nil).Client()) } -const schema_f9d8a0180405d9ed = "x\xda\x8c\x93Mh\x13A\x1c\xc5\xffof\xe2\x14i" + - "H\xc7\x8d\xdfB\xa5\xb4\xa29\xb4\xb6\x82\x1f=\x98\xa0" + - "\xa8\x17\x0f\xd9PD,\x82I\\m\xb4\xc9\x86l\xb6" + - "RA\xbcT\xec]\x04-\x04TP\x14/V\xf1 " + - "\xe2\xc1KK\xd5\x83\x07\x05{\xf1\xa6\x14!\x8a H" + - "\xfd`e\x12w\x13m-^wf\xde\xff\xf7\xde\xfb" + - "\xef\xd6\xfbH\x88\xdep\\\x123\x07B\xcb\xbc\xbe\x17" + - "\xed3\x13\xdb\x8bc\xa4\x0c\x10\x09I\xb4\xed\x02\x8f\x81" + - "\x84\xb7w\xec\xf9\xe8\xf8\xa5\xb6\xf1\xfaI\x08\xfa(\xcf" + - "W\x80`\xb8