Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uDiscovery Redesign #219

Closed
wants to merge 1 commit into from
Closed

uDiscovery Redesign #219

wants to merge 1 commit into from

Conversation

stevenhartley
Copy link
Contributor

@stevenhartley stevenhartley commented Aug 2, 2024

The following is the redesign of uDiscovery service based on the various lessons learned from deploying uDiscovery in production and valuable feedback from developers. uDiscovery is no longer a dumping ground for all kinds of information but instead only stores service discovery information (service location, version, and service topic metadata).

#137

@stevenhartley stevenhartley added the enhancement New feature or request label Aug 2, 2024
@stevenhartley stevenhartley added this to the v1.6.0-alpha.4 milestone Aug 2, 2024
Copy link

@kz9nyy kz9nyy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
My only doubts are regarding the reconciliation process.
I don't have a clear understanding after reading the API design.
I think some further explanation would help someone who is reading this for the first time.

up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved

Domain-UDiscovery ->> Local-UDiscovery: GetServiceTopics()
Local-UDiscovery -->> Domain-UDiscovery: GetServiceTopicsResponse
Domain-UDiscovery ->> Domain-UDiscovery: ReconcileData()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the ReconcileData function will re-sync the DB.
What do you compare against? How do you test for equality?
In this example, will it just re-sync the topics i.e. (partial sync)?
I'm thinking that you would need a snapshot or hash of the entire DB to guarantee synchronization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if that is implementation details for a given implementation or something that we need to specify here. @kz9nyy Could we elaborate on the reconcileData() functionality in a subsequent PR?

up-l3/udiscovery/v3/service.adoc Show resolved Hide resolved
@stevenhartley stevenhartley self-assigned this Aug 9, 2024
up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved

== Client Facing APIs

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 the xref:../../../up-core-api/uprotocol/core/udiscovery/v3/udiscovery.proto[uDiscovery service proto].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to consider introducing a document attribute for the reference to the proto file. This will make it easier to maintain the link (if it needs to change) and will save you a lot of typing :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that in another change you did, I'll consider it for the future edits

up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
- *ue_id:* The unique identifier of the service (both the instance and service ID portions).
- *authority_name:* The name of the authority that hosts the service.
- *ue_version_major:* The version of the service.
- *resource_id:* The resource ID (value of 0 us used to indicate the default ID for the service).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the default ID for a service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resource_id of 0 means the default topic for responses and notifications to be sent to


== Client APIs

The following section we will elaborate on the service-side requirements for the uDiscover service when it serves the client facing APIs defined in the xref:../../../up-core-api/uprotocol/core/udiscovery/v3/udiscovery.proto[udiscovery.proto].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to introduce a document attribute for the link to the proto ...

up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
up-core-api/uprotocol/core/udiscovery/v3/udiscovery.proto Outdated Show resolved Hide resolved
// 3. code.INVALID_ARGUMENT: The passed UUri is invalid
// 4. code.PERMISSION_DENIED: The caller does not have permission to perform the query
rpc LookupUri(LookupUriRequest) returns (LookupUriResponse) {
// Find Services.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FMPOV all of this documentation should go into the specification document ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sophokles73 I changed this now so please re-review

// How long the topic metadata is valid for in seconds.
// If the metadata is older than this value, the client should re-fetch the metadata.
// If the field is missed or the value is 0, the client should assume the metadata is valid forever.
optional uint32 ttl = 3;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServiceTopicInfo already includes ttl, why this one is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I will remove it now

// If the metadata has expired, the UDiscovery service that received this data must flush the ServiceTopic info.
// If the field is missed, the ServiceTopicInfo is valid forever.
// If the field is set to 0, the ServiceTopicInfo should be removed from the database immediately.
optional uint32 ttl = 2;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removal is not obvious when ttl is used to request that. Default value 0 by generated code is returned if field is not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mishap4 , Because the field is optional, there is a difference from default and not present, this means we can treat them differntly.

up-core-api/uprotocol/core/udiscovery/v3/udiscovery.proto Outdated Show resolved Hide resolved
@@ -42,43 +42,22 @@ service uDiscovery {

// Find Services.
//
// The API is used to find the authority(ies), instance(s), and version(s) of services based on the passed URI.
// Discovery the authority(ies) (where), instance(s), and version(s) of services based on the passed URI.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean

Discovery of the authorities ...

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to be one or many authories but I guess I can just make it all plural.

up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
--
* *MUST* return a `UCode.INVALID_ARGUMENT` if:
* The lower 16 bits of `ue_id` (_service ID_) is missing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can the lower 16 bits be missing, i.e. how would a corresponding URI look like? Or did you mean: if the lower 16 bits are 0x0000?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum... I guess you might want to find out version for the uSubscription service so this requirement needs to be removed then all together.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a corresponding entry to the list of examples? I still haven't understood the use case ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushing a change now


==== Example Use Cases

Below are example use cases for the API when passed certain URIs (shown in string form) along with the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sentence seems to be missing an ending

up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
up-l3/udiscovery/v3/service.adoc Outdated Show resolved Hide resolved
@@ -42,43 +42,22 @@ service uDiscovery {

// Find Services.
//
// The API is used to find the authority(ies), instance(s), and version(s) of services based on the passed URI.
// Discovery the authority(ies) (where), instance(s), and version(s) of services based on the passed URI.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meant to be one or many authories but I guess I can just make it all plural.

// How long the topic metadata is valid for in seconds.
// If the metadata is older than this value, the client should re-fetch the metadata.
// If the field is missed or the value is 0, the client should assume the metadata is valid forever.
optional uint32 ttl = 3;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I will remove it now

--
* *MUST* return a `UCode.INVALID_ARGUMENT` if:
* The lower 16 bits of `ue_id` (_service ID_) is missing.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hum... I guess you might want to find out version for the uSubscription service so this requirement needs to be removed then all together.

up-l3/udiscovery/v3/client.adoc Outdated Show resolved Hide resolved
Copy link
Contributor

@sophokles73 sophokles73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sophokles73
Copy link
Contributor

@stevenhartley can you rebase this PR?

The following is the redesign of uDiscovery service based on the various
lessons learned from deploying uDiscovery in production and valuable
feedback from developers.  uDiscovery is no longer a dumping ground for
all forms of information but instead only stores service discovery
information (service location, version, and service topic metadata).

Co-authored-by: Christian Alexander <christian.alexander101@gmail.com>
Co-authored-by: Kai Hudalla <sophokles.kh@gmail.com>

 #137
@stevenhartley stevenhartley closed this by deleting the head repository Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants