Skip to content

Conversation

valerian-roche
Copy link
Contributor

Following previous rework of sotw and delta handling, the remaining differences of behavior between the two are:

  • on first request, check the returned version in sotw to validate version prefix. Also compute the version differently
  • in some cases, return full state in sotw. In other cases don't return if the only change is deletion
  • compute the version differently

In this context, the code can now be mostly merged, apart from the type differences on requests and responses (which I think can be reduced to none soon, but requires more rework on simple side and would be somewhat backward incompatible). In this commit, the linear cache no longer treats sotw and delta watches differently. They are tracked in the same maps and the changes and responses are computed in a common method. Differences in behavior (e.g. full state or which version to use) is now a functional attribute of the watch itself. There are two main parts not yet fully merged:

  • changing the version in sotw when using stable versions. The requirement to prepend cache version prefix makes it harder to abstract
  • defining whether a change only removing resources should trigger a response. This could be made a functional flag but given its intersection with fullStateResponses seemed fragile

…r cache to have behavior driven logic instead

Following previous rework of sotw and delta handling, the remaining differences of behavior between the two are:
 - on first request, check the returned version in sotw to validate version prefix. Also compute the version differently
 - in some cases, return full state in sotw. In other cases don't return if the only change is deletion
 - compute the version differently

In this context, the code can now be mostly merged, apart from the type differences on requests and responses (which I think can be reduced to none soon, but requires more rework on simple side and would be somewhat backward incompatible).
In this commit, the linear cache no longer treats sotw and delta watches differently. They are tracked in the same maps and the changes and responses are computed in a common method. Differences in behavior (e.g. full state or which version to use) is now a functional attribute of the watch itself.
There are two main parts not yet fully merged:
 - changing the version in sotw when using stable versions. The requirement to prepend cache version prefix makes it harder to abstract
 - defining whether a change only removing resources should trigger a response. This could be made a functional flag but given its intersection with `fullStateResponses` seemed fragile

Signed-off-by: Valerian Roche <[email protected]>
@valerian-roche
Copy link
Contributor Author

This PR backports the change already merged as part of DataDog#14

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.

1 participant