Documentation ¶
Overview ¶
Package db encapsulates tsuru connection with MongoDB.
The function Conn dials to MongoDB using data from the configuration file and returns a connection (represented by the storage.Storage type). It manages an internal pool of connections, and reconnects in case of failures. That means that you should not store references to the connection, but always call Open.
Index ¶
- Constants
- func DbConfig(prefix string) (string, string)
- func IsCollectionExistsError(err error) bool
- type Storage
- func (s *Storage) Apps() *storage.Collection
- func (s *Storage) EventBlocks() *storage.Collection
- func (s *Storage) Events() *storage.Collection
- func (s *Storage) Jobs() *storage.Collection
- func (s *Storage) PasswordTokens() *storage.Collection
- func (s *Storage) Pools() *storage.Collection
- func (s *Storage) PoolsConstraints() *storage.Collection
- func (s *Storage) Roles() *storage.Collection
- func (s *Storage) ServiceInstances() *storage.Collection
- func (s *Storage) Services() *storage.Collection
- func (s *Storage) Tokens() *storage.Collection
- func (s *Storage) Users() *storage.Collection
Constants ¶
const ( DefaultDatabaseURL = "127.0.0.1:27017" DefaultDatabaseName = "tsuru" )
Variables ¶
This section is empty.
Functions ¶
func IsCollectionExistsError ¶
Types ¶
type Storage ¶
func Conn ¶
Conn reads the tsuru config and calls storage.Open to get a database connection.
Most tsuru packages should probably use this function. storage.Open is intended for use when supporting more than one database.
func (*Storage) Apps ¶
func (s *Storage) Apps() *storage.Collection
Apps returns the apps collection from MongoDB.
func (*Storage) EventBlocks ¶
func (s *Storage) EventBlocks() *storage.Collection
func (*Storage) Events ¶
func (s *Storage) Events() *storage.Collection
func (*Storage) Jobs ¶
func (s *Storage) Jobs() *storage.Collection
Jobs returns the jobs collection from MongoDB.
func (*Storage) PasswordTokens ¶
func (s *Storage) PasswordTokens() *storage.Collection
func (*Storage) Pools ¶
func (s *Storage) Pools() *storage.Collection
Pools returns the pool collection.
func (*Storage) PoolsConstraints ¶
func (s *Storage) PoolsConstraints() *storage.Collection
PoolsConstraints return the pool constraints collection.
func (*Storage) Roles ¶
func (s *Storage) Roles() *storage.Collection
func (*Storage) ServiceInstances ¶
func (s *Storage) ServiceInstances() *storage.Collection
ServiceInstances returns the services_instances collection from MongoDB.
func (*Storage) Services ¶
func (s *Storage) Services() *storage.Collection
Services returns the services collection from MongoDB.
func (*Storage) Tokens ¶
func (s *Storage) Tokens() *storage.Collection
func (*Storage) Users ¶
func (s *Storage) Users() *storage.Collection
Users returns the users collection from MongoDB.