Documentation ¶
Index ¶
- Constants
- Variables
- type ConnectionPool
- func (pool *ConnectionPool) AvailableConnections() int
- func (pool *ConnectionPool) Discard(conn *connection.IRODSConnection)
- func (pool *ConnectionPool) Get() (*connection.IRODSConnection, bool, error)
- func (pool *ConnectionPool) GetNew() (*connection.IRODSConnection, error)
- func (pool *ConnectionPool) IdleConnections() int
- func (pool *ConnectionPool) OccupiedConnections() int
- func (pool *ConnectionPool) OpenConnections() int
- func (pool *ConnectionPool) Release()
- func (pool *ConnectionPool) Return(conn *connection.IRODSConnection) error
- type ConnectionPoolConfig
- type IRODSSession
- func (sess *IRODSSession) AcquireConnection() (*connection.IRODSConnection, error)
- func (sess *IRODSSession) AcquireConnectionsMulti(number int) ([]*connection.IRODSConnection, error)
- func (sess *IRODSSession) ConnectionTotal() int
- func (sess *IRODSSession) DiscardConnection(conn *connection.IRODSConnection) error
- func (sess *IRODSSession) GetAccount() *types.IRODSAccount
- func (sess *IRODSSession) GetConfig() *IRODSSessionConfig
- func (sess *IRODSSession) GetMetrics() *metrics.IRODSMetrics
- func (sess *IRODSSession) Release()
- func (sess *IRODSSession) ReturnConnection(conn *connection.IRODSConnection) error
- type IRODSSessionConfig
Constants ¶
const ( // IRODSSessionConnectionMaxMin is a minimum value for connection max IRODSSessionConnectionMaxMin = 5 // IRODSSessionConnectionMaxDefault is a default value for connection max IRODSSessionConnectionMaxDefault = 10 // IRODSSessionConnectionLifespanDefault is a default value for connection lifespan IRODSSessionConnectionLifespanDefault = 1 * time.Hour // IRODSSessionTimeoutDefault is a default value for timeout IRODSSessionTimeoutDefault = 5 * time.Minute )
Variables ¶
var ErrConnectionPoolFull = errors.New("failed to create a new connection, pool is full")
Functions ¶
This section is empty.
Types ¶
type ConnectionPool ¶ added in v0.5.7
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool is a struct for connection pool
func NewConnectionPool ¶ added in v0.5.7
func NewConnectionPool(config *ConnectionPoolConfig, metrics *metrics.IRODSMetrics) (*ConnectionPool, error)
NewConnectionPool creates a new ConnectionPool
func (*ConnectionPool) AvailableConnections ¶ added in v0.9.6
func (pool *ConnectionPool) AvailableConnections() int
AvailableConnections returns connections that are available to use
func (*ConnectionPool) Discard ¶ added in v0.5.9
func (pool *ConnectionPool) Discard(conn *connection.IRODSConnection)
Discard discards the connection
func (*ConnectionPool) Get ¶ added in v0.5.7
func (pool *ConnectionPool) Get() (*connection.IRODSConnection, bool, error)
Get gets a new or an idle connection out of the pool the boolean return value indicates if the returned conneciton is new (True) or existing idle (False)
func (*ConnectionPool) GetNew ¶ added in v0.5.9
func (pool *ConnectionPool) GetNew() (*connection.IRODSConnection, error)
GetNew gets a new connection out of the pool
func (*ConnectionPool) IdleConnections ¶ added in v0.5.7
func (pool *ConnectionPool) IdleConnections() int
IdleConnections returns total number of idle connections
func (*ConnectionPool) OccupiedConnections ¶ added in v0.5.7
func (pool *ConnectionPool) OccupiedConnections() int
OccupiedConnections returns total number of connections in use
func (*ConnectionPool) OpenConnections ¶ added in v0.5.7
func (pool *ConnectionPool) OpenConnections() int
OpenConnections returns total number of connections
func (*ConnectionPool) Release ¶ added in v0.5.7
func (pool *ConnectionPool) Release()
Release releases all resources
func (*ConnectionPool) Return ¶ added in v0.5.7
func (pool *ConnectionPool) Return(conn *connection.IRODSConnection) error
Return returns the connection after use
type ConnectionPoolConfig ¶ added in v0.5.7
type ConnectionPoolConfig struct { Account *types.IRODSAccount ApplicationName string InitialCap int MaxIdle int MaxCap int // output warning if total connections exceeds maxcap number Lifespan time.Duration // if a connection exceeds its lifespan, the connection will die IdleTimeout time.Duration // if there's no activity on a connection for the timeout time, the connection will die OperationTimeout time.Duration // if there's no response for the timeout time, the request will fail }
ConnectionPoolConfig is for connection pool configuration
type IRODSSession ¶
type IRODSSession struct {
// contains filtered or unexported fields
}
IRODSSession manages connections to iRODS
func NewIRODSSession ¶
func NewIRODSSession(account *types.IRODSAccount, config *IRODSSessionConfig) (*IRODSSession, error)
NewIRODSSession create a IRODSSession
func (*IRODSSession) AcquireConnection ¶
func (sess *IRODSSession) AcquireConnection() (*connection.IRODSConnection, error)
AcquireConnection returns an idle connection
func (*IRODSSession) AcquireConnectionsMulti ¶ added in v0.9.6
func (sess *IRODSSession) AcquireConnectionsMulti(number int) ([]*connection.IRODSConnection, error)
AcquireConnectionsMulti returns idle connections
func (*IRODSSession) ConnectionTotal ¶ added in v0.9.7
func (sess *IRODSSession) ConnectionTotal() int
Connections returns the number of connections in the pool
func (*IRODSSession) DiscardConnection ¶ added in v0.5.9
func (sess *IRODSSession) DiscardConnection(conn *connection.IRODSConnection) error
DiscardConnection discards a connection
func (*IRODSSession) GetAccount ¶ added in v0.7.6
func (sess *IRODSSession) GetAccount() *types.IRODSAccount
GetAccount returns an account
func (*IRODSSession) GetConfig ¶ added in v0.9.6
func (sess *IRODSSession) GetConfig() *IRODSSessionConfig
GetConfig returns a configuration
func (*IRODSSession) GetMetrics ¶ added in v0.9.7
func (sess *IRODSSession) GetMetrics() *metrics.IRODSMetrics
GetMetrics returns metrics
func (*IRODSSession) ReturnConnection ¶
func (sess *IRODSSession) ReturnConnection(conn *connection.IRODSConnection) error
ReturnConnection returns an idle connection
type IRODSSessionConfig ¶
type IRODSSessionConfig struct { ApplicationName string ConnectionLifespan time.Duration OperationTimeout time.Duration ConnectionIdleTimeout time.Duration ConnectionMax int ConnectionInitNumber int ConnectionMaxIdle int StartNewTransaction bool }
IRODSSessionConfig is for session configuration
func NewIRODSSessionConfig ¶
func NewIRODSSessionConfig(applicationName string, connectionLifespan time.Duration, operationTimeout time.Duration, idleTimeout time.Duration, connectionMax int, startNewTransaction bool) *IRODSSessionConfig
NewIRODSSessionConfig create a IRODSSessionConfig
func NewIRODSSessionConfigWithDefault ¶
func NewIRODSSessionConfigWithDefault(applicationName string) *IRODSSessionConfig
NewIRODSSessionConfigWithDefault create a IRODSSessionConfig with a default settings