1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: google/spanner/v1/transaction.proto 3 4package spanner // import "google.golang.org/genproto/googleapis/spanner/v1" 5 6import proto "github.com/golang/protobuf/proto" 7import fmt "fmt" 8import math "math" 9import duration "github.com/golang/protobuf/ptypes/duration" 10import timestamp "github.com/golang/protobuf/ptypes/timestamp" 11import _ "google.golang.org/genproto/googleapis/api/annotations" 12 13// Reference imports to suppress errors if they are not otherwise used. 14var _ = proto.Marshal 15var _ = fmt.Errorf 16var _ = math.Inf 17 18// This is a compile-time assertion to ensure that this generated file 19// is compatible with the proto package it is being compiled against. 20// A compilation error at this line likely means your copy of the 21// proto package needs to be updated. 22const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package 23 24// # Transactions 25// 26// 27// Each session can have at most one active transaction at a time. After the 28// active transaction is completed, the session can immediately be 29// re-used for the next transaction. It is not necessary to create a 30// new session for each transaction. 31// 32// # Transaction Modes 33// 34// Cloud Spanner supports two transaction modes: 35// 36// 1. Locking read-write. This type of transaction is the only way 37// to write data into Cloud Spanner. These transactions rely on 38// pessimistic locking and, if necessary, two-phase commit. 39// Locking read-write transactions may abort, requiring the 40// application to retry. 41// 42// 2. Snapshot read-only. This transaction type provides guaranteed 43// consistency across several reads, but does not allow 44// writes. Snapshot read-only transactions can be configured to 45// read at timestamps in the past. Snapshot read-only 46// transactions do not need to be committed. 47// 48// For transactions that only read, snapshot read-only transactions 49// provide simpler semantics and are almost always faster. In 50// particular, read-only transactions do not take locks, so they do 51// not conflict with read-write transactions. As a consequence of not 52// taking locks, they also do not abort, so retry loops are not needed. 53// 54// Transactions may only read/write data in a single database. They 55// may, however, read/write data in different tables within that 56// database. 57// 58// ## Locking Read-Write Transactions 59// 60// Locking transactions may be used to atomically read-modify-write 61// data anywhere in a database. This type of transaction is externally 62// consistent. 63// 64// Clients should attempt to minimize the amount of time a transaction 65// is active. Faster transactions commit with higher probability 66// and cause less contention. Cloud Spanner attempts to keep read locks 67// active as long as the transaction continues to do reads, and the 68// transaction has not been terminated by 69// [Commit][google.spanner.v1.Spanner.Commit] or 70// [Rollback][google.spanner.v1.Spanner.Rollback]. Long periods of 71// inactivity at the client may cause Cloud Spanner to release a 72// transaction's locks and abort it. 73// 74// Reads performed within a transaction acquire locks on the data 75// being read. Writes can only be done at commit time, after all reads 76// have been completed. 77// Conceptually, a read-write transaction consists of zero or more 78// reads or SQL queries followed by 79// [Commit][google.spanner.v1.Spanner.Commit]. At any time before 80// [Commit][google.spanner.v1.Spanner.Commit], the client can send a 81// [Rollback][google.spanner.v1.Spanner.Rollback] request to abort the 82// transaction. 83// 84// ### Semantics 85// 86// Cloud Spanner can commit the transaction if all read locks it acquired 87// are still valid at commit time, and it is able to acquire write 88// locks for all writes. Cloud Spanner can abort the transaction for any 89// reason. If a commit attempt returns `ABORTED`, Cloud Spanner guarantees 90// that the transaction has not modified any user data in Cloud Spanner. 91// 92// Unless the transaction commits, Cloud Spanner makes no guarantees about 93// how long the transaction's locks were held for. It is an error to 94// use Cloud Spanner locks for any sort of mutual exclusion other than 95// between Cloud Spanner transactions themselves. 96// 97// ### Retrying Aborted Transactions 98// 99// When a transaction aborts, the application can choose to retry the 100// whole transaction again. To maximize the chances of successfully 101// committing the retry, the client should execute the retry in the 102// same session as the original attempt. The original session's lock 103// priority increases with each consecutive abort, meaning that each 104// attempt has a slightly better chance of success than the previous. 105// 106// Under some circumstances (e.g., many transactions attempting to 107// modify the same row(s)), a transaction can abort many times in a 108// short period before successfully committing. Thus, it is not a good 109// idea to cap the number of retries a transaction can attempt; 110// instead, it is better to limit the total amount of wall time spent 111// retrying. 112// 113// ### Idle Transactions 114// 115// A transaction is considered idle if it has no outstanding reads or 116// SQL queries and has not started a read or SQL query within the last 10 117// seconds. Idle transactions can be aborted by Cloud Spanner so that they 118// don't hold on to locks indefinitely. In that case, the commit will 119// fail with error `ABORTED`. 120// 121// If this behavior is undesirable, periodically executing a simple 122// SQL query in the transaction (e.g., `SELECT 1`) prevents the 123// transaction from becoming idle. 124// 125// ## Snapshot Read-Only Transactions 126// 127// Snapshot read-only transactions provides a simpler method than 128// locking read-write transactions for doing several consistent 129// reads. However, this type of transaction does not support writes. 130// 131// Snapshot transactions do not take locks. Instead, they work by 132// choosing a Cloud Spanner timestamp, then executing all reads at that 133// timestamp. Since they do not acquire locks, they do not block 134// concurrent read-write transactions. 135// 136// Unlike locking read-write transactions, snapshot read-only 137// transactions never abort. They can fail if the chosen read 138// timestamp is garbage collected; however, the default garbage 139// collection policy is generous enough that most applications do not 140// need to worry about this in practice. 141// 142// Snapshot read-only transactions do not need to call 143// [Commit][google.spanner.v1.Spanner.Commit] or 144// [Rollback][google.spanner.v1.Spanner.Rollback] (and in fact are not 145// permitted to do so). 146// 147// To execute a snapshot transaction, the client specifies a timestamp 148// bound, which tells Cloud Spanner how to choose a read timestamp. 149// 150// The types of timestamp bound are: 151// 152// - Strong (the default). 153// - Bounded staleness. 154// - Exact staleness. 155// 156// If the Cloud Spanner database to be read is geographically distributed, 157// stale read-only transactions can execute more quickly than strong 158// or read-write transaction, because they are able to execute far 159// from the leader replica. 160// 161// Each type of timestamp bound is discussed in detail below. 162// 163// ### Strong 164// 165// Strong reads are guaranteed to see the effects of all transactions 166// that have committed before the start of the read. Furthermore, all 167// rows yielded by a single read are consistent with each other -- if 168// any part of the read observes a transaction, all parts of the read 169// see the transaction. 170// 171// Strong reads are not repeatable: two consecutive strong read-only 172// transactions might return inconsistent results if there are 173// concurrent writes. If consistency across reads is required, the 174// reads should be executed within a transaction or at an exact read 175// timestamp. 176// 177// See [TransactionOptions.ReadOnly.strong][google.spanner.v1.TransactionOptions.ReadOnly.strong]. 178// 179// ### Exact Staleness 180// 181// These timestamp bounds execute reads at a user-specified 182// timestamp. Reads at a timestamp are guaranteed to see a consistent 183// prefix of the global transaction history: they observe 184// modifications done by all transactions with a commit timestamp <= 185// the read timestamp, and observe none of the modifications done by 186// transactions with a larger commit timestamp. They will block until 187// all conflicting transactions that may be assigned commit timestamps 188// <= the read timestamp have finished. 189// 190// The timestamp can either be expressed as an absolute Cloud Spanner commit 191// timestamp or a staleness relative to the current time. 192// 193// These modes do not require a "negotiation phase" to pick a 194// timestamp. As a result, they execute slightly faster than the 195// equivalent boundedly stale concurrency modes. On the other hand, 196// boundedly stale reads usually return fresher results. 197// 198// See [TransactionOptions.ReadOnly.read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.read_timestamp] and 199// [TransactionOptions.ReadOnly.exact_staleness][google.spanner.v1.TransactionOptions.ReadOnly.exact_staleness]. 200// 201// ### Bounded Staleness 202// 203// Bounded staleness modes allow Cloud Spanner to pick the read timestamp, 204// subject to a user-provided staleness bound. Cloud Spanner chooses the 205// newest timestamp within the staleness bound that allows execution 206// of the reads at the closest available replica without blocking. 207// 208// All rows yielded are consistent with each other -- if any part of 209// the read observes a transaction, all parts of the read see the 210// transaction. Boundedly stale reads are not repeatable: two stale 211// reads, even if they use the same staleness bound, can execute at 212// different timestamps and thus return inconsistent results. 213// 214// Boundedly stale reads execute in two phases: the first phase 215// negotiates a timestamp among all replicas needed to serve the 216// read. In the second phase, reads are executed at the negotiated 217// timestamp. 218// 219// As a result of the two phase execution, bounded staleness reads are 220// usually a little slower than comparable exact staleness 221// reads. However, they are typically able to return fresher 222// results, and are more likely to execute at the closest replica. 223// 224// Because the timestamp negotiation requires up-front knowledge of 225// which rows will be read, it can only be used with single-use 226// read-only transactions. 227// 228// See [TransactionOptions.ReadOnly.max_staleness][google.spanner.v1.TransactionOptions.ReadOnly.max_staleness] and 229// [TransactionOptions.ReadOnly.min_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.min_read_timestamp]. 230// 231// ### Old Read Timestamps and Garbage Collection 232// 233// Cloud Spanner continuously garbage collects deleted and overwritten data 234// in the background to reclaim storage space. This process is known 235// as "version GC". By default, version GC reclaims versions after they 236// are one hour old. Because of this, Cloud Spanner cannot perform reads 237// at read timestamps more than one hour in the past. This 238// restriction also applies to in-progress reads and/or SQL queries whose 239// timestamp become too old while executing. Reads and SQL queries with 240// too-old read timestamps fail with the error `FAILED_PRECONDITION`. 241type TransactionOptions struct { 242 // Required. The type of transaction. 243 // 244 // Types that are valid to be assigned to Mode: 245 // *TransactionOptions_ReadWrite_ 246 // *TransactionOptions_ReadOnly_ 247 Mode isTransactionOptions_Mode `protobuf_oneof:"mode"` 248 XXX_NoUnkeyedLiteral struct{} `json:"-"` 249 XXX_unrecognized []byte `json:"-"` 250 XXX_sizecache int32 `json:"-"` 251} 252 253func (m *TransactionOptions) Reset() { *m = TransactionOptions{} } 254func (m *TransactionOptions) String() string { return proto.CompactTextString(m) } 255func (*TransactionOptions) ProtoMessage() {} 256func (*TransactionOptions) Descriptor() ([]byte, []int) { 257 return fileDescriptor_transaction_1d57af638fc1a731, []int{0} 258} 259func (m *TransactionOptions) XXX_Unmarshal(b []byte) error { 260 return xxx_messageInfo_TransactionOptions.Unmarshal(m, b) 261} 262func (m *TransactionOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 263 return xxx_messageInfo_TransactionOptions.Marshal(b, m, deterministic) 264} 265func (dst *TransactionOptions) XXX_Merge(src proto.Message) { 266 xxx_messageInfo_TransactionOptions.Merge(dst, src) 267} 268func (m *TransactionOptions) XXX_Size() int { 269 return xxx_messageInfo_TransactionOptions.Size(m) 270} 271func (m *TransactionOptions) XXX_DiscardUnknown() { 272 xxx_messageInfo_TransactionOptions.DiscardUnknown(m) 273} 274 275var xxx_messageInfo_TransactionOptions proto.InternalMessageInfo 276 277type isTransactionOptions_Mode interface { 278 isTransactionOptions_Mode() 279} 280 281type TransactionOptions_ReadWrite_ struct { 282 ReadWrite *TransactionOptions_ReadWrite `protobuf:"bytes,1,opt,name=read_write,json=readWrite,proto3,oneof"` 283} 284 285type TransactionOptions_ReadOnly_ struct { 286 ReadOnly *TransactionOptions_ReadOnly `protobuf:"bytes,2,opt,name=read_only,json=readOnly,proto3,oneof"` 287} 288 289func (*TransactionOptions_ReadWrite_) isTransactionOptions_Mode() {} 290 291func (*TransactionOptions_ReadOnly_) isTransactionOptions_Mode() {} 292 293func (m *TransactionOptions) GetMode() isTransactionOptions_Mode { 294 if m != nil { 295 return m.Mode 296 } 297 return nil 298} 299 300func (m *TransactionOptions) GetReadWrite() *TransactionOptions_ReadWrite { 301 if x, ok := m.GetMode().(*TransactionOptions_ReadWrite_); ok { 302 return x.ReadWrite 303 } 304 return nil 305} 306 307func (m *TransactionOptions) GetReadOnly() *TransactionOptions_ReadOnly { 308 if x, ok := m.GetMode().(*TransactionOptions_ReadOnly_); ok { 309 return x.ReadOnly 310 } 311 return nil 312} 313 314// XXX_OneofFuncs is for the internal use of the proto package. 315func (*TransactionOptions) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { 316 return _TransactionOptions_OneofMarshaler, _TransactionOptions_OneofUnmarshaler, _TransactionOptions_OneofSizer, []interface{}{ 317 (*TransactionOptions_ReadWrite_)(nil), 318 (*TransactionOptions_ReadOnly_)(nil), 319 } 320} 321 322func _TransactionOptions_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 323 m := msg.(*TransactionOptions) 324 // mode 325 switch x := m.Mode.(type) { 326 case *TransactionOptions_ReadWrite_: 327 b.EncodeVarint(1<<3 | proto.WireBytes) 328 if err := b.EncodeMessage(x.ReadWrite); err != nil { 329 return err 330 } 331 case *TransactionOptions_ReadOnly_: 332 b.EncodeVarint(2<<3 | proto.WireBytes) 333 if err := b.EncodeMessage(x.ReadOnly); err != nil { 334 return err 335 } 336 case nil: 337 default: 338 return fmt.Errorf("TransactionOptions.Mode has unexpected type %T", x) 339 } 340 return nil 341} 342 343func _TransactionOptions_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 344 m := msg.(*TransactionOptions) 345 switch tag { 346 case 1: // mode.read_write 347 if wire != proto.WireBytes { 348 return true, proto.ErrInternalBadWireType 349 } 350 msg := new(TransactionOptions_ReadWrite) 351 err := b.DecodeMessage(msg) 352 m.Mode = &TransactionOptions_ReadWrite_{msg} 353 return true, err 354 case 2: // mode.read_only 355 if wire != proto.WireBytes { 356 return true, proto.ErrInternalBadWireType 357 } 358 msg := new(TransactionOptions_ReadOnly) 359 err := b.DecodeMessage(msg) 360 m.Mode = &TransactionOptions_ReadOnly_{msg} 361 return true, err 362 default: 363 return false, nil 364 } 365} 366 367func _TransactionOptions_OneofSizer(msg proto.Message) (n int) { 368 m := msg.(*TransactionOptions) 369 // mode 370 switch x := m.Mode.(type) { 371 case *TransactionOptions_ReadWrite_: 372 s := proto.Size(x.ReadWrite) 373 n += 1 // tag and wire 374 n += proto.SizeVarint(uint64(s)) 375 n += s 376 case *TransactionOptions_ReadOnly_: 377 s := proto.Size(x.ReadOnly) 378 n += 1 // tag and wire 379 n += proto.SizeVarint(uint64(s)) 380 n += s 381 case nil: 382 default: 383 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 384 } 385 return n 386} 387 388// Message type to initiate a read-write transaction. Currently this 389// transaction type has no options. 390type TransactionOptions_ReadWrite struct { 391 XXX_NoUnkeyedLiteral struct{} `json:"-"` 392 XXX_unrecognized []byte `json:"-"` 393 XXX_sizecache int32 `json:"-"` 394} 395 396func (m *TransactionOptions_ReadWrite) Reset() { *m = TransactionOptions_ReadWrite{} } 397func (m *TransactionOptions_ReadWrite) String() string { return proto.CompactTextString(m) } 398func (*TransactionOptions_ReadWrite) ProtoMessage() {} 399func (*TransactionOptions_ReadWrite) Descriptor() ([]byte, []int) { 400 return fileDescriptor_transaction_1d57af638fc1a731, []int{0, 0} 401} 402func (m *TransactionOptions_ReadWrite) XXX_Unmarshal(b []byte) error { 403 return xxx_messageInfo_TransactionOptions_ReadWrite.Unmarshal(m, b) 404} 405func (m *TransactionOptions_ReadWrite) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 406 return xxx_messageInfo_TransactionOptions_ReadWrite.Marshal(b, m, deterministic) 407} 408func (dst *TransactionOptions_ReadWrite) XXX_Merge(src proto.Message) { 409 xxx_messageInfo_TransactionOptions_ReadWrite.Merge(dst, src) 410} 411func (m *TransactionOptions_ReadWrite) XXX_Size() int { 412 return xxx_messageInfo_TransactionOptions_ReadWrite.Size(m) 413} 414func (m *TransactionOptions_ReadWrite) XXX_DiscardUnknown() { 415 xxx_messageInfo_TransactionOptions_ReadWrite.DiscardUnknown(m) 416} 417 418var xxx_messageInfo_TransactionOptions_ReadWrite proto.InternalMessageInfo 419 420// Message type to initiate a read-only transaction. 421type TransactionOptions_ReadOnly struct { 422 // How to choose the timestamp for the read-only transaction. 423 // 424 // Types that are valid to be assigned to TimestampBound: 425 // *TransactionOptions_ReadOnly_Strong 426 // *TransactionOptions_ReadOnly_MinReadTimestamp 427 // *TransactionOptions_ReadOnly_MaxStaleness 428 // *TransactionOptions_ReadOnly_ReadTimestamp 429 // *TransactionOptions_ReadOnly_ExactStaleness 430 TimestampBound isTransactionOptions_ReadOnly_TimestampBound `protobuf_oneof:"timestamp_bound"` 431 // If true, the Cloud Spanner-selected read timestamp is included in 432 // the [Transaction][google.spanner.v1.Transaction] message that describes the transaction. 433 ReturnReadTimestamp bool `protobuf:"varint,6,opt,name=return_read_timestamp,json=returnReadTimestamp,proto3" json:"return_read_timestamp,omitempty"` 434 XXX_NoUnkeyedLiteral struct{} `json:"-"` 435 XXX_unrecognized []byte `json:"-"` 436 XXX_sizecache int32 `json:"-"` 437} 438 439func (m *TransactionOptions_ReadOnly) Reset() { *m = TransactionOptions_ReadOnly{} } 440func (m *TransactionOptions_ReadOnly) String() string { return proto.CompactTextString(m) } 441func (*TransactionOptions_ReadOnly) ProtoMessage() {} 442func (*TransactionOptions_ReadOnly) Descriptor() ([]byte, []int) { 443 return fileDescriptor_transaction_1d57af638fc1a731, []int{0, 1} 444} 445func (m *TransactionOptions_ReadOnly) XXX_Unmarshal(b []byte) error { 446 return xxx_messageInfo_TransactionOptions_ReadOnly.Unmarshal(m, b) 447} 448func (m *TransactionOptions_ReadOnly) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 449 return xxx_messageInfo_TransactionOptions_ReadOnly.Marshal(b, m, deterministic) 450} 451func (dst *TransactionOptions_ReadOnly) XXX_Merge(src proto.Message) { 452 xxx_messageInfo_TransactionOptions_ReadOnly.Merge(dst, src) 453} 454func (m *TransactionOptions_ReadOnly) XXX_Size() int { 455 return xxx_messageInfo_TransactionOptions_ReadOnly.Size(m) 456} 457func (m *TransactionOptions_ReadOnly) XXX_DiscardUnknown() { 458 xxx_messageInfo_TransactionOptions_ReadOnly.DiscardUnknown(m) 459} 460 461var xxx_messageInfo_TransactionOptions_ReadOnly proto.InternalMessageInfo 462 463type isTransactionOptions_ReadOnly_TimestampBound interface { 464 isTransactionOptions_ReadOnly_TimestampBound() 465} 466 467type TransactionOptions_ReadOnly_Strong struct { 468 Strong bool `protobuf:"varint,1,opt,name=strong,proto3,oneof"` 469} 470 471type TransactionOptions_ReadOnly_MinReadTimestamp struct { 472 MinReadTimestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=min_read_timestamp,json=minReadTimestamp,proto3,oneof"` 473} 474 475type TransactionOptions_ReadOnly_MaxStaleness struct { 476 MaxStaleness *duration.Duration `protobuf:"bytes,3,opt,name=max_staleness,json=maxStaleness,proto3,oneof"` 477} 478 479type TransactionOptions_ReadOnly_ReadTimestamp struct { 480 ReadTimestamp *timestamp.Timestamp `protobuf:"bytes,4,opt,name=read_timestamp,json=readTimestamp,proto3,oneof"` 481} 482 483type TransactionOptions_ReadOnly_ExactStaleness struct { 484 ExactStaleness *duration.Duration `protobuf:"bytes,5,opt,name=exact_staleness,json=exactStaleness,proto3,oneof"` 485} 486 487func (*TransactionOptions_ReadOnly_Strong) isTransactionOptions_ReadOnly_TimestampBound() {} 488 489func (*TransactionOptions_ReadOnly_MinReadTimestamp) isTransactionOptions_ReadOnly_TimestampBound() {} 490 491func (*TransactionOptions_ReadOnly_MaxStaleness) isTransactionOptions_ReadOnly_TimestampBound() {} 492 493func (*TransactionOptions_ReadOnly_ReadTimestamp) isTransactionOptions_ReadOnly_TimestampBound() {} 494 495func (*TransactionOptions_ReadOnly_ExactStaleness) isTransactionOptions_ReadOnly_TimestampBound() {} 496 497func (m *TransactionOptions_ReadOnly) GetTimestampBound() isTransactionOptions_ReadOnly_TimestampBound { 498 if m != nil { 499 return m.TimestampBound 500 } 501 return nil 502} 503 504func (m *TransactionOptions_ReadOnly) GetStrong() bool { 505 if x, ok := m.GetTimestampBound().(*TransactionOptions_ReadOnly_Strong); ok { 506 return x.Strong 507 } 508 return false 509} 510 511func (m *TransactionOptions_ReadOnly) GetMinReadTimestamp() *timestamp.Timestamp { 512 if x, ok := m.GetTimestampBound().(*TransactionOptions_ReadOnly_MinReadTimestamp); ok { 513 return x.MinReadTimestamp 514 } 515 return nil 516} 517 518func (m *TransactionOptions_ReadOnly) GetMaxStaleness() *duration.Duration { 519 if x, ok := m.GetTimestampBound().(*TransactionOptions_ReadOnly_MaxStaleness); ok { 520 return x.MaxStaleness 521 } 522 return nil 523} 524 525func (m *TransactionOptions_ReadOnly) GetReadTimestamp() *timestamp.Timestamp { 526 if x, ok := m.GetTimestampBound().(*TransactionOptions_ReadOnly_ReadTimestamp); ok { 527 return x.ReadTimestamp 528 } 529 return nil 530} 531 532func (m *TransactionOptions_ReadOnly) GetExactStaleness() *duration.Duration { 533 if x, ok := m.GetTimestampBound().(*TransactionOptions_ReadOnly_ExactStaleness); ok { 534 return x.ExactStaleness 535 } 536 return nil 537} 538 539func (m *TransactionOptions_ReadOnly) GetReturnReadTimestamp() bool { 540 if m != nil { 541 return m.ReturnReadTimestamp 542 } 543 return false 544} 545 546// XXX_OneofFuncs is for the internal use of the proto package. 547func (*TransactionOptions_ReadOnly) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { 548 return _TransactionOptions_ReadOnly_OneofMarshaler, _TransactionOptions_ReadOnly_OneofUnmarshaler, _TransactionOptions_ReadOnly_OneofSizer, []interface{}{ 549 (*TransactionOptions_ReadOnly_Strong)(nil), 550 (*TransactionOptions_ReadOnly_MinReadTimestamp)(nil), 551 (*TransactionOptions_ReadOnly_MaxStaleness)(nil), 552 (*TransactionOptions_ReadOnly_ReadTimestamp)(nil), 553 (*TransactionOptions_ReadOnly_ExactStaleness)(nil), 554 } 555} 556 557func _TransactionOptions_ReadOnly_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 558 m := msg.(*TransactionOptions_ReadOnly) 559 // timestamp_bound 560 switch x := m.TimestampBound.(type) { 561 case *TransactionOptions_ReadOnly_Strong: 562 t := uint64(0) 563 if x.Strong { 564 t = 1 565 } 566 b.EncodeVarint(1<<3 | proto.WireVarint) 567 b.EncodeVarint(t) 568 case *TransactionOptions_ReadOnly_MinReadTimestamp: 569 b.EncodeVarint(2<<3 | proto.WireBytes) 570 if err := b.EncodeMessage(x.MinReadTimestamp); err != nil { 571 return err 572 } 573 case *TransactionOptions_ReadOnly_MaxStaleness: 574 b.EncodeVarint(3<<3 | proto.WireBytes) 575 if err := b.EncodeMessage(x.MaxStaleness); err != nil { 576 return err 577 } 578 case *TransactionOptions_ReadOnly_ReadTimestamp: 579 b.EncodeVarint(4<<3 | proto.WireBytes) 580 if err := b.EncodeMessage(x.ReadTimestamp); err != nil { 581 return err 582 } 583 case *TransactionOptions_ReadOnly_ExactStaleness: 584 b.EncodeVarint(5<<3 | proto.WireBytes) 585 if err := b.EncodeMessage(x.ExactStaleness); err != nil { 586 return err 587 } 588 case nil: 589 default: 590 return fmt.Errorf("TransactionOptions_ReadOnly.TimestampBound has unexpected type %T", x) 591 } 592 return nil 593} 594 595func _TransactionOptions_ReadOnly_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 596 m := msg.(*TransactionOptions_ReadOnly) 597 switch tag { 598 case 1: // timestamp_bound.strong 599 if wire != proto.WireVarint { 600 return true, proto.ErrInternalBadWireType 601 } 602 x, err := b.DecodeVarint() 603 m.TimestampBound = &TransactionOptions_ReadOnly_Strong{x != 0} 604 return true, err 605 case 2: // timestamp_bound.min_read_timestamp 606 if wire != proto.WireBytes { 607 return true, proto.ErrInternalBadWireType 608 } 609 msg := new(timestamp.Timestamp) 610 err := b.DecodeMessage(msg) 611 m.TimestampBound = &TransactionOptions_ReadOnly_MinReadTimestamp{msg} 612 return true, err 613 case 3: // timestamp_bound.max_staleness 614 if wire != proto.WireBytes { 615 return true, proto.ErrInternalBadWireType 616 } 617 msg := new(duration.Duration) 618 err := b.DecodeMessage(msg) 619 m.TimestampBound = &TransactionOptions_ReadOnly_MaxStaleness{msg} 620 return true, err 621 case 4: // timestamp_bound.read_timestamp 622 if wire != proto.WireBytes { 623 return true, proto.ErrInternalBadWireType 624 } 625 msg := new(timestamp.Timestamp) 626 err := b.DecodeMessage(msg) 627 m.TimestampBound = &TransactionOptions_ReadOnly_ReadTimestamp{msg} 628 return true, err 629 case 5: // timestamp_bound.exact_staleness 630 if wire != proto.WireBytes { 631 return true, proto.ErrInternalBadWireType 632 } 633 msg := new(duration.Duration) 634 err := b.DecodeMessage(msg) 635 m.TimestampBound = &TransactionOptions_ReadOnly_ExactStaleness{msg} 636 return true, err 637 default: 638 return false, nil 639 } 640} 641 642func _TransactionOptions_ReadOnly_OneofSizer(msg proto.Message) (n int) { 643 m := msg.(*TransactionOptions_ReadOnly) 644 // timestamp_bound 645 switch x := m.TimestampBound.(type) { 646 case *TransactionOptions_ReadOnly_Strong: 647 n += 1 // tag and wire 648 n += 1 649 case *TransactionOptions_ReadOnly_MinReadTimestamp: 650 s := proto.Size(x.MinReadTimestamp) 651 n += 1 // tag and wire 652 n += proto.SizeVarint(uint64(s)) 653 n += s 654 case *TransactionOptions_ReadOnly_MaxStaleness: 655 s := proto.Size(x.MaxStaleness) 656 n += 1 // tag and wire 657 n += proto.SizeVarint(uint64(s)) 658 n += s 659 case *TransactionOptions_ReadOnly_ReadTimestamp: 660 s := proto.Size(x.ReadTimestamp) 661 n += 1 // tag and wire 662 n += proto.SizeVarint(uint64(s)) 663 n += s 664 case *TransactionOptions_ReadOnly_ExactStaleness: 665 s := proto.Size(x.ExactStaleness) 666 n += 1 // tag and wire 667 n += proto.SizeVarint(uint64(s)) 668 n += s 669 case nil: 670 default: 671 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 672 } 673 return n 674} 675 676// A transaction. 677type Transaction struct { 678 // `id` may be used to identify the transaction in subsequent 679 // [Read][google.spanner.v1.Spanner.Read], 680 // [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], 681 // [Commit][google.spanner.v1.Spanner.Commit], or 682 // [Rollback][google.spanner.v1.Spanner.Rollback] calls. 683 // 684 // Single-use read-only transactions do not have IDs, because 685 // single-use transactions do not support multiple requests. 686 Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` 687 // For snapshot read-only transactions, the read timestamp chosen 688 // for the transaction. Not returned by default: see 689 // [TransactionOptions.ReadOnly.return_read_timestamp][google.spanner.v1.TransactionOptions.ReadOnly.return_read_timestamp]. 690 // 691 // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. 692 // Example: `"2014-10-02T15:01:23.045123456Z"`. 693 ReadTimestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=read_timestamp,json=readTimestamp,proto3" json:"read_timestamp,omitempty"` 694 XXX_NoUnkeyedLiteral struct{} `json:"-"` 695 XXX_unrecognized []byte `json:"-"` 696 XXX_sizecache int32 `json:"-"` 697} 698 699func (m *Transaction) Reset() { *m = Transaction{} } 700func (m *Transaction) String() string { return proto.CompactTextString(m) } 701func (*Transaction) ProtoMessage() {} 702func (*Transaction) Descriptor() ([]byte, []int) { 703 return fileDescriptor_transaction_1d57af638fc1a731, []int{1} 704} 705func (m *Transaction) XXX_Unmarshal(b []byte) error { 706 return xxx_messageInfo_Transaction.Unmarshal(m, b) 707} 708func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 709 return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) 710} 711func (dst *Transaction) XXX_Merge(src proto.Message) { 712 xxx_messageInfo_Transaction.Merge(dst, src) 713} 714func (m *Transaction) XXX_Size() int { 715 return xxx_messageInfo_Transaction.Size(m) 716} 717func (m *Transaction) XXX_DiscardUnknown() { 718 xxx_messageInfo_Transaction.DiscardUnknown(m) 719} 720 721var xxx_messageInfo_Transaction proto.InternalMessageInfo 722 723func (m *Transaction) GetId() []byte { 724 if m != nil { 725 return m.Id 726 } 727 return nil 728} 729 730func (m *Transaction) GetReadTimestamp() *timestamp.Timestamp { 731 if m != nil { 732 return m.ReadTimestamp 733 } 734 return nil 735} 736 737// This message is used to select the transaction in which a 738// [Read][google.spanner.v1.Spanner.Read] or 739// [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] call runs. 740// 741// See [TransactionOptions][google.spanner.v1.TransactionOptions] for more information about transactions. 742type TransactionSelector struct { 743 // If no fields are set, the default is a single use transaction 744 // with strong concurrency. 745 // 746 // Types that are valid to be assigned to Selector: 747 // *TransactionSelector_SingleUse 748 // *TransactionSelector_Id 749 // *TransactionSelector_Begin 750 Selector isTransactionSelector_Selector `protobuf_oneof:"selector"` 751 XXX_NoUnkeyedLiteral struct{} `json:"-"` 752 XXX_unrecognized []byte `json:"-"` 753 XXX_sizecache int32 `json:"-"` 754} 755 756func (m *TransactionSelector) Reset() { *m = TransactionSelector{} } 757func (m *TransactionSelector) String() string { return proto.CompactTextString(m) } 758func (*TransactionSelector) ProtoMessage() {} 759func (*TransactionSelector) Descriptor() ([]byte, []int) { 760 return fileDescriptor_transaction_1d57af638fc1a731, []int{2} 761} 762func (m *TransactionSelector) XXX_Unmarshal(b []byte) error { 763 return xxx_messageInfo_TransactionSelector.Unmarshal(m, b) 764} 765func (m *TransactionSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 766 return xxx_messageInfo_TransactionSelector.Marshal(b, m, deterministic) 767} 768func (dst *TransactionSelector) XXX_Merge(src proto.Message) { 769 xxx_messageInfo_TransactionSelector.Merge(dst, src) 770} 771func (m *TransactionSelector) XXX_Size() int { 772 return xxx_messageInfo_TransactionSelector.Size(m) 773} 774func (m *TransactionSelector) XXX_DiscardUnknown() { 775 xxx_messageInfo_TransactionSelector.DiscardUnknown(m) 776} 777 778var xxx_messageInfo_TransactionSelector proto.InternalMessageInfo 779 780type isTransactionSelector_Selector interface { 781 isTransactionSelector_Selector() 782} 783 784type TransactionSelector_SingleUse struct { 785 SingleUse *TransactionOptions `protobuf:"bytes,1,opt,name=single_use,json=singleUse,proto3,oneof"` 786} 787 788type TransactionSelector_Id struct { 789 Id []byte `protobuf:"bytes,2,opt,name=id,proto3,oneof"` 790} 791 792type TransactionSelector_Begin struct { 793 Begin *TransactionOptions `protobuf:"bytes,3,opt,name=begin,proto3,oneof"` 794} 795 796func (*TransactionSelector_SingleUse) isTransactionSelector_Selector() {} 797 798func (*TransactionSelector_Id) isTransactionSelector_Selector() {} 799 800func (*TransactionSelector_Begin) isTransactionSelector_Selector() {} 801 802func (m *TransactionSelector) GetSelector() isTransactionSelector_Selector { 803 if m != nil { 804 return m.Selector 805 } 806 return nil 807} 808 809func (m *TransactionSelector) GetSingleUse() *TransactionOptions { 810 if x, ok := m.GetSelector().(*TransactionSelector_SingleUse); ok { 811 return x.SingleUse 812 } 813 return nil 814} 815 816func (m *TransactionSelector) GetId() []byte { 817 if x, ok := m.GetSelector().(*TransactionSelector_Id); ok { 818 return x.Id 819 } 820 return nil 821} 822 823func (m *TransactionSelector) GetBegin() *TransactionOptions { 824 if x, ok := m.GetSelector().(*TransactionSelector_Begin); ok { 825 return x.Begin 826 } 827 return nil 828} 829 830// XXX_OneofFuncs is for the internal use of the proto package. 831func (*TransactionSelector) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { 832 return _TransactionSelector_OneofMarshaler, _TransactionSelector_OneofUnmarshaler, _TransactionSelector_OneofSizer, []interface{}{ 833 (*TransactionSelector_SingleUse)(nil), 834 (*TransactionSelector_Id)(nil), 835 (*TransactionSelector_Begin)(nil), 836 } 837} 838 839func _TransactionSelector_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { 840 m := msg.(*TransactionSelector) 841 // selector 842 switch x := m.Selector.(type) { 843 case *TransactionSelector_SingleUse: 844 b.EncodeVarint(1<<3 | proto.WireBytes) 845 if err := b.EncodeMessage(x.SingleUse); err != nil { 846 return err 847 } 848 case *TransactionSelector_Id: 849 b.EncodeVarint(2<<3 | proto.WireBytes) 850 b.EncodeRawBytes(x.Id) 851 case *TransactionSelector_Begin: 852 b.EncodeVarint(3<<3 | proto.WireBytes) 853 if err := b.EncodeMessage(x.Begin); err != nil { 854 return err 855 } 856 case nil: 857 default: 858 return fmt.Errorf("TransactionSelector.Selector has unexpected type %T", x) 859 } 860 return nil 861} 862 863func _TransactionSelector_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { 864 m := msg.(*TransactionSelector) 865 switch tag { 866 case 1: // selector.single_use 867 if wire != proto.WireBytes { 868 return true, proto.ErrInternalBadWireType 869 } 870 msg := new(TransactionOptions) 871 err := b.DecodeMessage(msg) 872 m.Selector = &TransactionSelector_SingleUse{msg} 873 return true, err 874 case 2: // selector.id 875 if wire != proto.WireBytes { 876 return true, proto.ErrInternalBadWireType 877 } 878 x, err := b.DecodeRawBytes(true) 879 m.Selector = &TransactionSelector_Id{x} 880 return true, err 881 case 3: // selector.begin 882 if wire != proto.WireBytes { 883 return true, proto.ErrInternalBadWireType 884 } 885 msg := new(TransactionOptions) 886 err := b.DecodeMessage(msg) 887 m.Selector = &TransactionSelector_Begin{msg} 888 return true, err 889 default: 890 return false, nil 891 } 892} 893 894func _TransactionSelector_OneofSizer(msg proto.Message) (n int) { 895 m := msg.(*TransactionSelector) 896 // selector 897 switch x := m.Selector.(type) { 898 case *TransactionSelector_SingleUse: 899 s := proto.Size(x.SingleUse) 900 n += 1 // tag and wire 901 n += proto.SizeVarint(uint64(s)) 902 n += s 903 case *TransactionSelector_Id: 904 n += 1 // tag and wire 905 n += proto.SizeVarint(uint64(len(x.Id))) 906 n += len(x.Id) 907 case *TransactionSelector_Begin: 908 s := proto.Size(x.Begin) 909 n += 1 // tag and wire 910 n += proto.SizeVarint(uint64(s)) 911 n += s 912 case nil: 913 default: 914 panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) 915 } 916 return n 917} 918 919func init() { 920 proto.RegisterType((*TransactionOptions)(nil), "google.spanner.v1.TransactionOptions") 921 proto.RegisterType((*TransactionOptions_ReadWrite)(nil), "google.spanner.v1.TransactionOptions.ReadWrite") 922 proto.RegisterType((*TransactionOptions_ReadOnly)(nil), "google.spanner.v1.TransactionOptions.ReadOnly") 923 proto.RegisterType((*Transaction)(nil), "google.spanner.v1.Transaction") 924 proto.RegisterType((*TransactionSelector)(nil), "google.spanner.v1.TransactionSelector") 925} 926 927func init() { 928 proto.RegisterFile("google/spanner/v1/transaction.proto", fileDescriptor_transaction_1d57af638fc1a731) 929} 930 931var fileDescriptor_transaction_1d57af638fc1a731 = []byte{ 932 // 537 bytes of a gzipped FileDescriptorProto 933 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xd1, 0x8a, 0xd3, 0x40, 934 0x14, 0x86, 0xd3, 0x6e, 0xb7, 0x74, 0x4f, 0xbb, 0xdd, 0xee, 0x2c, 0x8b, 0x35, 0x88, 0x4a, 0x45, 935 0xf0, 0x2a, 0xa1, 0xeb, 0x8d, 0x20, 0x82, 0x76, 0x17, 0x0d, 0x82, 0x6c, 0x49, 0xd7, 0x15, 0xa4, 936 0x10, 0xa7, 0xcd, 0x18, 0x06, 0x92, 0x99, 0x30, 0x33, 0x59, 0xbb, 0xf7, 0xbe, 0x84, 0xaf, 0xe0, 937 0x23, 0xf8, 0x08, 0xde, 0xf9, 0x46, 0x92, 0xc9, 0xa4, 0xcd, 0x36, 0x17, 0xdb, 0xbb, 0x4c, 0xcf, 938 0xff, 0xff, 0xe7, 0x9b, 0x73, 0x86, 0xc2, 0xb3, 0x88, 0xf3, 0x28, 0x26, 0xae, 0x4c, 0x31, 0x63, 939 0x44, 0xb8, 0x37, 0x63, 0x57, 0x09, 0xcc, 0x24, 0x5e, 0x2a, 0xca, 0x99, 0x93, 0x0a, 0xae, 0x38, 940 0x3a, 0x2e, 0x44, 0x8e, 0x11, 0x39, 0x37, 0x63, 0xfb, 0x91, 0xf1, 0xe1, 0x94, 0xba, 0x98, 0x31, 941 0xae, 0x70, 0xae, 0x97, 0x85, 0xc1, 0x7e, 0x6c, 0xaa, 0xfa, 0xb4, 0xc8, 0xbe, 0xbb, 0x61, 0x26, 942 0xf0, 0x26, 0xd0, 0x7e, 0xb2, 0x5d, 0x57, 0x34, 0x21, 0x52, 0xe1, 0x24, 0x2d, 0x04, 0xa3, 0x7f, 943 0x2d, 0x40, 0x57, 0x1b, 0x8e, 0xcb, 0x54, 0xa7, 0xa3, 0x29, 0x80, 0x20, 0x38, 0x0c, 0x7e, 0x08, 944 0xaa, 0xc8, 0xb0, 0xf1, 0xb4, 0xf1, 0xa2, 0x7b, 0xe6, 0x3a, 0x35, 0x3a, 0xa7, 0x6e, 0x75, 0x7c, 945 0x82, 0xc3, 0x2f, 0xb9, 0xcd, 0xb3, 0xfc, 0x03, 0x51, 0x1e, 0xd0, 0x27, 0xd0, 0x87, 0x80, 0xb3, 946 0xf8, 0x76, 0xd8, 0xd4, 0x81, 0xce, 0xee, 0x81, 0x97, 0x2c, 0xbe, 0xf5, 0x2c, 0xbf, 0x23, 0xcc, 947 0xb7, 0xdd, 0x85, 0x83, 0x75, 0x23, 0xfb, 0xe7, 0x1e, 0x74, 0x4a, 0x15, 0x1a, 0x42, 0x5b, 0x2a, 948 0xc1, 0x59, 0xa4, 0xb1, 0x3b, 0x9e, 0xe5, 0x9b, 0x33, 0xfa, 0x08, 0x28, 0xa1, 0x2c, 0xd0, 0x18, 949 0xeb, 0x39, 0x18, 0x16, 0xbb, 0x64, 0x29, 0x27, 0xe5, 0x5c, 0x95, 0x0a, 0xcf, 0xf2, 0x07, 0x09, 950 0x65, 0x79, 0x83, 0xf5, 0x6f, 0xe8, 0x2d, 0x1c, 0x26, 0x78, 0x15, 0x48, 0x85, 0x63, 0xc2, 0x88, 951 0x94, 0xc3, 0x3d, 0x1d, 0xf3, 0xb0, 0x16, 0x73, 0x61, 0x16, 0xe2, 0x59, 0x7e, 0x2f, 0xc1, 0xab, 952 0x59, 0x69, 0x40, 0xe7, 0xd0, 0xdf, 0x22, 0x69, 0xed, 0x40, 0x72, 0x28, 0xee, 0x60, 0x5c, 0xc0, 953 0x11, 0x59, 0xe1, 0xa5, 0xaa, 0x80, 0xec, 0xdf, 0x0f, 0xd2, 0xd7, 0x9e, 0x0d, 0xca, 0x19, 0x9c, 954 0x0a, 0xa2, 0x32, 0x51, 0x9b, 0x4d, 0x3b, 0x9f, 0xa0, 0x7f, 0x52, 0x14, 0xef, 0x0c, 0x60, 0x72, 955 0x0c, 0x47, 0x6b, 0x5d, 0xb0, 0xe0, 0x19, 0x0b, 0x27, 0x6d, 0x68, 0x25, 0x3c, 0x24, 0xa3, 0x6f, 956 0xd0, 0xad, 0xac, 0x11, 0xf5, 0xa1, 0x49, 0x43, 0xbd, 0x8c, 0x9e, 0xdf, 0xa4, 0x21, 0x7a, 0x57, 957 0xbb, 0xf8, 0xbd, 0x2b, 0xd8, 0xba, 0xf6, 0xe8, 0x4f, 0x03, 0x4e, 0x2a, 0x2d, 0x66, 0x24, 0x26, 958 0x4b, 0xc5, 0x05, 0x7a, 0x0f, 0x20, 0x29, 0x8b, 0x62, 0x12, 0x64, 0xb2, 0x7c, 0xb6, 0xcf, 0x77, 959 0x7a, 0x65, 0xf9, 0x63, 0x2d, 0xac, 0x9f, 0x25, 0x41, 0x03, 0x8d, 0x9c, 0x63, 0xf5, 0x3c, 0x4b, 960 0x43, 0xbf, 0x81, 0xfd, 0x05, 0x89, 0x28, 0x33, 0x7b, 0xde, 0x39, 0xb4, 0x70, 0x4d, 0x00, 0x3a, 961 0xd2, 0x40, 0x4e, 0x7e, 0x35, 0xe0, 0x74, 0xc9, 0x93, 0x7a, 0xc2, 0x64, 0x50, 0x89, 0x98, 0xe6, 962 0x43, 0x98, 0x36, 0xbe, 0xbe, 0x32, 0xb2, 0x88, 0xc7, 0x98, 0x45, 0x0e, 0x17, 0x91, 0x1b, 0x11, 963 0xa6, 0x47, 0xe4, 0x16, 0x25, 0x9c, 0x52, 0x59, 0xf9, 0x5b, 0x79, 0x6d, 0x3e, 0x7f, 0x37, 0x1f, 964 0x7c, 0x28, 0xac, 0xe7, 0x31, 0xcf, 0x42, 0x67, 0x66, 0xfa, 0x5c, 0x8f, 0xff, 0x96, 0x95, 0xb9, 965 0xae, 0xcc, 0x4d, 0x65, 0x7e, 0x3d, 0x5e, 0xb4, 0x75, 0xf0, 0xcb, 0xff, 0x01, 0x00, 0x00, 0xff, 966 0xff, 0xa6, 0x28, 0x2f, 0x4a, 0xae, 0x04, 0x00, 0x00, 967} 968