Categorygithub.com/tsuna/gohbase
modulepackage
0.0.0-20250211005646-328d054dfef9
Repository: https://github.com/tsuna/gohbase.git
Documentation: pkg.go.dev

# README

Golang HBase client CI codecov.io GoDoc

This is a pure Go client for HBase.

Current status: beta.

Supported Versions

HBase >= 1.0

Installation

go get github.com/tsuna/gohbase

Example Usage

Create a client

client := gohbase.NewClient("localhost")

Insert a cell

// Values maps a ColumnFamily -> Qualifiers -> Values.
values := map[string]map[string][]byte{"cf": map[string][]byte{"a": []byte{0}}}
putRequest, err := hrpc.NewPutStr(context.Background(), "table", "key", values)
rsp, err := client.Put(putRequest)

Get an entire row

getRequest, err := hrpc.NewGetStr(context.Background(), "table", "row")
getRsp, err := client.Get(getRequest)

Get a specific cell

// Perform a get for the cell with key "15", column family "cf" and qualifier "a"
family := map[string][]string{"cf": []string{"a"}}
getRequest, err := hrpc.NewGetStr(context.Background(), "table", "15",
    hrpc.Families(family))
getRsp, err := client.Get(getRequest)

Get a specific cell with a filter

pFilter := filter.NewKeyOnlyFilter(true)
family := map[string][]string{"cf": []string{"a"}}
getRequest, err := hrpc.NewGetStr(context.Background(), "table", "15",
    hrpc.Families(family), hrpc.Filters(pFilter))
getRsp, err := client.Get(getRequest)

Scan with a filter

pFilter := filter.NewPrefixFilter([]byte("7"))
scanRequest, err := hrpc.NewScanStr(context.Background(), "table",
		hrpc.Filters(pFilter))
scanRsp, err := client.Scan(scanRequest)

Contributing

Any help would be appreciated. Please use Github pull requests to send changes for review. Please sign the Contributor License Agreement when you send your first change for review.

License

Copyright © 2015 The GoHBase Authors. All rights reserved. Use of this source code is governed by the Apache License 2.0 that can be found in the COPYING file.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package region contains data structures to represent HBase regions.
No description provided by the author
Package zk encapsulates our interactions with ZooKeeper.

# Functions

CompressionCodec will return an option to set compression codec between client and server.
DebugState information about the clients keyRegionCache, and clientRegionCache.
EffectiveUser will return an option that will set the user used when accessing regions.
FlushInterval will return an option that will set the timeout for flushing the RPC queues used in a given client.
Logger will return an option to set *slog.Logger instance.
NewAdminClient creates an admin HBase client.
NewClient creates a new HBase client.
RegionDialer will return an option that uses the specified Dialer for connecting to region servers.
RegionLookupTimeout will return an option that sets the region lookup timeout.
RegionReadTimeout will return an option that sets the region read timeout.
RpcQueueSize will return an option that will set the size of the RPC queues used in a given client.
ZooKeeperDialer will return an option to pass the given dialer function into the ZooKeeper client Connect() call, which allows for customizing network connections.
ZookeeperRoot will return an option that will set the zookeeper root path used in a given client.
ZookeeperTimeout will return an option that will set the zookeeper session timeout.

# Variables

ErrCannotFindRegion is returned when it took too many tries to find a region for the request.
ErrClientClosed is returned when the gohbase client has been closed.
NotExecutedError is returned when an RPC in a batch is not executed due to encountering a different error in the batch.
TableNotFound is returned when attempting to access a table that doesn't exist on this cluster.

# Interfaces

AdminClient to perform administrative operations with HMaster.
Client a regular HBase client.
RPCClient is core client of gohbase.

# Type aliases

Option is a function used to configure optional config items for a Client.