cutan.projects_store¶
Where a cutan project’s files are read from: a disk folder or S3, by configuration.
The library’s projects kind is a mapping relative path -> bytes (ADR-0024:
s3://{bucket}/{tenant}/cutan/projects/{rel} mirrors ~/.local/share/cutan/projects/{rel}
exactly, so both backends hold the same keys). projects_store() returns that
mapping; materialize_project() returns a real folder for tools that need files
(ffmpeg, a browser), reading through a cache under ~/.cache/cutan/projects/.
Configuration (environment; the first match wins, CUTAN_HOME always forces local):
CUTAN_HOMEset: local, under that root (an explicit root beats any S3 setting)CUTAN_PROJECTS_BACKEND=s3: S3, withCUTAN_S3_BUCKET(defaulttw-apps),CUTAN_S3_PROFILE(defaulttw-server) andCUTAN_S3_TENANT(defaultthorwhalen)otherwise: local (the default)
Functions
|
|
|
A real folder holding |
|
The projects as |
Classes
|
Which backend holds the projects, and its S3 coordinates. |
- class cutan.projects_store.ProjectsStoreSettings(backend='local', bucket='tw-apps', profile='tw-server', tenant='thorwhalen')[source]¶
Bases:
objectWhich backend holds the projects, and its S3 coordinates.
- classmethod from_environ(environ=None)[source]¶
>>> ProjectsStoreSettings.from_environ({}).backend 'local' >>> ProjectsStoreSettings.from_environ({"CUTAN_PROJECTS_BACKEND": "s3"}).backend 's3' >>> env = {"CUTAN_PROJECTS_BACKEND": "s3", "CUTAN_HOME": "/x"} >>> ProjectsStoreSettings.from_environ(env).backend 'local'
- cutan.projects_store.materialize_project(project_id, *, settings=None, store=None, cache=None)[source]¶
A real folder holding
project_id’s files.Local backend: the project folder itself, no copy. S3: files are read through into the cache and kept; a cached file whose size matches the object’s is reused.
- Return type: