Local Backend#

LocalBackend configuration schema for OpenFactory applications.

This module defines the LocalBackendConfig class, which extends BaseBackendConfig to configure local host directory backends.

Warning

The LocalBackend is primarily intended for development or testing purposes. It allows OpenFactory services to bind-mount a directory from the host filesystem into Docker containers. For production or network-shared storage, use networked backends (e.g., NFS or S3).

Note

  • All paths are validated to be absolute and to exist on the host.

  • Mount points inside containers are normalized and restricted to safe characters.

  • This module only provides configuration and validation; it does not perform actual file operations.

Usage Example

To use the Local Storage Backend, add a storage entry to your OpenFactory YAML configuration file:

storage:
  type: local
  local_path: /nfs/data
  mount_point: /mnt

See also

The runtime class of the Local Backend is openfactory.filelayer.local_backend.LocalBackend.

class openfactory.schemas.filelayer.local_backend.LocalBackendConfig(**data)[source]#

Bases: BaseBackendConfig

Configuration schema for LocalBackend.

This backend is intended primarily for development or testing purposes. It allows OpenFactory services to bind-mount a local host directory into Docker containers. For production or network-shared storage, use networked backends.

create_backend_instance()[source]#

Instantiate the runtime LocalBackend using this configuration.

Return type:

openfactory.filelayer.local_backend.LocalBackend

Returns:

LocalBackend – Runtime backend instance.

local_path: str#
model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'str_strip_whitespace': True, 'validate_assignment': True}#

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

mount_point: str#
type: Literal['local']#
classmethod validate_mount_point(value)[source]#

Validates and normalizes the mount point inside the container.

Return type:

str

Parameters:

value (str) – Container mount point path.

Returns:

str – Normalized absolute path.

Raises:

ValueError – If the path is relative, contains ‘..’, invalid chars, or too long.

classmethod validate_path(value)[source]#

Validates that the host path exists and is a valid absolute path.

Return type:

str

Parameters:

value (str) – Path to validate.

Returns:

str – Normalized absolute path.

Raises:

ValueError – If the path is not absolute or does not exist on the host.