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

Add metadata get/patch subcommands to restatectl #2010

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pcholakov
Copy link
Contributor

@pcholakov pcholakov commented Oct 1, 2024

This PR introduces a new metadata subcommand with options to retrieve and update values in both "direct" mode working on a local-metadata-store or remotely against both the Restate-native metadata service and Etcd.

The FlexBuffers-encoded values are rendered to the user as JSON. This allows us to use JSON Patch to succinctly express modifications.

Here is how it looks in action:

> restatectl metadata get -k "schema_registry"
{
  "version": 9,
  "deployments": [
    [
      "dp_11Oa6uG2mNPjTYcD03AFgnn",
      {
        "metadata": {
          "created_at": 1727447806006,
          "delivery_options": {
            "additional_headers": {}
          },
          "supported_protocol_versions": {
            "end": 2,
            "start": 1
          },
          ...

> restatectl metadata patch --access-mode direct --config-file config.toml --key "schema_registry" \
  --patch '[{"op": "replace", "path": "/deployments/0/1/metadata/supported_protocol_versions/end", "value": 1}]' --version 7 --dry-run
Error: Version mismatch: expected v7, got v9 from store

> restatectl metadata patch -c config.toml -k "schema_registry" -
  -p '[{"op": "replace", "path": "/deployments/0/1/metadata/supported_protocol_versions/end", "value": 1}]' -e 9
{
  "version": 10,
  "deployments": [
    [
      "dp_11Oa6uG2mNPjTYcD03AFgnn",
      {
        "metadata": {
          "created_at": 1727447806006,
          "delivery_options": {
            "additional_headers": {}
          },
          "supported_protocol_versions": {
            "end": 1,
            "start": 1
          },
          ...

@pcholakov pcholakov force-pushed the feat/restatectl-metadata branch 5 times, most recently from 6014077 to d2c37f7 Compare October 2, 2024 19:38
@pcholakov pcholakov marked this pull request as ready for review October 3, 2024 21:42
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