entity.infrastructure.protocols module

Protocol definitions for infrastructure interfaces.

class entity.infrastructure.protocols.DatabaseInfrastructure(*args, **kwargs)[source]

Bases: Protocol

Protocol for database infrastructure implementations.

async startup()[source]

Perform asynchronous initialization.

Return type:

None

async shutdown()[source]

Perform asynchronous cleanup.

Return type:

None

async health_check()[source]

Return True if the infrastructure is healthy.

Return type:

bool

connect()[source]

Return a database connection context manager.

Return type:

Any

__init__(*args, **kwargs)
class entity.infrastructure.protocols.VectorStoreInfrastructure(*args, **kwargs)[source]

Bases: Protocol

Protocol for vector store infrastructure implementations.

async startup()[source]

Perform asynchronous initialization.

Return type:

None

async shutdown()[source]

Perform asynchronous cleanup.

Return type:

None

async health_check()[source]

Return True if the infrastructure is healthy.

Return type:

bool

connect()[source]

Return a vector store connection context manager.

Return type:

Any

__init__(*args, **kwargs)
class entity.infrastructure.protocols.StorageInfrastructure(*args, **kwargs)[source]

Bases: Protocol

Protocol for storage infrastructure implementations.

async startup()[source]

Perform asynchronous initialization.

Return type:

None

async shutdown()[source]

Perform asynchronous cleanup.

Return type:

None

async health_check()[source]

Return True if the infrastructure is healthy.

Return type:

bool

resolve(path)[source]

Resolve a path relative to the storage root.

Parameters:

path (str)

Return type:

str

async read(path)[source]

Read file contents.

Parameters:

path (str)

Return type:

bytes

async write(path, data)[source]

Write file contents.

Parameters:
Return type:

None

async delete(path)[source]

Delete a file.

Parameters:

path (str)

Return type:

None

async exists(path)[source]

Check if a file exists.

Parameters:

path (str)

Return type:

bool

async list_files(prefix='')[source]

List files with optional prefix.

Parameters:

prefix (str)

Return type:

list[str]

__init__(*args, **kwargs)