Skip to content

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.

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

FieldTypeDescription
issuerbytesThe logical client to enroll, 16 bytes; see OperationRef.issuer.

Response: EnrollIssuerResponse

FieldTypeDescription
incarnationuint64The incarnation opened; every earlier incarnation of the issuer is closed.
next_sequenceuint64The first number the client allocates in this incarnation.
deploymentbytesThe 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

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation the client numbered in before it restarted.
next_sequenceuint64The next number the client persisted before it restarted.

Response: ResumeIssuerResponse

FieldTypeDescription
next_sequenceuint64The number to continue from: the persisted one, or the incarnation's retired prefix when that is higher.
deploymentbytesThe 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

FieldTypeDescription
operationOperationRefThe operation to resolve.
excludeboolWhen 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

FieldTypeDescription
stateOperationStateWhere the operation stands.
commit_tsuint64The 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

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation the numbers belong to.
sequencesuint64[]The numbers whose outcomes the client no longer needs, in any order.
deploymentbytesThe 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

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation whose numbers to retire.
belowuint64The first number not to retire: every number below it, up to the first one still owed its outcome, is retired.
deploymentbytesThe deployment of the incarnation, 16 bytes; see OperationRef.deployment.

Response: RetireOperationsResponse

Empty response (no fields).

Types ​

AcknowledgeOperationsRequest ​

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation the numbers belong to.
sequencesuint64[]The numbers whose outcomes the client no longer needs, in any order.
deploymentbytesThe deployment of the incarnation, 16 bytes; see OperationRef.deployment.

AcknowledgeOperationsResponse ​

No fields.

EnrollIssuerRequest ​

FieldTypeDescription
issuerbytesThe logical client to enroll, 16 bytes; see OperationRef.issuer.

EnrollIssuerResponse ​

FieldTypeDescription
incarnationuint64The incarnation opened; every earlier incarnation of the issuer is closed.
next_sequenceuint64The first number the client allocates in this incarnation.
deploymentbytesThe 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.

FieldTypeDescription
issuerbytesThe 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.
incarnationuint64The issuer's incarnation the number belongs to, from EnrollIssuerResponse.
sequenceuint64The 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.
deploymentbytesThe 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 ​

FieldTypeDescription
operationOperationRefThe operation to resolve.
excludeboolWhen 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 ​

FieldTypeDescription
stateOperationStateWhere the operation stands.
commit_tsuint64The commit timestamp of the committed attempt, for COMMITTED; zero otherwise. The same number a write's QueryStats.commit_ts reports.

ResumeIssuerRequest ​

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation the client numbered in before it restarted.
next_sequenceuint64The next number the client persisted before it restarted.

ResumeIssuerResponse ​

FieldTypeDescription
next_sequenceuint64The number to continue from: the persisted one, or the incarnation's retired prefix when that is higher.
deploymentbytesThe deployment the incarnation belongs to, 16 bytes.

RetireOperationsRequest ​

FieldTypeDescription
issuerbytesThe logical client, 16 bytes.
incarnationuint64The incarnation whose numbers to retire.
belowuint64The first number not to retire: every number below it, up to the first one still owed its outcome, is retired.
deploymentbytesThe deployment of the incarnation, 16 bytes; see OperationRef.deployment.

RetireOperationsResponse ​

No fields.

Enums ​

OperationState ​

Where a client operation stands.

ValueNumberDescription
OPERATION_STATE_UNSPECIFIED0—
OPERATION_STATE_COMMITTED1An attempt of it committed; nothing else of it ever takes effect.
OPERATION_STATE_ABORTED2It is proven never to take effect: excluded before any attempt committed it, or its incarnation closed with nothing recorded of it.
OPERATION_STATE_UNKNOWN4Nothing 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_RETIRED5Its outcome was released (acknowledged or retired): it is settled, its outcome is no longer known, and no attempt of it is admitted again.