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

feat(state): core of reading/writing identities in state #428

Merged
merged 6 commits into from
Jul 8, 2024

Conversation

benhoyt
Copy link
Contributor

@benhoyt benhoyt commented Jun 13, 2024

This adds code and tests for the state core of identities (spec OP043).

There's a new map[string]*Identity in state, which is marshalled via marshalledIdentity to disk. The marshalling for API requests is done by the apiIdentity type -- these are separate to ensure that the API (default) MarshalJSON for Identity does not include secrets (in future when we have identity types that include secrets; there's only user-id for now). So that's why there's a few more types and a bit more boilerplate than is necessary right now.

The new public State methods are:

  • AddIdentities: add new identities to the system
  • UpdateIdentities: update existing identities in the system
  • ReplaceIdentities: replace the given identities in the system; this allows adding new ones, updating existing ones, and removing identities (nil/null means remove)
  • RemoveIdentities: remove existing identities in the system
  • Identities: list all identities

Each of the FooIdentities modification functions validates that the identities are valid, and that the user-ids are unique, before applying to state.

@benhoyt benhoyt marked this pull request as ready for review June 19, 2024 22:44
Copy link
Member

@hpidcock hpidcock left a comment

Choose a reason for hiding this comment

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

Just a few minor issues or concerns. Otherwise looks good, thanks for breaking this up.

internals/overlord/state/identities.go Outdated Show resolved Hide resolved
internals/overlord/state/identities.go Show resolved Hide resolved
internals/overlord/state/identities.go Outdated Show resolved Hide resolved
internals/overlord/state/identities.go Outdated Show resolved Hide resolved
internals/overlord/state/identities_test.go Outdated Show resolved Hide resolved
@benhoyt benhoyt merged commit 9490b2d into canonical:master Jul 8, 2024
16 checks passed
@benhoyt benhoyt deleted the identities-state branch July 8, 2024 03:24
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.

2 participants