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
- type LogStorage
- type Storage
- func (s *Storage) Apps() *storage.Collection
- func (s *Storage) Deploys() *storage.Collection
- func (s *Storage) PasswordTokens() *storage.Collection
- func (s *Storage) Plans() *storage.Collection
- func (s *Storage) Platforms() *storage.Collection
- func (s *Storage) Quota() *storage.Collection
- func (s *Storage) Roles() *storage.Collection
- func (s *Storage) SAMLRequests() *storage.Collection
- func (s *Storage) ServiceInstances() *storage.Collection
- func (s *Storage) Services() *storage.Collection
- func (s *Storage) Teams() *storage.Collection
- func (s *Storage) Tokens() *storage.Collection
- func (s *Storage) UserActions() *storage.Collection
- func (s *Storage) Users() *storage.Collection
Constants ¶
const ( DefaultDatabaseURL = "127.0.0.1:27017" DefaultDatabaseName = "tsuru" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogStorage ¶
func LogConn ¶
func LogConn() (*LogStorage, error)
func (*LogStorage) Logs ¶
func (s *LogStorage) Logs(appName string) *storage.Collection
Logs returns the logs collection for one app from MongoDB.
func (*LogStorage) LogsCollections ¶
func (s *LogStorage) LogsCollections() ([]*storage.Collection, error)
LogsCollections returns logs collections for all apps from MongoDB.
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) Deploys ¶
func (s *Storage) Deploys() *storage.Collection
func (*Storage) PasswordTokens ¶
func (s *Storage) PasswordTokens() *storage.Collection
func (*Storage) Plans ¶
func (s *Storage) Plans() *storage.Collection
Plans returns the plans collection.
func (*Storage) Platforms ¶
func (s *Storage) Platforms() *storage.Collection
Platforms returns the platforms collection from MongoDB.
func (*Storage) Quota ¶
func (s *Storage) Quota() *storage.Collection
Quota returns the quota collection from MongoDB.
func (*Storage) Roles ¶
func (s *Storage) Roles() *storage.Collection
func (*Storage) SAMLRequests ¶
func (s *Storage) SAMLRequests() *storage.Collection
SAMLRequests returns the saml_requests from MongoDB.
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) Teams ¶
func (s *Storage) Teams() *storage.Collection
Teams returns the teams collection from MongoDB.
func (*Storage) Tokens ¶
func (s *Storage) Tokens() *storage.Collection
func (*Storage) UserActions ¶
func (s *Storage) UserActions() *storage.Collection
func (*Storage) Users ¶
func (s *Storage) Users() *storage.Collection
Users returns the users collection from MongoDB.