HBaseNet 0.1.0
dotnet add package HBaseNet --version 0.1.0
NuGet\Install-Package HBaseNet -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HBaseNet" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HBaseNet --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HBaseNet, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HBaseNet as a Cake Addin #addin nuget:?package=HBaseNet&version=0.1.0 // Install HBaseNet as a Cake Tool #tool nuget:?package=HBaseNet&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
HBaseNet
This is a pure CSharp client for HBase.
Supported Versions
HBase >= 1.0
Example Usage
Create a client
var ZkQuorum = "zooKeep-host-ip";
var admin = await new AdminClient(ZkQuorum).Build();
if (admin == null) return;
var client = await new StandardClient(ZkQuorum).Build();
if (client == null) return;
Admin operation
var table = "student";
var cols = new[]
{
new ColumnFamily("info")
{
Compression = Compression.GZ,
KeepDeletedCells = KeepDeletedCells.TRUE
},
new ColumnFamily("special")
{
Compression = Compression.GZ,
KeepDeletedCells = KeepDeletedCells.TTL,
DataBlockEncoding = DataBlockEncoding.PREFIX
}
};
var create = new CreateTableCall(table, cols)
{
SplitKeys = new[] { "0", "5" }
};
var listTable = new ListTableNamesCall();
var disable = new DisableTableCall(table);
var delete = new DeleteTableCall(table);
var ct = await admin.CreateTable(create);
var tables = await admin.ListTableNames(listTable);
var dt = await admin.DisableTable(disable);
var del = await admin.DeleteTable(delete);
Generally operation
var table = "student";
// put
var rowKey = "123";
var values = new Dictionary<string, IDictionary<string,byte[]>>
{
{
"default", new Dictionary<string, byte[]>
{
{"key", "value".ToUtf8Bytes()}
}
}
};
var rs = await client.Put(new MutateCall(table, rowKey, values));
// scan
var sc = new ScanCall(table, "1", "")
{
NumberOfRows = 100000
};
using var scanner = client.Scan(sc);
var scanResults = new List<Result>();
while (scanner.CanContinueNext)
{
var per = await scanner.Next();
if (true != per?.Any()) continue;
scanResults.AddRange(per);
}
// get
var getResult = await client.Get(new GetCall(table, rowKey));
// delete
var delResult = await client.Delete(new MutateCall(table, rowKey, null));
Use conversion tools
public class Student
{
public string Name { get; set; }
public string Address { get; set; }
public int Age { get; set; }
public float Score { get; set; }
public bool? IsMarried { get; set; }
[HBaseConverter(typeof(DateTimeUnix13Converter))]
public DateTime Create { get; set; }
[HBaseProperty(family: "special")]
[HBaseConverter(typeof(DateTimeUnix13Converter))]
public DateTime? Modify { get; set; }
[HBaseConverter(typeof(JsonStringConverter))]
public List<string> Courses { get; set; }
}
var convertCache = new ConvertCache().BuildCache<Student>(EndianBitConverter.BigEndian);
var student = new Student
{
Name = "Anna",
Age = 20,
Address = "Yuxi, China",
Score = 99,
IsMarried = true,
Create = DateTime.Now,
Courses = new List<string> { "Mathematics", "physics", "art" }
};
//object convert to values
var values = HBaseConvert.Instance.ConvertToDictionary(student, convertCache);
var rs = await client.Put(new MutateCall(Program.Table, rowKey, values));
//scan result convert to object of student
using var scanner = client.Scan(sc);
var scanResults = new List<Student>();
while (scanner.CanContinueNext)
{
var per = await scanner.Next();
if (true != per?.Any()) continue;
var stus = HBaseConvert.Instance.ConvertToCustom<Student>(per, convertCache);
scanResults.AddRange(stus);
}
You can also refer to the "Samples/HBaseNet.Console" project.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- CSharpTest.Net.Collections-NetStd2 (>= 14.906.1403.1084)
- EndianBitConverter (>= 1.1.0)
- Google.Protobuf (>= 3.12.3)
- Google.Protobuf.Tools (>= 3.12.3)
- Grpc (>= 2.30.0)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.6)
- Newtonsoft.Json (>= 12.0.3)
- ZooKeeperNetEx (>= 3.4.12.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on HBaseNet:
Package | Downloads |
---|---|
GingerCoreNET
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.0 | 14,465 | 1/5/2021 |
0.1.0-rc2-final | 416 | 8/2/2020 |