loom.core.repository.sqlalchemy.rls.guard_manifest

The guard revisions this release of loom ships, each pinned by its SHA-256 and its catalogue.

A released revision is never edited; a change is a new revision. The file digest is checked before a revision runs and against what the database recorded; the catalogue digests identify which revision a database holds from what any role can read, so startup accepts every revision at or above MIN_COMPATIBLE_GUARD_REVISION. Upgrade the application first, then bootstrap.

Functions

_verified(filename, sha256)

catalog_digest(lines)

Digest catalogue lines independently of their order.

digest(text)

Return the hexadecimal SHA-256 of text encoded as UTF-8.

pending_revisions(applied)

Return the revisions still to apply after checking the ones already applied.

preflight_sql()

Return the static statement that defines the guard-creating temporary function.

Classes

GuardRevision(number, filename, sha256, catalog)

One static guard revision: its number, its file, its digest and its catalogue digests.

class loom.core.repository.sqlalchemy.rls.guard_manifest.GuardRevision(number, filename, sha256, catalog)[source]

Bases: object

One static guard revision: its number, its file, its digest and its catalogue digests.

Parameters:
sql()[source]

Return the revision’s text after checking it is the released text.

Raises:

ConfigError – When the packaged file differs from the released digest.

Return type:

str

loom.core.repository.sqlalchemy.rls.guard_manifest.digest(text)[source]

Return the hexadecimal SHA-256 of text encoded as UTF-8.

Parameters:

text (str)

Return type:

str

loom.core.repository.sqlalchemy.rls.guard_manifest.catalog_digest(lines)[source]

Digest catalogue lines independently of their order.

Parameters:

lines (Iterable[str])

Return type:

str

loom.core.repository.sqlalchemy.rls.guard_manifest.preflight_sql()[source]

Return the static statement that defines the guard-creating temporary function.

Raises:

ConfigError – When the packaged file differs from the released digest.

Return type:

str

loom.core.repository.sqlalchemy.rls.guard_manifest.pending_revisions(applied)[source]

Return the revisions still to apply after checking the ones already applied.

Raises:

ConfigError – When the database holds a revision this release does not know, or one whose recorded digest differs from the released one.

Parameters:

applied (Mapping[int, str])

Return type:

tuple[GuardRevision, …]