httk.core.files

Stdlib-only storage records for OPTIMADE files entries.

FileRecord stores file metadata and a flat sha256 digest. The URL is part of identity deliberately: two paths to the same bytes are two entries. The mapping-valued checksums field is skipped because SQL storage cannot persist mappings; use sha256 for the storable digest.

Attributes

Classes

FileRecord

Store one OPTIMADE files entry with content identity metadata.

FileEntry

Logical entry family for served FileRecord records.

Module Contents

httk.core.files.FILES_DEFINITION_ID = 'https://schemas.optimade.org/defs/v1.2/entrytypes/optimade/files'[source]
class httk.core.files.FileRecord[source]

Bases: httk.core.entry_types.File

Store one OPTIMADE files entry with content identity metadata.

URL and name remain required positional fields. The URL is included in identity so separate paths to identical bytes remain separate entries. The human-readable and immutable identifiers, metadata timestamps, and other metadata are excluded from content identity. checksums is skipped because mapping fields are not SQL-storable; store the flat sha256 value when a storable digest is needed.

Parameters:
  • url – The URL to get the contents of the file.

  • name – The base name of the file.

  • id – The human-readable entry id shared by all revisions; minted by the store when None.

  • immutable_id – The per-revision immutable id; minted by the store when None.

  • last_modified – The optional timezone-aware metadata timestamp.

  • url_stable_until – The optional URL stability deadline.

  • size – The file size in bytes, if known.

  • media_type – The file MIME type, if known.

  • version – The file version, if known.

  • modification_timestamp – The optional content modification timestamp.

  • description – An optional free-form file description.

  • checksums – Optional checksums, kept out of SQL storage.

  • atime – The optional POSIX access timestamp.

  • ctime – The optional POSIX status-change timestamp.

  • mtime – The optional POSIX modification timestamp.

  • sha256 – The optional flat SHA-256 digest.

id: Annotated[str | None, IdentitySkip(), Indexed()] = None[source]
immutable_id: Annotated[str | None, IdentitySkip(), Unique()] = None[source]
last_modified: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
url_stable_until: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
size: int | None = None[source]
media_type: str | None = None[source]
version: str | None = None[source]
modification_timestamp: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
description: str | None = None[source]
checksums: Annotated[collections.abc.Mapping[str, str] | None, Skip()] = None[source]
atime: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
ctime: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
mtime: Annotated[datetime.datetime | None, IdentitySkip()] = None[source]
sha256: str | None = None[source]
property type: str[source]

Return the served entry type name.

class httk.core.files.FileEntry[source]

Logical entry family for served FileRecord records.

This family is not itself storable; store a FileRecord directly.

type = 'files'[source]
definition_id = 'https://schemas.optimade.org/defs/v1.2/entrytypes/optimade/files'[source]