session

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
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
	// TCPBufferSizeDefault is a default value for tcp buffer size
	TCPBufferSizeDefault = 4 * 1024 * 1024
)

Variables

This section is empty.

Functions

func IsConnectionPoolFullError added in v0.10.11

func IsConnectionPoolFullError(err error) bool

IsConnectionPoolFullError evaluates if the given error is ConnectionPoolFullError

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

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
	TcpBufferSize    int
}

ConnectionPoolConfig is for connection pool configuration

type ConnectionPoolFullError added in v0.10.11

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

ConnectionPoolFullError ...

func NewConnectionPoolFullError added in v0.10.11

func NewConnectionPoolFullError(message string) *ConnectionPoolFullError

NewConnectionPoolFullError creates ConnectionPoolFullError struct

func NewConnectionPoolFullErrorf added in v0.10.11

func NewConnectionPoolFullErrorf(format string, v ...interface{}) *ConnectionPoolFullError

NewConnectionPoolFullErrorf creates ConnectionPoolFullError struct

func (*ConnectionPoolFullError) Error added in v0.10.11

func (e *ConnectionPoolFullError) Error() string

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) AcquireUnmanagedConnection added in v0.10.11

func (sess *IRODSSession) AcquireUnmanagedConnection() (*connection.IRODSConnection, error)

AcquireUnmanagedConnection returns a connection that is not managed

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) Release

func (sess *IRODSSession) Release()

Release releases all connections

func (*IRODSSession) ReturnConnection

func (sess *IRODSSession) ReturnConnection(conn *connection.IRODSConnection) error

ReturnConnection returns an idle connection

func (*IRODSSession) SupportParallelUpload added in v0.10.11

func (sess *IRODSSession) SupportParallelUpload() bool

SupportParallelUpload returns if parallel upload is supported

type IRODSSessionConfig

type IRODSSessionConfig struct {
	ApplicationName       string
	ConnectionLifespan    time.Duration
	OperationTimeout      time.Duration
	ConnectionIdleTimeout time.Duration
	ConnectionMax         int
	ConnectionInitNumber  int
	ConnectionMaxIdle     int
	TcpBufferSize         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, tcpBufferSize int, startNewTransaction bool) *IRODSSessionConfig

NewIRODSSessionConfig create a IRODSSessionConfig

func NewIRODSSessionConfigWithDefault

func NewIRODSSessionConfigWithDefault(applicationName string) *IRODSSessionConfig

NewIRODSSessionConfigWithDefault create a IRODSSessionConfig with a default settings

Jump to

Keyboard shortcuts

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