Documentation ¶
Overview ¶
Package server describes all server-side operations.
Package server describes all server-side operations.
Index ¶
- func IsRunning(conf *config.Opts) (bool, error)
- func RegisterOperation(name string, operation Operation)
- func Run(conf *config.Opts) error
- func StartInBackground(conf *config.Opts) (int, error)
- type Notification
- type NotificationListener
- type Operation
- type Request
- type Server
- func (s *Server) Answer(req *Request, resp msg.Response) error
- func (s *Server) Dispatch(req *Request) error
- func (s *Server) InitiateShutdown()
- func (s *Server) RegisterListener(req *Request) (NotificationListener, error)
- func (s *Server) SaveTask(task msg.Task) error
- func (s *Server) SetActiveTask(taskName string)
- func (s *Server) StopCurrentTask() (msg.Task, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterOperation ¶
Types ¶
type Notification ¶
type Notification struct { Task string `json:"task"` // The name of the task; empty if idle Since time.Time `json:"since"` // Time of the last status change, formatted }
The notification to send to listeners.
func TaskNotification ¶
func TaskNotification(t msg.Task) Notification
A notification about a task, presumed to be the currently set one. If the task has been stopped, it sends an empty task name, signalling idle state.
type NotificationListener ¶
type NotificationListener struct {
// contains filtered or unexported fields
}
An entity awaiting notifications about task changes.
func (*NotificationListener) Notify ¶
func (lst *NotificationListener) Notify(ntf Notification) error
Notify this listener.
type Server ¶
type Server struct { Backend backend.Backend // The database backend CurrentTask msg.Task // The currently active task, if any // contains filtered or unexported fields }
A tilo Server. When the configuration is provided, the remaining fields are filled by the .init() method.
func (*Server) InitiateShutdown ¶
func (s *Server) InitiateShutdown()
Initiate the server to shut down, accepting no further connections.
func (*Server) RegisterListener ¶
func (s *Server) RegisterListener(req *Request) (NotificationListener, error)
Register the listener with the server. If it cannot be notified immediately, an error is returned.
func (*Server) SetActiveTask ¶
Change the server's current task.