forked from tsuna/gohbase
/
enable.go
52 lines (44 loc) · 1.22 KB
/
enable.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 (
"context"
"github.com/clarax/gohbase/pb"
"google.golang.org/protobuf/proto"
)
// EnableTable represents a EnableTable HBase call
type EnableTable struct {
base
}
// NewEnableTable creates a new EnableTable request that will enable the
// given table in HBase. For use by the admin client.
func NewEnableTable(ctx context.Context, table []byte) *EnableTable {
return &EnableTable{
base{
table: table,
ctx: ctx,
resultch: make(chan RPCResult, 1),
},
}
}
// Name returns the name of this RPC call.
func (et *EnableTable) Name() string {
return "EnableTable"
}
// ToProto converts the RPC into a protobuf message
func (et *EnableTable) ToProto() proto.Message {
return &pb.EnableTableRequest{
TableName: &pb.TableName{
// TODO: handle namespaces
Namespace: []byte("default"),
Qualifier: et.table,
},
}
}
// NewResponse creates an empty protobuf message to read the response of this
// RPC.
func (et *EnableTable) NewResponse() proto.Message {
return &pb.EnableTableResponse{}
}