This repository has been archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 267
Trait feature: introspection/trait/get_zomes_by_trait #2181
Open
lucksus
wants to merge
20
commits into
develop
Choose a base branch
from
trait-conductor-features
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lucksus
changed the title
WIP: Trait handling
Conductor admin fn: introspection/trait/get_zomes_by_trait
Apr 21, 2020
lucksus
changed the title
Conductor admin fn: introspection/trait/get_zomes_by_trait
Trait feature: introspection/trait/get_zomes_by_trait
Apr 21, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucksus I am guessing that trait matching as done here is shallow, in the sense that ZomeApiResult<String>
only says so much, and that ZomeApiResult<SomeStruct>
is also shallow, because SomeStruct
s full definition isn't provided to be matched against.
How are you thinking about that kind of thing?
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR summary
Adds the ability to get instances/zomes by given trait.
New conductor admin function
introspection/traits/get_zomes_by_trait
receives one parametertrait
which is expected to be a JSON object that describes a zome trait. Example:The conductor then iterates over all running instances, retrieves their DNA, iterates over all zomes and for each zome checks if it implements the given trait, both by using the same name and all function signatures (i.e. function names, parameter names, ordering and types).
It then returns a list of all found zomes with their according instance id, so the caller has all information to call the found trait implementations next.
Example of returned format:
app-spec-proc-macro
This branch also fixes the deactivated app-spec for hdk-proc-macro (HDK v2) which got deactivated in CI and became broken. I wanted to make sure this also works in HDK v2, which AFAIK is encouraged by the docs. Maybe app-spec should be switched over to proc-macro only?
followups
This mounts the new functions in all admin interfaces and no other interfaces. This is fine for first prototype implementations as needed by Junto, where the Junto installation maintains the conductor installation (in its own app bundle). In order to properly use traits in the context of Holoscape or Holo, we would need to make this available to non-admin interfaces as well. But that implies more complexity needed:
introspect/instances/request_access
which takes an instance ID and asks the user via pop-up if the requesting hApp should be granted access to an already running and different DNA).changelog
documentation