Skip to content

Commit

Permalink
feat: Update transaction.proto to include different lock modes (#9236)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 481838475

Source-Link: googleapis/googleapis@922f1f3

Source-Link: googleapis/googleapis-gen@bf32c6e
  • Loading branch information
jskeet committed Oct 18, 2022
1 parent 3350e47 commit 4fed510
Showing 1 changed file with 115 additions and 27 deletions.
142 changes: 115 additions & 27 deletions apis/Google.Cloud.Spanner.V1/Google.Cloud.Spanner.V1/Transaction.g.cs
Expand Up @@ -26,34 +26,38 @@ public static partial class TransactionReflection {
string.Concat(
"CiNnb29nbGUvc3Bhbm5lci92MS90cmFuc2FjdGlvbi5wcm90bxIRZ29vZ2xl",
"LnNwYW5uZXIudjEaHmdvb2dsZS9wcm90b2J1Zi9kdXJhdGlvbi5wcm90bxof",
"Z29vZ2xlL3Byb3RvYnVmL3RpbWVzdGFtcC5wcm90byLDBAoSVHJhbnNhY3Rp",
"Z29vZ2xlL3Byb3RvYnVmL3RpbWVzdGFtcC5wcm90byLrBQoSVHJhbnNhY3Rp",
"b25PcHRpb25zEkUKCnJlYWRfd3JpdGUYASABKAsyLy5nb29nbGUuc3Bhbm5l",
"ci52MS5UcmFuc2FjdGlvbk9wdGlvbnMuUmVhZFdyaXRlSAASTwoPcGFydGl0",
"aW9uZWRfZG1sGAMgASgLMjQuZ29vZ2xlLnNwYW5uZXIudjEuVHJhbnNhY3Rp",
"b25PcHRpb25zLlBhcnRpdGlvbmVkRG1sSAASQwoJcmVhZF9vbmx5GAIgASgL",
"Mi4uZ29vZ2xlLnNwYW5uZXIudjEuVHJhbnNhY3Rpb25PcHRpb25zLlJlYWRP",
"bmx5SAAaCwoJUmVhZFdyaXRlGhAKDlBhcnRpdGlvbmVkRG1sGqgCCghSZWFk",
"T25seRIQCgZzdHJvbmcYASABKAhIABI4ChJtaW5fcmVhZF90aW1lc3RhbXAY",
"AiABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wSAASMgoNbWF4X3N0",
"YWxlb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mVyqgIXR29vZ2xlLkNsb3VkLlNwYW5uZXIuVjHKAhdHb29nbGVcQ2xv",
"dWRcU3Bhbm5lclxWMeoCGkdvb2dsZTo6Q2xvdWQ6OlNwYW5uZXI6OlYxYgZw",
"cm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.DurationReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions), global::Google.Cloud.Spanner.V1.TransactionOptions.Parser, new[]{ "ReadWrite", "PartitionedDml", "ReadOnly" }, new[]{ "Mode" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite), global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions), global::Google.Cloud.Spanner.V1.TransactionOptions.Parser, new[]{ "ReadWrite", "PartitionedDml", "ReadOnly" }, new[]{ "Mode" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite), global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Parser, new[]{ "ReadLockMode" }, null, new[]{ typeof(global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode) }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions.Types.PartitionedDml), global::Google.Cloud.Spanner.V1.TransactionOptions.Types.PartitionedDml.Parser, null, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly), global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadOnly.Parser, new[]{ "Strong", "MinReadTimestamp", "MaxStaleness", "ReadTimestamp", "ExactStaleness", "ReturnReadTimestamp" }, new[]{ "TimestampBound" }, null, null, null)}),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Spanner.V1.Transaction), global::Google.Cloud.Spanner.V1.Transaction.Parser, new[]{ "Id", "ReadTimestamp" }, null, null, null, null),
Expand Down Expand Up @@ -94,7 +98,8 @@ public static partial class TransactionReflection {
///
/// Queries on change streams must be performed with the snapshot read-only
/// transaction mode, specifying a strong read. Please see
/// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong] for more details.
/// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]
/// for more details.
///
/// 3. Partitioned DML. This type of transaction is used to execute
/// a single Partitioned DML statement. Partitioned DML partitions
Expand Down Expand Up @@ -230,7 +235,8 @@ public static partial class TransactionReflection {
/// Queries on change streams (see below for more details) must also specify
/// the strong read timestamp bound.
///
/// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
/// See
/// [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong].
///
/// Exact staleness:
///
Expand All @@ -251,7 +257,9 @@ public static partial class TransactionReflection {
/// equivalent boundedly stale concurrency modes. On the other hand,
/// boundedly stale reads usually return fresher results.
///
/// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and
/// See
/// [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp]
/// and
/// [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness].
///
/// Bounded staleness:
Expand Down Expand Up @@ -281,7 +289,9 @@ public static partial class TransactionReflection {
/// which rows will be read, it can only be used with single-use
/// read-only transactions.
///
/// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and
/// See
/// [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness]
/// and
/// [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp].
///
/// Old read timestamps and garbage collection:
Expand Down Expand Up @@ -784,6 +794,7 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public ReadWrite(ReadWrite other) : this() {
readLockMode_ = other.readLockMode_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}

Expand All @@ -793,6 +804,21 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
return new ReadWrite(this);
}

/// <summary>Field number for the "read_lock_mode" field.</summary>
public const int ReadLockModeFieldNumber = 1;
private global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode readLockMode_ = global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified;
/// <summary>
/// Read lock mode for the transaction.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode ReadLockMode {
get { return readLockMode_; }
set {
readLockMode_ = value;
}
}

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
Expand All @@ -808,13 +834,15 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
if (ReferenceEquals(other, this)) {
return true;
}
if (ReadLockMode != other.ReadLockMode) return false;
return Equals(_unknownFields, other._unknownFields);
}

[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (ReadLockMode != global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified) hash ^= ReadLockMode.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
Expand All @@ -833,6 +861,10 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (ReadLockMode != global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified) {
output.WriteRawTag(8);
output.WriteEnum((int) ReadLockMode);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
Expand All @@ -843,6 +875,10 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (ReadLockMode != global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified) {
output.WriteRawTag(8);
output.WriteEnum((int) ReadLockMode);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
Expand All @@ -853,6 +889,9 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (ReadLockMode != global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified) {
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) ReadLockMode);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
Expand All @@ -865,6 +904,9 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
if (other == null) {
return;
}
if (other.ReadLockMode != global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode.Unspecified) {
ReadLockMode = other.ReadLockMode;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}

Expand All @@ -880,6 +922,10 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 8: {
ReadLockMode = (global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode) input.ReadEnum();
break;
}
}
}
#endif
Expand All @@ -895,11 +941,50 @@ public sealed partial class ReadWrite : pb::IMessage<ReadWrite>
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 8: {
ReadLockMode = (global::Google.Cloud.Spanner.V1.TransactionOptions.Types.ReadWrite.Types.ReadLockMode) input.ReadEnum();
break;
}
}
}
}
#endif

#region Nested types
/// <summary>Container for nested types declared in the ReadWrite message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// `ReadLockMode` is used to set the read lock mode for read-write
/// transactions.
/// </summary>
public enum ReadLockMode {
/// <summary>
/// Default value.
///
/// If the value is not specified, the pessimistic read lock is used.
/// </summary>
[pbr::OriginalName("READ_LOCK_MODE_UNSPECIFIED")] Unspecified = 0,
/// <summary>
/// Pessimistic lock mode.
///
/// Read locks are acquired immediately on read.
/// </summary>
[pbr::OriginalName("PESSIMISTIC")] Pessimistic = 1,
/// <summary>
/// Optimistic lock mode.
///
/// Locks for reads within the transaction are not acquired on read.
/// Instead the locks are acquired on a commit to validate that
/// read/queried data has not changed since the transaction started.
/// </summary>
[pbr::OriginalName("OPTIMISTIC")] Optimistic = 2,
}

}
#endregion

}

