angelos.lib.facade.base

Layout for new Facade framework.

class angelos.lib.facade.base.BaseFacade(home_dir: pathlib.Path, secret: bytes)

Bases: object

Facade is the interface and firewall for an entity and its documents.

Parameters
  • home_dir (str) – Path to the facade storage archives.

  • secret (bytes) – 32 byte encryption key.

  • vault ("StorageFacadeExtension") – The vault storage.

__home_dir

Description of attribute __home_dir.

Type

type

__secret

Description of attribute __secret.

Type

type

__post_init

Description of attribute __post_init.

Type

type

__closed

Description of attribute __closed.

Type

type

__data

Description of attribute __data.

Type

type

__api

Description of attribute __api.

Type

type

__task

Description of attribute __task.

Type

type

__storage

Description of attribute __storage.

Type

type

property api

Exposes the mapped api extensions of the facade.

Returns

The mapping class for apis.

Return type

FacadeMapping

close() → None

Close down the facade in a proper way.

property closed

Indicate if archive is closed.

Returns

Facade closed state.

Return type

bool

property data

Exposes the data extensions of the facade.

Returns

The mapping class for apis.

Return type

FacadeMapping

property path

Property exposing the Facade home directory..

Returns

Facade home path.

Return type

str

post_init(vault: VaultStorage) → None

Async post initialization.

property secret

Property exposing the Facade encryption key.

Returns

Facade encryption key.

Return type

bytes

property storage

Exposes the mapped archive extensions in the facade.

Returns

The mapping class for archives.

Return type

FacadeMapping

property task

Exposes the mapped task extensions on the facade.

Returns

The mapping class for tasks.

Return type

FacadeMapping

exception angelos.lib.facade.base.FacadeError

Bases: RuntimeError

Thrown when error happens in or with a Facade.

EXTENSION_ATTR_OCCUPIED = ('Extension attribute already occupied.', 100)
EXTENSION_ATTR_OCCUPIED_STORAGE = ('Extension storage attribute already occupied.', 101)
ILLEGAL_ROLE = ('Illegal role', 103)
MISSING_ENTITY = ('No entity present in portfolio', 104)
POST_INIT_DONE = ('Post init already done', 102)
UNKNOWN_ENTITY_TYPE = ('Entity in portfolio of unknown type', 105)
class angelos.lib.facade.base.FacadeExtension(facade: BaseFacade)

Bases: angelos.lib.facade.base.FacadeFrozen

Base class for a facade service extension.

An extension is a class or service that adds functionality to the facade, a kind of plugin.

Parameters

facade (Facade) – Owning facade.

ATTRIBUTE = ('',)
gather(*aws: Awaitable) → List[Any]

Run multiple awaitables in asyncio.gather.

If there is any exceptions they will be printed to the logs.

Parameters

*aws (Awaitable) – Multiple awaitables to be run async.

Returns

Success or failure.

Return type

bool

class angelos.lib.facade.base.FacadeFrozen(facade: BaseFacade)

Bases: object

Base class for instances owned by the Facade.

All inheritors has a reference back to their owning Facade and can make use of the @internal decorator.

Parameters

facade (Facade) – Owning facade instance.

property facade

Expose a readonly weakref of the facade.

Returns

weak reference to the owning facade.

Return type

Facade