The microservice should be able to assign map of unique user IDs on different services to each other. Users would make quries like "Give me an ID from service B if I have an ID equal to I in service A" and receive the appropriate output.
We define three basic concepts:
Simply put, key is a string which identifies some service of interest such as Slack or JIRA. Example keys: "slack", "jira".
String which defines value of interest for some key. Example: "john.doe" or "[email protected]".
Relation between a key and a value, a pair. Example: "slack" -> "john.doe"
.
Keymap is a set of key-bindings. Informally, each keymap is related to some user. In keymap, key-bindings are unique, which means that for any keymap and particular key A, there can be only one value X. Example of invalid keymap:
"slack" -> "john.doe"
"slack" -> "doejohn"
"jira" -> "[email protected]"
However, the following two keymaps are valid:
1. "slack" -> "doejohn"
2. "slack" -> "john.doe"
"jira" -> "[email protected]"
Additionally, any key-binding must uniqely identify keymap, which means that if given value for some key, it must point to at most one keymap.
Client should be able to add new key-binding, which is a key-value pair. He/she should be able to specify that such binding should be correlated with other key-value pair. Example:
"Add a value A for key X, where key Y has value B."
Which will result in following keymap being remembered (if there already exists keymap with value B for Y):
X -> A
Y -> B
In certain situation we can also simply specify:
"Add value A for key X"
- which should add new keymap ("X -> A") to the store.
Client should be able to update existing keymaps. Same rules apply as above. Example query could look like:
"Update key X to value A where key Y has value B".
Notice the special case:
"Update key X to value A where key X has value B".
Client should be able to delete information: both specific keys and whole keymaps. Example queries:
"Delete keymap where key X has value A"
or:
"Delete value for key X where key Y has value A"
Finally, client should be able to retrieve information:
"Get value of key X where key Y has value A."