Documentation ¶
Index ¶
- type Config
- type Connection
- type TaskService
- func (ts *TaskService) Close()
- func (ts *TaskService) Do(commandName string, args ...interface{}) (reply interface{}, err error)
- func (ts *TaskService) FailedOpSolved(task string, taskID, opID bson.ObjectId) error
- func (ts *TaskService) PushFail(task string, taskID bson.ObjectId, args ...interface{}) bson.ObjectId
- func (ts *TaskService) PushTask(task string, args ...interface{}) bson.ObjectId
- func (ts *TaskService) TaskDone(task string, taskID bson.ObjectId) error
- func (ts *TaskService) TaskResolver(conn *Connection)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { URL string `json:"url"` Port string `json:"port"` StaticContentPath string `json:"static_content_path"` RedisAddress string `json:"redis_address"` SecretKey string `json:"secret_key"` SessionName string `json:"session_name"` DatabaseUrl string `json:"database_url"` DatabaseName string `json:"database_name"` Debug bool `json:"debug"` SecureCookies bool `json:"secure_cookies"` StorePath string `json:"store_path"` ThumbnailStorePath string `json:"thumbnail_store_path"` WebStorePath string `json:"web_store_path"` WebThumbnailStorePath string `json:"web_thumbnail_store_path"` LogsPath string `json:"logs_path"` UseHTTPS bool `json:"use_https"` SSLCert string `json:"ssl_cert"` SSLKey string `json:"ssl_key"` }
Config gathers all the necessary data to run the app
type Connection ¶
Connection represents the database session
func NewDatabaseConn ¶
func NewDatabaseConn(config *Config) (*Connection, error)
NewDatabaseConn initializes the database connection
func (*Connection) C ¶
func (c *Connection) C(collection string) *mgo.Collection
C returns a pointer to a mgo.Collection
type TaskService ¶
func NewTaskService ¶
func NewTaskService(config *Config) (*TaskService, error)
NewTaskSercice initializes the task service
func (*TaskService) Do ¶
func (ts *TaskService) Do(commandName string, args ...interface{}) (reply interface{}, err error)
Do performs a Redis commant
func (*TaskService) FailedOpSolved ¶
func (ts *TaskService) FailedOpSolved(task string, taskID, opID bson.ObjectId) error
FailedOpSolved marks a previously failed operation as solved and erases its data
func (*TaskService) PushFail ¶
func (ts *TaskService) PushFail(task string, taskID bson.ObjectId, args ...interface{}) bson.ObjectId
PushFail pushes a failed operation to Redis
func (*TaskService) PushTask ¶
func (ts *TaskService) PushTask(task string, args ...interface{}) bson.ObjectId
PushTask pushes a task to Redis
func (*TaskService) TaskDone ¶
func (ts *TaskService) TaskDone(task string, taskID bson.ObjectId) error
TaskDone clears all the data for the given task
func (*TaskService) TaskResolver ¶
func (ts *TaskService) TaskResolver(conn *Connection)
TaskResolver is a process that takes care of the failed operations pushed to redis. The resolver tries to run again the task. If the task can't be completed by the resolver it will get discarded.