OSDN Git Service

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