github.com/tsuna/gohbase@v0.0.0-20250731002811-4ffcadfba63e/hrpc/delete.go (about)

     1  // Copyright (C) 2015  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  // DeleteTable represents a DeleteTable HBase call
    16  type DeleteTable struct {
    17  	base
    18  }
    19  
    20  // NewDeleteTable creates a new DeleteTable request that will delete the
    21  // given table in HBase. For use by the admin client.
    22  func NewDeleteTable(ctx context.Context, table []byte) *DeleteTable {
    23  	return &DeleteTable{
    24  		base{
    25  			table:    table,
    26  			ctx:      ctx,
    27  			resultch: make(chan RPCResult, 1),
    28  		},
    29  	}
    30  }
    31  
    32  // Name returns the name of this RPC call.
    33  func (dt *DeleteTable) Name() string {
    34  	return "DeleteTable"
    35  }
    36  
    37  // Description returns the description of this RPC call.
    38  func (dt *DeleteTable) Description() string {
    39  	return dt.Name()
    40  }
    41  
    42  // ToProto converts the RPC into a protobuf message
    43  func (dt *DeleteTable) ToProto() proto.Message {
    44  	return &pb.DeleteTableRequest{
    45  		TableName: &pb.TableName{
    46  			// TODO: hadle namespaces properly
    47  			Namespace: []byte("default"),
    48  			Qualifier: dt.table,
    49  		},
    50  	}
    51  }
    52  
    53  // NewResponse creates an empty protobuf message to read the response of this
    54  // RPC.
    55  func (dt *DeleteTable) NewResponse() proto.Message {
    56  	return &pb.DeleteTableResponse{}
    57  }