Skip to content

Factor out bits of the worker protocol to use elsewhere #9099

Merged
Ericson2314 merged 2 commits intoNixOS:masterfrom
obsidiansystems:common-proto
Oct 9, 2023
Merged

Factor out bits of the worker protocol to use elsewhere #9099
Ericson2314 merged 2 commits intoNixOS:masterfrom
obsidiansystems:common-proto

Conversation

@Ericson2314
Copy link
Member

Motivation

This introduces some shared infrastructure for our notion of protocols.
We can then define multiple protocols in terms of that notion.
We an also express how particular protocols depend on each other.

For example, we can define a common protocol and a worker protocol,
where the second depends on the first in terms of the data types it can
read and write.

The "serve" protocol can just use the common one for now, but will
eventually need its own machinary just like the worker protocol for
version-aware serialisers. Even though all the commits of that first PR are approved, I think it is good to split it up when adding tests for extra clarity.

Context

The first commit of this is the first commit of #6223, a PR which was approved except for needing tests. The second commit of this is new, and adds such missing tests.

Priorities

Add 👍 to pull requests you find important.

@Ericson2314 Ericson2314 added the protocol Things involving the daemon protocol & compatibility issues label Oct 5, 2023
@github-actions github-actions bot added with-tests Issues related to testing. PRs with tests have some priority store Issues and pull requests concerning the Nix store and removed protocol Things involving the daemon protocol & compatibility issues labels Oct 5, 2023
@Ericson2314 Ericson2314 added the protocol Things involving the daemon protocol & compatibility issues label Oct 5, 2023
@Ericson2314
Copy link
Member Author

https://github.com/google/googletest/blob/main/docs/advanced.md this claims there is a way to reuse whole testsuites across implementations, but it didn't immediately work for me and also it seems quite weird.

Ericson2314 and others added 2 commits October 9, 2023 16:55
This introduces some shared infrastructure for our notion of protocols.
We can then define multiple protocols in terms of that notion.
We an also express how particular protocols depend on each other.

For example, we can define a common protocol and a worker protocol,
where the second depends on the first in terms of the data types it can
read and write.

The "serve" protocol can just use the common one for now, but will
eventually need its own machinary just like the worker protocol for
version-aware serialisers
Copy the relevant tests to ensure the new interfaces added in the last
commit are tested.

Perhaps I should try to deduplicat these tests some more. However its
not clear how to do that outside of a big ugly C++ macro.
https://github.com/google/googletest/blob/main/docs/advanced.md has some
stuff but it is cumbersome and I didn't figure it out yet.

This is done in a separate commit in order to be sure that the first
commit really didn't change any behavior; if we changed the
implementation and the tests at once, it would be harder to tell whether
or not some behavioral changes slipped in what is supposed to be a "pure
refactor".

Co-Authored-By: Valentin Gagarin <valentin.gagarin@tweag.io>
Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed in detail and ran the tests locally.

@Ericson2314 Ericson2314 enabled auto-merge October 9, 2023 21:10
@Ericson2314 Ericson2314 merged commit 4b1a973 into NixOS:master Oct 9, 2023
@Ericson2314 Ericson2314 deleted the common-proto branch October 13, 2023 14:45
tebowy pushed a commit to tebowy/nix that referenced this pull request Jul 11, 2024
Factor out bits of the worker protocol to use elsewhere

(cherry picked from commit 4b1a973)
Change-Id: If93afa0f8b1cf9b0e705b34fa71e6fd708752758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

protocol Things involving the daemon protocol & compatibility issues store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants