@@ -79,9 +79,10 @@ type ManagedStream struct {
79
79
fc * flowController
80
80
81
81
// aspects of the stream client
82
- ctx context.Context // retained context for the stream
83
- cancel context.CancelFunc
84
- open func (streamID string ) (storagepb.BigQueryWrite_AppendRowsClient , error ) // how we get a new connection
82
+ ctx context.Context // retained context for the stream
83
+ cancel context.CancelFunc
84
+ callOptions []gax.CallOption // options passed when opening an append client
85
+ open func (streamID string , opts ... gax.CallOption ) (storagepb.BigQueryWrite_AppendRowsClient , error ) // how we get a new connection
85
86
86
87
mu sync.Mutex
87
88
arc * storagepb.BigQueryWrite_AppendRowsClient // current stream connection
@@ -141,14 +142,14 @@ func (ms *ManagedStream) StreamType() StreamType {
141
142
142
143
// FlushRows advances the offset at which rows in a BufferedStream are visible. Calling
143
144
// this method for other stream types yields an error.
144
- func (ms * ManagedStream ) FlushRows (ctx context.Context , offset int64 ) (int64 , error ) {
145
+ func (ms * ManagedStream ) FlushRows (ctx context.Context , offset int64 , opts ... gax. CallOption ) (int64 , error ) {
145
146
req := & storagepb.FlushRowsRequest {
146
147
WriteStream : ms .streamSettings .streamID ,
147
148
Offset : & wrapperspb.Int64Value {
148
149
Value : offset ,
149
150
},
150
151
}
151
- resp , err := ms .c .rawClient .FlushRows (ctx , req )
152
+ resp , err := ms .c .rawClient .FlushRows (ctx , req , opts ... )
152
153
recordStat (ms .ctx , FlushRequests , 1 )
153
154
if err != nil {
154
155
return 0 , err
@@ -161,12 +162,12 @@ func (ms *ManagedStream) FlushRows(ctx context.Context, offset int64) (int64, er
161
162
//
162
163
// Finalizing does not advance the current offset of a BufferedStream, nor does it commit
163
164
// data in a PendingStream.
164
- func (ms * ManagedStream ) Finalize (ctx context.Context ) (int64 , error ) {
165
+ func (ms * ManagedStream ) Finalize (ctx context.Context , opts ... gax. CallOption ) (int64 , error ) {
165
166
// TODO: consider blocking for in-flight appends once we have an appendStream plumbed in.
166
167
req := & storagepb.FinalizeWriteStreamRequest {
167
168
Name : ms .streamSettings .streamID ,
168
169
}
169
- resp , err := ms .c .rawClient .FinalizeWriteStream (ctx , req )
170
+ resp , err := ms .c .rawClient .FinalizeWriteStream (ctx , req , opts ... )
170
171
if err != nil {
171
172
return 0 , err
172
173
}
@@ -208,7 +209,7 @@ func (ms *ManagedStream) openWithRetry() (storagepb.BigQueryWrite_AppendRowsClie
208
209
if ms .streamSettings != nil {
209
210
streamID = ms .streamSettings .streamID
210
211
}
211
- arc , err := ms .open (streamID )
212
+ arc , err := ms .open (streamID , ms . callOptions ... )
212
213
bo , shouldRetry := r .Retry (err )
213
214
if err != nil && shouldRetry {
214
215
recordStat (ms .ctx , AppendClientOpenRetryCount , 1 )
0 commit comments