hbasepool

package
v0.0.0-...-90d5307 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package hbasepool hbase connection pool

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port uint16

	// Maximum number of idle connections in the pool.
	MaxIdle int

	// Maximum number of connections allocated by the pool at a given time.
	// When zero, there is no limit on the number of connections in the pool.
	MaxActive int

	// Close connections after remaining idle for this duration. If the value
	// is zero, then idle connections are not closed. Applications should set
	// the timeout to a value less than the server's timeout.
	IdleTimeout time.Duration

	// Close connections older than this duration. If the value is zero, then
	// the pool does not close connections based on age.
	MaxConnLifetime time.Duration
}

Config config

type Conn

type Conn struct {
	Closed     bool
	CreateTime time.Time
	Trans      thrift.TTransport
	Client     *hbase.THBaseServiceClient
}

Conn hbase conn

func NewConn

func NewConn(host string, port uint16) (Conn, error)

NewConn new hbase conn

func (*Conn) Close

func (c *Conn) Close()

Close close

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool hbase connection pool

func NewPool

func NewPool(cnf Config) *Pool

func (*Pool) Close

func (p *Pool) Close()

Close close connection

func (*Pool) Get

func (p *Pool) Get() (Conn, error)

Get gets a connection. The application must close the returned connection.

func (*Pool) Put

func (p *Pool) Put(c Conn)

Put put connection back

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL