angelos.facade.storage.vault

Vault.

class angelos.facade.storage.vault.VaultStorage(facade: Facade, home_dir: pathlib.Path, secret: bytes, delete=<Delete.HARD: 2>)

Bases: angelos.facade.facade.StorageFacadeExtension, angelos.facade.storage.portfolio_mixin.PortfolioMixin

Vault interface.

The Vault is the most important archive in a facade, because it contains the private entity data.

ATTRIBUTE = ('vault',)
CONCEAL = ('vault.ar7',)
INBOX = PurePosixPath('/messages/inbox')
INIT_FILES = (('/settings/preferences.ini', b''), ('/settings/networks.csv', b''))
INIT_HIERARCHY = ('/cache', '/cache/msg', '/contacts', '/contacts/favorites', '/contacts/friends', '/contacts/all', '/contacts/blocked', '/issued', '/issued/verified', '/issued/trusted', '/issued/revoked', '/messages', '/messages/inbox', '/messages/read', '/messages/drafts', '/messages/outbox', '/messages/sent', '/messages/spam', '/messages/trash', '/networks', '/settings', '/settings/nodes', '/portfolios')
NODES = PurePosixPath('/settings/nodes')
USEFLAG = (118,)
delete(filename: pathlib.PurePosixPath)

Remove a document at a certain location.

Parameters

filename

Returns:

issuer(issuer, path: pathlib.PurePosixPath = PurePosixPath('/'), limit=1)

Search a folder for documents by issuer.

Create a link to file or directory.

Parameters
  • path (str) – Path of the link.

  • (str (link_to) – Path being linked to.

load_settings(name: unicode) → _io.StringIO

Load a text settings file.

Parameters

name

Returns:

save(filename: pathlib.PurePosixPath, document, document_file_id_match=True) → uuid.UUID

Save a document at a certain location.

Parameters
  • filename

  • document

  • document_file_id_match

Returns:

save_settings(name: unicode, text: _io.StringIO) → bool

Save or update a text settings file.

Parameters
  • name

  • text

Returns:

search(pattern: unicode = '/', modified: datetime.datetime = None, created: datetime.datetime = None, owner: uuid.UUID = None, link: bool = False, limit: int = 0, deleted: Optional[bool] = None, fields: Callable = <cyfunction VaultStorage.search.<locals>.<lambda>>) → Dict[uuid.UUID, Any]

Searches for a files in the storage.

Parameters
  • pattern (str) – Path search pattern.

  • modified (datetime.datetime) – Files modified since.

  • created (datetime.datetime) – Files created since.

  • owner (uuid.UUID) – Files belonging to owner.

  • link (bool) – Include links in result.

  • limit (int) – Max number of hits (0 is unlimited).

  • deleted (bool) – Search for deleted files.

  • fields (lambda) – Lambda function that compiles the result row.

Returns (Dict[uuid.UUID, Any]):

Returns a dictionary with a custom resultset indexed by file ID.

search_docs(issuer: Optional[uuid.UUID] = None, path: pathlib.PurePosixPath = PurePosixPath('/'), limit: int = 1) → List[bytes]

Search a folder for documents by issuer and path.

classmethod setup(home_dir: pathlib.Path, secret: bytes, portfolio: angelos.portfolio.collection.PrivatePortfolio, vault_type: Optional[int] = None, vault_role: Optional[int] = None) → object

Create and setup the whole Vault according to policy’s.

Parameters
  • home_dir (str) –

  • secret (bytes) –

  • portfolio (PrivatePortfolio) –

  • vtype

  • vrole

Returns:

update(filename: pathlib.PurePosixPath, document) → uuid.UUID

Update a document on file.

Parameters
  • filename

  • document

Returns: