Documentation ¶
Index ¶
- Constants
- Variables
- type Agent
- type ProfileType
- type Task
- type TaskManager
- type TaskManagerMongo
- func (s *TaskManagerMongo) FindAndStallTaskForCaller(callerName string) (task Task, err error)
- func (s *TaskManagerMongo) FindTask(id string) (t Task, err error)
- func (s *TaskManagerMongo) GarbageCollectExpiredAgents(callerName string) (changeInfo *mgo.ChangeInfo, err error)
- func (s *TaskManagerMongo) NewTask(callerName string, profile ProfileType, status string) (t Task)
- func (s *TaskManagerMongo) SaveTask(t Task) (Task, error)
- func (s *TaskManagerMongo) ScheduleTask(task Task, expireTime time.Time) Task
- func (s *TaskManagerMongo) SubscribeToSchedule(callerName string) (subscription chan Task)
- type TaskSaver
Constants ¶
const ( //TaskAgentLongRunning -- TaskAgentLongRunning ProfileType = "agent_task_long_running" //TaskAgentScheduledTask -- TaskAgentScheduledTask ProfileType = "agent_scheduled_task" //TaskLongPollQueue -- TaskLongPollQueue ProfileType = "longpoll_queue" //ExpiredTask - ExpiredTask int64 = 0 //TaskStatusAvailable --- task status is set to available TaskStatusAvailable = "available" //AgentTaskStatusInitializing --- AgentTaskStatusInitializing = "initializing" //AgentTaskStatusScheduled --- AgentTaskStatusScheduled = "scheduled" //AgentTaskStatusRunning --- AgentTaskStatusRunning = "running" //AgentTaskStatusComplete --- AgentTaskStatusComplete = "complete" //AgentTaskStatusFailed --- AgentTaskStatusFailed = "failed" )
Variables ¶
var ( //ErrNoResults - no results found in query ErrNoResults = errors.New("no results found") //AgentTaskPollerInterval - time offset to poll a task from an agent AgentTaskPollerInterval = time.Duration(2) * time.Second //AgentTaskPollerTimeout - time until a agent will expire its task if not polled AgentTaskPollerTimeout = time.Duration(5) * time.Minute )
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent an object which knows how to handle long running tasks. polling, timeouts etc
func NewAgent ¶
func NewAgent(t TaskManager, callerName string) Agent
NewAgent -- creates a new initialized agent object
type ProfileType ¶
type ProfileType string
ProfileType - indicator of the purpose of the task to be performed
type Task ¶
type Task struct { ID bson.ObjectId `bson:"_id"` Timestamp time.Time `bson:"timestamp"` Expires int64 `bson:"expires"` Status string `bson:"status"` Profile ProfileType `bson:"profile"` CallerName string `bson:"caller_name"` MetaData map[string]interface{} `bson:"metadata"` }
Task - a task object
type TaskManager ¶
type TaskManager interface { NewTask(callerName string, profile ProfileType, status string) (t Task) FindTask(id string) (t Task, err error) FindAndStallTaskForCaller(callerName string) (task Task, err error) SaveTask(t Task) (Task, error) ScheduleTask(t Task, expireTime time.Time) Task }
TaskManager ---
type TaskManagerMongo ¶
type TaskManagerMongo struct {
// contains filtered or unexported fields
}
TaskManagerMongo - manages task interactions crud stuff
func NewTaskManagerMongo ¶
func NewTaskManagerMongo(taskCollection collection) (tm *TaskManagerMongo)
NewTaskManager - this creates a new task manager object and returns it
func (*TaskManagerMongo) FindAndStallTaskForCaller ¶
func (s *TaskManagerMongo) FindAndStallTaskForCaller(callerName string) (task Task, err error)
FindAndStallTaskForCaller - find and lock the first matching task, then return it
func (*TaskManagerMongo) FindTask ¶
func (s *TaskManagerMongo) FindTask(id string) (t Task, err error)
FindTask - this will find and return a task with a given ID
func (*TaskManagerMongo) GarbageCollectExpiredAgents ¶
func (s *TaskManagerMongo) GarbageCollectExpiredAgents(callerName string) (changeInfo *mgo.ChangeInfo, err error)
GarbageCollectExpiredAgents --
func (*TaskManagerMongo) NewTask ¶
func (s *TaskManagerMongo) NewTask(callerName string, profile ProfileType, status string) (t Task)
NewTask - get us a new empty task
func (*TaskManagerMongo) SaveTask ¶
func (s *TaskManagerMongo) SaveTask(t Task) (Task, error)
SaveTask - saves the given task
func (*TaskManagerMongo) ScheduleTask ¶
func (s *TaskManagerMongo) ScheduleTask(task Task, expireTime time.Time) Task
ScheduleTask --
func (*TaskManagerMongo) SubscribeToSchedule ¶
func (s *TaskManagerMongo) SubscribeToSchedule(callerName string) (subscription chan Task)
SubscribeToSchedule - subscribe to a schedule and get a channel to listen on for a task when it hits its scheduled time
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/onsi/ginkgo
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API.
|
Ginkgo is a BDD-style testing framework for Golang The godoc documentation describes Ginkgo's API. |
_workspace/src/github.com/onsi/ginkgo/config
Ginkgo accepts a number of configuration options.
|
Ginkgo accepts a number of configuration options. |
_workspace/src/github.com/onsi/ginkgo/ginkgo
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use.
|
The Ginkgo CLI The Ginkgo CLI is fully documented [here](http://onsi.github.io/ginkgo/#the_ginkgo_cli) You can also learn more by running: ginkgo help Here are some of the more commonly used commands: To install: go install github.com/onsi/ginkgo/ginkgo To run tests: ginkgo To run tests in all subdirectories: ginkgo -r To run tests in particular packages: ginkgo <flags> /path/to/package /path/to/another/package To pass arguments/flags to your tests: ginkgo <flags> <packages> -- <pass-throughs> To run tests in parallel ginkgo -p this will automatically detect the optimal number of nodes to use. |
_workspace/src/github.com/onsi/ginkgo/internal/remote
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete.
|
Aggregator is a reporter used by the Ginkgo CLI to aggregate and present parallel test output coherently as tests complete. |
_workspace/src/github.com/onsi/ginkgo/reporters
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output.
|
Ginkgo's Default Reporter A number of command line flags are available to tweak Ginkgo's default output. |
_workspace/src/github.com/onsi/gomega
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.
|
Gomega is the Ginkgo BDD-style testing framework's preferred matcher library. |
_workspace/src/github.com/onsi/gomega/format
Gomega's format package pretty-prints objects.
|
Gomega's format package pretty-prints objects. |
_workspace/src/github.com/onsi/gomega/gbytes
Package gbytes provides a buffer that supports incrementally detecting input.
|
Package gbytes provides a buffer that supports incrementally detecting input. |
_workspace/src/github.com/onsi/gomega/gexec
Package gexec provides support for testing external processes.
|
Package gexec provides support for testing external processes. |
_workspace/src/github.com/onsi/gomega/ghttp
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers.
|
Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports registering multiple handlers. |
_workspace/src/github.com/onsi/gomega/ghttp/protobuf
Package protobuf is a generated protocol buffer package.
|
Package protobuf is a generated protocol buffer package. |
_workspace/src/github.com/onsi/gomega/matchers
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported.
|
Gomega matchers This package implements the Gomega matchers and does not typically need to be imported. |
_workspace/src/github.com/op/go-logging
Package logging implements a logging infrastructure for Go.
|
Package logging implements a logging infrastructure for Go. |
_workspace/src/gopkg.in/mgo.v2
Package mgo offers a rich MongoDB driver for Go.
|
Package mgo offers a rich MongoDB driver for Go. |
_workspace/src/gopkg.in/mgo.v2/bson
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver.
|
Package bson is an implementation of the BSON specification for Go: http://bsonspec.org It was created as part of the mgo MongoDB driver for Go, but is standalone and may be used on its own without the driver. |
_workspace/src/gopkg.in/mgo.v2/internal/scram
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802.
|
Pacakage scram implements a SCRAM-{SHA-1,etc} client per RFC5802. |
_workspace/src/gopkg.in/mgo.v2/testserver
WARNING: This package was replaced by mgo.v2/dbtest.
|
WARNING: This package was replaced by mgo.v2/dbtest. |
_workspace/src/gopkg.in/mgo.v2/txn
The txn package implements support for multi-document transactions.
|
The txn package implements support for multi-document transactions. |