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

More work for issues #6 and #13 #64

Merged
merged 26 commits into from
May 14, 2023
Merged

More work for issues #6 and #13 #64

merged 26 commits into from
May 14, 2023

Conversation

rneswold
Copy link
Contributor

This is an ongoing pull-request to finish work mentioned in #13, which will allow progress on issue #6.

rneswold added 26 commits May 3, 2023 23:47
They block indefinitely, for now. But it starts up a task for each
`[[logic]]` section that's defined.
- Add some comments
- Have one method call another
If a logic node fails to initialize, report that it isn't being used
and don't add it to the set of background tasks. Before this commit, a
failure was causing a panic.
The client request/reply channel now includes a request for a setting
channel for a device. The client specifies the device name and it gets
an `mpsc::channel` in which to send settings.

Logic nodes will need this to send calculated results.
This new enumeration value handles reporting errors due to parsing.
This commit covers several sets of changes:

- The parser now takes an "environment", which is a pair of slices of
  strings. The parser uses then to lookup input and output devices,
  respectively.

- `compile::compile()` was moved to `compile::Program::compile()`

- `compile::eval()` takes an environment parameter which is an array
  of `Option<Value>`. The function uses it to get the latest values of
  devices when computing the expression.

- Expressions support the `Display` trait.
This code needs testing, but I believe -- to first order -- that we
can have devices control devices all within DrMem!
These two messages were expanded to include more information about
what went wrong.
The `drmem-api` crate re-publishes the modules below `types` and makes
`types` private. This makes many of the types have a shorter path (for
instance, `drmem_api::device::Value` instead of
`drmem_api::types::device::Value`.)

In fixing the rest of the codebase to support this change, I also made
using these types more consistent. Some files used `Value` from
`drmem_api::device` while others used `redis::Value` and still others
used it from `toml`. Now at least one level of module name is
specified so it is obvious from where the definitions came.
The driver lifetime now consists of three phases instead of two. A
new, initial phase was added so the drivers could register devices.
The driver lifetime then loops through phases two and three.

This commit not only changes the API, but fixes all the drivers to
support it.
This feature should be kept up to date to include every driver.
If a driver fails during the call to `.create_instance()`, the
managing task will restart it after 5 seconds. If it fails again, the
delay is doubled to ten seconds, then doubled, etc. until it maxes out
at 10 minutes.

If `.create_instance()` ever succeeds, the timeout is reset to 5
seconds.
The two starting phases now have different error log names.
This commit contains a version of the 3-phase startup where all the
drivers will complete registering their devices before the logic
blocks are started.
The driver manager never returns, so its return type should be
`Infallible`.
@rneswold rneswold linked an issue May 14, 2023 that may be closed by this pull request
@rneswold rneswold merged commit 108cf7c into DrMemCS:main May 14, 2023
@rneswold rneswold deleted the pr-issue6 branch May 14, 2023 04:47
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 this pull request may close these issues.

Add framework for "logic blocks"
1 participant