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.capability_repository.CapabilityRepository[source]

Repository for all capability specific actions.

add(capability, capability_type)[source]

Add a new capability to the database.

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

Checks if the given capability exist in the database.

Parameters:capability – the capability to search for.
Returns:True if the lable exists, otherwise False
remove(capability, capability_type=None)[source]

Remove a capability from the database.

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

Remove a capabilities with a specific capability type.

Parameters:capability_type – the capability type where all related capabilitys 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 (dict) – 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.
update(service)[source]

Update a service in the database.

Parameters:service (dict) – a service model to be updated