bucket
An organisation's bucket: registering it, checking it, and registering the files it holds.
An organisation that holds site storage registers one dedicated S3-compatible bucket, with an access key scoped to it. The platform holds the key sealed and signs every URL for the bucket. The bucket is checked from the admin's browser, which must pass, and from the platform, which is expected not to reach it.
BucketCheck
pydantic-model
¶
Bases: BaseModel
The signed requests of one check, on a small test object.
Fields:
-
check_id(UUID) -
object_key(str) -
expires_at(datetime) -
requests(dict[BucketCheckStep, SignedRequest])
BucketCheckOut
pydantic-model
¶
Bases: BaseModel
The latest check of the bucket from a browser, with its current key.
Fields:
-
outcome(BucketCheckOutcome) -
steps(dict[BucketCheckStep, bool]) -
detail(str | None) -
checked_at(datetime) -
checked_by(str)
BucketCheckReport
pydantic-model
¶
Bases: BaseModel
What each step of a check did.
Fields:
-
steps(dict[BucketCheckStep, bool]) -
detail(str | None)
BucketFile
pydantic-model
¶
Bases: BaseModel
A file the bucket stores, as its listing names it.
Fields:
-
key(str) -
size(int) -
etag(str | None) -
last_modified(datetime | None)
etag = None
pydantic-field
¶
Its ETag, as the listing names it.
last_modified = None
pydantic-field
¶
When it was last modified, as the listing names it (LastModified). A gateway that serves files on disk may give a file written there no ETag, or keep one that no longer fits it; its modification time still changes with it.
BucketFolders
pydantic-model
¶
Bases: BaseModel
The folders a bucket project registered files from: where to look for new files.
Fields:
-
folders(list[str])
folders
pydantic-field
¶
Each folder its registered files were chosen from, ending in '/', or empty for the whole bucket. A folder inside another is left out: listing the other finds its files.
BucketFound
pydantic-model
¶
Bases: BaseModel
Files a listing of the bucket found, as the client reports them.
Fields:
-
files(list[BucketFile]) -
folder(str | None) -
after(str | None) -
through(str | None)
Validators:
-
_files_in_the_folder
after = None
pydantic-field
¶
The range judged starts after this key: the last key of the folder's previous report. Unset, from the folder's first key.
files
pydantic-field
¶
The files, as the listing names them.
folder = None
pydantic-field
¶
The folder whose every file that can be registered files names, between after and through, ending in '/', or empty for the whole bucket. The project's files registered from below it in that range are judged: one the listing lacks, or names with another size, ETag or modification time, is missing at the site; one it names as registered is there again. Without it, nothing is judged.
through = None
pydantic-field
¶
The range judged ends at this key: the last key reported, when more of the folder follows. Unset, through the folder's last key. A folder listed page by page is judged in full, one report at a time, in key order.
judges(key)
¶
Whether key is in the folder and the range this report judges.
BucketFoundOut
pydantic-model
¶
Bases: BaseModel
Which of the files a listing found the project can register.
Fields:
missing
pydantic-field
¶
The keys of the project's files registered from below the folder listed in full that are missing at the site: no file is at the key, or the file there has another size, ETag or modification time. Empty when no folder was listed in full.
new
pydantic-field
¶
The keys of the files that can be registered where they are and that the project has not registered.
BucketKey
pydantic-model
¶
Bases: BaseModel
An access key scoped to the bucket: it may read, write, list and delete there.
Fields:
-
access_key_id(str) -
secret_access_key(SecretStr)
secret_access_key
pydantic-field
¶
Held sealed by the platform, and never returned.
BucketKeyOut
pydantic-model
¶
Bases: BaseModel
One of the bucket's keys; its secret is never returned.
Fields:
-
access_key_id(str) -
created_at(datetime)
BucketListing
pydantic-model
¶
Bases: BaseModel
One page of the bucket to list, to register recordings already stored there.
Fields:
-
prefix(str) -
folders(bool) -
continuation_token(str | None)
Validators:
-
_leaves_out_where_youSleep_writes
continuation_token = None
pydantic-field
¶
The previous page's NextContinuationToken, to list the next.
folders = False
pydantic-field
¶
List one level, the folders under the prefix apart from its files, to browse; else every key under it, to register.
prefix = ''
pydantic-field
¶
List the keys under this prefix; empty is the top of the bucket, listed one level down. Nothing under youSleep/ is listed.
BucketOut
pydantic-model
¶
Bases: BaseModel
One of the organisation's buckets, its keys and its checks.
Fields:
-
id(UUID) -
endpoint_url(str) -
region(str) -
bucket(str) -
created_at(datetime) -
superseded_at(datetime | None) -
key(BucketKeyOut | None) -
signed_with(BucketKeyOut | None) -
browser_check(BucketCheckOut | None) -
runner_check(BucketCheckOut | None) -
reads_failing_since(datetime | None) -
platform_reach(PlatformReachOut | None) -
ready(bool) -
projects(int) -
runners(list[BucketRunner]) -
deletes_waiting(int) -
deletes_given_up(int)
browser_check = None
pydantic-field
¶
The latest browser check with the newest key.
deletes_given_up = 0
pydantic-field
¶
Files deleted on the platform whose delete the site's runners failed for so long that it is no longer tried: they stay in the bucket. A check of the bucket's key that passes asks for their delete again.
deletes_waiting = 0
pydantic-field
¶
Files deleted on the platform that the site's runners have not yet deleted from the bucket. A delete that fails is tried again.
key
pydantic-field
¶
The newest key it was given; none once revoked.
projects = 0
pydantic-field
¶
How many projects keep their recordings in it. While none does, a bucket registered in its place replaces it with nothing left behind.
reads_failing_since = None
pydantic-field
¶
Since when the site's runners have failed to read the bucket's recordings with the key that signs for it: the bucket refused the key, or did not answer. Null once one of them reads it again, or while another key signs.
ready
pydantic-field
¶
Whether the bucket can hold new projects: a key signs for it, that key's latest browser check passed or warned, and the platform cannot reach it or that was acknowledged.
runner_check = None
pydantic-field
¶
The latest check from a runner of the site with the newest key, as its doctor runs it from the site's network. It does not decide whether the bucket is ready.
runners
pydantic-field
¶
Whether each approved runner of the organisation's site can work with the bucket, as its policy reports.
signed_with = None
pydantic-field
¶
The key URLs for it are signed with: the newest whose browser check passed or warned. A newer key takes over once its own check passes, and the one before it is then revoked; none before any key's check has passed.
superseded_at = None
pydantic-field
¶
When another bucket was registered in its place. It keeps the projects stored in it; new projects go to the other.
BucketReads
pydantic-model
¶
BucketReadsOut
pydantic-model
¶
Bases: BaseModel
A ranged GET of each file's header, signed for the browser.
Fields:
-
reads(dict[str, SignedRequest])
reads
pydantic-field
¶
Each key's GET of its header, valid for a few minutes.
BucketRegistered
pydantic-model
¶
Bases: BaseModel
How one file of a batch registration went: its recording's ID, or why not.
Fields:
-
key(str) -
recording_id(UUID | None) -
name(str | None) -
code(str | None) -
message(str | None)
code = None
pydantic-field
¶
Why it was not registered, as an error code such as already_registered.
key
pydantic-field
¶
The file's key in the bucket.
message = None
pydantic-field
¶
Why, in words.
name = None
pydantic-field
¶
The name its recording carries, and its study without the extension: in a project that codes file names, the code it was registered under.
recording_id = None
pydantic-field
¶
The recording it is registered as.
BucketRegisteredOut
pydantic-model
¶
Bases: BaseModel
How each file of a batch registration went, in the order sent.
Fields:
-
results(list[BucketRegistered])
BucketRegistration
pydantic-model
¶
Bases: BucketKey, FreshCheck
A bucket an organisation registers, with its key and a fresh check.
Fields:
-
password(str) -
code(str | None) -
access_key_id(str) -
secret_access_key(SecretStr) -
endpoint_url(str) -
region(str) -
bucket(str)
Validators:
-
_an_https_origin→endpoint_url
endpoint_url
pydantic-field
¶
The bucket's S3 endpoint: https://, a host and an optional port, without a path. Path-style addressing is used.
BucketRunner
pydantic-model
¶
Bases: BaseModel
Whether one of the site's runners can work with a bucket, as its policy reports.
Fields:
-
runner_id(UUID) -
name(str) -
address_allowed(bool | None) -
missing_kinds(list[LeaseKind])
PlatformReachOut
pydantic-model
¶
Bases: BaseModel
Whether the platform could reach the bucket when it last tried.
Fields:
-
reach(PlatformReach) -
detail(str) -
checked_at(datetime) -
acknowledged_at(datetime | None)
acknowledged_at = None
pydantic-field
¶
When an owner or admin acknowledged that the platform can reach the bucket. Only a reachable bucket needs it.
SignedRequest
pydantic-model
¶
modified_alike(recorded, seen)
¶
Whether a file's modification time is the one recorded, as far as both are known.
Read at whole seconds, within MODIFIED_TOLERANCE. An unknown time on
either side decides nothing.
names_platform_keys(prefix, *, folders)
¶
Whether a listing under prefix would name the keys youSleep writes.
Listed one level down, the top of the bucket names youSleep/ as a
folder only; listed in full, it names every key under it.
not_registrable(key)
¶
Return why the bucket's file at key cannot be registered where it is, or None.
A key with a . or .. segment, or a leading /, is refused: a
URL to it would be rewritten to another key, perhaps one under
youSleep/.