Skip to main content

KV_SAVE

info

This command is only available when persistence is enabled.

Saves the data to the filesystem so it can be loaded on startup or at runtime with KV_LOAD.

  • The server config must have persist::enabled set true.
  • Data is written to persist::path set in the config file

ParamTypeMeaningRequired
namestringA friendly name for the dataset. The data is saved to a directory with this name. The name is used when loading the data.Y

The data is written to: <persist::path>/<name>/<timestamp>.

If the config has "persist::path" set to "/nemesisdb/data" and the command is:

{
"KV_SAVE":
{
"name":"dump1"
}
}

The data is written to: /nemesisdb/data/dump1/<timestamp>.

If the command is sent again with the same name, it won't overwrite the first because the <timestamp> is different.

When loading data, the newest timestamp is selected.


Response

KV_SAVE_RSP

ParamTypeMeaning
stunsigned intStatus
namestringThe name used in the request
durationunsigned intDuration, in milliseconds, for the save to complete

st can be:

  • SaveComplete (save complete without error)
  • SaveError (save incomplete, error occured)

See response status for status values.


Examples

Initiate save
{
"KV_SAVE":
{
"name":"users"
}
}
Save complete
{
"KV_SAVE_RSP":
{
"st": 121,
"name":"users",
"duration":50
}
}