Skip to content

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:

BucketCheckOut pydantic-model

Bases: BaseModel

The latest check of the bucket from a browser, with its current key.

Fields:

checked_by pydantic-field

Who ran it: the person or the runner.

steps pydantic-field

Each step and whether it did what it should.

BucketCheckReport pydantic-model

Bases: BaseModel

What each step of a check did.

Fields:

BucketFile pydantic-model

Bases: BaseModel

A file the bucket stores, as its listing names it.

Fields:

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 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:

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:

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:

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:

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

Bases: BaseModel

Files in the bucket whose headers the browser reads, to register them.

Fields:

keys pydantic-field

The files' keys, each an EDF file outside youSleep/.

BucketReadsOut pydantic-model

Bases: BaseModel

A ranged GET of each file's header, signed for the browser.

Fields:

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:

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:

BucketRegistration pydantic-model

Bases: BucketKey, FreshCheck

A bucket an organisation registers, with its key and a fresh check.

Fields:

Validators:

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:

address_allowed pydantic-field

Whether its policy names the bucket's address; null while it has not reported its policy.

missing_kinds pydantic-field

The kinds of job the bucket needs that it does not take: ingest reads each recording in, delete removes an uploaded copy.

PlatformReachOut pydantic-model

Bases: BaseModel

Whether the platform could reach the bucket when it last tried.

Fields:

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

Bases: BaseModel

A request the bucket is to receive, signed by the platform.

Fields:

  • method (str)
  • url (str)
  • headers (dict[str, str])

headers pydantic-field

Headers to send with it; they are part of the signature.

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/.