fedn.network.storage.statestore.stores package
- class fedn.network.storage.statestore.stores.ClientStore[source]
-
Client store interface.
- class fedn.network.storage.statestore.stores.CombinerStore[source]
Bases:
Store[CombinerDTO]- abstract get_by_name() CombinerDTO[source]
- class fedn.network.storage.statestore.stores.ModelStore[source]
-
- abstract list_ancestors(id: str, limit: int, include_self: bool = False, reverse: bool = False) List[ModelDTO][source]
List ancestors param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- class fedn.network.storage.statestore.stores.PackageStore[source]
Bases:
Store[PackageDTO]- abstract delete_active() bool[source]
Delete the active entity return: Whether the operation was successful
- abstract get_active() PackageDTO[source]
Get the active entity return: The entity
- class fedn.network.storage.statestore.stores.PredictionStore[source]
Bases:
Store[PredictionDTO]
- class fedn.network.storage.statestore.stores.SessionStore[source]
Bases:
Store[SessionDTO]
- class fedn.network.storage.statestore.stores.ValidationStore[source]
Bases:
Store[ValidationDTO]
Subpackages
- fedn.network.storage.statestore.stores.dto package
ClientDTOCombinerDTOMetricDTOModelDTONodeDTOPackageDTOPredictionDTORoundDTORunDTOSessionConfigDTOSessionConfigDTO.aggregatorSessionConfigDTO.aggregator_kwargsSessionConfigDTO.buffer_sizeSessionConfigDTO.clients_requiredSessionConfigDTO.delete_models_storageSessionConfigDTO.helper_typeSessionConfigDTO.model_idSessionConfigDTO.requested_clientsSessionConfigDTO.round_timeoutSessionConfigDTO.roundsSessionConfigDTO.server_functionsSessionConfigDTO.validateSessionConfigDTO.validate_config
SessionDTOStatusDTOTelemetryDTOValidationDTO- Submodules
- fedn.network.storage.statestore.stores.dto.attribute module
- fedn.network.storage.statestore.stores.dto.client module
- fedn.network.storage.statestore.stores.dto.combiner module
- fedn.network.storage.statestore.stores.dto.metric module
- fedn.network.storage.statestore.stores.dto.model module
- fedn.network.storage.statestore.stores.dto.package module
- fedn.network.storage.statestore.stores.dto.prediction module
- fedn.network.storage.statestore.stores.dto.round module
- fedn.network.storage.statestore.stores.dto.run module
- fedn.network.storage.statestore.stores.dto.session module
SessionConfigDTOSessionConfigDTO.aggregatorSessionConfigDTO.aggregator_kwargsSessionConfigDTO.buffer_sizeSessionConfigDTO.clients_requiredSessionConfigDTO.delete_models_storageSessionConfigDTO.helper_typeSessionConfigDTO.model_idSessionConfigDTO.requested_clientsSessionConfigDTO.round_timeoutSessionConfigDTO.roundsSessionConfigDTO.server_functionsSessionConfigDTO.validateSessionConfigDTO.validate_config
SessionDTO
- fedn.network.storage.statestore.stores.dto.shared module
- fedn.network.storage.statestore.stores.dto.status module
- fedn.network.storage.statestore.stores.dto.telemetry module
- fedn.network.storage.statestore.stores.dto.validation module
Submodules
fedn.network.storage.statestore.stores.attribute_store module
- class fedn.network.storage.statestore.stores.attribute_store.AttributeStore[source]
Bases:
Store[AttributeDTO]- get_current_attributes_for_client(client_id: str) List[AttributeDTO][source]
Get all attributes for a specific client.
This method returns the most recent attributes for the given client_id.
- class fedn.network.storage.statestore.stores.attribute_store.MongoDBAttributeStore(database: Database, collection: str)[source]
Bases:
AttributeStore,MongoDBStore[AttributeDTO]
- class fedn.network.storage.statestore.stores.attribute_store.SQLAttributeStore(session)[source]
Bases:
AttributeStore,SQLStore[AttributeDTO,AttributeModel]
fedn.network.storage.statestore.stores.client_store module
- class fedn.network.storage.statestore.stores.client_store.ClientStore[source]
-
Client store interface.
- class fedn.network.storage.statestore.stores.client_store.MongoDBClientStore(database: Database, collection: str)[source]
Bases:
ClientStore,MongoDBStore[ClientDTO]- connected_client_count(combiners: List[str]) List[source]
Count the number of connected clients for each combiner.
- update(item: ClientDTO) ClientDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.client_store.SQLClientStore(Session)[source]
Bases:
ClientStore,SQLStore[ClientDTO,ClientModel]- connected_client_count(combiners) List[Dict][source]
Count the number of connected clients for each combiner.
- update(item: ClientDTO) ClientDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
fedn.network.storage.statestore.stores.combiner_store module
- class fedn.network.storage.statestore.stores.combiner_store.CombinerStore[source]
Bases:
Store[CombinerDTO]- abstract get_by_name() CombinerDTO[source]
- class fedn.network.storage.statestore.stores.combiner_store.MongoDBCombinerStore(database: Database, collection: str)[source]
Bases:
CombinerStore,MongoDBStore[CombinerDTO]- get_by_name(name: str) CombinerDTO[source]
- class fedn.network.storage.statestore.stores.combiner_store.SQLCombinerStore(Session)[source]
Bases:
CombinerStore,SQLStore[CombinerDTO,CombinerModel]- get_by_name(name: str) CombinerDTO[source]
fedn.network.storage.statestore.stores.metric_store module
- class fedn.network.storage.statestore.stores.metric_store.MongoDBMetricStore(database: Database, collection: str)[source]
Bases:
MetricStore,MongoDBStore[MetricDTO]
- class fedn.network.storage.statestore.stores.metric_store.SQLMetricStore(session)[source]
Bases:
MetricStore,SQLStore[MetricDTO,MetricModel]
fedn.network.storage.statestore.stores.model_store module
- class fedn.network.storage.statestore.stores.model_store.ModelStore[source]
-
- abstract list_ancestors(id: str, limit: int, include_self: bool = False, reverse: bool = False) List[ModelDTO][source]
List ancestors param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- class fedn.network.storage.statestore.stores.model_store.MongoDBModelStore(database: Database, collection: str)[source]
Bases:
ModelStore,MongoDBStore[ModelDTO]- list(limit=0, skip=0, sort_key=None, sort_order=SortOrder.DESCENDING, **kwargs)[source]
Select entities.
- Parameters:
- Returns:
The list of entities
- Return type:
List[DTO]
- list_ancestors(id: str, limit: int, include_self: bool = False, reverse: bool = False) List[ModelDTO][source]
List ancestors param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- list_descendants(id: str, limit: int) List[ModelDTO][source]
List descendants param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- update(item: ModelDTO) ModelDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.model_store.SQLModelStore(Session)[source]
Bases:
ModelStore,SQLStore[ModelDTO,ModelModel]- list_ancestors(id: str, limit: int, include_self=False, reverse=False)[source]
List ancestors param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- list_descendants(id: str, limit: int)[source]
List descendants param id: The id of the entity
type: str description: The id of the entity, can be either the id or the model (property)
- param limit: The maximum number of entities to return
type: int
return: A list of entities
- update(item: ModelDTO) ModelDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
fedn.network.storage.statestore.stores.package_store module
- class fedn.network.storage.statestore.stores.package_store.MongoDBPackageStore(database: Database, collection: str)[source]
Bases:
PackageStore,MongoDBStore[PackageDTO]- delete(id: str) bool[source]
Delete an entity.
- Parameters:
id (str) – The id of the entity
- Returns:
success or failure
- Return type:
Bool
- get(id: str) PackageDTO[source]
Get an entity by id.
- get_active() PackageDTO[source]
Get the active entity return: The entity
- list(limit=0, skip=0, sort_key=None, sort_order=SortOrder.DESCENDING, **kwargs) List[PackageDTO][source]
Select entities.
- Parameters:
- Returns:
The list of entities
- Return type:
List[DTO]
- class fedn.network.storage.statestore.stores.package_store.PackageStore[source]
Bases:
Store[PackageDTO]- abstract delete_active() bool[source]
Delete the active entity return: Whether the operation was successful
- abstract get_active() PackageDTO[source]
Get the active entity return: The entity
- class fedn.network.storage.statestore.stores.package_store.SQLPackageStore(Session)[source]
Bases:
PackageStore,SQLStore[PackageDTO,PackageModel]- get_active() PackageDTO[source]
Get the active entity return: The entity
fedn.network.storage.statestore.stores.prediction_store module
- class fedn.network.storage.statestore.stores.prediction_store.MongoDBPredictionStore(database: Database, collection: str)[source]
Bases:
PredictionStore,MongoDBStore[PredictionDTO]
- class fedn.network.storage.statestore.stores.prediction_store.PredictionStore[source]
Bases:
Store[PredictionDTO]
- class fedn.network.storage.statestore.stores.prediction_store.SQLPredictionStore(Session)[source]
Bases:
PredictionStore,SQLStore[PredictionDTO,PredictionModel]
fedn.network.storage.statestore.stores.round_store module
- class fedn.network.storage.statestore.stores.round_store.MongoDBRoundStore(database: Database, collection: str)[source]
Bases:
RoundStore,MongoDBStore[RoundDTO]- update(item: RoundDTO) RoundDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.round_store.SQLRoundStore(Session)[source]
Bases:
RoundStore,SQLStore[RoundDTO,RoundModel]- update(item: RoundDTO) RoundDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
fedn.network.storage.statestore.stores.run_store module
- class fedn.network.storage.statestore.stores.run_store.MongoDBRunStore(database: Database, collection: str)[source]
Bases:
RunStore,MongoDBStore[RunDTO]- update(item: RunDTO) RunDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.run_store.SQLRunStore(session)[source]
Bases:
RunStore,SQLStore[RunDTO,RunModel]- update(item)[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
fedn.network.storage.statestore.stores.session_store module
- class fedn.network.storage.statestore.stores.session_store.MongoDBSessionStore(database: Database, collection: str)[source]
Bases:
SessionStore,MongoDBStore[SessionDTO]- update(item: SessionDTO) SessionDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.session_store.SQLSessionStore(Session)[source]
Bases:
SessionStore,SQLStore[SessionDTO,SessionModel]- update(item: SessionDTO) SessionDTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.session_store.SessionStore[source]
Bases:
Store[SessionDTO]
fedn.network.storage.statestore.stores.status_store module
- class fedn.network.storage.statestore.stores.status_store.MongoDBStatusStore(database: Database, collection: str)[source]
Bases:
StatusStore,MongoDBStore[StatusDTO]
- class fedn.network.storage.statestore.stores.status_store.SQLStatusStore(Session)[source]
Bases:
StatusStore,SQLStore[StatusDTO,StatusModel]
fedn.network.storage.statestore.stores.store module
- class fedn.network.storage.statestore.stores.store.MongoDBStore(database: Database, collection: str, primary_key: str)[source]
Bases:
Store[DTO],Generic[DTO]Base MongoDB store implementation.
- __init__(database: Database, collection: str, primary_key: str) None[source]
Initialize MongoDBStore.
- add(item: DTO) DTO[source]
Add an entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
ValidationError – If validation fails.
- delete(id: str) bool[source]
Delete an entity.
- Parameters:
id (str) – The id of the entity
- Returns:
success or failure
- Return type:
Bool
- list(limit: int = 0, skip: int = 0, sort_key: str | None = None, sort_order=SortOrder.DESCENDING, **kwargs) List[DTO][source]
Select entities.
- Parameters:
- Returns:
The list of entities
- Return type:
List[DTO]
- update(item: DTO) DTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.store.SQLStore(Session: Type[Session], SQLModel: Type[MODEL], primary_key: str)[source]
Bases:
Store[DTO],Generic[DTO,MODEL]Base SQL store implementation.
- __init__(Session: Type[Session], SQLModel: Type[MODEL], primary_key: str) None[source]
Initialize SQLStore.
- add(item: DTO) DTO[source]
Add an entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
ValidationError – If validation fails.
- delete(id: str) bool[source]
Delete an entity.
- Parameters:
id (str) – The id of the entity
- Returns:
success or failure
- Return type:
Bool
- list(limit=0, skip=0, sort_key=None, sort_order=SortOrder.DESCENDING, **kwargs) List[DTO][source]
Select entities.
- Parameters:
- Returns:
The list of entities
- Return type:
List[DTO]
- update(item: DTO) DTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.store.Store[source]
-
Abstract class for a store.
OBS! This is an interface, do not add any implementations here.
- abstract add(item: DTO) DTO[source]
Add an entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
ValidationError – If validation fails.
- abstract delete(id: str) bool[source]
Delete an entity.
- Parameters:
id (str) – The id of the entity
- Returns:
success or failure
- Return type:
Bool
- abstract list(limit: int = 0, skip: int = 0, sort_key: str | None = None, sort_order=SortOrder.DESCENDING, **kwargs) List[DTO][source]
Select entities.
- Parameters:
- Returns:
The list of entities
- Return type:
List[DTO]
- abstract update(item: DTO) DTO[source]
Update an existing entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
EntityNotFound – If the entity is not found.
ValidationError – If validation fails.
fedn.network.storage.statestore.stores.telemetry_store module
- class fedn.network.storage.statestore.stores.telemetry_store.MongoDBTelemetryStore(database: Database, collection: str)[source]
Bases:
TelemetryStore,MongoDBStore[TelemetryDTO]- add(item: TelemetryDTO) TelemetryDTO[source]
Add an entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.telemetry_store.SQLTelemetryStore(Session)[source]
Bases:
TelemetryStore,SQLStore[TelemetryDTO,TelemetryModel]- add(item: TelemetryDTO) TelemetryDTO[source]
Add an entity.
- Parameters:
item (DTO) – The entity to update.
- Returns:
The updated entity.
- Return type:
- Raises:
ValidationError – If validation fails.
- class fedn.network.storage.statestore.stores.telemetry_store.TelemetryStore[source]
Bases:
Store[TelemetryDTO]
fedn.network.storage.statestore.stores.validation_store module
- class fedn.network.storage.statestore.stores.validation_store.MongoDBValidationStore(database: Database, collection: str)[source]
Bases:
ValidationStore,MongoDBStore[ValidationDTO]
- class fedn.network.storage.statestore.stores.validation_store.SQLValidationStore(Session)[source]
Bases:
ValidationStore,SQLStore[ValidationDTO,ValidationModel]
- class fedn.network.storage.statestore.stores.validation_store.ValidationStore[source]
Bases:
Store[ValidationDTO]