The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in IETF BCP14 (RFC2119 & RFC8174)
SPDX-FileCopyrightText: 2024 Contributors to the Eclipse Foundation See the NOTICE file(s) distributed with this work for additional information regarding copyright ownership. This program and the accompanying materials are made available under the terms of the Apache License Version 2.0 which is available at https://www.apache.org/licenses/LICENSE-2.0 SPDX-FileType: DOCUMENTATION SPDX-License-Identifier: Apache-2.0
In the following document we will elaborate on the design and requirements for the uDiscovery service client facing APIs.
sequenceDiagram
Client ->> UDiscoveryService: FindService()
Client ->> UDiscoveryService: FindServiceTopics()
In Client APIs above, Client represents the client-facing APIs to talk to uDiscovery database that can be found in the various language libraries such as up-cpp, up-java, etc.. that are used to find services and their topics.
The client facing APIs of uDiscovery provide the means for uEs to discover services (where they are located, versions, etc…), and topic metadata that a service produces (method id and permissions, publish topic message formats, etc…). The API is declared in the udiscovery.proto.
Each uProtocol Language Library MUST implement the client-side APIs of udiscovery.proto using the uProtocol Communication Layer (uP-L2) API RpcClient.
The FindServices() API is used to find service instances matching search criteria like authority, instance ID and (major) version. The only mandatory part of the provided (search) URI is the uEntity ID (ue_id
), the rest can be discovered. The recursive
flag can be used to include the uDiscovery service instance’s parent nodes in the search.
-
MUST return a
UCode.NOT_FOUND
if no service matching the passed URI was found.
-
MUST return a
UCode.INVALID_ARGUMENT
if: -
recursive==true
andauthority_name
does not contain the wildcard*
. -
UUri
is empty
-
MUST return a
UCode.PERMISSION_DENIED
if the caller is not permitted to query for that service.
Below are example string URIs that could be passed to the API.
URI | recursive |
Description |
---|---|---|
|
false |
Find local instances & versions of service 1234. |
|
false |
Find instances & versions of service 1234 that are known to the local uDiscovery service instance. |
|
true |
Find instances & versions of service 4 that are known to the local uDiscovery service instance or any of its parent nodes. |
|
false |
Find the authority_name for version 2 & instance 1 of service 1234. |
The GetServiceTopics() API is used to fetch metadata about one or more topics (depending on what is passed in the UUri) so clients can know more metadata about the topic(s). Wildcard ue_id and/or resource_id can be used to fetch multiple UServiceTopic
information. The UServiceTopic
contains topic metadata such as the minimum permission level required to read from the topic, message name, payload format (how the message is encoded) and more.
-
MUST return a
UCode.NOT_FOUND
if no topic matching the URI was found.
-
MUST return a
UCode.INVALID_ARGUMENT
if the URI passed in is not a valid uProtocol UUri.
-
MUST return a
UCode.PERMISSION_DENIED
if the caller is not permitted to query for that topic.
Below are example use cases for the API when passed certain URIs (shown in string form) along with the expected results.
URI | Description |
---|---|
|
Return the |
|
Return repeated list of |
Note
|
Please refer to the udiscovery.proto for details of the UDiscovery Client APIs. |