Documentation ¶
Overview ¶
Package app Waiting Time Analysis Backend API
The tool allows to identify activity transitions given an event log and analyze its waiting times.
Schemes: http Host: 193.40.11.233 BasePath: / Version: 1.0.0
Consumes:
- application/json
Produces:
- application/json
swagger:meta
Index ¶
- func CancelJobByID(app *Application) http.HandlerFunc
- func DeleteJobs(app *Application) http.HandlerFunc
- func EnableCORS(inner http.Handler) http.Handler
- func GetJobByID(app *Application) http.HandlerFunc
- func GetJobs(app *Application) http.HandlerFunc
- func Index(w http.ResponseWriter, r *http.Request)
- func Logger(app *Application, inner http.Handler, name string) http.Handler
- func PostJob(app *Application) http.HandlerFunc
- func PostJobFromBody(app *Application) http.HandlerFunc
- func SampleCallback(app *Application) http.HandlerFunc
- func StaticAssets(app *Application) http.HandlerFunc
- func SwaggerJSON(app *Application) http.HandlerFunc
- type Application
- type Configuration
- type Queue
- func (q *Queue) Add(job *model.Job) error
- func (q *Queue) Clear() error
- func (q *Queue) ClearOld(d time.Duration) error
- func (q *Queue) FindByID(id string) *model.Job
- func (q *Queue) FindByMD5(md5 string) *model.Job
- func (q *Queue) Next() *model.Job
- func (q *Queue) Remove(job *model.Job, removeFiles bool) error
- type Route
- type Routes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CancelJobByID ¶
func CancelJobByID(app *Application) http.HandlerFunc
swagger:operation GET /jobs/{id}/cancel cancelJob
Cancel processing of a job.
--- Produces:
- application/json
Parameters:
- name: id in: path description: Job's ID required: true type: string
Responses:
default: schema: $ref: '#/definitions/ApiResponseError' 200: schema: $ref: '#/definitions/ApiSingleJobResponse'
func DeleteJobs ¶
func DeleteJobs(app *Application) http.HandlerFunc
swagger:route DELETE /jobs deleteJobs
Delete all non-running jobs. If a job is running, it returns an error. Cancel the running jobs manually before deleting them.
--- Responses:
default: schema: $ref: '#/definitions/ApiResponseError' 200: schema: $ref: '#/definitions/ApiJobsResponse'
func GetJobByID ¶
func GetJobByID(app *Application) http.HandlerFunc
swagger:operation GET /jobs/{id} getJob
Get a single job.
--- Consumes:
- application/json
Produces:
- application/json
Parameters:
- name: id in: path description: Job's ID required: true type: string
Responses:
default: schema: $ref: '#/definitions/ApiResponseError' 200: schema: $ref: '#/definitions/ApiSingleJobResponse'
func GetJobs ¶
func GetJobs(app *Application) http.HandlerFunc
swagger:route GET /jobs listJobs
List all jobs.
--- Responses:
default: schema: $ref: '#/definitions/ApiJobsResponse'
func PostJob ¶
func PostJob(app *Application) http.HandlerFunc
swagger:operation POST /jobs postJob
Submit a job for analysis. The endpoint accepts JSON and CSV request bodies. If the callback URL is provided, a GET request with empty body is sent to this endpoint when analysis is complete.
--- Consumes:
- application/json
- text/csv
Produces:
- application/json
Parameters:
- name: Body in: body description: Description of a job required: true schema: $ref: '#/definitions/ApiRequest'
Responses:
default: schema: $ref: '#/definitions/ApiResponseError' 200: schema: $ref: '#/definitions/ApiSingleJobResponse'
func PostJobFromBody ¶
func PostJobFromBody(app *Application) http.HandlerFunc
func SampleCallback ¶ added in v1.1.0
func SampleCallback(app *Application) http.HandlerFunc
swagger:operation POST /callback postCallback
Sample endpoint that receives a callback from the analysis service and responds with a 200 OK.
--- Consumes:
- application/json
Produces:
- application/json
Parameters:
- name: Body in: body description: Callback request required: true schema: $ref: '#/definitions/ApiCallbackRequest'
Responses:
default: schema: $ref: '#/definitions/ApiResponseError' 200: schema: $ref: '#/definitions/ApiCallbackRequest'
func StaticAssets ¶
func StaticAssets(app *Application) http.HandlerFunc
func SwaggerJSON ¶
func SwaggerJSON(app *Application) http.HandlerFunc
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(config *Configuration) (*Application, error)
func (*Application) Addr ¶
func (app *Application) Addr() string
func (*Application) Close ¶
func (app *Application) Close()
func (*Application) GetRouter ¶
func (app *Application) GetRouter() *mux.Router
func (*Application) LoadQueue ¶
func (app *Application) LoadQueue() error
func (*Application) ProcessQueue ¶
func (app *Application) ProcessQueue()
ProcessQueue should be started in a separate goroutine to run the queue processing alongside the web server. It checks for any pending job and process one if available. It also saves the queue to disk when processing is done, and clears old records periodically.
func (*Application) SaveQueue ¶
func (app *Application) SaveQueue() error
type Configuration ¶
type Configuration struct { DevelopmentMode bool Host string Port uint AssetsDir string ResultsDir string QueueSleepTime time.Duration JobTimeout time.Duration LogPath string QueuePath string }
func DefaultConfiguration ¶
func DefaultConfiguration() *Configuration
type Queue ¶
func (*Queue) ClearOld ¶ added in v1.1.0
ClearOld removes jobs older than a given time from the queue and disk. Given duration should be negative to represent a time in the past.