Skip to content

Commit

Permalink
refactor(libsinsp/container_engine): drop request_rw_size
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Jan 6, 2025
1 parent 3100c7f commit 291d95e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion userspace/libsinsp/container_engine/containerd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ bool libsinsp::container_engine::containerd::resolve(sinsp_threadinfo *tinfo,
return false;
}

containerd_lookup_request request(container_id, CT_CONTAINERD, 0, false);
containerd_lookup_request request(container_id, CT_CONTAINERD, 0);

container_cache_interface *cache = &container_cache();
sinsp_container_info::ptr_t container_info = cache->get_container(request.container_id);
Expand Down
17 changes: 5 additions & 12 deletions userspace/libsinsp/container_engine/containerd.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ namespace libsinsp {
namespace container_engine {

struct containerd_lookup_request {
containerd_lookup_request(): container_type(CT_CONTAINERD), uid(0), request_rw_size(false) {}
containerd_lookup_request(): container_type(CT_CONTAINERD), uid(0) {}

containerd_lookup_request(const std::string& container_id_value,
sinsp_container_type container_type_value,
unsigned long uid_value,
bool rw_size_value):
unsigned long uid_value):
container_id(container_id_value),
container_type(container_type_value),
uid(uid_value),
request_rw_size(rw_size_value) {}
uid(uid_value) {}

bool operator<(const containerd_lookup_request& rhs) const {
if(container_id != rhs.container_id) {
Expand All @@ -54,22 +52,17 @@ struct containerd_lookup_request {
return container_type < rhs.container_type;
}

if(uid != rhs.uid) {
return uid < rhs.uid;
}

return request_rw_size < rhs.request_rw_size;
return uid < rhs.uid;
}

bool operator==(const containerd_lookup_request& rhs) const {
return container_id == rhs.container_id && container_type == rhs.container_type &&
uid == rhs.uid && request_rw_size == rhs.request_rw_size;
uid == rhs.uid;
}

std::string container_id;
sinsp_container_type container_type;
unsigned long uid;
bool request_rw_size;
};

class containerd_async_source : public container_async_source<containerd_lookup_request> {
Expand Down

0 comments on commit 291d95e

Please sign in to comment.