service

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: ISC Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName = "session_id"
	SessionTTL        = 86_400 // seconds
)
View Source
const (
	PgAdvisoryLockId2ServiceInit   uint32 = 0x0001
	PgAdvisoryLockId2JobScheduling uint32 = 0x0002
	PgAdvisoryLockId2JobDeployment uint32 = 0x0003
)
View Source
const PgAdvisoryLockId1 uint32 = 0x0100

Advisory locks are identified by two 32 bit integers. We arbitrarily reserve a value for the first one for all locks taken by Eventline.

Note that go-daemon uses 0x00ff.

Variables

View Source
var (
	ErrAuthenticationRequired = errors.New("authentication required")
	ErrAdminRoleRequired      = errors.New("admin role required")
	ErrInvalidSessionCookie   = errors.New("invalid session cookie")
	ErrUnknownAPIKey          = errors.New("unknown api key")
	ErrUnknownAccount         = errors.New("unknown account")
	ErrUnknownSession         = errors.New("unknown session")
	ErrMissingProjectId       = errors.New("missing project id")
	ErrInvalidProjectId       = errors.New("invalid project id")
)
View Source
var (
	ErrIdentityNotRefreshable = errors.New("identity is not refreshable")
)
View Source
var (
	ErrWrongPassword = errors.New("wrong password")
)

Functions

func DecodeOAuth2State

func DecodeOAuth2State(state string) (eventline.Id, eventline.Id, error)

func DefaultProjectNotificationSettings

func DefaultProjectNotificationSettings(project *eventline.Project) *eventline.ProjectNotificationSettings

func DefaultProjectSettings

func DefaultProjectSettings(project *eventline.Project) *eventline.ProjectSettings

func EncodeOAuth2State

func EncodeOAuth2State(identityId eventline.Id, sessionId eventline.Id) (string, error)

func IdentityConnectorSelect

func IdentityConnectorSelect(name string) *web.Select

func IdentityTypeSelect

func IdentityTypeSelect(cdef *eventline.ConnectorDef, name string) *web.Select

func NewLoginMenu

func NewLoginMenu(selectedEntry string) *web.Menu

func NewMainMenu

func NewMainMenu(selectedEntry string) *web.Menu

Types

type APIHTTPServer

type APIHTTPServer struct {
	*HTTPServer
}

func NewAPIHTTPServer

func NewAPIHTTPServer(service *Service) (*APIHTTPServer, error)

type DuplicateAPIKeyNameError

type DuplicateAPIKeyNameError struct {
	Name string
}

func (DuplicateAPIKeyNameError) Error

func (err DuplicateAPIKeyNameError) Error() string

type DuplicateIdentityNameError

type DuplicateIdentityNameError struct {
	Name string
}

func (DuplicateIdentityNameError) Error

func (err DuplicateIdentityNameError) Error() string

type DuplicateProjectNameError

type DuplicateProjectNameError struct {
	Name string
}

func (DuplicateProjectNameError) Error

func (err DuplicateProjectNameError) Error() string

type DuplicateUsernameError

type DuplicateUsernameError struct {
	Username string
}

func (DuplicateUsernameError) Error

func (err DuplicateUsernameError) Error() string

type EventWorker

type EventWorker struct {
	Log     *dlog.Logger
	Service *Service
}

func NewEventWorker

func NewEventWorker(s *Service) *EventWorker

func (*EventWorker) Init

func (ew *EventWorker) Init(w *eventline.Worker)

func (*EventWorker) ProcessJob

func (ew *EventWorker) ProcessJob() (bool, error)

func (*EventWorker) Start

func (ew *EventWorker) Start() error

func (*EventWorker) Stop

func (ew *EventWorker) Stop()

type HTTPContext

type HTTPContext struct {
	// If authenticated
	AccountId       *eventline.Id
	AccountRole     *eventline.AccountRole
	AccountSettings *eventline.AccountSettings

	// If authenticated on the web interface
	Session *eventline.Session

	// If there is a current project
	ProjectIdChecked bool // true if we have performed project id detection
	ProjectId        *eventline.Id
	ProjectName      string
}

func (*HTTPContext) AccountProjectScope

