FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
ns_db::ns_bind::Binds Struct Reference

Container for multiple bind mount configurations. More...

#include <bind.hpp>

Public Member Functions

std::vector< Bind > const & get () const
 Retrieves the current list of bind mounts.
 
void push_back (Bind const &bind)
 Appends a new bind mount to the collection.
 
void erase (size_t index)
 Removes a bind mount by its index.
 
bool empty () const noexcept
 Checks whether the bind mount collection is empty.
 

Friends

Value< Bindsdeserialize (std::string_view raw_json)
 Deserializes JSON string into a Binds object.
 

Detailed Description

Container for multiple bind mount configurations.

Manages a collection of Bind entries representing all bind mounts configured for a sandboxed application. Provides methods for adding, removing, and querying bind mounts. Supports serialization to and deserialization from JSON. Maintains index consistency automatically when entries are added or removed.

Definition at line 87 of file bind.hpp.

Member Function Documentation

◆ empty()

bool ns_db::ns_bind::Binds::empty ( ) const
inlinenoexcept

Checks whether the bind mount collection is empty.

Tests if the internal vector contains any bind mount entries. Returns true if no bindings are currently configured, false otherwise.

Returns
bool True if no bind mounts are present, false otherwise

Definition at line 166 of file bind.hpp.

Here is the caller graph for this function:

◆ erase()

void ns_db::ns_bind::Binds::erase ( size_t index)
inline

Removes a bind mount by its index.

Searches for and removes the bind mount with the specified index from the internal vector. After removal, reindexes all remaining bind mounts sequentially starting from 0 to maintain consistent indexing. Logs whether the element was found and removed or if no element with the given index existed.

Parameters
indexThe zero-based index of the bind mount to remove

Definition at line 145 of file bind.hpp.

Here is the caller graph for this function:

◆ get()

std::vector< Bind > const & ns_db::ns_bind::Binds::get ( ) const
inlinenodiscard

Retrieves the current list of bind mounts.

Returns a const reference to the internal vector containing all configured bind mount entries. Does not create a copy; callers receive direct read-only access to the underlying storage.

Returns
std::vector<Bind> const& Const reference to the vector of bind mounts

Definition at line 115 of file bind.hpp.

Here is the caller graph for this function:

◆ push_back()

void ns_db::ns_bind::Binds::push_back ( Bind const & bind)
inline

Appends a new bind mount to the collection.

Adds the provided bind mount configuration to the internal vector. The bind mount will be appended to the end of the list, maintaining insertion order. No validation is performed; the caller is responsible for ensuring the bind configuration is valid.

Parameters
bindThe bind mount configuration to add to the collection

Definition at line 130 of file bind.hpp.

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ deserialize

Value< Binds > deserialize ( std::string_view raw_json)
friend

Deserializes JSON string into a Binds object.

Parses a JSON string containing bind mount configurations and constructs a Binds object. Each JSON entry should have "src", "dst", and "type" fields. The type field must be "ro" (read-only), "rw" (read-write), or "dev" (device). Entries with invalid indices are logged as warnings and skipped. Successfully parsed entries are added to the Binds collection with their respective indices, source paths, destination paths, and access types.

Parameters
raw_jsonThe JSON string containing bind mount configurations
Returns
Value<Binds> The deserialized Binds object on success, or error on parse failure
Parameters
str_raw_jsonThe json string which to deserialize
Returns
The Boot class or the respective error
Parameters
raw_jsonThe json string which to deserialize
Returns
The Desktop class or the respective error
Parameters
str_raw_jsonThe json string which to deserialize
Returns
The Logs class or the respective error
Parameters
str_raw_jsonThe json string which to deserialize
Returns
The Daemon class or the respective error
Parameters
str_raw_jsonThe json string which to deserialize
Returns
The Dispatcher class or the respective error
Parameters
str_raw_jsonThe json string which to deserialize
Returns
The Message class or the respective error
Parameters
raw_jsonThe json string which to deserialize
Returns
The Recipe class or the respective error

Definition at line 184 of file bind.hpp.


The documentation for this struct was generated from the following file: