app

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package app implements most of the application logic, it contains everything that is needed to serve a request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is an autodeb server application

func NewApp

func NewApp(
	config *Config,
	db *database.Database,
	dataFS filesystem.FS,
	oauthProvider oauth.Provider,
	renderer *htmltemplate.Renderer,
	staticFS http.FileSystem,
	sessionsStore sessions.Store,
	logger log.Logger) (*App, error)

NewApp create an app from a configuration

func (*App) AuthService added in v0.6.0

func (app *App) AuthService() *auth.Service

AuthService returns the authentification service

func (*App) Config added in v0.6.0

func (app *App) Config() *Config

Config returns the app's config

func (*App) GetAllFileUploadsByUploadID added in v0.3.0

func (app *App) GetAllFileUploadsByUploadID(uploadID uint) ([]*models.FileUpload, error)

GetAllFileUploadsByUploadID returns all FileUploads associated to an upload

func (*App) GetAllJobs

func (app *App) GetAllJobs() ([]*models.Job, error)

GetAllJobs returns all jobs

func (*App) GetAllUploads

func (app *App) GetAllUploads() ([]*models.Upload, error)

GetAllUploads returns all uploads

func (*App) GetJob added in v0.4.0

func (app *App) GetJob(id uint) (*models.Job, error)

GetJob returns the job with the given id

func (*App) GetJobLog added in v0.4.0

func (app *App) GetJobLog(jobID uint) (io.ReadCloser, error)

GetJobLog returns the log of a job

func (*App) GetUploadDSC added in v0.3.0

func (app *App) GetUploadDSC(uploadID uint) (io.ReadCloser, error)

GetUploadDSC returns the DSC of the upload with a matching id

func (*App) GetUploadFile added in v0.3.0

func (app *App) GetUploadFile(uploadID uint, filename string) (io.ReadCloser, error)

GetUploadFile returns the file associated with the upload id and filename

func (*App) JobsDirectory added in v0.4.0

func (app *App) JobsDirectory() string

JobsDirectory contains saved data for jobs such as logs

func (*App) Logger added in v0.6.0

func (app *App) Logger() log.Logger

Logger returns the logger

func (*App) OAuthProvider added in v0.6.0

func (app *App) OAuthProvider() oauth.Provider

OAuthProvider returns the configured OAuth provider

func (*App) ProcessUpload

func (app *App) ProcessUpload(uploadParameters *UploadParameters, content io.Reader) (*models.Upload, error)

ProcessUpload processes uploads

func (*App) SaveJobLog added in v0.4.0

func (app *App) SaveJobLog(jobID uint, content io.Reader) error

SaveJobLog will save logs for a job

func (*App) StaticFS added in v0.6.0

func (app *App) StaticFS() http.FileSystem

StaticFS contains static files to be served over http

func (*App) TemplatesRenderer added in v0.6.0

func (app *App) TemplatesRenderer() *htmltemplate.Renderer

TemplatesRenderer returns the template renderer

func (*App) UnqueueNextJob added in v0.3.0

func (app *App) UnqueueNextJob() (*models.Job, error)

UnqueueNextJob returns the next job and marks it as assigned

func (*App) UpdateJob added in v0.4.0

func (app *App) UpdateJob(job *models.Job) error

UpdateJob will update a job

func (*App) UploadedFilesDirectory

func (app *App) UploadedFilesDirectory() string

UploadedFilesDirectory contains files that are not yet associated with a package upload.

func (*App) UploadsDirectory

func (app *App) UploadsDirectory() string

UploadsDirectory contains completed uploads.

type Config added in v0.6.0

type Config struct {
	ServerURL string
}

Config holds additional configuration that is needed by App. Properties of this struct are not only needed for initialization, they are refered to during operations.

type UploadParameters

type UploadParameters = uploads.UploadParameters

UploadParameters define upload options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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