Skip to main content

KV Store

Stores and retrieves key/value pairs along with optional metadata in a Kelp KV data store.

component image

In-ports

get Object | String — retrieve the value and metadata for the given key.

set Object — set the value or metadata for the given key.

delete Object | String — remove an object with the specified key from the data store.

meta Object | String — retrieve the metadata for the given key.

list-keys Object — list all keys in the data store (limited to 100 results).

Out-ports

result Object — emits an object corresponding to the key on get input port.

set Object — confirms the "set" operation by emitting the same event input or emits an error if "key" or "value" is missing or invalid.

delete Object — emits the key of the deleted object from delete input.

meta Array — emits metadata corresponding to the key on meta input port.

keys Array — emits a list of keys for all objects stored in the assigned data store.

errors Object — emits any errors that occur during action execution.

Overview

The KV Store component allows for the execution of CRUD (Create, Read, Update, Delete) operations, along with the capability to list keys on the associated Kelp key/value store. Before using, ensure that the key/value store is created and assigned to the component.

The Kelp key/value store (KV Store) facilitates storing arbitrary strings identified by string keys. It is treated as a JSON object containing "key" and "value", and optionally "meta" for metadata, like { "key": "name", "value": "James", "meta": null}.

Each input port represents a specific operation. All operations, except list-keys, require the "key" property to identify the stored object. Corresponding output ports emit events for each input event. For example, sending {"key": "<key_value>"} to the get input port retrieves the value if the object exists and emits it on result.

Set operation adds a new object if the key isn't found. If the key exists, it updates the object with the new value.

list-keys port accepts any event and returns an array of keys for all currently stored objects in the store. The output on "keys" port will be {"keys": [{"key": "name"}]}. By default, it returns up to 100 keys. To retrieve additional keys, include an "offset" property in the input event—for example, { offset: 200 } will return keys 201–300. To include metadata with the keys, add includeMetadata: true to the input event.

Use a context property with each input to correlate with corresponding output events. This property passes through unchanged to the corresponding output port. For unique context values, use the KelpQL uuid_v4() function in your transformation.

Settings

This component requires no additional configuration.