angelos.archive7.archive

Archive implementation.

class angelos.archive7.archive.Archive7(filename: pathlib.Path, secret: bytes, delete: int = <Delete.ERASE: 3>)

Bases: angelos.common.misc.SharedResourceMixin

Archive main class and high level API.

class Query(pattern: unicode = '*')

Bases: object

Low level query API.

EQ = '='
GT = '>'
LT = '<'
NE = '≠'
build(paths=None)

Generate the search query function.

created(created, operand='<')

Search with creation date.

deleted(deleted)

Search for deleted.

group(group, operand='=')

Search with unix group.

id(identity=None)

Search for ID.

modified(modified, operand='<')

Search with modified date.

owner(owner, operand='=')

Search with owner.

parent(parent, operand='=')

Search with directory ID.

type(_type=None, operand='=')

Search for an entry type.

property types

File system entry types.

user(user, operand='=')

Search with unix username.

chmod(*args, **kwargs)
close()

Close archive.

property closed

Archive closed status.

glob(name: unicode = '*', id: uuid.UUID = None, parent: uuid.UUID = None, owner: uuid.UUID = None, created: datetime.datetime = None, modified: datetime.datetime = None, deleted: bool = False, user: unicode = None, group: unicode = None) → set

Glob the file system in the archive.

info(*args, **kwargs)
isdir(*args, **kwargs)
isfile(*args, **kwargs)
load(*args, **kwargs)
mkdir(*args, **kwargs)
mkfile(*args, **kwargs)
move(*args, **kwargs)
static open(filename: pathlib.Path, secret: bytes, delete: int = 3)

Open an archive with a symmetric encryption key.

Parameters
  • filename (str) – Path and filename to archive

  • secret (bytes) – Encryption key

  • delete (int) – Delete methodology

Returns (Archive7):

Opened Archive7 instance

remove(*args, **kwargs)
rename(*args, **kwargs)
save(*args, **kwargs) → uuid.UUID
search(query: angelos.archive7.archive.Archive7.Query)

Search is an async generator that iterates over the file system hierarchy.

Use accordingly: query = Archive.Query() async for entry, path in archive.search(query):

pass

static setup(filename: pathlib.Path, secret: bytes, owner: uuid.UUID = None, node: uuid.UUID = None, title: unicode = None, domain: uuid.UUID = None, type_: int = None, role: int = None, use: int = None)

Create a new archive.

Parameters
  • filename (str) – Path and filename to archive

  • secret (bytes) – Encryption key

  • owner (uuid.UUID) – Angelos owner UUID

  • node (uuid.UUID) – Angelos node UUID

  • title (str) – Title or name of the archive

  • domain (uuid.UUID) – Angelos domain UUID

  • type (int) – Facade type

  • role (int) – Node role

  • use (int) – Archive usage

Returns (Archive7):

Initialized Archive7 instance

stats()

Archive stats.

exception angelos.archive7.archive.Archive7Error

Bases: RuntimeError

Errors related to Archive7.

AR7_NOT_FOUND = ('Archive file not found', 121)
AR7_OPERAND_INVALID = ('Invalid or unsupported operand', 122)
INVALID_FORMAT = ('Invalid format', 120)
class angelos.archive7.archive.Header(owner: uuid.UUID, identity: uuid.UUID = None, node: uuid.UUID = None, domain: uuid.UUID = None, title: Union[bytes, bytearray] = None, type_: int = None, role: int = None, use: int = None, major: int = 2, minor: int = 0, created: datetime.datetime = None)

Bases: object

Header for the Archive 7 format.

FORMAT = '!8scHHbbb16s16s16s16sQ256s'
created
domain
id
major
static meta_unpack(data: Union[bytes, bytearray])angelos.archive7.archive.Header
minor
node
owner
role
title
type
use