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

[pangea] dynamic call module #86

Closed
3 tasks done
florianlenz opened this issue Aug 19, 2018 · 1 comment · Fixed by #93
Closed
3 tasks done

[pangea] dynamic call module #86

florianlenz opened this issue Aug 19, 2018 · 1 comment · Fixed by #93
Assignees
Milestone

Comments

@florianlenz
Copy link
Contributor

florianlenz commented Aug 19, 2018

Feature / Issue

Pangea needs a lot of custom calls to fetch initial state from panthalassa. For example:

  • identity public key
  • chat messages
  • and much more (specially in the future)

Writing a method for fetching all of those data is very time consuming since we have to build bridges for ios and android. A dynamic "call" module would fix that problem. The dynamic call module will take a call id (e.g. MESSAGES) as the first parameter and an map of values as the second parameter (e.g. {chat: "partner-id-pub-key", amount: 50}). The call will then be validated by the module and fetch the messages based on the parameters. A call module should always return an map of values. There should be a call module interface and a call module registry, the registry would basically take care of finding the right module for a call id.

This is how the call module might look like:

type CallModule interface {
   // the call id this module relates to 
   CallID() string
   // validate the given parameters - might return an error when received invalid parameters
   Validate(map[string]interface{}) error
   // will handle the call and return the result
   Handle(map[string]interface{}) (map[string]interface{}, error)
}

This is how the call module registry might look like:

type CallModuleReg interface {
   Call(callID, map[string]interface{}) (map[string]interface{}, error)
}

You are free to come up with other ideas / solutions. Please just post them here in the GH issue.

Acceptance criteria

  • tests
  • documentation on how to use it in the code
  • call module interface and registry is done
@florianlenz
Copy link
Contributor Author

Will be done at tuesday @kevowevo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant