Documentation ¶
Overview ¶
Package mgosession provides multiplexing for MongoDB sessions. It is designed so that many concurrent operations can be performed without using one MongoDB socket connection for each operation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Clock clock.Clock = clock.WallClock
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { // Debug logs a message at debug level. Debug(message string) // Info logs a message at info level. Info(message string) }
Logger is used by mgosession to log information about sessions.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents a pool of mgo sessions.
func NewPool ¶
NewPool returns a session pool that maintains a maximum of maxSessions sessions available for reuse.
All the sessions will be coped (with Session.Copy) from s.
The logger is used to log informational messages about the pool and may be nil if no logging is required.
func (*Pool) Close ¶
func (p *Pool) Close()
Close closes the pool. It may be called concurrently with other Pool methods, but once called, a call to Session will panic.
func (*Pool) Reset ¶
func (p *Pool) Reset()
Reset resets the session pool so that no existing sessions will be reused. This should be called when an unexpected error has been encountered using a session.