Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #20 from erinkim4/dependency-management
Browse files Browse the repository at this point in the history
Dependency management rewrite
  • Loading branch information
wadefagen authored Dec 7, 2021
2 parents 14edf02 + f9c75e9 commit 7c7c794
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 201 deletions.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ In order to add a microservice to MIX, the microservice in question must make a
'dependencies' : [
{
'port' : 'HOST PORT',
'ip' : 'HOST PROTOCOL and IP',
'dependencies' : [
{
...and so on. Dependencies can be infinitely nested.
}
]
'name' : 'Another IM',
'creator' : 'Your Name'
},
{
'port' : 'HOST,
'ip' : 'HOST PROTOCOL and IP',
'dependencies' : []
'port' : 'HOST PORT',
'ip' : 'HOST PROTOCOL and IP'
}
]
}
```

On the first request, MIX will search the list of connected IMs to match the specified dependencies.

The accepted formats are (in order of match priority):
- `name` and `creator`
- `ip` and `port`

To track the IP of the microservice, MIX will fetch the IP from the request.

To handle multiple IMs, MIX maintains a running list of all connected IMs. MIX will add all dependencies as if they were independent IMs. For dependency handling, see below.
Expand All @@ -52,7 +52,9 @@ To remove a microservice from MIX, the microservice must make a `DELETE` request

## Dependency Handling:

MIX will handle dependencies in a tree-like bottom-up fashion, retrieving the output of all of any IMs dependencies before making a request to that IM. IMs are not required to do dependency handling, as MIX will handle it. All IMs which have dependencies are assumed to not require location data. In order to avoid redundant requests to IMs, MIX maintains a running list of all IMs which have already had requests sent to them.
MIX will handle dependencies in a tree-like bottom-up fashion, retrieving the output of all of any IMs dependencies before making a request to that IM. IMs are not required to do dependency handling, as MIX will handle it. All IMs which have dependencies are assumed to not require location data.*

*(this is not consistent with MIX behavior, as MIX gives location data to IMs with dependencies.)

## Requirements for IMs:

Expand All @@ -74,7 +76,7 @@ MIX will send the following JSON schema to all IMs which do not have any depende
}
```

For IMs with multiple dependencies, MIX will combine the JSON schema of each dependency to send to that IM. Consider the following example:
For IMs with multiple dependencies, MIX will combine the latitude and longitude with the JSON schema of each dependency to send to that IM. Consider the following example:

IM 1 has dependencies 2 and 3.

Expand All @@ -98,7 +100,9 @@ IM 1 will receive the following schema as input:

```
{
'distance' : float
'latitude' : float,
'longitude' : float,
'distance' : float,
'squared_distance' : float
}
```
Expand All @@ -112,3 +116,5 @@ Cache-Control: max-age=x
```

where x is some arbitrary number.

Currently, MIX infers the `max-age` of all responses from the first IM response with non-zero `max-age`.
Loading

0 comments on commit 7c7c794

Please sign in to comment.