forked from jasonzzw/gohbase
-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete.go
51 lines (43 loc) · 1.21 KB
/
delete.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (C) 2015 The GoHBase Authors. All rights reserved.
// This file is part of GoHBase.
// Use of this source code is governed by the Apache License 2.0
// that can be found in the COPYING file.
package hrpc
import (
"context"
"github.com/ZengKunLi/gohbase/pb"
"github.com/golang/protobuf/proto"
)
// DeleteTable represents a DeleteTable HBase call
type DeleteTable struct {
base
}
// NewDeleteTable creates a new DeleteTable request that will delete the
// given table in HBase. For use by the admin client.
func NewDeleteTable(ctx context.Context, table []byte) *DeleteTable {
return &DeleteTable{
base{
table: table,
ctx: ctx,
},
}
}
// Name returns the name of this RPC call.
func (dt *DeleteTable) Name() string {
return "DeleteTable"
}
// ToProto converts the RPC into a protobuf message
func (dt *DeleteTable) ToProto() (proto.Message, error) {
return &pb.DeleteTableRequest{
TableName: &pb.TableName{
// TODO: hadle namespaces properly
Namespace: []byte("default"),
Qualifier: dt.table,
},
}, nil
}
// NewResponse creates an empty protobuf message to read the response of this
// RPC.
func (dt *DeleteTable) NewResponse() proto.Message {
return &pb.DeleteTableResponse{}
}