forked from jasonzzw/gohbase
-
Notifications
You must be signed in to change notification settings - Fork 1
/
disable.go
51 lines (43 loc) · 1.21 KB
/
disable.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"
)
// DisableTable represents a DisableTable HBase call
type DisableTable struct {
base
}
// NewDisableTable creates a new DisableTable request that will disable the
// given table in HBase. For use by the admin client.
func NewDisableTable(ctx context.Context, table []byte) *DisableTable {
return &DisableTable{
base{
table: table,
ctx: ctx,
},
}
}
// Name returns the name of this RPC call.
func (dt *DisableTable) Name() string {
return "DisableTable"
}
// ToProto converts the RPC into a protobuf message
func (dt *DisableTable) ToProto() (proto.Message, error) {
return &pb.DisableTableRequest{
TableName: &pb.TableName{
// TODO: handle namespaces
Namespace: []byte("default"),
Qualifier: dt.table,
},
}, nil
}
// NewResponse creates an empty protobuf message to read the response of this
// RPC.
func (dt *DisableTable) NewResponse() proto.Message {
return &pb.DisableTableResponse{}
}