forked from tsuna/gohbase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.go
52 lines (45 loc) · 1.28 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
52
// 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 (
"github.com/golang/protobuf/proto"
"github.com/Flipboard/gohbase/pb"
"golang.org/x/net/context"
)
// DeleteTable represents a DeleteTable HBase call
type DeleteTable struct {
tableOp
}
// 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 {
dt := &DeleteTable{
tableOp{base{
table: table,
ctx: ctx,
}},
}
return dt
}
// GetName returns the name of this RPC call.
func (dt *DeleteTable) GetName() string {
return "DeleteTable"
}
// Serialize will convert this HBase call into a slice of bytes to be written to
// the network
func (dt *DeleteTable) Serialize() ([]byte, error) {
dtreq := &pb.DeleteTableRequest{
TableName: &pb.TableName{
Namespace: []byte("default"),
Qualifier: dt.table,
},
}
return proto.Marshal(dtreq)
}
// NewResponse creates an empty protobuf message to read the response of this
// RPC.
func (dt *DeleteTable) NewResponse() proto.Message {
return &pb.DeleteTableResponse{}
}