func (ctx *HTTPContext) AccountProjectScope() eventline.Scope

func (*HTTPContext) AccountScope

func (ctx *HTTPContext) AccountScope() eventline.Scope

func (*HTTPContext) ProjectScope

func (ctx *HTTPContext) ProjectScope() eventline.Scope

type HTTPHandler

type HTTPHandler struct {
	*dhttp.Handler

	Service      *Service
	Interface    HTTPInterface
	RouteOptions HTTPRouteOptions
	Context      *HTTPContext
}

func (*HTTPHandler) DeleteCookie

func (h *HTTPHandler) DeleteCookie()

func (*HTTPHandler) IdRouteVariable

func (h *HTTPHandler) IdRouteVariable(name string) (id eventline.Id, err error)

func (*HTTPHandler) LoadSession

func (h *HTTPHandler) LoadSession(sessionId eventline.Id) error

func (*HTTPHandler) ParseCursor

func (h *HTTPHandler) ParseCursor(sorts eventline.Sorts) (*eventline.Cursor, error)

func (*HTTPHandler) ParseMetricParameters

func (h *HTTPHandler) ParseMetricParameters() (*eventline.MetricParameters, error)

func (*HTTPHandler) RedirectionTarget

func (h *HTTPHandler) RedirectionTarget() string

func (*HTTPHandler) ReplyAuthError

func (h *HTTPHandler) ReplyAuthError(status int, code string, format string, args ...interface{})

func (*HTTPHandler) ReplyContent

func (h *HTTPHandler) ReplyContent(status int, content web.Content)

func (*HTTPHandler) ReplyJSONLocation

func (h *HTTPHandler) ReplyJSONLocation(status int, uri string, extra map[string]interface{})

func (*HTTPHandler) ReplyView

func (h *HTTPHandler) ReplyView(status int, view *web.View)

func (*HTTPHandler) SetContextSession

func (h *HTTPHandler) SetContextSession(session *eventline.Session)

func (*HTTPHandler) SetSessionCookie

func (h *HTTPHandler) SetSessionCookie(cookie *http.Cookie)

func (*HTTPHandler) TimestampQueryParameter

func (h *HTTPHandler) TimestampQueryParameter(name string) (*time.Time, error)

type HTTPInterface

type HTTPInterface string
const (
	APIHTTPInterface HTTPInterface = "api"
	WebHTTPInterface HTTPInterface = "web"
)

type HTTPRouteFunc

type HTTPRouteFunc func(*HTTPHandler)

type HTTPRouteOptions

type HTTPRouteOptions struct {
	Public  bool
	Admin   bool
	Project bool
}

type HTTPServer

type HTTPServer struct {
	Log *dlog.Logger

	Pg *pg.Client // shortcut to avoid s.Service.Daemon.Pg

	Service *Service
	Server  *dhttp.Server
}

func (*HTTPServer) AbortJobExecution added in v1.0.0

func (s *HTTPServer) AbortJobExecution(h *HTTPHandler, jeId eventline.Id) error

func (*HTTPServer) CreateProject

func (s *HTTPServer) CreateProject(h *HTTPHandler, newProject *eventline.NewProject) (*eventline.Project, error)

func (*HTTPServer) DeleteJob

func (s *HTTPServer) DeleteJob(h *HTTPHandler, jobId eventline.Id) error

func (*HTTPServer) DeleteProject

func (s *HTTPServer) DeleteProject(h *HTTPHandler, projectId eventline.Id) error

func (*HTTPServer) DisableJob

func (s *HTTPServer) DisableJob(h *HTTPHandler, jobId eventline.Id) error

func (*HTTPServer) EnableJob

func (s *HTTPServer) EnableJob(h *HTTPHandler, jobId eventline.Id) error

func (*HTTPServer) ExecuteJob

func (*HTTPServer) LoadAccount

func (s *HTTPServer) LoadAccount(h *HTTPHandler) (*eventline.Account, error)

func (*HTTPServer) LoadAccountPage

func (s *HTTPServer) LoadAccountPage(h *HTTPHandler) (*eventline.Page, error)

func (*HTTPServer) LoadIdentity

