db

package
v0.0.0-...-9451de5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

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

View Source
const (
	DefaultDatabaseURL  = "127.0.0.1:27017"
	DefaultDatabaseName = "tsuru"
)

Variables

This section is empty.

Functions

func DbConfig

func DbConfig(prefix string) (string, string)

Types

type LogStorage

type LogStorage struct {
	*storage.Storage
}

func LogConn

func LogConn() (*LogStorage, error)

func (*LogStorage) AppLogCollection

func (s *LogStorage) AppLogCollection(appName string) *storage.Collection

AppLogCollection returns the logs collection for one app from MongoDB.

func (*LogStorage) CreateAppLogCollection

func (s *LogStorage) CreateAppLogCollection(appName string) (*storage.Collection, error)

CreateAppLogCollection creates a new capped collection to store logs for an app.

func (*LogStorage) LogsCollections

func (s *LogStorage) LogsCollections() ([]*storage.Collection, error)

LogsCollections returns logs collections for all apps from MongoDB.

type Storage

type Storage struct {
	*storage.Storage
}

func Conn

func Conn() (*Storage, error)

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) InstallHosts

func (s *Storage) InstallHosts() *storage.Collection

func (*Storage) Limiter

func (s *Storage) Limiter() *storage.Collection

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) 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) 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.

func (*Storage) VolumeBinds

func (s *Storage) VolumeBinds() *storage.Collection

func (*Storage) Volumes

func (s *Storage) Volumes() *storage.Collection

Directories

Path Synopsis
Package dbtest provides utilities test functions and types for interacting with the database during tests.
Package dbtest provides utilities test functions and types for interacting with the database during tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL