com.google.api.services.spanner.v1.model.CommitRequest Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.spanner.v1.model;
/**
* The request for Commit.
*
* This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Spanner API. For a detailed explanation see:
* https://developers.google.com/api-client-library/java/google-http-java-client/json
*
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class CommitRequest extends com.google.api.client.json.GenericJson {
/**
* Optional. The amount of latency this request is configured to incur in order to improve
* throughput. If this field is not set, Spanner assumes requests are relatively latency sensitive
* and automatically determines an appropriate delay time. You can specify a commit delay value
* between 0 and 500 ms.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private String maxCommitDelay;
/**
* The mutations to be executed when this transaction commits. All mutations are applied
* atomically, in the order they appear in this list.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.util.List mutations;
/**
* Common options for this request.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private RequestOptions requestOptions;
/**
* If `true`, then statistics related to the transaction will be included in the CommitResponse.
* Default value is `false`.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Boolean returnCommitStats;
/**
* Execute mutations in a temporary transaction. Note that unlike commit of a previously-started
* transaction, commit with a temporary transaction is non-idempotent. That is, if the
* `CommitRequest` is sent to Cloud Spanner more than once (for instance, due to retries in the
* application, or in the transport library), it is possible that the mutations are executed more
* than once. If this is undesirable, use BeginTransaction and Commit instead.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private TransactionOptions singleUseTransaction;
/**
* Commit a previously-started transaction.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String transactionId;
/**
* Optional. The amount of latency this request is configured to incur in order to improve
* throughput. If this field is not set, Spanner assumes requests are relatively latency sensitive
* and automatically determines an appropriate delay time. You can specify a commit delay value
* between 0 and 500 ms.
* @return value or {@code null} for none
*/
public String getMaxCommitDelay() {
return maxCommitDelay;
}
/**
* Optional. The amount of latency this request is configured to incur in order to improve
* throughput. If this field is not set, Spanner assumes requests are relatively latency sensitive
* and automatically determines an appropriate delay time. You can specify a commit delay value
* between 0 and 500 ms.
* @param maxCommitDelay maxCommitDelay or {@code null} for none
*/
public CommitRequest setMaxCommitDelay(String maxCommitDelay) {
this.maxCommitDelay = maxCommitDelay;
return this;
}
/**
* The mutations to be executed when this transaction commits. All mutations are applied
* atomically, in the order they appear in this list.
* @return value or {@code null} for none
*/
public java.util.List getMutations() {
return mutations;
}
/**
* The mutations to be executed when this transaction commits. All mutations are applied
* atomically, in the order they appear in this list.
* @param mutations mutations or {@code null} for none
*/
public CommitRequest setMutations(java.util.List mutations) {
this.mutations = mutations;
return this;
}
/**
* Common options for this request.
* @return value or {@code null} for none
*/
public RequestOptions getRequestOptions() {
return requestOptions;
}
/**
* Common options for this request.
* @param requestOptions requestOptions or {@code null} for none
*/
public CommitRequest setRequestOptions(RequestOptions requestOptions) {
this.requestOptions = requestOptions;
return this;
}
/**
* If `true`, then statistics related to the transaction will be included in the CommitResponse.
* Default value is `false`.
* @return value or {@code null} for none
*/
public java.lang.Boolean getReturnCommitStats() {
return returnCommitStats;
}
/**
* If `true`, then statistics related to the transaction will be included in the CommitResponse.
* Default value is `false`.
* @param returnCommitStats returnCommitStats or {@code null} for none
*/
public CommitRequest setReturnCommitStats(java.lang.Boolean returnCommitStats) {
this.returnCommitStats = returnCommitStats;
return this;
}
/**
* Execute mutations in a temporary transaction. Note that unlike commit of a previously-started
* transaction, commit with a temporary transaction is non-idempotent. That is, if the
* `CommitRequest` is sent to Cloud Spanner more than once (for instance, due to retries in the
* application, or in the transport library), it is possible that the mutations are executed more
* than once. If this is undesirable, use BeginTransaction and Commit instead.
* @return value or {@code null} for none
*/
public TransactionOptions getSingleUseTransaction() {
return singleUseTransaction;
}
/**
* Execute mutations in a temporary transaction. Note that unlike commit of a previously-started
* transaction, commit with a temporary transaction is non-idempotent. That is, if the
* `CommitRequest` is sent to Cloud Spanner more than once (for instance, due to retries in the
* application, or in the transport library), it is possible that the mutations are executed more
* than once. If this is undesirable, use BeginTransaction and Commit instead.
* @param singleUseTransaction singleUseTransaction or {@code null} for none
*/
public CommitRequest setSingleUseTransaction(TransactionOptions singleUseTransaction) {
this.singleUseTransaction = singleUseTransaction;
return this;
}
/**
* Commit a previously-started transaction.
* @see #decodeTransactionId()
* @return value or {@code null} for none
*/
public java.lang.String getTransactionId() {
return transactionId;
}
/**
* Commit a previously-started transaction.
* @see #getTransactionId()
* @return Base64 decoded value or {@code null} for none
*
* @since 1.14
*/
public byte[] decodeTransactionId() {
return com.google.api.client.util.Base64.decodeBase64(transactionId);
}
/**
* Commit a previously-started transaction.
* @see #encodeTransactionId()
* @param transactionId transactionId or {@code null} for none
*/
public CommitRequest setTransactionId(java.lang.String transactionId) {
this.transactionId = transactionId;
return this;
}
/**
* Commit a previously-started transaction.
* @see #setTransactionId()
*
*
* The value is encoded Base64 or {@code null} for none.
*
*
* @since 1.14
*/
public CommitRequest encodeTransactionId(byte[] transactionId) {
this.transactionId = com.google.api.client.util.Base64.encodeBase64URLSafeString(transactionId);
return this;
}
@Override
public CommitRequest set(String fieldName, Object value) {
return (CommitRequest) super.set(fieldName, value);
}
@Override
public CommitRequest clone() {
return (CommitRequest) super.clone();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy