public void InterceptClientSideShortCall() { var policy = new MyPolicy("a"); (var server, var client) = SetupClientServerPair(); using (server) using (client) { //client.WhenConnected.Wait(); var counters = new Counters(); server.Main = new TestInterfaceImpl(counters); using (var main = policy.Attach(client.GetMain <ITestInterface>())) { var request1 = main.Foo(321, false, default); Assert.IsTrue(policy.Calls.TryReceive(out var cc)); Assert.IsFalse(request1.IsCompleted); var rw = SerializerState.CreateForRpc <Capnproto_test.Capnp.Test.TestInterface.Result_Foo.WRITER>(); rw.X = "bar"; cc.OutArgs = rw; cc.ReturnToAlice(); Assert.IsTrue(request1.IsCompleted); Assert.AreEqual("bar", request1.Result); } } }
async Task <AnswerOrCounterquestion> MethodA(DeserializerState d_, CancellationToken cancellationToken_) { var in_ = CapnpSerializable.Create <CapnpGen.GenericA <TT> .Params_methodA>(d_); await Impl.MethodA(in_.Param1, cancellationToken_); var s_ = SerializerState.CreateForRpc <CapnpGen.GenericA <TT> .Result_methodA.WRITER>(); return(s_); }
async Task <AnswerOrCounterquestion> Stop(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { await Impl.Stop(cancellationToken_); var s_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Result_Stop.WRITER>(); return(s_); } }
async Task <AnswerOrCounterquestion> SetTimeout(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { var in_ = CapnpSerializable.Create <Mas.Schema.Service.Admin.Params_SetTimeout>(d_); await Impl.SetTimeout(in_.Seconds, cancellationToken_); var s_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Result_SetTimeout.WRITER>(); return(s_); } }
async Task <AnswerOrCounterquestion> UpdateIdentity(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { var in_ = CapnpSerializable.Create <Mas.Schema.Service.Admin.Params_UpdateIdentity>(d_); await Impl.UpdateIdentity(in_.OldId, in_.NewInfo, cancellationToken_); var s_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Result_UpdateIdentity.WRITER>(); return(s_); } }
async Task <AnswerOrCounterquestion> SetupPorts(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { var in_ = CapnpSerializable.Create <Mas.Schema.Fbp.Component.Params_SetupPorts>(d_); await Impl.SetupPorts(in_.InPorts, in_.OutPorts, cancellationToken_); var s_ = SerializerState.CreateForRpc <Mas.Schema.Fbp.Component.Result_SetupPorts.WRITER>(); return(s_); } }
public async Task Stop(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Fbp.Component.Params_Stop.WRITER>(); var arg_ = new Mas.Schema.Fbp.Component.Params_Stop() { }; arg_?.serialize(in_); using (var d_ = await Call(15499137556701095600UL, 1, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Fbp.Component.Result_Stop>(d_); return; } }
public async Task <Mas.Schema.Crop.Cultivar> Cultivar(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Params_Cultivar.WRITER>(); var arg_ = new Mas.Schema.Crop.Crop.Params_Cultivar() { }; arg_?.serialize(in_); using (var d_ = await Call(16757216515467467908UL, 1, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Crop.Crop.Result_Cultivar>(d_); return(r_.Cult); } }
public async Task <long> MethodA(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <CapnpGen.Issue25A.Params_methodA.WRITER>(); var arg_ = new CapnpGen.Issue25A.Params_methodA() { }; arg_.serialize(in_); var d_ = await Call(12726067773386434894UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned; var r_ = CapnpSerializable.Create <CapnpGen.Issue25A.Result_methodA>(d_); return(r_.Result); }
Task <AnswerOrCounterquestion> MethodA(DeserializerState d_, CancellationToken cancellationToken_) { return(Impatient.MaybeTailCall(Impl.MethodA(cancellationToken_), result => { var s_ = SerializerState.CreateForRpc <CapnpGen.Issue25A.Result_methodA.WRITER>(); var r_ = new CapnpGen.Issue25A.Result_methodA { Result = result }; r_.serialize(s_); return s_; } )); }
Task <AnswerOrCounterquestion> Save(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { return(Impatient.MaybeTailCall(Impl.Save(CapnpSerializable.Create <Capnp.Persistent <TSturdyRef, TOwner> .SaveParams>(d_), cancellationToken_), r_ => { var s_ = SerializerState.CreateForRpc <Capnp.Persistent <TSturdyRef, TOwner> .SaveResults.WRITER>(); r_.serialize(s_); return s_; } )); } }
public async Task Stop(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Params_Stop.WRITER>(); var arg_ = new Mas.Schema.Service.Admin.Params_Stop() { }; arg_?.serialize(in_); using (var d_ = await Call(18357226832451728969UL, 2, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Service.Admin.Result_Stop>(d_); return; } }
public async Task <IReadOnlyList <Mas.Schema.Common.IdInformation> > Identities(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Params_Identities.WRITER>(); var arg_ = new Mas.Schema.Service.Admin.Params_Identities() { }; arg_?.serialize(in_); using (var d_ = await Call(18357226832451728969UL, 3, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Service.Admin.Result_Identities>(d_); return(r_.Infos); } }
public async Task <Mas.Schema.Common.IdInformation> Info(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Common.Identifiable.Params_Info.WRITER>(); var arg_ = new Mas.Schema.Common.Identifiable.Params_Info() { }; arg_?.serialize(in_); using (var d_ = await Call(12875740530987518165UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Common.IdInformation>(d_); return(r_); } }
public async Task <string> Method(string @param, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Rpc.Test.A.Params_Method.WRITER>(); var arg_ = new Mas.Rpc.Test.A.Params_Method() { Param = @param }; arg_?.serialize(in_); using (var d_ = await Call(13447466392595712079UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Rpc.Test.A.Result_Method>(d_); return(r_.Res); } }
public async Task <(string, bool, bool)> ImportData(string id, IReadOnlyList <byte> dwla, IReadOnlyList <byte> dwlb, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Model.Weberest.DWLABImport.Params_ImportData.WRITER>(); var arg_ = new Mas.Schema.Model.Weberest.DWLABImport.Params_ImportData() { Id = id, Dwla = dwla, Dwlb = dwlb }; arg_?.serialize(in_); using (var d_ = await Call(11647625426448067183UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Model.Weberest.DWLABImport.Result_ImportData>(d_); return(r_.Id, r_.SuccessA, r_.SuccessB); } }
public async Task SetupPorts(IReadOnlyList <Mas.Schema.Fbp.Component.NameToPort> inPorts, IReadOnlyList <Mas.Schema.Fbp.Component.NameToPort> outPorts, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Fbp.Component.Params_SetupPorts.WRITER>(); var arg_ = new Mas.Schema.Fbp.Component.Params_SetupPorts() { InPorts = inPorts, OutPorts = outPorts }; arg_?.serialize(in_); using (var d_ = await Call(15499137556701095600UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Fbp.Component.Result_SetupPorts>(d_); return; } }
public async Task UpdateIdentity(string oldId, Mas.Schema.Common.IdInformation newInfo, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Params_UpdateIdentity.WRITER>(); var arg_ = new Mas.Schema.Service.Admin.Params_UpdateIdentity() { OldId = oldId, NewInfo = newInfo }; arg_?.serialize(in_); using (var d_ = await Call(18357226832451728969UL, 4, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned) { var r_ = CapnpSerializable.Create <Mas.Schema.Service.Admin.Result_UpdateIdentity>(d_); return; } }
public async Task MethodA(TT param1, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <CapnpGen.GenericA <TT> .Params_methodA.WRITER>(); var arg_ = new CapnpGen.GenericA <TT> .Params_methodA() { Param1 = param1 }; arg_.serialize(in_); var d_ = await Call(10341943558714247093UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_).WhenReturned; var r_ = CapnpSerializable.Create <CapnpGen.GenericA <TT> .Result_methodA>(d_); return; }
public Task <Capnp.Persistent <TSturdyRef, TOwner> .SaveResults> Save(Capnp.Persistent <TSturdyRef, TOwner> .SaveParams arg_, CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Capnp.Persistent <TSturdyRef, TOwner> .SaveParams.WRITER>(); arg_?.serialize(in_); return(Impatient.MakePipelineAware(Call(14468694717054801553UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_), d_ => { using (d_) { var r_ = CapnpSerializable.Create <Capnp.Persistent <TSturdyRef, TOwner> .SaveResults>(d_); return r_; } } )); }
Task <AnswerOrCounterquestion> Parameters(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { return(Impatient.MaybeTailCall(Impl.Parameters(cancellationToken_), @params => { var s_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Result_Parameters.WRITER>(); var r_ = new Mas.Schema.Crop.Crop.Result_Parameters { Params = @params }; r_.serialize(s_); return s_; } )); } }
Task <AnswerOrCounterquestion> Identities(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { return(Impatient.MaybeTailCall(Impl.Identities(cancellationToken_), infos => { var s_ = SerializerState.CreateForRpc <Mas.Schema.Service.Admin.Result_Identities.WRITER>(); var r_ = new Mas.Schema.Service.Admin.Result_Identities { Infos = infos }; r_.serialize(s_); return s_; } )); } }
Task <AnswerOrCounterquestion> Cultivar(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { return(Impatient.MaybeTailCall(Impl.Cultivar(cancellationToken_), cult => { var s_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Result_Cultivar.WRITER>(); var r_ = new Mas.Schema.Crop.Crop.Result_Cultivar { Cult = cult }; r_.serialize(s_); return s_; } )); } }
Task <AnswerOrCounterquestion> Method(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { var in_ = CapnpSerializable.Create <Mas.Rpc.Test.A.Params_Method>(d_); return(Impatient.MaybeTailCall(Impl.Method(in_.Param, cancellationToken_), res => { var s_ = SerializerState.CreateForRpc <Mas.Rpc.Test.A.Result_Method.WRITER>(); var r_ = new Mas.Rpc.Test.A.Result_Method { Res = res }; r_.serialize(s_); return s_; } )); } }
Task <AnswerOrCounterquestion> ImportData(DeserializerState d_, CancellationToken cancellationToken_) { using (d_) { var in_ = CapnpSerializable.Create <Mas.Schema.Model.Weberest.DWLABImport.Params_ImportData>(d_); return(Impatient.MaybeTailCall(Impl.ImportData(in_.Id, in_.Dwla, in_.Dwlb, cancellationToken_), (id, successA, successB) => { var s_ = SerializerState.CreateForRpc <Mas.Schema.Model.Weberest.DWLABImport.Result_ImportData.WRITER>(); var r_ = new Mas.Schema.Model.Weberest.DWLABImport.Result_ImportData { Id = id, SuccessA = successA, SuccessB = successB }; r_.serialize(s_); return s_; } )); } }
public Task <object> Parameters(CancellationToken cancellationToken_ = default) { var in_ = SerializerState.CreateForRpc <Mas.Schema.Crop.Crop.Params_Parameters.WRITER>(); var arg_ = new Mas.Schema.Crop.Crop.Params_Parameters() { }; arg_?.serialize(in_); return(Impatient.MakePipelineAware(Call(16757216515467467908UL, 0, in_.Rewrap <DynamicSerializerState>(), false, cancellationToken_), d_ => { using (d_) { var r_ = CapnpSerializable.Create <Mas.Schema.Crop.Crop.Result_Parameters>(d_); return (r_.Params); } } )); }
public void OnCallFromAlice(CallContext callContext) { // is a Persistent interface if (callContext.InterfaceId == PersistentInterfaceId) { var result = CapnpSerializable.Create <Mas.Rpc.Persistence.Persistent.Result_Save>(callContext.OutArgs); var res = _registry.Restorer.Save(new BareProxy((ConsumedCapability)callContext.Bob)); result.SturdyRef = res.SturdyRef; result.UnsaveSR = res.UnsaveSR; var resultWriter = SerializerState.CreateForRpc <Mas.Rpc.Persistence.Persistent.Result_Save.WRITER>(); result.serialize(resultWriter); callContext.OutArgs = resultWriter; callContext.ReturnToAlice(); } else { callContext.ForwardToBob(); } }