WARNING: As previously announced on our communication channels, the Kytos project will enter the "shutdown" phase on May 31, 2021. After this date, only critical patches (security and core bug fixes) will be accepted, and the project will be in "critical-only" mode for another six months (until November 30, 2021). For more information visit the FAQ at <https://kytos.io/faq>. We'll have eternal gratitude to the entire community of developers and users that made the project so far.
This NApp is responsible for data persistence, saving and retrieving information. It can be acessed by external agents through the REST API or by other NApps, using the event-based methods.
Each box of data can be saved in a different namespace, with support for nested namespaces.
The NApp is designed to support many options of back-end persistence solutions. Currently it features filesystem operations, but alternatives such as SQL or NoSQL databases will be implemented.
All of the Kytos Network Applications are located in the NApps online repository. To install this NApp, run:
$ kytos napps install kytos/storehouse
The NApp listens to events requesting operations. Every event must have a callback function to be executed right after the internal method returns. The signature of the callback function is described with each event.
Event requesting to save data to a box in a namespace.
{
data: <any data to be saved>,
namespace: <namespace name>,
callback: <callback function> # To be executed after the method returns.
}
def callback_function_name(box, error=False):
# box: copy of the Box instance stored with data and metadata.
# error: False when the operation is successful, True otherwise.
Event requesting to load data from a box in a namespace.
{
box_id: <ID of the Box to retrieve data from>,
namespace: <namespace name>,
callback: <callback function> # To be executed after the method returns.
}
def callback_function_name(box, error=False):
# box: the retrieved Box instance.
# error: False when the operation is successful, True otherwise.
Event requesting to list all boxes in a namespace.
{
namespace: <namespace name>,
callback: <callback function> # To be executed after the method returns.
}
def callback_function_name(box_list, error=False):
# box_list: the retrieved list of Box.box_id.
# error: False when the operation is successful, True otherwise.
Event requesting to remove a box from a namespace.
{
box_id: <ID of the Box to be deleted>,
namespace: <namespace name>,
callback: <callback function> # To be executed after the method returns.
}
def callback_function_name(result, error=False):
# result: True if the box was deleted, False otherwise .
# error: False when the operation is successful, True otherwise.
You can find a list of the available endpoints and example input/output in the 'REST API' tab in this NApp's webpage in the Kytos NApps Server.