Documentation ¶
Overview ¶
Package lldb implements generic connection to MongoDB, and contains subpackages for specific methods of connection.
Index ¶
- Constants
- Variables
- func IsConnectionError(err error) bool
- type ApplyOpsResponse
- type DBConnector
- type GetConnectorFunc
- type Oplog
- type SessionProvider
- func (self *SessionProvider) Close()
- func (self *SessionProvider) GetSession() (*mgo.Session, error)
- func (self *SessionProvider) SetBypassDocumentValidation(bypassDocumentValidation bool)
- func (self *SessionProvider) SetFlags(flagBits sessionFlag)
- func (self *SessionProvider) SetReadPreference(pref mgo.Mode)
- func (self *SessionProvider) SetTags(tags bson.D)
- type VanillaDBConnector
Constants ¶
const ( None sessionFlag = 0 Monotonic sessionFlag = 1 << iota DisableSocketTimeout )
Session flags.
const ( ErrLostConnection = "lost connection to server" ErrNoReachableServers = "no reachable servers" ErrNsNotFound = "ns not found" // replication errors list the replset name if we are talking to a mongos, // so we can only check for this universal prefix ErrReplTimeoutPrefix = "waiting for replication timed out" ErrCouldNotContactPrimaryPrefix = "could not contact primary for replica set" ErrCouldNotFindPrimaryPrefix = `could not find host matching read preference { mode: "primary"` ErrUnableToTargetPrefix = "unable to target" ErrNotMaster = "not master" ErrConnectionRefusedSuffix = "Connection refused" )
const (
DefaultTestPort = "33333"
)
Default port for integration tests
const (
MaxBSONSize = 16 * 1024 * 1024 // 16MB - maximum BSON document size
)
MongoDB enforced limits.
Variables ¶
var (
GetConnectorFuncs = []GetConnectorFunc{}
)
Functions ¶
func IsConnectionError ¶
IsConnectionError returns a boolean indicating if a given error is due to an error in an underlying DB connection (as opposed to some other write failure such as a duplicate key error)
Types ¶
type ApplyOpsResponse ¶
ApplyOpsResponse represents the response from an 'applyOps' command.
type DBConnector ¶
type DBConnector interface { // configure, based on the options passed in Configure(options.ToolOptions) error // dial the database and get a fresh new session GetNewSession() (*mgo.Session, error) }
Interface type for connecting to the database.
type GetConnectorFunc ¶
type GetConnectorFunc func(opts options.ToolOptions) DBConnector
Used to get appropriate the DBConnector(s) based on opts
type Oplog ¶
type Oplog struct { Timestamp bson.MongoTimestamp `bson:"ts"` HistoryID int64 `bson:"h"` Version int `bson:"v"` Operation string `bson:"op"` Namespace string `bson:"ns"` Object bson.D `bson:"o"` Query bson.D `bson:"o2"` UI *bson.Binary `bson:"ui,omitempty"` }
Oplog represents a MongoDB oplog document.
type SessionProvider ¶
type SessionProvider struct {
// contains filtered or unexported fields
}
Used to manage database sessions
func NewSessionProvider ¶
func NewSessionProvider(opts options.ToolOptions) (*SessionProvider, error)
NewSessionProvider constructs a session provider but does not attempt to create the initial session.
func (*SessionProvider) Close ¶
func (self *SessionProvider) Close()
Close closes the master session in the connection pool
func (*SessionProvider) GetSession ¶
func (self *SessionProvider) GetSession() (*mgo.Session, error)
Returns a session connected to the database server for which the session provider is configured.
func (*SessionProvider) SetBypassDocumentValidation ¶
func (self *SessionProvider) SetBypassDocumentValidation(bypassDocumentValidation bool)
SetBypassDocumentValidation sets whether to bypass document validation in the SessionProvider and eventually in the masterSession
func (*SessionProvider) SetFlags ¶
func (self *SessionProvider) SetFlags(flagBits sessionFlag)
SetFlags allows certain modifications to the masterSession after initial creation.
func (*SessionProvider) SetReadPreference ¶
func (self *SessionProvider) SetReadPreference(pref mgo.Mode)
SetReadPreference sets the read preference mode in the SessionProvider and eventually in the masterSession
func (*SessionProvider) SetTags ¶
func (self *SessionProvider) SetTags(tags bson.D)
SetTags sets the server selection tags in the SessionProvider and eventually in the masterSession
type VanillaDBConnector ¶
type VanillaDBConnector struct {
// contains filtered or unexported fields
}
Basic connector for dialing the database, with no authentication.
func (*VanillaDBConnector) Configure ¶
func (self *VanillaDBConnector) Configure(opts options.ToolOptions) error
Configure sets up the db connector using the options in opts. It parses the connection string and then sets up the dial information using the default dial timeout.
func (*VanillaDBConnector) GetNewSession ¶
func (self *VanillaDBConnector) GetNewSession() (*mgo.Session, error)
GetNewSession connects to the server and returns the established session and any error encountered.
Directories ¶
Path | Synopsis |
---|---|
Package kerberos implements authentication to MongoDB using kerberos
|
Package kerberos implements authentication to MongoDB using kerberos |
Package tlsgo provides a mgo connection using Go's native TLS library.
|
Package tlsgo provides a mgo connection using Go's native TLS library. |