Methods
attachCallStream(callStream)
Attaches the underlying gRPC call stream once it is prepared by GAPIC.
Parameters:
| Name | Type | Description |
|---|---|---|
callStream |
The cancellable stream returned by GAX. |
attachRequestFn(requestFn)
Invokes requestFn to initialize the callStream, or skips invocation if the user-facing stream was already destroyed before preparation finished.
Parameters:
| Name | Type | Description |
|---|---|---|
requestFn |
The function that instantiates the GAX call stream. |
cancelCallStream()
Cancels the active gRPC call stream if it has not already completed.
Note: In @grpc/grpc-js, calling .cancel() after a stream has already
finished or drained with Status.OK will overwrite the status to CANCELLED.
We guard against this by checking streamFinished and statusReceived.
completeOperation()
Completes the OpenTelemetry operation metric. Idempotent.
handleRequestError(error)
Handles errors encountered during GAPIC request preparation.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
The error from prepareGapicRequest_. |
handleStreamClose()
Handles stream close on the user-facing stream. Defers metric completion if the gRPC call is still in flight, ensuring attempt status is recorded by the interceptor before operation completion is finalized.
handleStreamFinish()
Handles stream finish when all data has been written to the transform stream.
setup()
Sets up destruction hooks and lifecycle listeners on the user-facing stream.
startRequest()
Marks that the GAPIC request preparation has been initiated (e.g. upon 'reading').
waitForStatusOrClose()
Waits for the gRPC call to deliver its terminal status or close event before finalizing operation metrics.