angelos.facade.storage.portfolio_mixin

Mixin for enforcing portfolio policy’s before importing.

exception angelos.facade.storage.portfolio_mixin.PortfolioError

Bases: RuntimeError

Programming error.

ALREADY_EXISTS = ('Portfolio already in storage.', 100)
OWNER_DELETE = ('Forbidden to delete owning portfolio.', 101)
class angelos.facade.storage.portfolio_mixin.PortfolioMixin

Bases: object

Mixin that lets a storage deal with a portfolio repository.

PATH_PORTFOLIOS = (PurePosixPath('/portfolios'),)
accept_portfolio(portfolio: angelos.portfolio.collection.Portfolio)angelos.common.policy.Report

Accept a new portfolio of documents into the vault.

All policies are being applied, if any document is invalid a policy breach will be raised. The owner documents are excluded.

delete_portfolio(eid: uuid.UUID) → bool

Delete an existing portfolio, except the owner.

list_portfolios() → Set[Tuple[str, uuid.UUID]]

Load a list of all portfolios.

Returns (List[Tuple[str, uuid.UUID]]):

List of tuples with portfolio path and ID.

load_portfolio(eid: uuid.UUID, config: Tuple[str])angelos.portfolio.collection.Portfolio

Load portfolio based on uuid.

new_portfolio(portfolio: angelos.portfolio.collection.Portfolio) → bool

Write new portfolio to archive.

portfolio_exists_not(path: pathlib.PurePosixPath, eid: uuid.UUID)

Check that portfolio exists.

portfolio_files(path: pathlib.PurePosixPath, owner: Optional[uuid.UUID] = None)

Glob a list of all files in a portfolio.

portfolio_path(eid: uuid.UUID) → pathlib.PurePosixPath

Generate portfolio path for a particular entity id.

reload_portfolio(portfolio: angelos.portfolio.collection.Portfolio, config: Tuple[str]) → bool

Synchronize portfolio from storage.

remove_file(doc: angelos.document.statements.Revoked)

Remove a revoked statement to the current archive.

save_portfolio(portfolio: angelos.portfolio.collection.Portfolio) → bool

Save a changed portfolio.

This method expects policies to be applied.

statements_portfolio(documents: Set[Union[angelos.document.statements.Verified, angelos.document.statements.Trusted, angelos.document.statements.Revoked]])

Import a bunch of statements to several portfolios.

This method applies policies including revoked.

update_portfolio(portfolio: angelos.portfolio.collection.Portfolio)angelos.common.policy.Report

Update an existing portfolio in storage with documents.

This method applies policies while doing document comparison.

write_file(filename: pathlib.PurePosixPath, doc: angelos.document.document.Document, issuer_as_owner: bool = False)

Write a document to the current archive.

exception angelos.facade.storage.portfolio_mixin.PortfolioNotFound

Bases: RuntimeWarning

Portfolio not found.