Skip to content

Commit

Permalink
RpcClient Update to match implementations (#76)
Browse files Browse the repository at this point in the history
* Update spec to match implementations

The following chance replaces UAttributes with CallOptions that are defined in uattributes.proto

#69

* Fix the link
  • Loading branch information
Steven Hartley authored Mar 8, 2024
1 parent fb9513c commit 8345997
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions up-l2/rpcclient.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,41 @@ SPDX-License-Identifier: Apache-2.0

All link:../languages.adoc[language-specific uProtocol libraries] *MUST* declare the `RpcClient` interface with method:

`OUT Future link:../basics/umessage.adoc[UMessage] invokeMethod(IN link:../basics/uri.adoc[UUri], IN UPayload?, IN link:../basics/uattributes.adoc[UAttributes])` +
`OUT Future link:../basics/umessage.adoc[UMessage] invokeMethod(IN link:../basics/uri.adoc[UUri], IN UPayload?, IN link:../basics/uattributes.adoc[CallOptions])`

.Parameters
[#parameters, width="80%",cols="30%,70%"]
|===

== Implementation
| Parameter
| Description

| `UUri`
| Method URI that is being invoked

Every link:../upclient.adoc[uPClient library] *MUST* implement the `RpcClient` interface.
| `CallOptions`
| Set of attributes that can be sent as part of a method invocation

|===


== Implementation

Implementations communicate to their underlining transport through the link:../up-l1/README.adoc#_utransport[uTransport Interface].

* The `UUri` and `UAttributes` passed to `invokeMethod()` *MUST* be cached non-persistent memory per call, this is to be able to complete the `Future` when the response is received from the server.
* Every link:../upclient.adoc[uPClient library] *MUST* implement the `RpcClient` interface.

* The `UUri` and `CallOptions` passed to `invokeMethod()` *MUST* be cached non-persistent memory per call, this is to be able to complete the `Future` when the response is received from the server.

* The `UPayload` passed to `invokeMethod()` *MAY* be null or empty.
* The `UPayload` passed to `invokeMethod()` *MAY* be null or empty.

* Method invocation that fails, *MUST* return exceptionally as defined by the link:../basics/error_model.adoc[uProtocol Error Model].
* Method invocation that fails, *MUST* return exceptionally as defined by the link:../basics/error_model.adoc[uProtocol Error Model].

* Cached requests must be completed exceptionally with `DEADLINE_EXCEEDED` when `UAttributes.isExpired()` is `true`. This notifies the calling context that the request has expired.
* Cached requests must be completed exceptionally with `DEADLINE_EXCEEDED` when `UAttributes.isExpired()` is `true`. This notifies the calling context that the request has expired.

* *MUST* return `INVALID_PARAMETER` for the following errors:
** `UUri` is null or empty
** `UAttributes.type() != UMessageType.REQUEST` or
`UAttributesValidator.validate()` fails (i.e. one of the UAttributes is invalid per UAttributesValidator).
* *MUST* return `INVALID_PARAMETER` if `UUri` is null or empty or `CallOptions.priority() < CS4`

* *MUST* return `ALREADY_EXISTS` if the same request already exists (i.e. same `UUri` and `UAttributes`). This is to prevent duplicate requests.
* *MUST* return `ALREADY_EXISTS` if the same request already exists (i.e. same `UUri` and `CallOptions`). This is to prevent duplicate requests.

* *MUST* complete future successfully when the response is received from the server.

Expand Down

0 comments on commit 8345997

Please sign in to comment.