Skip to content

Commit

Permalink
cleanup(sinsp): move clear to built_in_table
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Nosek <[email protected]>
  • Loading branch information
gnosek committed Dec 12, 2024
1 parent e0117a7 commit 22c6ca8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
8 changes: 0 additions & 8 deletions userspace/libsinsp/plugin_table_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,6 @@ struct plugin_table_wrapper : public libsinsp::state::table<KeyType> {
return m_dyn_fields_as_base_class;
}

void clear_entries() override {
auto res = m_input->writer_ext->clear_table(m_input->table);
if(res != SS_PLUGIN_SUCCESS) {
throw sinsp_exception(table_input_error_prefix(m_owner, m_input.get()) +
"clear entries failure: " + m_owner->get_last_error());
}
}

// used only for foreach_entry below
struct table_iterator_state {
std::string err;
Expand Down
12 changes: 6 additions & 6 deletions userspace/libsinsp/state/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ class base_table {
m_dynamic_fields = dynf;
}

/**
* @brief Erase all the entries present in the table.
* After invoking this function, entries_count() will return true.
*/
virtual void clear_entries() = 0;

/**
* @brief Allocates and returns a new entry for the table. This is just
* a factory method, the entry will not automatically added to the table.
Expand Down Expand Up @@ -322,6 +316,12 @@ class built_in_table : public table<KeyType> {
virtual std::shared_ptr<table_entry> add_entry(const KeyType& key,
std::unique_ptr<table_entry> entry) = 0;

/**
* @brief Erase all the entries present in the table.
* After invoking this function, entries_count() will return true.
*/
virtual void clear_entries() = 0;

/**
* @brief Removes an entry from the table with the given key.
*
Expand Down

0 comments on commit 22c6ca8

Please sign in to comment.