vendor: update all dependencies
This commit is contained in:
+23
-17
@@ -45,24 +45,26 @@ func errEarlyReadEnd() error {
|
||||
|
||||
// stream is the internal fault tolerant method for streaming data from
|
||||
// Cloud Spanner.
|
||||
func stream(ctx context.Context, rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error), release func(time.Time, error)) *RowIterator {
|
||||
func stream(ctx context.Context, rpc func(ct context.Context, resumeToken []byte) (streamingReceiver, error), setTimestamp func(time.Time), release func(error)) *RowIterator {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
return &RowIterator{
|
||||
streamd: newResumableStreamDecoder(ctx, rpc),
|
||||
rowd: &partialResultSetDecoder{},
|
||||
release: release,
|
||||
cancel: cancel,
|
||||
streamd: newResumableStreamDecoder(ctx, rpc),
|
||||
rowd: &partialResultSetDecoder{},
|
||||
setTimestamp: setTimestamp,
|
||||
release: release,
|
||||
cancel: cancel,
|
||||
}
|
||||
}
|
||||
|
||||
// RowIterator is an iterator over Rows.
|
||||
type RowIterator struct {
|
||||
streamd *resumableStreamDecoder
|
||||
rowd *partialResultSetDecoder
|
||||
release func(time.Time, error)
|
||||
cancel func()
|
||||
err error
|
||||
rows []*Row
|
||||
streamd *resumableStreamDecoder
|
||||
rowd *partialResultSetDecoder
|
||||
setTimestamp func(time.Time)
|
||||
release func(error)
|
||||
cancel func()
|
||||
err error
|
||||
rows []*Row
|
||||
}
|
||||
|
||||
// Next returns the next result. Its second return value is iterator.Done if
|
||||
@@ -77,6 +79,10 @@ func (r *RowIterator) Next() (*Row, error) {
|
||||
if r.err != nil {
|
||||
return nil, r.err
|
||||
}
|
||||
if !r.rowd.ts.IsZero() && r.setTimestamp != nil {
|
||||
r.setTimestamp(r.rowd.ts)
|
||||
r.setTimestamp = nil
|
||||
}
|
||||
}
|
||||
if len(r.rows) > 0 {
|
||||
row := r.rows[0]
|
||||
@@ -94,7 +100,7 @@ func (r *RowIterator) Next() (*Row, error) {
|
||||
}
|
||||
|
||||
// Do calls the provided function once in sequence for each row in the iteration. If the
|
||||
// function returns a non-nil error, Do immediately returns that value.
|
||||
// function returns a non-nil error, Do immediately returns that error.
|
||||
//
|
||||
// If there are no rows in the iterator, Do will return nil without calling the
|
||||
// provided function.
|
||||
@@ -123,7 +129,7 @@ func (r *RowIterator) Stop() {
|
||||
r.cancel()
|
||||
}
|
||||
if r.release != nil {
|
||||
r.release(r.rowd.ts, r.err)
|
||||
r.release(r.err)
|
||||
if r.err == nil {
|
||||
r.err = spannerErrorf(codes.FailedPrecondition, "Next called after Stop")
|
||||
}
|
||||
@@ -197,7 +203,7 @@ func (q *partialResultQueue) clear() {
|
||||
*q = partialResultQueue{}
|
||||
}
|
||||
|
||||
// dump retrives all items from partialResultQueue and return them in a slice.
|
||||
// dump retrieves all items from partialResultQueue and return them in a slice.
|
||||
// It is used only in tests.
|
||||
func (q *partialResultQueue) dump() []*sppb.PartialResultSet {
|
||||
var dq []*sppb.PartialResultSet
|
||||
@@ -359,7 +365,7 @@ func (d *resumableStreamDecoder) next() bool {
|
||||
// Do context check here so that even gRPC failed to do
|
||||
// so, resumableStreamDecoder can still break the loop
|
||||
// as expected.
|
||||
d.err = errContextCanceled(d.err)
|
||||
d.err = errContextCanceled(d.ctx, d.err)
|
||||
d.changeState(aborted)
|
||||
default:
|
||||
}
|
||||
@@ -537,7 +543,7 @@ func (p *partialResultSetDecoder) yield(chunked, last bool) *Row {
|
||||
|
||||
// yieldTx returns transaction information via caller supplied callback.
|
||||
func errChunkedEmptyRow() error {
|
||||
return spannerErrorf(codes.FailedPrecondition, "partialResultSetDecoder gets chunked empty row")
|
||||
return spannerErrorf(codes.FailedPrecondition, "got invalid chunked PartialResultSet with empty Row")
|
||||
}
|
||||
|
||||
// add tries to merge a new PartialResultSet into buffered Row. It returns
|
||||
@@ -611,7 +617,7 @@ func (p *partialResultSetDecoder) isMergeable(a *proto3.Value) bool {
|
||||
// errIncompatibleMergeTypes returns error for incompatible protobuf types
|
||||
// that cannot be merged by partialResultSetDecoder.
|
||||
func errIncompatibleMergeTypes(a, b *proto3.Value) error {
|
||||
return spannerErrorf(codes.FailedPrecondition, "partialResultSetDecoder merge(%T,%T) - incompatible types", a.Kind, b.Kind)
|
||||
return spannerErrorf(codes.FailedPrecondition, "incompatible type in chunked PartialResultSet. expected (%T), got (%T)", a.Kind, b.Kind)
|
||||
}
|
||||
|
||||
// errUnsupportedMergeType returns error for protobuf type that cannot be
|
||||
|
||||
Reference in New Issue
Block a user