Base Backend#

Base configuration schema for all storage backends in OpenFactory applications.

This module defines the BaseBackendConfig class, which serves as the foundation for backend-specific configuration schemas (e.g., NFSBackendConfig, LocalBackendConfig, S3BackendConfig).

Note

  • Use subclasses to define fields specific to each backend.

  • The extra=”forbid” option ensures that typos or unexpected fields in configuration files raise validation errors.

  • Subclasses must implement BaseBackendConfig.create_backend_instance() to return the actual runtime backend instance.

Warning

The BaseBackendConfig class is an abstract class not intented to be used.

class openfactory.schemas.filelayer.base_backend.BaseBackendConfig(**data)[source]#

Bases: BaseModel

Base configuration schema for all storage backends in OpenFactory applications.

All backend-specific configuration fields must be defined in a subclass of BaseBackendConfig (e.g., NFSBackendConfig, S3BackendConfig).

Ading a new backend

  1. Create a subclass of BaseBackendConfig with its specific fields.

  2. Update openfactory.schemas.filelayer.types.StorageBackend to accept the new backend type.

  3. Implement the corresponding openfactory.filelayer.backend.FileBackend subclass for deployment and usage.

create_backend_instance()[source]#

Create a runtime backend instance from this configuration.

Subclasses must implement this method to return the actual backend instance (e.g., NFSBackend).

Returns:

Any – Runtime backend instance corresponding to this configuration.

Raises:

NotImplementedError – If the subclass does not implement this method.

description: str | None#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_assignment': True}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

type: str#