diff --git a/test/fixtures/async-objects/ControllerRuntime.qx b/test/fixtures/async-objects/ControllerRuntime.qx index 3ccd904..9e4e742 100644 --- a/test/fixtures/async-objects/ControllerRuntime.qx +++ b/test/fixtures/async-objects/ControllerRuntime.qx @@ -8,4 +8,15 @@ package ControllerRuntime id "async:controller-runtime" revision "async:controll interface document id "async:controller:document" : DocumentData using [content.get, summary.set]; interface provider id "async:controller:provider" : Summarizer using [summarize.call]; }; + operation finish id "async:controller:finish" + : record { operationId: string; summary: record { text: string; basedOn: string; }; } -> unit + mode call execution transaction targets [server] receiver atom Document requires { + state job id "async:finish:job" : optional [read, write]; + state summary id "async:finish:summary" : record { text: string; basedOn: string; } [write]; + }; + operation runPending id "async:controller:run-pending" : optional -> unit + mode call execution remote receiver atom Document requires { + interface document id "async:pending:document" : DocumentData using [content.get, recordSummary.call]; + interface provider id "async:pending:provider" : Summarizer using [summarize.call]; + }; } diff --git a/test/fixtures/async-objects/DocumentData.qx b/test/fixtures/async-objects/DocumentData.qx index 214adbe..85e0aac 100644 --- a/test/fixtures/async-objects/DocumentData.qx +++ b/test/fixtures/async-objects/DocumentData.qx @@ -7,4 +7,11 @@ interface DocumentData id "async:document-data" revision "async:document-data@1" get id "async:summary:get" execution snapshot targets [browser, server]; set id "async:summary:set" execution transaction targets [browser, server]; } + queryable value pendingJob id "async:pending-job" : optional { + get id "async:pending-job:get" execution snapshot targets [server]; + set id "async:pending-job:set" execution transaction targets [server]; + } + operation recordSummary id "async:record-summary" : record { operationId: string; summary: Summary; } -> unit { + call id "async:record-summary:call" execution transaction targets [server]; + } } diff --git a/test/fixtures/async-objects/SummaryController.qx b/test/fixtures/async-objects/SummaryController.qx index 82567e5..75b6002 100644 --- a/test/fixtures/async-objects/SummaryController.qx +++ b/test/fixtures/async-objects/SummaryController.qx @@ -2,4 +2,7 @@ interface SummaryController id "async:controller" revision "async:controller@1" operation refresh id "async:refresh" : record { operationId: string; } -> string { call id "async:refresh:call" execution remote; } + operation processPending id "async:process-pending" : optional -> unit { + call id "async:process-pending:call" execution remote; + } } diff --git a/test/fixtures/async-objects/workspace.qx b/test/fixtures/async-objects/workspace.qx index fb0d48a..85e8bd9 100644 --- a/test/fixtures/async-objects/workspace.qx +++ b/test/fixtures/async-objects/workspace.qx @@ -10,6 +10,8 @@ workspace AsyncObjects id "workspace:async" revision "workspace:async@1" commit private state Content id "async:state:content" on Document : string policy register; private state Summary id "async:state:summary" on Document : record { text: string; basedOn: string; } policy register default { "text": "", "basedOn": "" }; + private state PendingJob id "async:state:pending-job" on Document : optional + policy register default null; private edge ProviderLink id "async:provider-link" { atom Document projection provider id "async:provider-projection" exactly-one public-traversal; atom Provider projection documents id "async:documents-projection" many-unique; @@ -18,12 +20,22 @@ workspace AsyncObjects id "workspace:async" revision "workspace:async@1" commit bind content.get to state Content.read; bind summary.get to state Summary.read; bind summary.set to state Summary.write; + bind pendingJob.get to state PendingJob.read; + bind pendingJob.set to state PendingJob.write; + bind recordSummary.call to package ControllerRuntime.finish with { + job to state PendingJob; + summary to state Summary; + }; } conform Document as SummaryController id "async:document:controller" { bind refresh.call to package ControllerRuntime.refresh with { document to interface DocumentData; provider to interface Summarizer via edge ProviderLink.provider; }; + bind processPending.call to package ControllerRuntime.runPending with { + document to interface DocumentData; + provider to interface Summarizer via edge ProviderLink.provider; + }; } conform Provider as Summarizer id "async:provider:summarizer" { bind summarize.call to package ProviderRuntime.summarize;