context

package
v0.0.0-...-92ec744 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectNatsQueue

func ConnectNatsQueue(servers []string, d db.Connection) queue.Connection

ConnectNatsQueue connects the application to the Gnatsd cluster.

func ConnectRiakDb

func ConnectRiakDb(host string) db.Connection

ConnectRiakDb connects the application to the Riak cluster.

func ParseNatsNodes

func ParseNatsNodes() ([]string, bool)

ParseNatsNodes decies whether to connect the application to Gnatsd or not.

func ParseRiakHost

func ParseRiakHost() (string, bool)

ParseRiakHost decides whether to connect the application to riak or not.

Types

type Context

type Context struct {
	Db    db.Connection    // client to talk with a database.
	Queue queue.Connection // client to talk with a queue.
}

Context holds connections to external dependencies. It configures the application to use specific queue and storage drivers.

func NewDefaultContext

func NewDefaultContext() Context

NewDefaultContext initializes the application context. It takes the Gnatsd nodes from an environment variable called CRAWLER_GNATSD_NODES, using nats://127.0.0.1:2222 by default. It takes Riak's address from an environment variable called CRAWLER_RIAK_URL, using 127.0.0.1:8087 by default.

Jump to

Keyboard shortcuts

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