OperationService
Client operation identity: number a client's writes so that each takes effect at most once however it is retried, and find out after a lost reply, a reconnect, a restart of the client or a change of leader how a write stands, without running it again.
A logical client (an issuer) is enrolled once per incarnation and numbers its writes itself, without a round trip per write. A write that carries an OperationRef (ExecuteCypherRequest.operation, CommitTransactionRequest .operation, session Execute.operation and Commit.operation) takes effect at most once: a retry of a write that already took effect runs nothing and is refused with FAILED_PRECONDITION, reason OPERATION_SETTLED, naming its outcome. A client that must survive its own crash persists the reference before it sends the write.
Proto source
Transport
All methods are available via:
- gRPC on port 7080 — native high-performance API
- REST/JSON on port 7081 — HTTP/JSON transcoding via embedded structured-proxy
Methods
EnrollIssuer
Enroll a new incarnation of an issuer, closing every earlier one: a closed incarnation admits no new write, and what it admitted stays resolvable. A client enrolls when it starts a logical client for the first time or cannot restore its allocation.
HTTP: POST /v1/operation/issuer/enroll
Request: EnrollIssuerRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client to enroll, 16 bytes; see OperationRef.issuer. |
Response: EnrollIssuerResponse
| Field | Type | Description |
|---|---|---|
incarnation | uint64 | The incarnation opened; every earlier incarnation of the issuer is closed. |
next_sequence | uint64 | The first number the client allocates in this incarnation. |
deployment | bytes | The deployment the incarnation belongs to, 16 bytes, carried in every OperationRef of the incarnation. |
ResumeIssuer
Resume an incarnation after a client restart, numbering from what the client persisted. Refused with FAILED_PRECONDITION when the incarnation is closed or was never enrolled here: the client then enrolls a new one.
HTTP: POST /v1/operation/issuer/resume
Request: ResumeIssuerRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation the client numbered in before it restarted. |
next_sequence | uint64 | The next number the client persisted before it restarted. |
Response: ResumeIssuerResponse
| Field | Type | Description |
|---|---|---|
next_sequence | uint64 | The number to continue from: the persisted one, or the incarnation's retired prefix when that is higher. |
deployment | bytes | The deployment the incarnation belongs to, 16 bytes. |
ResolveOperation
How an operation stands, optionally proving that one with no committed attempt never takes effect.
HTTP: POST /v1/operation/resolve
Request: ResolveOperationRequest
| Field | Type | Description |
|---|---|---|
operation | OperationRef | The operation to resolve. |
exclude | bool | When true, an operation nothing is recorded of is excluded through the log first, so the answer is final: COMMITTED, or ABORTED and never taking effect. The proof a client needs before it gives the operation up or runs the work again under a new reference. Decided by the group's log, and refused on a member that is not the leader (FAILED_PRECONDITION, reason NOT_LEADER). When false, reports what this member has applied. |
Response: ResolveOperationResponse
| Field | Type | Description |
|---|---|---|
state | OperationState | Where the operation stands. |
commit_ts | uint64 | The commit timestamp of the committed attempt, for COMMITTED; zero otherwise. The same number a write's QueryStats.commit_ts reports. |
AcknowledgeOperations
Release the outcomes of operations the client no longer needs, out of number order: each settled one then reads as retired and admits nothing. An operation still owed its outcome, or a number nothing is recorded of, is left as it is.
HTTP: POST /v1/operation/acknowledge
Request: AcknowledgeOperationsRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation the numbers belong to. |
sequences | uint64[] | The numbers whose outcomes the client no longer needs, in any order. |
deployment | bytes | The deployment of the incarnation, 16 bytes; see OperationRef.deployment. |
Response: AcknowledgeOperationsResponse
Empty response (no fields).
RetireOperations
Retire an incarnation's numbers below a bound, up to the first one still owed its outcome: their records are released and the numbers, used or not, admit nothing again.
HTTP: POST /v1/operation/retire
Request: RetireOperationsRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation whose numbers to retire. |
below | uint64 | The first number not to retire: every number below it, up to the first one still owed its outcome, is retired. |
deployment | bytes | The deployment of the incarnation, 16 bytes; see OperationRef.deployment. |
Response: RetireOperationsResponse
Empty response (no fields).
Types
AcknowledgeOperationsRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation the numbers belong to. |
sequences | uint64[] | The numbers whose outcomes the client no longer needs, in any order. |
deployment | bytes | The deployment of the incarnation, 16 bytes; see OperationRef.deployment. |
AcknowledgeOperationsResponse
No fields.
EnrollIssuerRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client to enroll, 16 bytes; see OperationRef.issuer. |
EnrollIssuerResponse
| Field | Type | Description |
|---|---|---|
incarnation | uint64 | The incarnation opened; every earlier incarnation of the issuer is closed. |
next_sequence | uint64 | The first number the client allocates in this incarnation. |
deployment | bytes | The deployment the incarnation belongs to, 16 bytes, carried in every OperationRef of the incarnation. |
OperationRef
A reference to one client operation: what a client persists before sending a write and sends again with every retry of it, on any connection and to any member.
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client: 16 bytes the client chooses once and keeps across its restarts (a random value, or a digest of a stable application identity). Independent clients use different issuers; a connection, session or server is not an issuer. |
incarnation | uint64 | The issuer's incarnation the number belongs to, from EnrollIssuerResponse. |
sequence | uint64 | The operation's number within the incarnation, allocated by the client: starting at EnrollIssuerResponse.next_sequence, each new write takes the next number, and a retry of a write keeps its number. Numbers are an identity, not an execution order: writes with different numbers may run concurrently and complete in any order. |
deployment | bytes | The deployment that enrolled the incarnation, 16 bytes, from EnrollIssuerResponse.deployment. A server of another deployment refuses the reference with INVALID_ARGUMENT, reason FOREIGN_OPERATION, rather than admit it as a new operation. |
ResolveOperationRequest
| Field | Type | Description |
|---|---|---|
operation | OperationRef | The operation to resolve. |
exclude | bool | When true, an operation nothing is recorded of is excluded through the log first, so the answer is final: COMMITTED, or ABORTED and never taking effect. The proof a client needs before it gives the operation up or runs the work again under a new reference. Decided by the group's log, and refused on a member that is not the leader (FAILED_PRECONDITION, reason NOT_LEADER). When false, reports what this member has applied. |
ResolveOperationResponse
| Field | Type | Description |
|---|---|---|
state | OperationState | Where the operation stands. |
commit_ts | uint64 | The commit timestamp of the committed attempt, for COMMITTED; zero otherwise. The same number a write's QueryStats.commit_ts reports. |
ResumeIssuerRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation the client numbered in before it restarted. |
next_sequence | uint64 | The next number the client persisted before it restarted. |
ResumeIssuerResponse
| Field | Type | Description |
|---|---|---|
next_sequence | uint64 | The number to continue from: the persisted one, or the incarnation's retired prefix when that is higher. |
deployment | bytes | The deployment the incarnation belongs to, 16 bytes. |
RetireOperationsRequest
| Field | Type | Description |
|---|---|---|
issuer | bytes | The logical client, 16 bytes. |
incarnation | uint64 | The incarnation whose numbers to retire. |
below | uint64 | The first number not to retire: every number below it, up to the first one still owed its outcome, is retired. |
deployment | bytes | The deployment of the incarnation, 16 bytes; see OperationRef.deployment. |
RetireOperationsResponse
No fields.
Enums
OperationState
Where a client operation stands.
| Value | Number | Description |
|---|---|---|
OPERATION_STATE_UNSPECIFIED | 0 | — |
OPERATION_STATE_COMMITTED | 1 | An attempt of it committed; nothing else of it ever takes effect. |
OPERATION_STATE_ABORTED | 2 | It is proven never to take effect: excluded before any attempt committed it, or its incarnation closed with nothing recorded of it. |
OPERATION_STATE_UNKNOWN | 4 | Nothing is recorded of it: an attempt may still be on its way. Not proof that it was never sent; resolving with exclude gives one. |
OPERATION_STATE_RETIRED | 5 | Its outcome was released (acknowledged or retired): it is settled, its outcome is no longer known, and no attempt of it is admitted again. |