func (s *HTTPServer) LoadIdentity(h *HTTPHandler, identityId eventline.Id) (*eventline.Identity, error)

func (*HTTPServer) LoadJob

func (s *HTTPServer) LoadJob(h *HTTPHandler, jobId eventline.Id) (*eventline.Job, error)

func (*HTTPServer) LoadJobByName

func (s *HTTPServer) LoadJobByName(h *HTTPHandler, jobName string) (*eventline.Job, error)

func (*HTTPServer) LoadJobExecution added in v1.0.0

func (s *HTTPServer) LoadJobExecution(h *HTTPHandler, jeId eventline.Id) (*eventline.JobExecution, error)

func (*HTTPServer) LoadProject

func (s *HTTPServer) LoadProject(h *HTTPHandler, projectId eventline.Id) (*eventline.Project, error)

func (*HTTPServer) LoadProjectByName

func (s *HTTPServer) LoadProjectByName(h *HTTPHandler, projectName string) (*eventline.Project, error)

func (*HTTPServer) LoadProjectPage

func (s *HTTPServer) LoadProjectPage(h *HTTPHandler) (*eventline.Page, error)

func (*HTTPServer) LogIn

func (s *HTTPServer) LogIn(h *HTTPHandler, loginData *LoginData) (*eventline.Session, error)

func (*HTTPServer) RestartJobExecution added in v1.0.0

func (s *HTTPServer) RestartJobExecution(h *HTTPHandler, jeId eventline.Id) error

func (*HTTPServer) UpdateProject

func (s *HTTPServer) UpdateProject(h *HTTPHandler, projectId eventline.Id, newProject *eventline.NewProject) (*eventline.Project, error)

type IdentityInUseError

type IdentityInUseError struct {
	Id eventline.Id
}

func (IdentityInUseError) Error

func (err IdentityInUseError) Error() string

type IdentityRefresher

type IdentityRefresher struct {
	Log     *dlog.Logger
	Service *Service
	// contains filtered or unexported fields
}

func NewIdentityRefresher

func NewIdentityRefresher(s *Service) *IdentityRefresher

func (*IdentityRefresher) Init

func (ir *IdentityRefresher) Init(w *eventline.Worker)

func (*IdentityRefresher) ProcessJob

func (ir *IdentityRefresher) ProcessJob() (bool, error)

func (*IdentityRefresher) Start

func (ir *IdentityRefresher) Start() error

func (*IdentityRefresher) Stop

func (ir *IdentityRefresher) Stop()

type JobExecutionGC added in v1.0.0

type JobExecutionGC struct {
	Log     *dlog.Logger
	Service *Service
}

func NewJobExecutionGC added in v1.0.0

func NewJobExecutionGC(s *Service) *JobExecutionGC

func (*JobExecutionGC) Init added in v1.0.0

func (jegc *JobExecutionGC) Init(w *eventline.Worker)

func (*JobExecutionGC) ProcessJob added in v1.0.0

func (jegc *JobExecutionGC) ProcessJob() (bool, error)

func (*JobExecutionGC) Start added in v1.0.0

func (jegc *JobExecutionGC) Start() error

func (*JobExecutionGC) Stop added in v1.0.0

func (jegc *JobExecutionGC) Stop()

type JobExecutionWatcher added in v1.0.0

type JobExecutionWatcher struct {
	Log     *dlog.Logger
	Service *Service
}

func NewJobExecutionWatcher added in v1.0.0

func NewJobExecutionWatcher(s *Service) *JobExecutionWatcher

func (*JobExecutionWatcher) Init added in v1.0.0

func (w *JobExecutionWatcher) Init(worker *eventline.Worker)

func (*JobExecutionWatcher) ProcessJob added in v1.0.0

func (w *JobExecutionWatcher) ProcessJob() (bool, error)

func (*JobExecutionWatcher) Start added in v1.0.0

func (w *JobExecutionWatcher) Start() error

func (*JobExecutionWatcher) Stop added in v1.0.0

func (w *JobExecutionWatcher) Stop()

type JobScheduler

type JobScheduler struct {
	Log     *dlog.Logger
	Service *Service
}

