public class FeatureSeThriftClient extends java.lang.Object implements FeatureSe
FeatureSe
接口的RPC实现(线程安全)FeatureSe
接口方法到delegate()
指定的实例RuntimeException
异常被封装到ServiceRuntimeException
中抛出FeatureSeThriftClient thriftInstance = ClientFactory .builder() .setHostAndPort("127.0.0.1",26413) .build(FeatureSe.class, FeatureSeThriftClient.class);计算机生成代码(generated by automated tools ThriftServiceDecoratorGenerator @author guyadong)
Constructor and Description |
---|
FeatureSeThriftClient(net.gdface.thrift.ClientFactory factory) |
FeatureSeThriftClient(com.google.common.net.HostAndPort hostAndPort) |
FeatureSeThriftClient(java.lang.String host,
int port) |
Modifier and Type | Method and Description |
---|---|
boolean |
addFeature(byte[] featureId,
byte[] feature,
long appid)
添加一条特征码到内存表
|
boolean |
addFeature(byte[] featureId,
byte[] feature,
java.lang.String imgMD5)
添加一条特征码到内存表
|
void |
clearAll()
删除内存表中所有特征数据
|
protected FeatureSe |
delegate() |
net.gdface.thrift.ClientFactory |
getFactory() |
CodeBean |
getFeature(byte[] featureId)
根据特征码ID在表中查找指定的记录
|
CodeBean |
getFeatureByHex(java.lang.String featureId)
根据特征码ID在表中查找指定的记录
|
boolean |
removeFeature(byte[] featureId)
根据特征码ID中表中删除指定的记录
|
boolean |
removeFeatureByHex(java.lang.String featureId)
根据特征码ID中表中删除指定的记录
|
CodeBean[] |
searchCode(byte[] code,
double sim,
int rows)
在内存表中根据比对相似度进行特征码搜索
|
int |
size() |
boolean |
testConnect()
test if connectable for RPC service
|
java.lang.String |
toString() |
public FeatureSeThriftClient(net.gdface.thrift.ClientFactory factory)
public FeatureSeThriftClient(java.lang.String host, int port)
host
- RPC service hostport
- RPC service portpublic FeatureSeThriftClient(com.google.common.net.HostAndPort hostAndPort)
hostAndPort
- RPC service host and portpublic net.gdface.thrift.ClientFactory getFactory()
public boolean testConnect()
true
if connectable ,otherwise false
public java.lang.String toString()
toString
in class java.lang.Object
public boolean addFeature(byte[] featureId, byte[] feature, java.lang.String imgMD5)
FeatureSe
addFeature
in interface FeatureSe
featureId
- 特征码ID(MD5校验码),为null时,native library会自动计算MD5作为特征码IDfeature
- 特征码字节数组,为null
时返回falseimgMD5
- 特征所属图的MD5(32字节HEX字符串),可为nullpublic boolean addFeature(byte[] featureId, byte[] feature, long appid)
FeatureSe
addFeature
in interface FeatureSe
featureId
- 特征码ID(MD5校验码),为null时,native library会自动计算MD5作为特征码IDfeature
- 特征码字节数组,为null
时返回falseappid
- 应用id,由调用者定义,可为nullpublic CodeBean getFeature(byte[] featureId)
FeatureSe
getFeature
in interface FeatureSe
featureId
- 特征码ID,MD5校验码(16 bytes)null
,featureId
为null
或空返回null
public CodeBean getFeatureByHex(java.lang.String featureId)
FeatureSe
getFeatureByHex
in interface FeatureSe
featureId
- 特征码ID,MD5校验码(32字节HEX字符串)null
,featureId
为null
或空返回null
public boolean removeFeature(byte[] featureId)
FeatureSe
removeFeature
in interface FeatureSe
featureId
- 特征码ID,MD5校验码(16 bytes)public boolean removeFeatureByHex(java.lang.String featureId)
FeatureSe
removeFeatureByHex
in interface FeatureSe
featureId
- 特征码ID,MD5校验码(32字节HEX字符串)public CodeBean[] searchCode(byte[] code, double sim, int rows)
FeatureSe
searchCode
in interface FeatureSe
code
- 要比对的特征码sim
- 相似度阀值rows
- 最大返回的记录数Copyright © 2020. All rights reserved.