Documentation Repositories

class motey.repositories.base_repository.BaseRepository[source]

Base repository to wrapp database handling.

all()[source]

Return a list of all existing entries in the database.

Returns:a list of all existing entries.
clear()[source]

Remove all entries from the database.

class motey.repositories.labeling_repository.LabelingRepository[source]

Repository for all label specific actions.

add(label, label_type)[source]

Add a new label to the database.

Parameters:
  • label – the label to be added.
  • label_type – the label type of the label.
has(label)[source]

Checks if the given label exist in the database.

Parameters:label – the label to search for.
Returns:True if the lable exists, otherwise False
has_type(label_type)[source]

Checks if a label with the given label_type exist in the database.

Parameters:label_type – the type of the label to search for.
Returns:True if the label type exists, otherwise False
remove(label, label_type=None)[source]

Remove a label from the database.

Parameters:
  • label – the label to be removed.
  • label_type – optional. The label must also matche the label type to be removed.
remove_all_from_type(label_type)[source]

Remove a labels with a specific label type.

Parameters:label_type – the label type where all related labels should be removed.
class motey.repositories.nodes_repository.NodesRepository[source]

Repository for all node specific actions.

add(ip)[source]

Add a new node to the database if they not exist yet.

Parameters:ip – the ip of the new node.
has(ip)[source]

Checks if the given ip exist in the database.

Parameters:ip – the ip of the node to search for.
Returns:True if the node exists, otherwise False
remove(ip)[source]

Remove a node from the database.

Parameters:ip – the ip of the node to be removed.
class motey.repositories.service_repository.ServiceRepository[source]

Repository for all service specific actions.

add(service)[source]

Add a new service to the database if they not exist yet.

Parameters:service – a service model to be stored
has(service_id)[source]

Checks if the given id exist in the database.

Parameters:service_id – the id of the service to search for.
Returns:True if the service exists, otherwise False
remove(service_id)[source]

Remove a service from the database.

Parameters:service_id – the id of the service to be removed.