func NewJobScheduler

func NewJobScheduler(s *Service) *JobScheduler

func (*JobScheduler) Init

func (js *JobScheduler) Init(w *eventline.Worker)

func (*JobScheduler) ProcessJob

func (js *JobScheduler) ProcessJob() (bool, error)

func (*JobScheduler) Start

func (js *JobScheduler) Start() error

func (*JobScheduler) Stop

func (js *JobScheduler) Stop()

type JobSpecChecker

type JobSpecChecker struct {
	JobSpec *eventline.JobSpec

	Identities map[string]*eventline.Identity

	Service *Service
	Checker *check.Checker
	Conn    pg.Conn
	Scope   eventline.Scope
}

type LoginData

type LoginData struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*LoginData) Check

func (data *LoginData) Check(c *check.Checker)

type NotificationWorker

type NotificationWorker struct {
	Log     *dlog.Logger
	Service *Service
}

func NewNotificationWorker

func NewNotificationWorker(s *Service) *NotificationWorker

func (*NotificationWorker) Init

func (nw *NotificationWorker) Init(w *eventline.Worker)

func (*NotificationWorker) ProcessJob

func (nw *NotificationWorker) ProcessJob() (bool, error)

func (*NotificationWorker) Start

func (nw *NotificationWorker) Start() error

func (*NotificationWorker) Stop

func (nw *NotificationWorker) Stop()

type NotificationsCfg

type NotificationsCfg struct {
	SMTPServer     *SMTPServerCfg `json:"smtp_server"`
	FromAddress    string         `json:"from_address"`
	SubjectPrefix  string         `json:"subject_prefix"`
	Signature      string         `json:"signature"`
	AllowedDomains []string       `json:"allowed_domains"`
}

func DefaultNotificationsCfg

func DefaultNotificationsCfg() *NotificationsCfg

func (*NotificationsCfg) Check

func (cfg *NotificationsCfg) Check(c *check.Checker)

type ProService added in v1.0.0

type ProService interface {
	DefaultServiceCfg() check.Object
	Init(*Service) error
	Start() error
	Stop()
	Terminate()
}

type ProjectConfiguration

type ProjectConfiguration struct {
	Project                     *eventline.NewProject                  `json:"project"`
	ProjectSettings             *eventline.ProjectSettings             `json:"project_settings"`
	ProjectNotificationSettings *eventline.ProjectNotificationSettings `json:"project_notification_settings"`
}

func (*ProjectConfiguration) Check

func (cfg *ProjectConfiguration) Check(c *check.Checker)

type Runner

type Runner interface {
	Start() error
}

type SMTPServerCfg

