Expose `MultipartStore`: multipart uploads that span several calls

Aperta
#833 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, rust
Ambito
api, backend

Direzione di ricerca

Start by reading the existing sign functions and the Rust MultipartStore trait implementations named in the issue, especially PrefixStore and MaybePrefixedStore. The proposal outlines four public functions and a MultipartCapableStore alias, but leaves names and shapes open for discussion. Done means the maintainers agree on an API and it supports creating, resuming, completing, and aborting multipart uploads across calls.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Use case

put(..., use_multipart=True) and open_writer run a whole multipart upload inside one call. Some callers need to keep one multipart upload open across calls, and across processes: a server that receives a large file in several HTTP requests (a resumable upload protocol such as tus, where each request can reach a different host) creates the upload once, sends part n from the request that carries those bytes, and completes it from a later request. Today this needs a second S3 client next to obstore.

object_store already has the operations in its MultipartStore trait, implemented by AmazonS3, GoogleCloudStorage, MicrosoftAzure, InMemory and PrefixStore. The upload id and the part ids are strings, so a caller can store them and resume from another process.

Proposal

Four functions in the style of sign, each with an _async twin, restricted to the stores that implement the trait:

MultipartCapableStore: TypeAlias = AzureStore | GCSStore | S3Store | MemoryStore

class PartId(TypedDict):
    content_id: str

def create_multipart(
    store: MultipartCapableStore,
    path: str,
    *,
    attributes: Attributes | None = None,
    tags: dict[str, str] | None = None,
) -> str: ...  # the upload id

def put_part(
    store: MultipartCapableStore,
    path: str,
    upload_id: str,
    part_idx: int,
    data: bytes | Buffer,
) -> PartId: ...

def complete_multipart(
    store: MultipartCapableStore,
    path: str,
    upload_id: str,
    parts: Sequence[PartId],
) -> PutResult: ...

def abort_multipart(store: MultipartCapableStore, path: str, upload_id: str) -> None: ...

On the Rust side this would be a MultipartCapableStore enum like SignCapableStore, plus a MultipartStore impl for MaybePrefixedStore that prefixes the path, as PrefixStore does. MemoryStore in the alias lets users test their code without a bucket.

Names and shapes are a suggestion. Would you accept this?

Lingua principale
Python
Stelle
848
Fork
50
Merge medio
7h 58m
PR unite (30g)
10

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di developmentseed/obstore

Tutte le issue di developmentseed/obstore

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.