Skip to content

feat: Add explicit is_deleted endpoint to the registry canister. #9327

Closed
michael-weigelt wants to merge 2 commits intomasterfrom
mwe/registry_deletion_api
Closed

feat: Add explicit is_deleted endpoint to the registry canister. #9327
michael-weigelt wants to merge 2 commits intomasterfrom
mwe/registry_deletion_api

Conversation

@michael-weigelt
Copy link
Contributor

The get method of the registry canister returns None if the key does not exist at the given version, or if it was deleted. This makes it difficult to distinguish whether a value has been deleted or was never present.

Sometimes, callers want to act on positive data, rather than on the absence of data. is_deleted is an unambiguous signal that a value once existed but was explicitly deleted, allowing such callers to proceed with confidence.

This PR simply exposes this internally existing information to callers.

@github-actions github-actions bot added the feat label Mar 12, 2026
.rev()
.find(|value| value.version <= version)?;
match &result.content {
Some(high_capacity_registry_value::Content::DeletionMarker(_)) => Some(true),
Copy link
Contributor Author

@michael-weigelt michael-weigelt Mar 12, 2026

Choose a reason for hiding this comment

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

  1. Why is there a bool inside Content::DeletionMarker(bool)? The type and its usage (as far as I could see) imply that Content::DeletionMarker would have been enough, and Content::DeletionMarker(false) is an illegal/nonsensical data combination.

  2. Why is HighCapacityRegistryValue.content an Option if the Content enum already accounts for absent data via DeletionMarker. Could the content be absent in any other way? In other words, what in what scenario is content == None?

(If the answer has to do with protobuf, then bonus question: Why not define pb types that are separate from the types used in regular Rust code and make only legal states representable there?)

@michael-weigelt michael-weigelt changed the title feat: Add explicit is_deleted endpoint to registry canister. feat: Add explicit is_deleted endpoint to the registry canister. Mar 12, 2026
Some(result)
}

/// Returns `Some(true)` if the value for the given `key` is deleted at `version`.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also make this into an enum with names that speak for themselves. But there is a single internal consumer, so it is probably not that important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant