Skip to content

Consul KV api enhancements #4142

@CJLove

Description

@CJLove

Feature Description

Extend the Consul KV rest api with additional blocking query options:

$ curl \
    https://consul.rocks/v1/kv/my-key?meta=true&filter=true&index=X

The meta=true option would result in returning keys and metadata but no values
The filter=true would only include keys whose modify indices were > X

$ curl \
    https://consul.rocks/v1/kv/my-key?recurse=true&filter=true&index=X

The filter=true option would only return key/value/metadata for keys whose modify indices were > X

Use Case(s)

There are two use cases of interest:

  1. Support clients doing blocking query of a key prefix in order to detect keys being added/removed. Currently the blocking query returns the complete set of keys, so the client needs to maintain state and do set difference operations in order to detect added/removed keys.

  2. Support clients doing blocking query of a key prefix in order to detect values being modified. Right now this has to be done via a blocking query returning values for all keys.
    As suggested in this thread (https://groups.google.com/forum/#!msg/consul-tool/Axow65BtSuY/TCLD5AFmCgAJ;context-place=forum/consul-tool) it would be great if there was an option for Consul to filter and return just the keys with a X-Consul-Index > the index specified in the query

Metadata

Metadata

Assignees

No one assigned

    Labels

    theme/apiRelating to the HTTP API interfacethinkingMore time is needed to research by the Consul Contributorstype/enhancementProposed improvement or new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions