> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DVS Features

Part of [Dynamic Visualization Store](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r1/group__dvs__main)

### Delete Item API Overview

Sometimes solvers need to rewind to a previous timestep and begin writing new data for various reasons. The delete api facilitates this allowing users to make a call to delete specific timesteps or a collection of timesteps. This call is similar to the [dvs\_begin\_update()](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r1/dynamic__visualization__store__api_8h#aaac598618be531e8aa2b72ad41e18537) and [dvs\_end\_update()](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r1/dynamic__visualization__store__api_8h#ae75177bf47fcb28313e79840bf778c75) calls where all ranks must make the same call for each rank in parallel. The API calls for this are [dvs\_delete\_item()](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r1/dynamic__visualization__store__api_8h#a5237ada583b0cb7817d12d1135f9349e) (C API), [DVS::IClient::delete\_item()](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r1/class_d_v_s_1_1_i_client.md#a5e8f192f5c683a8265dd94020506a0aa) (C++ API), and delete\_item() (Python API).

**Note:** Currently for the delete item api call to work the number of servers needs to match how the data was originally written. So if it was written using 3 servers everything should still be running with 3 servers when calling the delete item api. If the number of servers varies you will see inconsistent results on timesteps being fully deleted out of all caches.

Example Usage:

```cpp theme={null}
#include <string>
#include <chrono>
#include <thread>

#include "dvs_client_interface.h"
#include "dvs_server_interface.h"
#include "dynamic_visualization_store_enums.h"

static void logging_function(void* user_data, const char* message)
{
    fprintf(stderr, message);
}

int main(int argc, char** argv)
{
  std::string server_uri = "grpc://localhost:12345/";
 DVS::IServer* server = DVS::CREATE_SERVER_INSTANCE(server_uri.c_str());
 if (!server) {
 //Error creating server
 return -1;
  }
  std::string cache_uri = "hdf5://localhost/D:/my/cache/location";
 //Set a cache uri location if saving/caching data
  server->set_option("CACHE_URI", cache_uri.c_str());
  uint32_t server_number = 0; //Zero based server number
  uint32_t local_ranks = 1; //Number of local ranks for this specific server
  server->startup(server_number, local_ranks);

 //Turn on blocking for server and client side deduplication
 dvs_client_flags client_flags = dvs_client_flags::BLOCK_FOR_SERVER | dvs_client_flags::DEDUP;
  std::string shared_secret = ""; // Can use a shared secret to authenticate clients with server
 DVS::IClient* client = DVS::CREATE_CLIENT_INSTANCE(server, client_flags, shared_secret.c_str());
 if (!client) {
 //Error creating client
 return -2;
  }
 dvs_log_flags log_flags = dvs_log_flags::LOG_ALL; //Turn on all logging for debugging
  client->set_logger(new DVS::Logger(nullptr, log_flags, logging_function));

  std::string dataset_name = "my_dataset";
  uint32_t my_rank = 0; //Zero based rank number;
  uint32_t num_global_ranks = 1; //Number of global ranks across all servers
  uint32_t num_chunks = 1; //Number of chunks this rank is using, 1 if not using chunking

 //Initialize dataset
  client->begin_init(dataset_name.c_str(), my_rank, num_global_ranks, num_chunks);
  client->set_unit_system("SI");
  {
 //Add a part
 dvs_part_info part_info;
    part_info._id = 1;
    part_info._name = "Part 1";
    part_info._structured = 0;
    part_info._chunking = 0;
    part_info._metadata_num_pairs = 0;
    part_info._metadata_keys = nullptr;
    part_info._metadata_vals = nullptr;
    client->add_part_info(&part_info, 1);
  }
  {
 //Add a var
 dvs_var_info var_info;
    var_info._id = 1;
    var_info._name = "Var 1";
    var_info._type = dvs_var_type::SCALAR;
    var_info._location = dvs_var_location::NODE;
    var_info._unit = "";
    var_info._unit_label = "";
    var_info._metadata_num_pairs = 0;
    var_info._metadata_keys = nullptr;
    var_info._metadata_vals = nullptr;
    client->add_var_info(&var_info, 1);
  }
  client->end_init();

 //Delete all timesteps after 5.5 seconds
 //See the DVS Cache URI section on Query Stanza's for more information on filtering.
 //The delete item API only supports timestep.time objects currently.
  client->delete_item(my_rank, "/timestep.time/gte/5.5");
 DVS::DESTROY_CLIENT_INSTANCE(client);
  uint32_t num_pending = 1;
  uint32_t num_complete = 0;
 //Wait until the server finished before shutting it down or the write operations may not complete
 while (num_pending > 0) {
 dvs_ret error = server->get_timestep_count(num_pending, num_complete);
 if (error != DVS_NONE) {
 break;
    }
    std::this_thread::sleep_for(std::chrono::milliseconds(50));
  }
 DVS::DESTROY_SERVER_INSTANCE(server);
}
```
