forked from forgejo/forgejo
Integrate public as bindata optionally (#293)
* Dropped unused codekit config * Integrated dynamic and static bindata for public * Ignore public bindata * Add a general generate make task * Integrated flexible public assets into web command * Updated vendoring, added all missiong govendor deps * Made the linter happy with the bindata and dynamic code * Moved public bindata definition to modules directory * Ignoring the new bindata path now * Updated to the new public modules import path * Updated public bindata command and drop the new prefix
This commit is contained in:
parent
4680c349dd
commit
b6a95a8cb3
691 changed files with 305318 additions and 1272 deletions
100
vendor/github.com/pingcap/go-hbase/call.go
generated
vendored
Normal file
100
vendor/github.com/pingcap/go-hbase/call.go
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
package hbase
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
pb "github.com/golang/protobuf/proto"
|
||||
"github.com/pingcap/go-hbase/proto"
|
||||
)
|
||||
|
||||
type call struct {
|
||||
id uint32
|
||||
methodName string
|
||||
request pb.Message
|
||||
responseBuffer pb.Message
|
||||
responseCh chan pb.Message
|
||||
}
|
||||
|
||||
type exception struct {
|
||||
msg string
|
||||
}
|
||||
|
||||
func isNotInRegionError(err error) bool {
|
||||
return strings.Contains(err.Error(), "org.apache.hadoop.hbase.NotServingRegionException")
|
||||
}
|
||||
func isUnknownScannerError(err error) bool {
|
||||
return strings.Contains(err.Error(), "org.apache.hadoop.hbase.UnknownScannerException")
|
||||
}
|
||||
|
||||
func (m *exception) Reset() { *m = exception{} }
|
||||
func (m *exception) String() string { return m.msg }
|
||||
func (m *exception) ProtoMessage() {}
|
||||
|
||||
func newCall(request pb.Message) *call {
|
||||
var responseBuffer pb.Message
|
||||
var methodName string
|
||||
|
||||
switch request.(type) {
|
||||
case *proto.GetRequest:
|
||||
responseBuffer = &proto.GetResponse{}
|
||||
methodName = "Get"
|
||||
case *proto.MutateRequest:
|
||||
responseBuffer = &proto.MutateResponse{}
|
||||
methodName = "Mutate"
|
||||
case *proto.ScanRequest:
|
||||
responseBuffer = &proto.ScanResponse{}
|
||||
methodName = "Scan"
|
||||
case *proto.GetTableDescriptorsRequest:
|
||||
responseBuffer = &proto.GetTableDescriptorsResponse{}
|
||||
methodName = "GetTableDescriptors"
|
||||
case *proto.CoprocessorServiceRequest:
|
||||
responseBuffer = &proto.CoprocessorServiceResponse{}
|
||||
methodName = "ExecService"
|
||||
case *proto.CreateTableRequest:
|
||||
responseBuffer = &proto.CreateTableResponse{}
|
||||
methodName = "CreateTable"
|
||||
case *proto.DisableTableRequest:
|
||||
responseBuffer = &proto.DisableTableResponse{}
|
||||
methodName = "DisableTable"
|
||||
case *proto.EnableTableRequest:
|
||||
responseBuffer = &proto.EnableTableResponse{}
|
||||
methodName = "EnableTable"
|
||||
case *proto.DeleteTableRequest:
|
||||
responseBuffer = &proto.DeleteTableResponse{}
|
||||
methodName = "DeleteTable"
|
||||
case *proto.MultiRequest:
|
||||
responseBuffer = &proto.MultiResponse{}
|
||||
methodName = "Multi"
|
||||
case *proto.SplitRegionRequest:
|
||||
responseBuffer = &proto.SplitRegionResponse{}
|
||||
methodName = "SplitRegion"
|
||||
}
|
||||
|
||||
return &call{
|
||||
methodName: methodName,
|
||||
request: request,
|
||||
responseBuffer: responseBuffer,
|
||||
responseCh: make(chan pb.Message, 1),
|
||||
}
|
||||
}
|
||||
|
||||
func (c *call) complete(err error, response []byte) {
|
||||
defer close(c.responseCh)
|
||||
|
||||
if err != nil {
|
||||
c.responseCh <- &exception{
|
||||
msg: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
err = pb.Unmarshal(response, c.responseBuffer)
|
||||
if err != nil {
|
||||
c.responseCh <- &exception{
|
||||
msg: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
c.responseCh <- c.responseBuffer
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue