@@ -912,6 +912,40 @@ func handleExecuteStreamEnd(stream btpb.Bigtable_ExecuteQueryClient, trailerMD *
912912 return nil
913913}
914914
915+ // Pinger pings the server and warms up the connection.
916+ func (c * Client ) Pinger (ctx context.Context ) (err error ) {
917+ md := metadata .Join (metadata .Pairs (
918+ resourcePrefixHeader , c .fullInstanceName (),
919+ requestParamsHeader , c .reqParamsHeaderValInstance (),
920+ ), c .newFeatureFlags ())
921+
922+ ctx = mergeOutgoingMetadata (ctx , md )
923+ ctx = trace .StartSpan (ctx , "cloud.google.com/go/bigtable/PingAndWarm" )
924+ defer func () { trace .EndSpan (ctx , err ) }()
925+ mt := c .newBuiltinMetricsTracer (ctx , "" , false )
926+ defer mt .recordOperationCompletion ()
927+
928+ err = c .pingerWithMetadata (ctx , mt )
929+ statusCode , statusErr := convertToGrpcStatusErr (err )
930+ mt .currOp .setStatus (statusCode .String ())
931+ return statusErr
932+ }
933+
934+ func (c * Client ) pingerWithMetadata (ctx context.Context , mt * builtinMetricsTracer ) (err error ) {
935+ req := & btpb.PingAndWarmRequest {
936+ Name : c .fullInstanceName (),
937+ AppProfileId : c .appProfile ,
938+ }
939+ err = gaxInvokeWithRecorder (ctx , mt , "PingAndWarm" , func (ctx context.Context , headerMD , trailerMD * metadata.MD , _ gax.CallSettings ) error {
940+ var err error
941+ _ , err = c .client .PingAndWarm (ctx , req , grpc .Header (headerMD ), grpc .Trailer (trailerMD ))
942+ return err
943+ })
944+
945+ return err
946+
947+ }
948+
915949func (ti * tableImpl ) ReadRows (ctx context.Context , arg RowSet , f func (Row ) bool , opts ... ReadOption ) error {
916950 return ti .Table .ReadRows (ctx , arg , f , opts ... )
917951}
0 commit comments