Tearleads

POST/documents/{documentId}/baseline-stages

Open a rotation baseline stage

Operation documents.baselineStages.open

Description

Opens the stage a writer uploads a rotation baseline's segments to ahead of the unlink or sync that rotates, for a history too large for one request. Requires write access to the document, as every later stage request does, and replaces the caller's earlier stage for it; a user holds at most 4 open stages, and one more returns 409 document_baseline_stage_limit_reached. The stage expires 60 minutes after its last upload and at most 24 hours after it opened; nothing staged is served until a rotating request commits it. An open does not wait for the caller's own stage on the document: while another of the caller's requests holds it (a segment being staged, a header being re-signed, a commit) the open returns 503 with Retry-After and changes nothing, so a writer lets its other requests to that stage finish before it opens again.

Authentication

Requires a signed-in session: the client sends its session token as a bearer token in the Authorization header.

Parameters

NameInTypeDetails
documentIdpathstringrequired
  • pattern ^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

Request body

application/jsonDocumentBaselineStageOpenRequest

Opens the stage of one rotation baseline: the segments a writer uploads ahead of the request that rotates.

3 fields
  • baselineIdstringrequired
    • lowercase UUID v4

    The id every segment of the baseline signs as baselineId. Client-chosen; it names the stage in later requests.

  • contentKeyCommitmentstringrequired
    • exactly 64 characters
    • lowercase hexadecimal

    Commitment of the content key the segments are encrypted under. For the document's current epoch it must be the stored one; for the next epoch it must be the one the rotating request's bundle declares.

  • contentKeyEpochintegerrequired
    • greater than 0

    Content-key epoch the segments are written at: the document's current epoch, or the one the rotating request opens.

Other fields are allowed.

Responses

200 OK

application/jsonDocumentBaselineStageStatusResponse

A rotation baseline stage as the server holds it.

7 fields
  • baselineIdstringrequired
    • lowercase UUID v4

    The staged baseline's id.

  • contentKeyCommitmentstringrequired
    • exactly 64 characters
    • lowercase hexadecimal

    Commitment of the content key the stage is for.

  • contentKeyEpochintegerrequired
    • greater than 0

    Content-key epoch the stage is for.

  • expiresAtstringrequired
    • not empty

    When the stage expires unless another segment or header arrives first, as an ISO 8601 instant.

  • nextSegmentIndexintegerrequired
    • 0 to 4,095

    Index the next staged segment must carry, and the index of the final segment a rotating request sends to commit the stage now.

  • segmentsDigeststringrequired
    • exactly 64 characters
    • lowercase hexadecimal

    The baseline digest over the segments staged so far: what a final segment sent now must sign as baselineSegmentsDigest.

  • stagedBytesintegerrequired
    • at least 0

    Bytes the stage stores so far: each staged segment's ciphertext, signed vectors, plaintext hash and write header. A stage holds at most 1 GiB.

Other fields are allowed.

503 Another request of the caller's holds its stage on the document, and the open did not wait for it. Nothing changed. Retry after the `Retry-After` delay (1 second), once the writer's other requests to that stage have finished. Also the answer when the database cannot be reached, as on every route.

application/jsonErrorResponse

Response headers

NameTypeDetails
retry-afterstringoptional
  • always 1

Other responses

StatusMeaningBody
400Bad Request

application/jsonErrorResponse

401Unauthorized

application/jsonSessionFailureResponse

402Payment Required

application/jsonPaymentRequiredErrorResponse

403Forbidden

application/jsonErrorResponse

404Not Found

application/jsonDocumentBaselineStageNotFoundErrorResponse

409Conflict

application/jsonDocumentBaselineStageConflictErrorResponse

500Internal Server Error

application/jsonErrorResponse