Class StartBatchTransactionAction.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
com.google.spanner.executor.v1.StartBatchTransactionAction.Builder
All Implemented Interfaces:
com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, StartBatchTransactionActionOrBuilder, Cloneable
Enclosing class:
StartBatchTransactionAction

public static final class StartBatchTransactionAction.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder> implements StartBatchTransactionActionOrBuilder
 Starts a batch read-only transaction in executor. Successful outcomes of this
 action will contain batch_txn_id--the identificator that can be used to start
 the same transaction in other Executors to parallelize partition processing.

 Example of a batch read flow:
 1. Start batch transaction with a timestamp (StartBatchTransactionAction)
 2. Generate database partitions for a read or query
 (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
 3. Call ExecutePartitionAction for some or all partitions, process rows
 4. Clean up the transaction (CloseBatchTransactionAction).

 More sophisticated example, with parallel processing:
 1. Start batch transaction with a timestamp (StartBatchTransactionAction),
 note the returned BatchTransactionId
 2. Generate database partitions for a read or query
 (GenerateDbPartitionsForReadAction/GenerateDbPartitionsForQueryAction)
 3. Distribute the partitions over a pool of workers, along with the
 transaction ID.

 In each worker:
 4-1. StartBatchTransactionAction with the given transaction ID
 4-2. ExecutePartitionAction for each partition it got, process read results
 4-3. Close (not cleanup) the transaction (CloseBatchTransactionAction).

 When all workers are done:
 5. Cleanup the transaction (CloseBatchTransactionAction). This can be done
 either by the last worker to finish the job, or by the main Executor that
 initialized this transaction in the first place. It is also possible to clean
 it up with a brand new Executor -- just execute StartBatchTransactionAction
 with the ID, then clean it up right away.

 Cleaning up is optional, but recommended.
 
Protobuf type google.spanner.executor.v1.StartBatchTransactionAction
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • clear

      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • getDefaultInstanceForType

      public StartBatchTransactionAction getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public StartBatchTransactionAction buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • clone

      Specified by:
      clone in interface com.google.protobuf.Message.Builder
      Specified by:
      clone in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clone in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • setField

      public StartBatchTransactionAction.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      setField in interface com.google.protobuf.Message.Builder
      Overrides:
      setField in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • clearField

      public StartBatchTransactionAction.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      Specified by:
      clearField in interface com.google.protobuf.Message.Builder
      Overrides:
      clearField in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • clearOneof

      public StartBatchTransactionAction.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Specified by:
      clearOneof in interface com.google.protobuf.Message.Builder
      Overrides:
      clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • setRepeatedField

      public StartBatchTransactionAction.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      Specified by:
      setRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • addRepeatedField

      public StartBatchTransactionAction.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      addRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • mergeFrom

      public StartBatchTransactionAction.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<StartBatchTransactionAction.Builder>
    • mergeFrom

    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • mergeFrom

      public StartBatchTransactionAction.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<StartBatchTransactionAction.Builder>
      Throws:
      IOException
    • getParamCase

      Specified by:
      getParamCase in interface StartBatchTransactionActionOrBuilder
    • clearParam

    • hasBatchTxnTime

      public boolean hasBatchTxnTime()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      hasBatchTxnTime in interface StartBatchTransactionActionOrBuilder
      Returns:
      Whether the batchTxnTime field is set.
    • getBatchTxnTime

      public com.google.protobuf.Timestamp getBatchTxnTime()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      getBatchTxnTime in interface StartBatchTransactionActionOrBuilder
      Returns:
      The batchTxnTime.
    • setBatchTxnTime

      public StartBatchTransactionAction.Builder setBatchTxnTime(com.google.protobuf.Timestamp value)
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
    • setBatchTxnTime

      public StartBatchTransactionAction.Builder setBatchTxnTime(com.google.protobuf.Timestamp.Builder builderForValue)
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
    • mergeBatchTxnTime

      public StartBatchTransactionAction.Builder mergeBatchTxnTime(com.google.protobuf.Timestamp value)
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
    • clearBatchTxnTime

      public StartBatchTransactionAction.Builder clearBatchTxnTime()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
    • getBatchTxnTimeBuilder

      public com.google.protobuf.Timestamp.Builder getBatchTxnTimeBuilder()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
    • getBatchTxnTimeOrBuilder

      public com.google.protobuf.TimestampOrBuilder getBatchTxnTimeOrBuilder()
       The exact timestamp to start the batch transaction.
       
      .google.protobuf.Timestamp batch_txn_time = 1;
      Specified by:
      getBatchTxnTimeOrBuilder in interface StartBatchTransactionActionOrBuilder
    • hasTid

      public boolean hasTid()
       ID of a batch read-only transaction. It can be used to start the same
       batch transaction on multiple executors and parallelize partition
       processing.
       
      bytes tid = 2;
      Specified by:
      hasTid in interface StartBatchTransactionActionOrBuilder
      Returns:
      Whether the tid field is set.
    • getTid

      public com.google.protobuf.ByteString getTid()
       ID of a batch read-only transaction. It can be used to start the same
       batch transaction on multiple executors and parallelize partition
       processing.
       
      bytes tid = 2;
      Specified by:
      getTid in interface StartBatchTransactionActionOrBuilder
      Returns:
      The tid.
    • setTid

      public StartBatchTransactionAction.Builder setTid(com.google.protobuf.ByteString value)
       ID of a batch read-only transaction. It can be used to start the same
       batch transaction on multiple executors and parallelize partition
       processing.
       
      bytes tid = 2;
      Parameters:
      value - The tid to set.
      Returns:
      This builder for chaining.
    • clearTid

       ID of a batch read-only transaction. It can be used to start the same
       batch transaction on multiple executors and parallelize partition
       processing.
       
      bytes tid = 2;
      Returns:
      This builder for chaining.
    • getCloudDatabaseRole

      public String getCloudDatabaseRole()
       Database role to assume while performing this action. Setting the
       database_role will enforce additional role-based access checks on this
       action.
       
      string cloud_database_role = 3;
      Specified by:
      getCloudDatabaseRole in interface StartBatchTransactionActionOrBuilder
      Returns:
      The cloudDatabaseRole.
    • getCloudDatabaseRoleBytes

      public com.google.protobuf.ByteString getCloudDatabaseRoleBytes()
       Database role to assume while performing this action. Setting the
       database_role will enforce additional role-based access checks on this
       action.
       
      string cloud_database_role = 3;
      Specified by:
      getCloudDatabaseRoleBytes in interface StartBatchTransactionActionOrBuilder
      Returns:
      The bytes for cloudDatabaseRole.
    • setCloudDatabaseRole

      public StartBatchTransactionAction.Builder setCloudDatabaseRole(String value)
       Database role to assume while performing this action. Setting the
       database_role will enforce additional role-based access checks on this
       action.
       
      string cloud_database_role = 3;
      Parameters:
      value - The cloudDatabaseRole to set.
      Returns:
      This builder for chaining.
    • clearCloudDatabaseRole

      public StartBatchTransactionAction.Builder clearCloudDatabaseRole()
       Database role to assume while performing this action. Setting the
       database_role will enforce additional role-based access checks on this
       action.
       
      string cloud_database_role = 3;
      Returns:
      This builder for chaining.
    • setCloudDatabaseRoleBytes

      public StartBatchTransactionAction.Builder setCloudDatabaseRoleBytes(com.google.protobuf.ByteString value)
       Database role to assume while performing this action. Setting the
       database_role will enforce additional role-based access checks on this
       action.
       
      string cloud_database_role = 3;
      Parameters:
      value - The bytes for cloudDatabaseRole to set.
      Returns:
      This builder for chaining.
    • setUnknownFields

      public final StartBatchTransactionAction.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      setUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>
    • mergeUnknownFields

      public final StartBatchTransactionAction.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      mergeUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<StartBatchTransactionAction.Builder>