@InterfaceAudience.Private public final class ProtobufUtil extends Object
ProtobufUtil
Modifier and Type | Method and Description |
---|---|
static AdminProtos.CloseRegionRequest |
buildCloseRegionRequest(ServerName server,
byte[] regionName)
Create a CloseRegionRequest for a given region name
|
static AdminProtos.CloseRegionRequest |
buildCloseRegionRequest(ServerName server,
byte[] regionName,
ServerName destinationServer) |
static AdminProtos.GetStoreFileRequest |
buildGetStoreFileRequest(byte[] regionName,
byte[] family)
Create a protocol buffer GetStoreFileRequest for a given region name
|
static HBaseProtos.ProcedureDescription |
buildProcedureDescription(String signature,
String instance,
Map<String,String> props) |
static <T> T |
call(Callable<T> callable)
Contain ServiceException inside here.
|
static void |
closeRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin,
ServerName server,
byte[] regionName)
A helper to close a region given a region name
using admin protocol.
|
static CompactionState |
createCompactionState(AdminProtos.GetRegionInfoResponse.CompactionState state)
Creates
CompactionState from
AdminProtos.GetRegionInfoResponse.CompactionState
state |
static AdminProtos.GetRegionInfoResponse.CompactionState |
createCompactionState(CompactionState state) |
static SnapshotProtos.SnapshotDescription |
createHBaseProtosSnapshotDesc(SnapshotDescription snapshotDesc)
Convert from
SnapshotDescription to
HBaseProtos.SnapshotDescription |
static SnapshotProtos.SnapshotDescription.Type |
createProtosSnapShotDescType(SnapshotType type)
Creates
HBaseProtos.SnapshotDescription.Type
from SnapshotType |
static SnapshotProtos.SnapshotDescription.Type |
createProtosSnapShotDescType(String snapshotDesc)
Creates
HBaseProtos.SnapshotDescription.Type
from the type of SnapshotDescription string |
static RegionLoadStats |
createRegionLoadStats(ClientProtos.RegionLoadStats stats) |
static SnapshotDescription |
createSnapshotDesc(SnapshotProtos.SnapshotDescription snapshotDesc)
Convert from
HBaseProtos.SnapshotDescription to
SnapshotDescription |
static SnapshotType |
createSnapshotType(SnapshotProtos.SnapshotDescription.Type type)
Creates
SnapshotType from the type of
HBaseProtos.SnapshotDescription |
static void |
expectPBMagicPrefix(byte[] bytes) |
static KeyValue.Type |
fromDeleteType(ClientProtos.MutationProto.DeleteType type)
Convert a protocol buffer DeleteType to delete KeyValue type.
|
static List<RegionInfo> |
getOnlineRegions(AdminProtos.AdminService.BlockingInterface admin)
A helper to get the all the online regions on a region
server using admin protocol.
|
static List<RegionInfo> |
getOnlineRegions(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin)
A helper to get the all the online regions on a region
server using admin protocol.
|
static String |
getRegionEncodedName(HBaseProtos.RegionSpecifier regionSpecifier)
Find the HRegion encoded name based on a region specifier
|
static RegionInfo |
getRegionInfo(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin,
byte[] regionName)
A helper to retrieve region info given a region name
using admin protocol.
|
static List<RegionInfo> |
getRegionInfos(AdminProtos.GetOnlineRegionResponse proto)
Get the list of region info from a GetOnlineRegionResponse
|
static List<RegionLoad> |
getRegionLoadInfo(AdminProtos.GetRegionLoadResponse regionLoadResponse) |
static IOException |
getRemoteException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se)
Return the IOException thrown by the remote server wrapped in
ServiceException as cause.
|
static AdminProtos.ServerInfo |
getServerInfo(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin)
A helper to get the info of a region server using admin protocol.
|
static String |
getShortTextFormat(org.apache.hbase.thirdparty.com.google.protobuf.Message m)
Return short version of Message toString'd, shorter than TextFormat#shortDebugString.
|
static byte[][] |
getSplitKeysArray(MasterProtos.CreateTableRequest proto)
get the split keys in form "byte [][]" from a CreateTableRequest proto
|
static List<String> |
getStoreFiles(AdminProtos.AdminService.BlockingInterface admin,
byte[] regionName,
byte[] family)
A helper to get the list of files of a column family
on a given region using admin protocol.
|
static List<String> |
getStoreFiles(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin,
byte[] regionName,
byte[] family)
A helper to get the list of files of a column family
on a given region using admin protocol.
|
static TableName[] |
getTableNameArray(List<HBaseProtos.TableName> tableNamesList) |
static long |
getTotalRequestsCount(ClusterStatusProtos.RegionLoad rl) |
static HBaseProtos.VersionInfo |
getVersionInfo()
Get a protocol buffer VersionInfo
|
static IOException |
handleRemoteException(Exception e)
Like
getRemoteException(ServiceException) but more generic, able to handle more than
just ServiceException . |
static boolean |
isClassLoaderLoaded() |
static boolean |
isPBMagicPrefix(byte[] bytes) |
static boolean |
isPBMagicPrefix(byte[] bytes,
int offset,
int len) |
static int |
lengthOfPBMagic() |
static void |
mergeDelimitedFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
InputStream in)
This version of protobuf's mergeDelimitedFrom avoid the hard-coded 64MB limit for decoding
buffers
|
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
byte[] b)
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
buffers when working with byte arrays
|
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
byte[] b,
int offset,
int length)
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
buffers when working with byte arrays
|
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs)
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
buffers when working with ByteStrings
|
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream codedInput,
int length) |
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
InputStream in)
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
buffers where the message size is not known
|
static void |
mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder,
InputStream in,
int size)
This version of protobuf's mergeFrom avoids the hard-coded 64MB limit for decoding
buffers where the message size is known
|
static <T extends org.apache.hbase.thirdparty.com.google.protobuf.Service> |
newServiceStub(Class<T> service,
org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel channel) |
static void |
openRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin,
ServerName server,
RegionInfo region)
A helper to open a region using admin protocol.
|
static ServerName |
parseServerNameFrom(byte[] data)
Get a ServerName from the passed in data bytes.
|
static byte[] |
prependPBMagic(byte[] bytes)
Prepend the passed bytes with four bytes of magic,
ProtobufMagic.PB_MAGIC ,
to flag what follows as a protobuf in hbase. |
static Append |
toAppend(ClientProtos.MutationProto proto,
CellScanner cellScanner)
Convert a protocol buffer Mutate to an Append
|
static ClientProtos.Authorizations |
toAuthorizations(Authorizations authorizations)
Create a protocol buffer Authorizations based on a client Authorizations.
|
static Authorizations |
toAuthorizations(byte[] protoBytes)
Convert a protocol buffer Authorizations bytes to a client Authorizations
|
static Authorizations |
toAuthorizations(ClientProtos.Authorizations proto)
Convert a protocol buffer Authorizations to a client Authorizations
|
static WALProtos.BulkLoadDescriptor |
toBulkLoadDescriptor(TableName tableName,
org.apache.hbase.thirdparty.com.google.protobuf.ByteString encodedRegionName,
Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles,
Map<String,Long> storeFilesSize,
long bulkloadSeqId)
Generates a marker for the WAL so that we propagate the notion of a bulk region load
throughout the WAL.
|
static ComparatorProtos.ByteArrayComparable |
toByteArrayComparable(byte[] value) |
static byte[] |
toBytes(org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs) |
static HBaseProtos.CacheEvictionStats |
toCacheEvictionStats(CacheEvictionStats cacheEvictionStats) |
static CacheEvictionStats |
toCacheEvictionStats(HBaseProtos.CacheEvictionStats stats) |
static CellProtos.Cell |
toCell(Cell kv) |
static Cell |
toCell(ExtendedCellBuilder cellBuilder,
CellProtos.Cell cell) |
static CellVisibility |
toCellVisibility(byte[] protoBytes)
Convert a protocol buffer CellVisibility bytes to a client CellVisibility
|
static ClientProtos.CellVisibility |
toCellVisibility(CellVisibility cellVisibility)
Create a protocol buffer CellVisibility based on a client CellVisibility.
|
static CellVisibility |
toCellVisibility(ClientProtos.CellVisibility proto)
Convert a protocol buffer CellVisibility to a client CellVisibility
|
static ColumnFamilyDescriptor |
toColumnFamilyDescriptor(HBaseProtos.ColumnFamilySchema cfs)
Converts a ColumnFamilySchema to ColumnFamilyDescriptor
|
static HBaseProtos.ColumnFamilySchema |
toColumnFamilySchema(ColumnFamilyDescriptor hcd)
Converts an ColumnFamilyDescriptor to ColumnFamilySchema
|
static WALProtos.CompactionDescriptor |
toCompactionDescriptor(RegionInfo info,
byte[] regionName,
byte[] family,
List<org.apache.hadoop.fs.Path> inputPaths,
List<org.apache.hadoop.fs.Path> outputPaths,
org.apache.hadoop.fs.Path storeDir) |
static WALProtos.CompactionDescriptor |
toCompactionDescriptor(RegionInfo info,
byte[] family,
List<org.apache.hadoop.fs.Path> inputPaths,
List<org.apache.hadoop.fs.Path> outputPaths,
org.apache.hadoop.fs.Path storeDir) |
static ComparatorProtos.Comparator |
toComparator(ByteArrayComparable comparator)
Convert a ByteArrayComparable to a protocol buffer Comparator
|
static ByteArrayComparable |
toComparator(ComparatorProtos.Comparator proto)
Convert a protocol buffer Comparator to a ByteArrayComparable
|
static Consistency |
toConsistency(ClientProtos.Consistency consistency) |
static ClientProtos.Consistency |
toConsistency(Consistency consistency) |
static ClientProtos.Cursor |
toCursor(Cell cell) |
static Cursor |
toCursor(ClientProtos.Cursor cursor) |
static ClientProtos.Cursor |
toCursor(Cursor cursor) |
static Delete |
toDelete(ClientProtos.MutationProto proto)
Convert a protocol buffer Mutate to a Delete
|
static Delete |
toDelete(ClientProtos.MutationProto proto,
CellScanner cellScanner)
Convert a protocol buffer Mutate to a Delete
|
static ClientProtos.MutationProto.DeleteType |
toDeleteType(KeyValue.Type type)
Convert a delete KeyValue type to protocol buffer DeleteType.
|
static byte[] |
toDelimitedByteArray(org.apache.hbase.thirdparty.com.google.protobuf.Message m) |
static Durability |
toDurability(ClientProtos.MutationProto.Durability proto)
Convert a protobuf Durability into a client Durability
|
static ClientProtos.MutationProto.Durability |
toDurability(Durability d)
Convert a client Durability into a protbuf Durability
|
static Throwable |
toException(HBaseProtos.NameBytesPair parameter)
Convert a stringified protocol buffer exception Parameter to a Java Exception
|
static FilterProtos.Filter |
toFilter(Filter filter)
Convert a client Filter to a protocol buffer Filter
|
static Filter |
toFilter(FilterProtos.Filter proto)
Convert a protocol buffer Filter to a client Filter
|
static WALProtos.FlushDescriptor |
toFlushDescriptor(WALProtos.FlushDescriptor.FlushAction action,
RegionInfo hri,
long flushSeqId,
Map<byte[],List<org.apache.hadoop.fs.Path>> committedFiles) |
static Get |
toGet(ClientProtos.Get proto)
Convert a protocol buffer Get to a client Get
|
static Get |
toGet(ClientProtos.MutationProto proto,
CellScanner cellScanner)
Convert a protocol buffer Mutate to a Get.
|
static ClientProtos.Get |
toGet(Get get)
Create a protocol buffer Get based on a client Get.
|
static Increment |
toIncrement(ClientProtos.MutationProto proto,
CellScanner cellScanner)
Convert a protocol buffer Mutate to an Increment
|
static void |
toIOException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se)
Unwraps an exception from a protobuf service into the underlying (expected) IOException.
|
static String |
toLockJson(List<LockServiceProtos.LockedResource> lockedResourceProtos) |
static ClientProtos.MutationProto |
toMutation(ClientProtos.MutationProto.MutationType type,
Mutation mutation) |
static ClientProtos.MutationProto |
toMutation(ClientProtos.MutationProto.MutationType type,
Mutation mutation,
ClientProtos.MutationProto.Builder builder) |
static ClientProtos.MutationProto |
toMutation(ClientProtos.MutationProto.MutationType type,
Mutation mutation,
ClientProtos.MutationProto.Builder builder,
long nonce) |
static ClientProtos.MutationProto |
toMutation(ClientProtos.MutationProto.MutationType type,
Mutation mutation,
long nonce)
Create a protocol buffer Mutate based on a client Mutation
|
static Mutation |
toMutation(ClientProtos.MutationProto proto)
Convert a MutateRequest to Mutation
|
static ClientProtos.MutationProto |
toMutationNoData(ClientProtos.MutationProto.MutationType type,
Mutation mutation)
Create a protocol buffer MutationProto based on a client Mutation.
|
static ClientProtos.MutationProto |
toMutationNoData(ClientProtos.MutationProto.MutationType type,
Mutation mutation,
ClientProtos.MutationProto.Builder builder)
Create a protocol buffer MutationProto based on a client Mutation.
|
static ClientProtos.MutationProto |
toMutationNoData(ClientProtos.MutationProto.MutationType type,
Mutation mutation,
ClientProtos.MutationProto.Builder builder,
long nonce) |
static NamespaceDescriptor |
toNamespaceDescriptor(HBaseProtos.NamespaceDescriptor desc) |
static List<NamespaceDescriptor> |
toNamespaceDescriptorList(MasterProtos.ListNamespaceDescriptorsResponse proto)
Get a list of NamespaceDescriptor from ListNamespaceDescriptorsResponse protobuf
|
static Optional<Long> |
toOptionalTimestamp(MasterProtos.MajorCompactionTimestampResponse resp) |
static String |
toProcedureJson(List<ProcedureProtos.Procedure> procProtos)
Helper to convert the protobuf Procedure to JSON String
|
static HBaseProtos.NamespaceDescriptor |
toProtoNamespaceDescriptor(NamespaceDescriptor ns) |
static QuotaProtos.QuotaScope |
toProtoQuotaScope(QuotaScope scope)
Convert a client QuotaScope to a protocol buffer QuotaScope
|
static QuotaProtos.QuotaType |
toProtoQuotaScope(QuotaType type)
Convert a client QuotaType to a protocol buffer QuotaType
|
static QuotaProtos.SpaceQuota |
toProtoSpaceQuota(long limit,
SpaceViolationPolicy violationPolicy)
Builds a protocol buffer SpaceQuota.
|
static HBaseProtos.TableName |
toProtoTableName(TableName tableName) |
static QuotaProtos.ThrottleType |
toProtoThrottleType(ThrottleType type)
Convert a client ThrottleType to a protocol buffer ThrottleType
|
static HBaseProtos.TimeUnit |
toProtoTimeUnit(TimeUnit timeUnit)
Convert a client TimeUnit to a protocol buffer TimeUnit
|
static QuotaProtos.SpaceViolationPolicy |
toProtoViolationPolicy(SpaceViolationPolicy policy)
Converts a client SpaceViolationPolicy to a protocol buffer SpaceViolationPolicy.
|
static Put |
toPut(ClientProtos.MutationProto proto)
Convert a protocol buffer Mutate to a Put.
|
static Put |
toPut(ClientProtos.MutationProto proto,
CellScanner cellScanner)
Convert a protocol buffer Mutate to a Put.
|
static QuotaScope |
toQuotaScope(QuotaProtos.QuotaScope proto)
Convert a protocol buffer QuotaScope to a client QuotaScope
|
static QuotaType |
toQuotaScope(QuotaProtos.QuotaType proto)
Convert a protocol buffer QuotaType to a client QuotaType
|
static Scan.ReadType |
toReadType(ClientProtos.Scan.ReadType readType) |
static ClientProtos.Scan.ReadType |
toReadType(Scan.ReadType readType) |
static WALProtos.RegionEventDescriptor |
toRegionEventDescriptor(WALProtos.RegionEventDescriptor.EventType eventType,
byte[] tableNameAsBytes,
byte[] encodedNameAsBytes,
byte[] regionNameAsBytes,
long seqId,
ServerName server,
Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles) |
static WALProtos.RegionEventDescriptor |
toRegionEventDescriptor(WALProtos.RegionEventDescriptor.EventType eventType,
RegionInfo hri,
long seqId,
ServerName server,
Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles) |
static RegionInfo |
toRegionInfo(HBaseProtos.RegionInfo proto)
Convert HBaseProto.RegionInfo to a RegionInfo
|
static HBaseProtos.RegionInfo |
toRegionInfo(RegionInfo info)
Convert a RegionInfo to a Proto RegionInfo
|
static HRegionLocation |
toRegionLocation(HBaseProtos.RegionLocation proto) |
static HBaseProtos.RegionLocation |
toRegionLocation(HRegionLocation loc) |
static ReplicationLoadSink |
toReplicationLoadSink(ClusterStatusProtos.ReplicationLoadSink rls) |
static ClusterStatusProtos.ReplicationLoadSink |
toReplicationLoadSink(ReplicationLoadSink rls) |
static ReplicationLoadSource |
toReplicationLoadSource(ClusterStatusProtos.ReplicationLoadSource rls) |
static ClusterStatusProtos.ReplicationLoadSource |
toReplicationLoadSource(ReplicationLoadSource rls) |
static ClientProtos.Result |
toResult(boolean existence,
boolean stale)
Convert a client Result to a protocol buffer Result
|
static Result |
toResult(ClientProtos.Result proto)
Convert a protocol buffer Result to a client Result
|
static Result |
toResult(ClientProtos.Result proto,
CellScanner scanner)
Convert a protocol buffer Result to a client Result
|
static ClientProtos.Result |
toResult(Result result)
Convert a client Result to a protocol buffer Result
|
static ClientProtos.Result |
toResultNoData(Result result)
Convert a client Result to a protocol buffer Result.
|
static Scan |
toScan(ClientProtos.Scan proto)
Convert a protocol buffer Scan to a client Scan
|
static ClientProtos.Scan |
toScan(Scan scan)
Convert a client Scan to a protocol buffer Scan
|
static ScanMetrics |
toScanMetrics(byte[] bytes) |
static MapReduceProtos.ScanMetrics |
toScanMetrics(ScanMetrics scanMetrics,
boolean reset) |
static List<SecurityCapability> |
toSecurityCapabilityList(List<MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities)
Convert SecurityCapabilitiesResponse.Capability to SecurityCapability
|
static ServerName |
toServerName(HBaseProtos.ServerName proto)
Convert a protocol buffer ServerName to a ServerName
|
static HBaseProtos.ServerName |
toServerName(ServerName serverName)
Convert a ServerName to a protocol buffer ServerName
|
static List<ServerName> |
toServerNameList(List<HBaseProtos.ServerName> proto)
Convert a list of protocol buffer ServerName to a list of ServerName
|
static List<SnapshotDescription> |
toSnapshotDescriptionList(MasterProtos.GetCompletedSnapshotsResponse response,
Pattern pattern) |
static TableDescriptor |
toTableDescriptor(HBaseProtos.TableSchema ts)
Converts a TableSchema to TableDescriptor
|
static List<TableDescriptor> |
toTableDescriptorList(MasterProtos.GetTableDescriptorsResponse proto)
Get a list of TableDescriptor from GetTableDescriptorsResponse protobuf
|
static List<TableDescriptor> |
toTableDescriptorList(MasterProtos.ListTableDescriptorsByNamespaceResponse proto)
Get a list of TableDescriptor from ListTableDescriptorsByNamespaceResponse protobuf
|
static TableName |
toTableName(HBaseProtos.TableName tableNamePB) |
static List<TableName> |
toTableNameList(List<HBaseProtos.TableName> tableNamesList) |
static HBaseProtos.TableSchema |
toTableSchema(TableDescriptor htd)
Converts an TableDescriptor to TableSchema
|
static String |
toText(org.apache.hbase.thirdparty.com.google.protobuf.Message msg) |
static ThrottleType |
toThrottleType(QuotaProtos.ThrottleType proto)
Convert a protocol buffer ThrottleType to a client ThrottleType
|
static QuotaProtos.TimedQuota |
toTimedQuota(long limit,
TimeUnit timeUnit,
QuotaScope scope)
Build a protocol buffer TimedQuota
|
static TimeRange |
toTimeRange(HBaseProtos.TimeRange timeRange) |
static HBaseProtos.TimeRange |
toTimeRange(TimeRange timeRange) |
static TimeUnit |
toTimeUnit(HBaseProtos.TimeUnit proto)
Convert a protocol buffer TimeUnit to a client TimeUnit
|
static SpaceViolationPolicy |
toViolationPolicy(QuotaProtos.SpaceViolationPolicy proto)
Converts a protocol buffer SpaceViolationPolicy to a client SpaceViolationPolicy.
|
static void |
warmupRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller,
AdminProtos.AdminService.BlockingInterface admin,
RegionInfo regionInfo)
A helper to warmup a region given a region name
using admin protocol
|
public static boolean isClassLoaderLoaded()
public static byte[] prependPBMagic(byte[] bytes)
ProtobufMagic.PB_MAGIC
,
to flag what follows as a protobuf in hbase. Prepend these bytes to all content written to
znodes, etc.bytes
- Bytes to decoratebytes
with magic prepended (Creates a new
byte array that is bytes.length
plus ProtobufMagic.PB_MAGIC
.length.public static boolean isPBMagicPrefix(byte[] bytes)
bytes
- Bytes to check.bytes
has ProtobufMagic.PB_MAGIC
for a prefix.public static boolean isPBMagicPrefix(byte[] bytes, int offset, int len)
bytes
- Bytes to check.offset
- offset to start atlen
- length to usebytes
has ProtobufMagic.PB_MAGIC
for a prefix.public static void expectPBMagicPrefix(byte[] bytes) throws DeserializationException
bytes
- bytes to checkDeserializationException
- if we are missing the pb magic prefixpublic static int lengthOfPBMagic()
ProtobufMagic.lengthOfPBMagic()
public static ComparatorProtos.ByteArrayComparable toByteArrayComparable(byte[] value)
public static IOException getRemoteException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se)
se
- ServiceException that wraps IO exception thrown by the serverpublic static IOException handleRemoteException(Exception e)
getRemoteException(ServiceException)
but more generic, able to handle more than
just ServiceException
. Prefer this method to
getRemoteException(ServiceException)
because trying to
contain direct protobuf references.e
- public static HBaseProtos.ServerName toServerName(ServerName serverName)
serverName
- the ServerName to converttoServerName(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName)
public static ServerName toServerName(HBaseProtos.ServerName proto)
proto
- the protocol buffer ServerName to convertpublic static List<ServerName> toServerNameList(List<HBaseProtos.ServerName> proto)
proto
- protocol buffer ServerNameListpublic static List<NamespaceDescriptor> toNamespaceDescriptorList(MasterProtos.ListNamespaceDescriptorsResponse proto)
proto
- the ListNamespaceDescriptorsResponsepublic static List<TableDescriptor> toTableDescriptorList(MasterProtos.GetTableDescriptorsResponse proto)
proto
- the GetTableDescriptorsResponsepublic static List<TableDescriptor> toTableDescriptorList(MasterProtos.ListTableDescriptorsByNamespaceResponse proto)
proto
- the ListTableDescriptorsByNamespaceResponsepublic static byte[][] getSplitKeysArray(MasterProtos.CreateTableRequest proto)
proto
- the CreateTableRequestpublic static Durability toDurability(ClientProtos.MutationProto.Durability proto)
public static ClientProtos.MutationProto.Durability toDurability(Durability d)
public static Get toGet(ClientProtos.Get proto) throws IOException
proto
- the protocol buffer Get to convertIOException
public static Consistency toConsistency(ClientProtos.Consistency consistency)
public static ClientProtos.Consistency toConsistency(Consistency consistency)
public static Put toPut(ClientProtos.MutationProto proto) throws IOException
proto
- The protocol buffer MutationProto to convertIOException
public static Put toPut(ClientProtos.MutationProto proto, CellScanner cellScanner) throws IOException
proto
- The protocol buffer MutationProto to convertcellScanner
- If non-null, the Cell data that goes with this proto.IOException
public static Delete toDelete(ClientProtos.MutationProto proto) throws IOException
proto
- the protocol buffer Mutate to convertIOException
public static Delete toDelete(ClientProtos.MutationProto proto, CellScanner cellScanner) throws IOException
proto
- the protocol buffer Mutate to convertcellScanner
- if non-null, the data that goes with this delete.IOException
public static Append toAppend(ClientProtos.MutationProto proto, CellScanner cellScanner) throws IOException
cellScanner
- proto
- the protocol buffer Mutate to convertIOException
public static Increment toIncrement(ClientProtos.MutationProto proto, CellScanner cellScanner) throws IOException
proto
- the protocol buffer Mutate to convertIOException
public static Mutation toMutation(ClientProtos.MutationProto proto) throws IOException
proto
- the protocol buffer Mutate to convertIOException
public static Get toGet(ClientProtos.MutationProto proto, CellScanner cellScanner) throws IOException
proto
- the protocol buffer Mutate to convert.cellScanner
- IOException
public static ClientProtos.Scan.ReadType toReadType(Scan.ReadType readType)
public static Scan.ReadType toReadType(ClientProtos.Scan.ReadType readType)
public static ClientProtos.Scan toScan(Scan scan) throws IOException
scan
- the client Scan to convertIOException
public static Scan toScan(ClientProtos.Scan proto) throws IOException
proto
- the protocol buffer Scan to convertIOException
public static ClientProtos.Cursor toCursor(Cursor cursor)
public static ClientProtos.Cursor toCursor(Cell cell)
public static Cursor toCursor(ClientProtos.Cursor cursor)
public static ClientProtos.Get toGet(Get get) throws IOException
get
- the client GetIOException
public static ClientProtos.MutationProto toMutation(ClientProtos.MutationProto.MutationType type, Mutation mutation) throws IOException
IOException
public static ClientProtos.MutationProto toMutation(ClientProtos.MutationProto.MutationType type, Mutation mutation, long nonce) throws IOException
type
- mutation
- IOException
public static ClientProtos.MutationProto toMutation(ClientProtos.MutationProto.MutationType type, Mutation mutation, ClientProtos.MutationProto.Builder builder) throws IOException
IOException
public static ClientProtos.MutationProto toMutation(ClientProtos.MutationProto.MutationType type, Mutation mutation, ClientProtos.MutationProto.Builder builder, long nonce) throws IOException
IOException
public static ClientProtos.MutationProto toMutationNoData(ClientProtos.MutationProto.MutationType type, Mutation mutation, ClientProtos.MutationProto.Builder builder) throws IOException
type
- mutation
- builder
- IOException
public static ClientProtos.MutationProto toMutationNoData(ClientProtos.MutationProto.MutationType type, Mutation mutation) throws IOException
type
- mutation
- IOException
public static ClientProtos.MutationProto toMutationNoData(ClientProtos.MutationProto.MutationType type, Mutation mutation, ClientProtos.MutationProto.Builder builder, long nonce) throws IOException
IOException
public static ClientProtos.Result toResult(Result result)
result
- the client Result to convertpublic static ClientProtos.Result toResult(boolean existence, boolean stale)
existence
- the client existence to sendpublic static ClientProtos.Result toResultNoData(Result result)
result
- the client Result to convertpublic static Result toResult(ClientProtos.Result proto)
proto
- the protocol buffer Result to convertpublic static Result toResult(ClientProtos.Result proto, CellScanner scanner) throws IOException
proto
- the protocol buffer Result to convertscanner
- Optional cell scanner.IOException
public static ComparatorProtos.Comparator toComparator(ByteArrayComparable comparator)
comparator
- the ByteArrayComparable to convertpublic static ByteArrayComparable toComparator(ComparatorProtos.Comparator proto) throws IOException
proto
- the protocol buffer Comparator to convertIOException
public static Filter toFilter(FilterProtos.Filter proto) throws IOException
proto
- the protocol buffer Filter to convertIOException
public static FilterProtos.Filter toFilter(Filter filter) throws IOException
filter
- the Filter to convertIOException
public static ClientProtos.MutationProto.DeleteType toDeleteType(KeyValue.Type type) throws IOException
type
- IOException
public static KeyValue.Type fromDeleteType(ClientProtos.MutationProto.DeleteType type) throws IOException
type
- The DeleteTypeIOException
public static Throwable toException(HBaseProtos.NameBytesPair parameter) throws IOException
parameter
- the protocol buffer Parameter to convertIOException
- if failed to deserialize the parameterpublic static <T extends org.apache.hbase.thirdparty.com.google.protobuf.Service> T newServiceStub(Class<T> service, org.apache.hbase.thirdparty.com.google.protobuf.RpcChannel channel) throws Exception
Exception
public static RegionInfo getRegionInfo(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin, byte[] regionName) throws IOException
admin
- regionName
- IOException
public static List<RegionLoad> getRegionLoadInfo(AdminProtos.GetRegionLoadResponse regionLoadResponse)
public static void closeRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin, ServerName server, byte[] regionName) throws IOException
admin
- regionName
- IOException
public static void warmupRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin, RegionInfo regionInfo) throws IOException
admin
- regionInfo
- IOException
public static void openRegion(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin, ServerName server, RegionInfo region) throws IOException
admin
- region
- IOException
public static List<RegionInfo> getOnlineRegions(AdminProtos.AdminService.BlockingInterface admin) throws IOException
admin
- IOException
public static List<RegionInfo> getOnlineRegions(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin) throws IOException
IOException
public static List<RegionInfo> getRegionInfos(AdminProtos.GetOnlineRegionResponse proto)
proto
- the GetOnlineRegionResponseproto
is nullpublic static AdminProtos.ServerInfo getServerInfo(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin) throws IOException
IOException
public static List<String> getStoreFiles(AdminProtos.AdminService.BlockingInterface admin, byte[] regionName, byte[] family) throws IOException
IOException
public static List<String> getStoreFiles(org.apache.hbase.thirdparty.com.google.protobuf.RpcController controller, AdminProtos.AdminService.BlockingInterface admin, byte[] regionName, byte[] family) throws IOException
IOException
public static long getTotalRequestsCount(ClusterStatusProtos.RegionLoad rl)
public static byte[] toDelimitedByteArray(org.apache.hbase.thirdparty.com.google.protobuf.Message m) throws IOException
m
- Message to get delimited pb serialization of (with pb magic prefix)IOException
public static String getRegionEncodedName(HBaseProtos.RegionSpecifier regionSpecifier) throws DoNotRetryIOException
regionSpecifier
- the region specifierDoNotRetryIOException
- if the specifier type is unsupportedpublic static ScanMetrics toScanMetrics(byte[] bytes)
public static MapReduceProtos.ScanMetrics toScanMetrics(ScanMetrics scanMetrics, boolean reset)
public static void toIOException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException se) throws IOException
se
- the ServiceException
instance to convert into an IOException
IOException
public static CellProtos.Cell toCell(Cell kv)
public static Cell toCell(ExtendedCellBuilder cellBuilder, CellProtos.Cell cell)
public static HBaseProtos.NamespaceDescriptor toProtoNamespaceDescriptor(NamespaceDescriptor ns)
public static NamespaceDescriptor toNamespaceDescriptor(HBaseProtos.NamespaceDescriptor desc)
public static WALProtos.CompactionDescriptor toCompactionDescriptor(RegionInfo info, byte[] family, List<org.apache.hadoop.fs.Path> inputPaths, List<org.apache.hadoop.fs.Path> outputPaths, org.apache.hadoop.fs.Path storeDir)
public static WALProtos.CompactionDescriptor toCompactionDescriptor(RegionInfo info, byte[] regionName, byte[] family, List<org.apache.hadoop.fs.Path> inputPaths, List<org.apache.hadoop.fs.Path> outputPaths, org.apache.hadoop.fs.Path storeDir)
public static WALProtos.FlushDescriptor toFlushDescriptor(WALProtos.FlushDescriptor.FlushAction action, RegionInfo hri, long flushSeqId, Map<byte[],List<org.apache.hadoop.fs.Path>> committedFiles)
public static WALProtos.RegionEventDescriptor toRegionEventDescriptor(WALProtos.RegionEventDescriptor.EventType eventType, RegionInfo hri, long seqId, ServerName server, Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles)
public static WALProtos.RegionEventDescriptor toRegionEventDescriptor(WALProtos.RegionEventDescriptor.EventType eventType, byte[] tableNameAsBytes, byte[] encodedNameAsBytes, byte[] regionNameAsBytes, long seqId, ServerName server, Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles)
public static String getShortTextFormat(org.apache.hbase.thirdparty.com.google.protobuf.Message m)
m
- m
public static TableName toTableName(HBaseProtos.TableName tableNamePB)
public static HBaseProtos.TableName toProtoTableName(TableName tableName)
public static List<TableName> toTableNameList(List<HBaseProtos.TableName> tableNamesList)
public static TableName[] getTableNameArray(List<HBaseProtos.TableName> tableNamesList)
public static CellVisibility toCellVisibility(ClientProtos.CellVisibility proto)
proto
- public static CellVisibility toCellVisibility(byte[] protoBytes) throws DeserializationException
protoBytes
- DeserializationException
public static ClientProtos.CellVisibility toCellVisibility(CellVisibility cellVisibility)
cellVisibility
- public static Authorizations toAuthorizations(ClientProtos.Authorizations proto)
proto
- public static Authorizations toAuthorizations(byte[] protoBytes) throws DeserializationException
protoBytes
- DeserializationException
public static ClientProtos.Authorizations toAuthorizations(Authorizations authorizations)
authorizations
- public static TimeUnit toTimeUnit(HBaseProtos.TimeUnit proto)
proto
- public static HBaseProtos.TimeUnit toProtoTimeUnit(TimeUnit timeUnit)
timeUnit
- public static ThrottleType toThrottleType(QuotaProtos.ThrottleType proto)
proto
- public static QuotaProtos.ThrottleType toProtoThrottleType(ThrottleType type)
type
- public static QuotaScope toQuotaScope(QuotaProtos.QuotaScope proto)
proto
- public static QuotaProtos.QuotaScope toProtoQuotaScope(QuotaScope scope)
scope
- public static QuotaType toQuotaScope(QuotaProtos.QuotaType proto)
proto
- public static QuotaProtos.QuotaType toProtoQuotaScope(QuotaType type)
type
- public static SpaceViolationPolicy toViolationPolicy(QuotaProtos.SpaceViolationPolicy proto)
proto
- The protocol buffer space violation policy.public static QuotaProtos.SpaceViolationPolicy toProtoViolationPolicy(SpaceViolationPolicy policy)
policy
- The client SpaceViolationPolicy object.public static QuotaProtos.TimedQuota toTimedQuota(long limit, TimeUnit timeUnit, QuotaScope scope)
limit
- the allowed number of request/data per timeUnittimeUnit
- the limit time unitscope
- the quota scopepublic static QuotaProtos.SpaceQuota toProtoSpaceQuota(long limit, SpaceViolationPolicy violationPolicy)
limit
- The maximum space usage for the quota in bytes.violationPolicy
- The policy to apply when the quota is violated.public static WALProtos.BulkLoadDescriptor toBulkLoadDescriptor(TableName tableName, org.apache.hbase.thirdparty.com.google.protobuf.ByteString encodedRegionName, Map<byte[],List<org.apache.hadoop.fs.Path>> storeFiles, Map<String,Long> storeFilesSize, long bulkloadSeqId)
tableName
- The tableName into which the bulk load is being imported into.encodedRegionName
- Encoded region name of the region which is being bulk loaded.storeFiles
- A set of store files of a column family are bulk loaded.storeFilesSize
- Map of store files and their lengthsbulkloadSeqId
- sequence ID (by a force flush) used to create bulk load hfile
namepublic static void mergeDelimitedFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, InputStream in) throws IOException
builder
- current message builderin
- Inputsream with delimited protobuf dataIOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, InputStream in, int size) throws IOException
builder
- current message builderin
- InputStream containing protobuf datasize
- known size of protobuf dataIOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, InputStream in) throws IOException
builder
- current message builderin
- InputStream containing protobuf dataIOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs) throws IOException
builder
- current message builderbs
- ByteString containing theIOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, byte[] b) throws IOException
builder
- current message builderb
- byte arrayIOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, byte[] b, int offset, int length) throws IOException
builder
- current message builderb
- byte arrayoffset
- length
- IOException
public static void mergeFrom(org.apache.hbase.thirdparty.com.google.protobuf.Message.Builder builder, org.apache.hbase.thirdparty.com.google.protobuf.CodedInputStream codedInput, int length) throws IOException
IOException
public static ReplicationLoadSink toReplicationLoadSink(ClusterStatusProtos.ReplicationLoadSink rls)
public static ReplicationLoadSource toReplicationLoadSource(ClusterStatusProtos.ReplicationLoadSource rls)
public static HBaseProtos.VersionInfo getVersionInfo()
public static List<SecurityCapability> toSecurityCapabilityList(List<MasterProtos.SecurityCapabilitiesResponse.Capability> capabilities)
capabilities
- capabilities returned in the SecurityCapabilitiesResponse messagepublic static TimeRange toTimeRange(HBaseProtos.TimeRange timeRange)
public static HBaseProtos.ColumnFamilySchema toColumnFamilySchema(ColumnFamilyDescriptor hcd)
hcd
- the ColumnFamilySchemapublic static ColumnFamilyDescriptor toColumnFamilyDescriptor(HBaseProtos.ColumnFamilySchema cfs)
cfs
- the ColumnFamilySchemaColumnFamilyDescriptor
made from the passed in cfs
public static HBaseProtos.TableSchema toTableSchema(TableDescriptor htd)
htd
- the TableDescriptorTableDescriptor
into a pb TableSchema instance.public static TableDescriptor toTableDescriptor(HBaseProtos.TableSchema ts)
ts
- A pb TableSchema instance.TableDescriptor
made from the passed in pb ts
.public static CompactionState createCompactionState(AdminProtos.GetRegionInfoResponse.CompactionState state)
CompactionState
from
AdminProtos.GetRegionInfoResponse.CompactionState
statestate
- the protobuf CompactionStatepublic static AdminProtos.GetRegionInfoResponse.CompactionState createCompactionState(CompactionState state)
public static Optional<Long> toOptionalTimestamp(MasterProtos.MajorCompactionTimestampResponse resp)
public static SnapshotProtos.SnapshotDescription.Type createProtosSnapShotDescType(SnapshotType type)
HBaseProtos.SnapshotDescription.Type
from SnapshotType
type
- the SnapshotDescription typepublic static SnapshotProtos.SnapshotDescription.Type createProtosSnapShotDescType(String snapshotDesc)
HBaseProtos.SnapshotDescription.Type
from the type of SnapshotDescription stringsnapshotDesc
- string representing the snapshot description typepublic static SnapshotType createSnapshotType(SnapshotProtos.SnapshotDescription.Type type)
SnapshotType
from the type of
HBaseProtos.SnapshotDescription
type
- the snapshot description typepublic static SnapshotProtos.SnapshotDescription createHBaseProtosSnapshotDesc(SnapshotDescription snapshotDesc)
SnapshotDescription
to
HBaseProtos.SnapshotDescription
snapshotDesc
- the POJO SnapshotDescriptionpublic static SnapshotDescription createSnapshotDesc(SnapshotProtos.SnapshotDescription snapshotDesc)
HBaseProtos.SnapshotDescription
to
SnapshotDescription
snapshotDesc
- the protobuf SnapshotDescriptionpublic static RegionLoadStats createRegionLoadStats(ClientProtos.RegionLoadStats stats)
public static String toText(org.apache.hbase.thirdparty.com.google.protobuf.Message msg)
msg
- msg
public static byte[] toBytes(org.apache.hbase.thirdparty.com.google.protobuf.ByteString bs)
public static <T> T call(Callable<T> callable) throws IOException
IOException
public static AdminProtos.GetStoreFileRequest buildGetStoreFileRequest(byte[] regionName, byte[] family)
regionName
- the name of the region to get infofamily
- the family to get store file listpublic static AdminProtos.CloseRegionRequest buildCloseRegionRequest(ServerName server, byte[] regionName)
regionName
- the name of the region to closepublic static AdminProtos.CloseRegionRequest buildCloseRegionRequest(ServerName server, byte[] regionName, ServerName destinationServer)
public static HBaseProtos.ProcedureDescription buildProcedureDescription(String signature, String instance, Map<String,String> props)
public static ServerName parseServerNameFrom(byte[] data) throws DeserializationException
data
- Data with a serialize server name in it; can handle the old style
servername where servername was host and port. Works too with data that
begins w/ the pb 'PBUF' magic and that is then followed by a protobuf that
has a serialized ServerName
in it.data
is null else converts passed data
to a ServerName instance.DeserializationException
public static String toProcedureJson(List<ProcedureProtos.Procedure> procProtos)
public static String toLockJson(List<LockServiceProtos.LockedResource> lockedResourceProtos)
public static HBaseProtos.RegionInfo toRegionInfo(RegionInfo info)
info
- the RegionInfo to convertpublic static RegionInfo toRegionInfo(HBaseProtos.RegionInfo proto)
proto
- the RegionInfo to convertpublic static HBaseProtos.RegionLocation toRegionLocation(HRegionLocation loc)
public static HRegionLocation toRegionLocation(HBaseProtos.RegionLocation proto)
public static List<SnapshotDescription> toSnapshotDescriptionList(MasterProtos.GetCompletedSnapshotsResponse response, Pattern pattern)
public static CacheEvictionStats toCacheEvictionStats(HBaseProtos.CacheEvictionStats stats) throws IOException
IOException
public static HBaseProtos.CacheEvictionStats toCacheEvictionStats(CacheEvictionStats cacheEvictionStats)
public static ClusterStatusProtos.ReplicationLoadSource toReplicationLoadSource(ReplicationLoadSource rls)
public static ClusterStatusProtos.ReplicationLoadSink toReplicationLoadSink(ReplicationLoadSink rls)
public static HBaseProtos.TimeRange toTimeRange(TimeRange timeRange)
Copyright © 2007–2019 Cloudera. All rights reserved.