Documentation ¶
Index ¶
- Variables
- type Pool
- type PoolConn
- func (p *PoolConn) Add(addRequest *ldap.AddRequest) error
- func (p *PoolConn) Bind(username, password string) error
- func (p *PoolConn) Close()
- func (p *PoolConn) Compare(dn, attribute, value string) (bool, error)
- func (p *PoolConn) Del(delRequest *ldap.DelRequest) error
- func (p *PoolConn) MarkUnusable()
- func (p *PoolConn) Modify(modifyRequest *ldap.ModifyRequest) error
- func (p *PoolConn) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)
- func (p *PoolConn) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
- func (p *PoolConn) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
- func (p *PoolConn) SetTimeout(t time.Duration)
- func (p *PoolConn) SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)
- func (p *PoolConn) Start()
- func (p *PoolConn) StartTLS(config *tls.Config) error
- type PoolFactory
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClosed is the error resulting if the pool is closed via pool.Close(). ErrClosed = errors.New("pool is closed") )
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool interface { // Get returns a new connection from the pool. Closing the connections puts // it back to the Pool. Closing it when the pool is destroyed or full will // be counted as an error. Get() (*PoolConn, error) // Close closes the pool and all its connections. After Close() the pool is // no longer usable. Close() // Len returns the current number of connections of the pool. Len() int }
Pool interface describes a pool implementation. A pool should have maximum capacity. An ideal pool is threadsafe and easy to use.
func NewChannelPool ¶
func NewChannelPool(initialCap, maxCap int, name string, factory PoolFactory, closeAt []uint8) (Pool, error)
NewChannelPool returns a new pool based on buffered channels with an initial capacity and maximum capacity. Factory is used when initial capacity is greater than zero to fill the pool. A zero initialCap doesn't fill the Pool until a new Get() is called. During a Get(), If there is no new connection available in the pool, a new connection will be created via the Factory() method.
closeAt will automagically mark the connection as unusable if the return code of the call is one of those passed, most likely you want to set this to something like
[]uint8{ldap.LDAPResultTimeLimitExceeded, ldap.ErrorNetwork}
type PoolConn ¶
type PoolConn struct { Conn ldap.Client // contains filtered or unexported fields }
PoolConn implements Client to override the Close() method
func (*PoolConn) Close ¶
func (p *PoolConn) Close()
Close() puts the given connects back to the pool instead of closing it.
func (*PoolConn) MarkUnusable ¶
func (p *PoolConn) MarkUnusable()
MarkUnusable() marks the connection not usable any more, to let the pool close it instead of returning it to pool.
func (*PoolConn) PasswordModify ¶
func (*PoolConn) SearchWithPaging ¶
func (*PoolConn) SetTimeout ¶
func (*PoolConn) SimpleBind ¶
type PoolFactory ¶
PoolFactory is a function to create new connections.