github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/hrpc/procedure.go (about) 1 // Copyright (C) 2016 The GoHBase Authors. All rights reserved. 2 // This file is part of GoHBase. 3 // Use of this source code is governed by the Apache License 2.0 4 // that can be found in the COPYING file. 5 6 package hrpc 7 8 import ( 9 "context" 10 11 "github.com/tsuna/gohbase/pb" 12 "google.golang.org/protobuf/proto" 13 ) 14 15 // GetProcedureState represents a call to HBase to check status of a procedure 16 type GetProcedureState struct { 17 base 18 19 procID uint64 20 } 21 22 // NewGetProcedureState creates a new GetProcedureState request. For use by the admin client. 23 func NewGetProcedureState(ctx context.Context, procID uint64) *GetProcedureState { 24 return &GetProcedureState{ 25 base: base{ 26 ctx: ctx, 27 resultch: make(chan RPCResult, 1), 28 }, 29 procID: procID, 30 } 31 } 32 33 // Name returns the name of this RPC call. 34 func (ps *GetProcedureState) Name() string { 35 return "getProcedureResult" 36 } 37 38 // Description returns the description of this RPC call. 39 func (ps *GetProcedureState) Description() string { 40 return ps.Name() 41 } 42 43 // ToProto converts the RPC into a protobuf message 44 func (ps *GetProcedureState) ToProto() proto.Message { 45 return &pb.GetProcedureResultRequest{ProcId: &ps.procID} 46 } 47 48 // NewResponse creates an empty protobuf message to read the response of this RPC. 49 func (ps *GetProcedureState) NewResponse() proto.Message { 50 return &pb.GetProcedureResultResponse{} 51 }