k8ssandra / management-api-for-apache-cassandra

RESTful / Secure Management Sidecar for Apache Cassandra
Apache License 2.0
70 stars 51 forks source link

Add Token Range to Endpoints endpoint #377

Closed emerkle826 closed 12 months ago

emerkle826 commented 1 year ago

Fixes #374

Miles-Garnsey commented 1 year ago

Confirming that I've manually tested this against a real cluster and it seems to behave as expected:

$ curl 127.0.0.1:8080/api/v2/tokens/rangetoendpoint | jq
{
  "token_range_to_endpoints": [
    {
      "tokens": [
        -1070326447217483000,
        574332704784027300
      ],
      "endpoints": [
        "127.0.0.1"
      ]
    },
    {
      "tokens": [
        -3772959478813367000,
        -1070326447217483000
      ],
      "endpoints": [
        "127.0.0.2"
      ]
    },
    {
      "tokens": [
        -5592763185766151000,
        -3772959478813367000
      ],
      "endpoints": [
        "127.0.0.1"
      ]
    },
    {
      "tokens": [
        -8583309438055266000,
        -5592763185766151000
      ],
      "endpoints": [
        "127.0.0.2"
      ]
    },
    {
      "tokens": [
        3465377086168102400,
        5812374237656065000
      ],
      "endpoints": [
        "127.0.0.2"
      ]
    },
    {
      "tokens": [
        574332704784027300,
        3465377086168102400
      ],
      "endpoints": [
        "127.0.0.1"
      ]
    },
    {
      "tokens": [
        5812374237656065000,
        7352722417716966000
      ],
      "endpoints": [
        "127.0.0.2"
      ]
    },
    {
      "tokens": [
        7352722417716966000,
        -8583309438055266000
      ],
      "endpoints": [
        "127.0.0.1"
      ]
    }
  ]
}

The only nit left to address is the name of the test class, I've approved so it can be merged as soon as that is updated.

Miles-Garnsey commented 12 months ago

@emerkle826 do you want to make that final change to the name of the test class and get this merged?