coda

package module
v0.0.0-...-857a595 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func (Agent) GetStatus

func (s Agent) GetStatus() chan string

GetStatus - returns a status emitting channel

func (Agent) GetTask

func (s Agent) GetTask() Task

GetTask - get the agents task object

func (Agent) Run

func (s Agent) Run(process func(Agent) error)

Run - this begins the running of an agent's async process

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

func NewTask

func NewTask() Task

NewTask - a helper to create a new task

func (Task) GetMeta

func (s Task) GetMeta(name string) interface{}

GetMeta - get a public metadata record

func (Task) Save

func (s Task) Save(ts TaskSaver)

Save -- Safe way to update a task

func (Task) SetMeta

func (s Task) SetMeta(name string, value interface{}) Task

SetMeta - set a public metadata record

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

type TaskSaver

type TaskSaver interface {
	SaveTask(t Task) (Task, error)
}

TaskSaver - interface that can save a task

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.

Jump to

Keyboard shortcuts

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