s3dol.capabilities¶
Keyed capabilities as sibling stores; non-keyed operations as free functions (ADR-0011 D2/D3/D4).
A keyed capability is a Layer B KvReader over the same key space whose
__getitem__ returns the capability:
BucketStore k -> bytes
BucketHandles s3dol.handles(s) k -> ObjectHandle
BucketUrls s3dol.urls(s) k -> presigned URL (str) | None
BucketInfo s3dol.info(s) k -> ObjectInfo (one HeadObject per key)
BucketListedInfo s3dol.listed_info(s) k -> ObjectInfo (one LIST, a snapshot)
__getitem__ is the one thing dol maps correctly at every wrapper depth,
so sibling stores are correct by construction: no inner_most_key, no
wrapped_self, no guard — immune to both the lost-reference hole (D1a) and
the non-Store-layer hole (D3a), the only form in ADR-0011 that is.
The cost, stated plainly (D2): a user who wraps the data store must wrap the sibling in parallel:
s = s3_store('bucket', prefix='p/')
h = s3dol.handles(s)
c = KeyCodecs.prefixed('x/') # a user-applied key codec
s2, h2 = c(s), c(h) # wrap BOTH
h2['f'] # -> handle on 'p/x/f'; correct at any depth
The accessors therefore derive a sibling from an unwrapped store and raise on a wrapped one, naming that remedy — s3dol will not guess a user’s codec chain (that is dol#10).
Free functions (D3) resolve keys with the store held as an argument (alive, so
no weakref registry is consulted). Per D3a they are more reliable than
methods, not reliable: a hand-rolled non-Store passthrough layer in the
chain can still defeat the resolution — no docstring here claims “correct at
any wrapper depth”; only the sibling stores may claim that.
Module Attributes
AWS's DeleteObjects cap. |
Functions
|
Delete bucket |
|
Bulk delete (ADR-0010 §2; a free function per ADR-0011 D4 — keyed + destructive + delegated is the census's data-destroying shape). |
|
The sibling store of |
|
The sibling store of |
|
The sibling store of |
|
The 'directories' one level under the store's scope, **relative to the caller's key space** — one |
|
A store scoped to |
|
The sibling store of presigned URLs: |
Classes
|
|
|
|
|
|
|
|
- class s3dol.capabilities.BucketHandles(bucket, *, connection=None, prefix='', delimiter='/', reads=None, writes=None, on_missing_bucket='assume', strict_delete=False)[source]¶
Bases:
BucketCollection,KvReaderk -> ObjectHandle(key bound at construction; zero round-trips).
- class s3dol.capabilities.BucketInfo(bucket, *, connection=None, prefix='', delimiter='/', reads=None, writes=None, on_missing_bucket='assume', strict_delete=False)[source]¶
Bases:
BucketCollection,KvReaderk -> ObjectInfo(oneHeadObject).
- class s3dol.capabilities.BucketListedInfo(bucket, *, connection=None, prefix='', delimiter='/', reads=None, writes=None, on_missing_bucket='assume', strict_delete=False)[source]¶
Bases:
BucketCollection,KvReaderk -> ObjectInfofrom the listing rows, not oneHeadObjectper key.The first access (a lookup or an iteration) pages through
ListObjectsV2once and keeps{key: ObjectInfo}(size,last_modified,etag,storage_class;content_typeand the other HEAD-only fields stayNone). It is lazy and a snapshot: later writes are not seen; make a newlisted_info(store)to refresh. A whole-bucket ETag comparison costs one LIST per 1000 keys.
- class s3dol.capabilities.BucketUrls(*args, expires_in=3600, client_method='get_object', **kwargs)[source]¶
Bases:
BucketCollection,KvReaderk -> presigned URL(zero object requests;Nonewhen anonymous). The canonical spelling of whaturl_forshims (ADR-0011 D3b).
- s3dol.capabilities.DELETE_MANY_CHUNK = 1000¶
AWS’s DeleteObjects cap. moto accepts 1001, so tier 2 can never catch a missing chunker (ADR-0010 §2) — hence the constant is also unit-tested.
- s3dol.capabilities.delete_bucket(endpoint, name, *, force=False)[source]¶
Delete bucket
name. Refuses a non-empty bucket unlessforce=True, in which case the cascade paginates — v0 listed one page, deleted ≤1000 objects, then failed: a partial, non-idempotent destruction (ADR-0010 §3). A free function, not a method (ADR-0011 D4).- Return type:
- s3dol.capabilities.delete_many(store, keys)[source]¶
Bulk delete (ADR-0010 §2; a free function per ADR-0011 D4 — keyed + destructive + delegated is the census’s data-destroying shape).
Chunks at 1000 (AWS’s cap), parses the
Errorslist out of the HTTP 200 response, and on partial failure raises oneS3PartialFailurecarrying.succeededand.failures. Absent keys are reported by S3 asDeleted— this function does not distinguish them (same idempotency asdel store[k]).Keys are the caller’s keys: with the store held as an argument the chain is resolved via
dol.inner_most_key(alive store — no weakref hole). Validate-the-target caveat (D4): the first argument must be an s3dol store or a dol wrapper over one.- Return type:
- s3dol.capabilities.handles(store)[source]¶
The sibling store of
ObjectHandles:handles(s)[k].- Return type:
- s3dol.capabilities.listed_info(store)[source]¶
The sibling store of
ObjectInfobuilt from one paginated LIST:listed_info(s)[k](a lazy snapshot; seeBucketListedInfo).- Return type:
- s3dol.capabilities.prefixes(store)[source]¶
The ‘directories’ one level under the store’s scope, **relative to the caller’s key space** — one
ListObjectsV2(Delimiter='/')readingCommonPrefixes(which v0 parsed and then called from nowhere; ADR-0009). Through a dol wrapper chain, the listing is rooted at the caller’s scope (each prefix layer’s contribution) and results are mapped back outward (_key_of_idper layer, innermost first — the inverse walkdoldoes not provide; ADR-0011 D3). A wrapper whose codec cannot express the scope raises — loud, not wrong.- Return type:
- s3dol.capabilities.sub(store, prefix)[source]¶
A store scoped to
prefix, in the caller’s key space (D3).Two branches, deliberately different (each documented in the ADR):
unwrapped s3dol store:
leaf._with(prefix=...)— cheap, keeps server-side prefix pushdown, returns the same class;dol-wrapped store: composes
Pipe(filt_iter.prefixes(p), KeyCodecs.prefixed(p))over the outer store (filter FIRST — the only safe composition, ADR-0006 §1), which preserves the user’s codecs but loses pushdown (a full scan filtered client-side; D8 closed this: the cheap path is the unwrapped branch) and returns a different type.