wasmCloud / lattice-observer

A reusable Elixir library for monitoring a lattice and deriving observed state
https://wasmcloud.com
Apache License 2.0
3 stars 2 forks source link

Clear multiple identical hosts #21

Closed brooksmtownsend closed 1 year ago

brooksmtownsend commented 2 years ago

This PR

  1. Adds a test pipeline for the lattice observer
  2. Updates some failing tests
  3. refactors the caps and tags to ensure that caps is a list of strings and tags are a comma separated list of tags (this is how it's represented in the host claims). This was only done to make tests work

And, most importantly, ensures that the host_started event clears out the lattice cache of any potentially remaining resources for that host. For 99% of the host_started events that are received this will be a no-op, however, in special cases where a host restarts un-gracefully (e.g. by forcefully killing the host) and the same host is restarted using the private key seed, this ensures that the lattice observer wipes the old state clean from the host.

This does not apply for scenarios where new hosts are launched with a different private key. Decaying hosts, when they fully decay out of the lattice, will remove their leftover resources (which they don't do now, will be tackled in a separate PR)

brooksmtownsend commented 2 years ago

Why did we choose to represent one as a list, and one as a comma-separated string?

Actually @connorsmith256 great point, I think in the OTP runtime they are both represented as a comma separated string. I can look into representing these as the same thing.

@autodidaddict am I missing anything here? I know this information originally comes from the wascap crate, with actor claims, but over time and in the OTP runtime they end up being cached as a string instead.