type SMTPServerCfg struct {
	Address  string `json:"address"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

func (*SMTPServerCfg) Check

func (cfg *SMTPServerCfg) Check(c *check.Checker)

type Service

type Service struct {
	Data ServiceData
	Cfg  ServiceCfg

	Daemon *daemon.Daemon
	Log    *dlog.Logger

	APIHTTPServer *APIHTTPServer
	WebHTTPServer *WebHTTPServer

	BuildIdHash      string
	WebHTTPServerURI *url.URL

	TextTemplate *template.Template
	// contains filtered or unexported fields
}

func NewService

func NewService(data ServiceData) *Service

func (*Service) AbortJobExecution

func (s *Service) AbortJobExecution(jeId eventline.Id, scope eventline.Scope) (*eventline.JobExecution, error)

func (*Service) AddFavouriteJob

func (s *Service) AddFavouriteJob(conn pg.Conn, jobId eventline.Id, scope eventline.Scope) error

func (*Service) ComposeNotificationMessage

func (s *Service) ComposeNotificationMessage(recipients []string, subject, templateName string, templateData interface{}) ([]byte, error)

func (*Service) CreateAPIKey

func (s *Service) CreateAPIKey(newAPIKey *eventline.NewAPIKey, scope eventline.Scope) (*eventline.APIKey, string, error)

func (*Service) CreateAccount

func (s *Service) CreateAccount(newAccount *eventline.NewAccount) (*eventline.Account, error)

func (*Service) CreateIdentity

func (s *Service) CreateIdentity(newIdentity *eventline.NewIdentity, scope eventline.Scope) (*eventline.Identity, error)

func (*Service) CreateNotification

func (s *Service) CreateNotification(conn pg.Conn, recipients []string, subject, templateName string, templateData interface{}, scope eventline.Scope) error

func (*Service) CreateOrUpdateJob

func (s *Service) CreateOrUpdateJob(conn pg.Conn, spec *eventline.JobSpec, scope eventline.Scope) (*eventline.Job, bool, error)

func (*Service) CreateProject

func (s *Service) CreateProject(newProject *eventline.NewProject, accountId *eventline.Id) (*eventline.Project, error)

func (*Service) CreateSession

func (s *Service) CreateSession(conn pg.Conn, ns *eventline.NewSession, scope eventline.Scope) (*eventline.Session, error)

func (*Service) CreateSubscription

func (s *Service) CreateSubscription(conn pg.Conn, job *eventline.Job, scope eventline.Scope) (*eventline.Subscription, error)

func (*Service) DaemonCfg

func (s *Service) DaemonCfg() (daemon.DaemonCfg, error)

func (*Service) DefaultServiceCfg added in v1.0.0

func (s *Service) DefaultServiceCfg() interface{}

func (*Service) DeleteAPIKey

func (s *Service) DeleteAPIKey(keyId eventline.Id, scope eventline.Scope) error

func (*Service) DeleteAccount

func (s *Service) DeleteAccount(accountId eventline.Id) error

func (*Service) DeleteIdentities

func (s *Service) DeleteIdentities(conn pg.Conn, scope eventline.Scope) error

func (*Service) DeleteIdentity

func (s *Service) DeleteIdentity(identityId eventline.Id, scope eventline.Scope) error

func (*Service) DeleteJob

func (s *Service) DeleteJob(conn pg.Conn, job *eventline.Job, scope eventline.Scope) error

func (*Service) DeleteProject

func (s *Service) DeleteProject(projectId eventline.Id, hctx *HTTPContext) error

func (*Service) DeliverNotification

func (s *Service) DeliverNotification(conn pg.Conn, n *eventline.Notification) error

func (*Service) DisableJob

func (s *Service) DisableJob(conn pg.Conn, jobId eventline.Id, scope eventline.Scope) (*eventline.Job, error)

func (*Service) EnableJob

func (s *Service) EnableJob(conn pg.Conn, jobId eventline.Id, scope eventline.Scope) (*eventline.Job, error)

func (*Service) ExecuteJob

func (s *Service) ExecuteJob(conn pg.Conn, jobId eventline.Id, input *eventline.JobExecutionInput, scope eventline.Scope) (*eventline.JobExecution, error)

func (*Service) FindConnectorWorker

func (s *Service) FindConnectorWorker(cname string) *eventline.Worker

func (*Service) FindWorker

func (s *Service) FindWorker(name string) *eventline.Worker

func (*Service) IdentityRedirectionURI

func (s *Service) IdentityRedirectionURI(identity *eventline.Identity, sessionId eventline.Id, defaultURI string) (string, error)

func (*Service) Init

func (s *Service) Init(d *daemon.Daemon) error

func (*Service) InstantiateJob

func (s *Service) InstantiateJob(conn pg.Conn, job *eventline.Job, event *eventline.Event, params map[string]interface{}, scope eventline.Scope) (*eventline.JobExecution, error)

func (*Service) LoadJobExecutionContext

func (s *Service) LoadJobExecutionContext(conn pg.Conn, je *eventline.JobExecution) (*eventline.ExecutionContext, error)

func (*Service) LogIn

func (s *Service) LogIn(data *LoginData, httpCtx *HTTPContext) (*eventline.Session, error)

func (*Service) LogOut

func (s *Service) LogOut(httpCtx *HTTPContext) error

func (*Service) MaybeCreateDefaultAccount

func (s *Service) MaybeCreateDefaultAccount(conn pg.Conn) (*eventline.Account, error)

func (*Service) MaybeCreateDefaultProject

func (s *Service) MaybeCreateDefaultProject(conn pg.Conn, account *eventline.Account) (*eventline.Project, error)

func (*Service) ProcessEvent

func (s *Service) ProcessEvent(conn pg.Conn, event *eventline.Event, scope eventline.Scope) (bool, error)

func (*Service) ProcessSubscription

func (s *Service) ProcessSubscription(conn pg.Conn, sctx *eventline.SubscriptionContext) error

func (*Service) RefreshIdentity

func (s *Service) RefreshIdentity(identityId eventline.Id, scope eventline.Scope) error

func (*Service) RemoveFavouriteJob

func (s *Service) RemoveFavouriteJob(conn pg.Conn, jobId eventline.Id, scope eventline.Scope) error

func (*Service) RenderNotificationText

func (s *Service) RenderNotificationText(name string, data interface{}) ([]byte, error)

func (*Service) ReplayEvent

func (s *Service) ReplayEvent(eventId eventline.Id, scope eventline.Scope) (*eventline.Event, error)

func (*Service) RestartJobExecution

func (s *Service) RestartJobExecution(jeId eventline.Id, scope eventline.Scope) (*eventline.JobExecution, error)

func (*Service) SelectAccountProject

func (s *Service) SelectAccountProject(projectId eventline.Id, hctx *HTTPContext) error

func (*Service) SelfUpdateAccount

func (s *Service) SelfUpdateAccount(accountId eventline.Id, update *eventline.AccountSelfUpdate, hctx *HTTPContext) error

func (*Service) SelfUpdateAccountPassword

func (s *Service) SelfUpdateAccountPassword(accountId eventline.Id, update *eventline.AccountPasswordUpdate) error

func (*Service) SendJobExecutionNotification

func (s *Service) SendJobExecutionNotification(conn pg.Conn, je *eventline.JobExecution) error

func (*Service) Start

func (s *Service) Start(d *daemon.Daemon) error

func (*Service) StartJobExecution

func (s *Service) StartJobExecution(conn pg.Conn, je *eventline.JobExecution, scope eventline.Scope) error

func (*Service) StartRunner

func (s *Service) StartRunner(data *eventline.RunnerData) (Runner, error)

func (*Service) Stop

func (s *Service) Stop(d *daemon.Daemon)

func (*Service) Terminate

func (s *Service) Terminate(d *daemon.Daemon)

func (*Service) TerminateSubscription

func (s *Service) TerminateSubscription(conn pg.Conn, subscription *eventline.Subscription, projectDeletion bool, scope eventline.Scope) error

func (*Service) TerminateSubscriptions

func (s *Service) TerminateSubscriptions(conn pg.Conn, scope eventline.Scope) error

func (*Service) UpdateAccount

func (s *Service) UpdateAccount(accountId eventline.Id, update *eventline.AccountUpdate) (*eventline.Account, error)

func (*Service) UpdateAccountPassword

func (s *Service) UpdateAccountPassword(accountId eventline.Id, update *eventline.AccountPasswordUpdate) (*eventline.Account, error)

func (*Service) UpdateIdentity

func (s *Service) UpdateIdentity(identityId eventline.Id, newIdentity *eventline.NewIdentity, scope eventline.Scope) (*eventline.Identity, error)

func (*Service) UpdateJobExecutionFailure added in v1.0.0

func (s *Service) UpdateJobExecutionFailure(conn pg.Conn, je *eventline.JobExecution, format string, args ...interface{}) error

func (*Service) UpdateProjectConfiguration

func (s *Service) UpdateProjectConfiguration(projectId eventline.Id, cfg *ProjectConfiguration) error

func (*Service) ValidateJobSpec

func (s *Service) ValidateJobSpec(conn pg.Conn, spec *eventline.JobSpec, scope eventline.Scope) error

func (*Service) ValidateServiceCfg added in v1.0.0

func (s *Service) ValidateServiceCfg() error

func (*Service) WrapRoute

func (s *Service) WrapRoute(fn HTTPRouteFunc, options HTTPRouteOptions, iface HTTPInterface) dhttp.RouteFunc

type ServiceCfg

type ServiceCfg struct {
	Logger *dlog.LoggerCfg `json:"logger"`

	DaemonAPI *daemon.APICfg `json:"daemon_api"`

	DataDirectory string `json:"data_directory"`

	APIHTTPServer *dhttp.ServerCfg `json:"api_http_server"`
	WebHTTPServer *dhttp.ServerCfg `json:"web_http_server"`

	Influx *influx.ClientCfg `json:"influx"`

	Pg *pg.ClientCfg `json:"pg"`

	EncryptionKey dcrypto.AES256Key `json:"encryption_key"`

	WebHTTPServerURI string `json:"web_http_server_uri"`

	Connectors map[string]json.RawMessage `json:"connectors"`

	Workers map[string]eventline.WorkerCfg `json:"workers"`

	MaxParallelJobExecutions    int `json:"max_parallel_job_executions"`
	JobExecutionRetention       int `json:"job_execution_retention"`        // days
	JobExecutionRefreshInterval int `json:"job_execution_refresh_interval"` // seconds
	JobExecutionTimeout         int `json:"job_execution_timeout"`          // seconds

	SessionRetention int `json:"session_retention"` // days

	AllowedRunners []string                   `json:"allowed_runners"`
	Runners        map[string]json.RawMessage `json:"runners"`

	Notifications *NotificationsCfg `json:"notifications"`

	ProCfg check.Object `json:"pro"`
}

func DefaultServiceCfg

func DefaultServiceCfg() ServiceCfg

func (*ServiceCfg) Check added in v1.0.0

func (cfg *ServiceCfg) Check(c *check.Checker, s *Service)

type ServiceData

type ServiceData struct {
	Product string
	BuildId string

	ProService ProService

	Connectors []eventline.Connector
	Runners    []*eventline.RunnerDef
}

type SessionGC added in v1.0.0

type SessionGC struct {
	Log     *dlog.Logger
	Service *Service
}

func NewSessionGC added in v1.0.0

func NewSessionGC(s *Service) *SessionGC

func (*SessionGC) Init added in v1.0.0

func (sgc *SessionGC) Init(w *eventline.Worker)

func (*SessionGC) ProcessJob added in v1.0.0

func (sgc *SessionGC) ProcessJob() (bool, error)

func (*SessionGC) Start added in v1.0.0

func (sgc *SessionGC) Start() error

func (*SessionGC) Stop added in v1.0.0

func (sgc *SessionGC) Stop()

type SubscriptionWorker

type SubscriptionWorker struct {
	Log     *dlog.Logger
	Service *Service
}

func NewSubscriptionWorker

func NewSubscriptionWorker(s *Service) *SubscriptionWorker

func (*SubscriptionWorker) Init

func (sw *SubscriptionWorker) Init(w *eventline.Worker)

func (*SubscriptionWorker) ProcessJob

func (sw *SubscriptionWorker) ProcessJob() (bool, error)

func (*SubscriptionWorker) Start

func (sw *SubscriptionWorker) Start() error

func (*SubscriptionWorker) Stop

func (sw *SubscriptionWorker) Stop()

type WebContext

type WebContext struct {
	Product          string
	Version          string
	VersionHash      string
	PublicPage       bool
	LoggedIn         bool
	AccountSettings  *eventline.AccountSettings
	ProjectIdChecked bool // true if we have performed project id detection
	ProjectId        *eventline.Id
	ProjectName      string
}

The set of information we inject into every rendered piece of web content. It is available in templates as .Context.

func (*WebContext) FormatAltDate

func (ctx *WebContext) FormatAltDate(t time.Time) (s string)

func (*WebContext) FormatDate

func (ctx *WebContext) FormatDate(t time.Time) (s string)

func (*WebContext) FormatDuration

func (ctx *WebContext) FormatDuration(d time.Duration) (s string)

type WebHTTPServer

type WebHTTPServer struct {
	*HTTPServer

	HTMLTemplate *template.Template
}

func NewWebHTTPServer

func NewWebHTTPServer(service *Service) (*WebHTTPServer, error)

func (*WebHTTPServer) NewTemplate

func (s *WebHTTPServer) NewTemplate(name string, data interface{}) *web.Template

Jump to

Keyboard shortcuts

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