GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - blackbeans/gogobase: gogobase is a simple hbase client via thrift .

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
proto
proto
 
 
.gitignore
.gitignore
 
 
Hbase.thrift
Hbase.thrift
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
errors.go
errors.go
 
 
go.mod
go.mod
 
 
goh.go
goh.go
 
 
hclient.go
hclient.go
 
 
htype.go
htype.go
 
 
pool.go
pool.go
 
 

Repository files navigation

Overview

gogobase is a golang client of hbase (via thrift) supports thrift's client pool .

Install

go get github.com/blackbeans/gogobase

Usage

    ctx,cancel := context.WithCancel(context.Background())
    
	defer cancel()
	registryUri := "thrift://xxxxx:9097"
	maxIdleSeconds := 30
	maxPoolSize := 20
    
	//create hbase thriftclient pool
	hbasePool := goh.NewThriftPool(
		ctx,
		registryUri,
		maxPoolSize,
		maxIdleSeconds,
		5*time.Second,
		func(addr string) (*goh.IdleClient, error) {

			hclient, err := goh.NewTcpClient(addr, goh.TBinaryProtocol, false)
			if nil != err {
				log4go.ErrorLog("stdout", "NewTcpClient|FAIL|%v|%s", err, addr)
				panic(err)
			}

			if err = hclient.Open(); nil != err {
				log4go.ErrorLog("stdout", "NewTcpClient.Open|FAIL|%v|%s", err, addr)
				return nil, err
			}

			return &goh.IdleClient{
				Socket: hclient.Trans,
				Client: hclient}, nil
		}, func(c *goh.IdleClient) error {
			
			//do something when the client is going to be closed!
			
			if nil != c.Client {
				c.Client.Close()
				c.Client = nil
			}
			c.Socket = nil
			return nil
		}, func(cli *goh.HClient) bool {
			
			//checking hclient is still alive~  
			
			_, err := cli.Get("table_name", []byte("check"), "cf:status", nil)
			if nil != err {
				return false
			}
			return true
		})

	idleClient,err := hbasePool.Get()
	if nil != err{
		return
	}
    //release the idleClient into the pool
	defer hbasePool.Put(idleClient)

	idleClient.Client.Get

	idleClient.Client.MutateRows

	idleClient.Client.ScannerOpenWithScan

	....

Links

  • https://github.com/sdming/goh

License

Apache License v2.0

About

gogobase is a simple hbase client via thrift .

Topics

gohgohbasehbasehbase-client

Resources

Readme
License
Activity

Stars

0 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.