/// <summary>
Expand Down Expand Up @@ -1245,7 +1330,8 @@ public sealed partial class ReadOnly : pb::IMessage<ReadOnly>
private bool returnReadTimestamp_;
/// <summary>
/// If true, the Cloud Spanner-selected read timestamp is included in
/// the [Transaction][google.spanner.v1.Transaction] message that describes the transaction.
/// the [Transaction][google.spanner.v1.Transaction] message that describes
/// the transaction.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
Expand Down Expand Up @@ -1856,7 +1942,8 @@ public sealed partial class Transaction : pb::IMessage<Transaction>
/// [Read][google.spanner.v1.Spanner.Read] or
/// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs.
///
/// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions.
/// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more
/// information about transactions.
/// </summary>
public sealed partial class TransactionSelector : pb::IMessage<TransactionSelector>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
Expand Down Expand Up @@ -1950,7 +2037,8 @@ public sealed partial class TransactionSelector : pb::IMessage<TransactionSelect
/// <summary>
/// Begin a new transaction and execute this read or SQL query in
/// it. The transaction ID of the new transaction is returned in
/// [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction], which is a [Transaction][google.spanner.v1.Transaction].
/// [ResultSetMetadata.transaction][google.spanner.v1.ResultSetMetadata.transaction],
/// which is a [Transaction][google.spanner.v1.Transaction].
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
Expand Down

0 comments on commit 4fed510

Please sign in to comment.