c# 访问hbase_HBase(一): c#访问hbase组件开发

本文档介绍了如何使用C#开发一个HBase客户端,包括创建、删除表,获取表信息,创建扫描器,存储单元格等操作。通过WebRequester类发送HTTP请求,并处理响应,实现与HBase的交互。
摘要由CSDN通过智能技术生成

public classHBaseClient : IHBaseClient

{privateWebRequester _requester;private readonlyRequestOptions _globalRequestOptions;///

///

///

///

///

public HBaseClient(string url, RequestOptions globalRequestOptions = null)

{

_globalRequestOptions= globalRequestOptions ??RequestOptions.GetDefaultOptions();

_requester= newWebRequester(url);

}///

///

///

///

///

public async Task GetVersionAsync(RequestOptions options = null)

{var optionToUse = options ??_globalRequestOptions;return await GetRequestAndDeserializeAsync(EndPointType.Version, optionToUse);

}///

///

///

///

///

///

public async Task CreateTableAsync(TableSchema schema, RequestOptions options = null)

{if (string.IsNullOrEmpty(schema.name))throw new ArgumentException("schema.name was either null or empty!", "schema");var optionToUse = options ??_globalRequestOptions;string endpoint = string.Format("{0}/{1}", schema.name, EndPointType.Schema);using (HttpWebResponse webResponse = awaitPutRequestAsync(endpoint,schema, optionToUse))

{if (webResponse.StatusCode ==HttpStatusCode.Created)

{return true;

}//table already exits

if (webResponse.StatusCode ==HttpStatusCode.OK)

{return false;

}//throw the exception otherwise

using (var output = newStreamReader(webResp

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值