Documentation ¶
Overview ¶
Package medias
Provide API to access medias information
Schemes: http, https
swagger:meta
Index ¶
- Constants
- type Configuration
- type Manager
- func (m *Manager) Activate(media *Media) error
- func (m *Manager) Commit() error
- func (m *Manager) CreateEmpty(owner string) *Media
- func (m *Manager) CreateSaveFileIfNotExist(filePath string, fileName string)
- func (m *Manager) Deactivate(media *Media) error
- func (m *Manager) Delete(media *Media) error
- func (m *Manager) FreePortNumberForPlugin(portNumber int)
- func (m *Manager) Get(idMedia int) (*Media, error)
- func (m *Manager) GetAll() []Media
- func (m *Manager) GetConfig() interface{}
- func (m *Manager) GetConfiguration() *Configuration
- func (m *Manager) GetNextID() int
- func (m *Manager) GetPluginDirectory(media *Media, eltName string, instanceId string) string
- func (m *Manager) GetPortNumberForPlugin() int
- func (m *Manager) GetSaveFilePath() (string, string, string)
- func (m *Manager) LoadFromDB()
- func (m *Manager) RemoveFromDB(media *Media)
- func (m *Manager) SaveIntoDB(media *Media)
- type Media
- type MediaPlugin
- type MediaPluginBackEnd
- type MediaPluginFrontEnd
- type Service
- func (m *Service) ActivateHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) DeactivateHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) DeleteAllHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) DeleteHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) GetAllHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) GetConfigHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) GetHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) GetManager() *Manager
- func (m *Service) GetPluginFilesHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) RestartHandler(w http.ResponseWriter, r *http.Request)
- func (m *Service) SaveHandler(w http.ResponseWriter, r *http.Request)
Constants ¶
const MEDIAS_CONFIG_FILENAME string = "medias.json"
const MEDIAS_CONFIG_PATH string = "data"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { LastID int `json:"lastid"` Medias []Media `json:"medias"` //PortsPool is an array of ports that were used by backends, but now are free (because of a deactivation) PortsPool []int //LastPortUsed is a counter and allow to generate a new free port number NextFreePortNumber int }
MediasConfig encapsulates all configuration data
swagger:model
func NewConfiguration ¶
func NewConfiguration() *Configuration
type Manager ¶
type Manager struct { Config *Configuration // contains filtered or unexported fields }
func NewManager ¶
func (*Manager) CreateEmpty ¶
CreateMedia Create a new Media, save it into memory and commit
func (*Manager) CreateSaveFileIfNotExist ¶
CreateSaveFileIfNotExist check if the save file for medias exists and create it if not.
func (*Manager) Deactivate ¶
func (*Manager) FreePortNumberForPlugin ¶
func (*Manager) GetConfiguration ¶
func (m *Manager) GetConfiguration() *Configuration
func (*Manager) GetPluginDirectory ¶
func (*Manager) GetPortNumberForPlugin ¶
func (*Manager) LoadFromDB ¶
func (m *Manager) LoadFromDB()
LoadMedias loads medias configuration from DB and stor it in memory
func (*Manager) RemoveFromDB ¶
RemoveMedia RemoveFromDB media from memory
func (*Manager) SaveIntoDB ¶
SaveIntoDB saves media information in memory.
type Media ¶
type Media struct { // the id for this media // // required: true // unique: true // min: 1 ID int `json:"id"` Name string `json:"name"` IsActive bool `json:"isactive"` Description string `json:"description"` Rows int `json:"rows"` Cols int `json:"cols"` Stylesvar map[string]interface{} `json:"stylesvar"` Plugins []MediaPlugin `json:"plugins"` Owner string `json:"owner"` ScreenRatio float64 `json:"screenRatio"` DisplayGrid bool `json:"displayGrid"` }
Media represents a media configuration
swagger:model
type MediaPlugin ¶
type MediaPlugin struct { InstanceId string `json:"instanceId"` EltName string `json:"eltName"` FrontEnd *MediaPluginFrontEnd `json:"frontend"` BackEnd *MediaPluginBackEnd `json:"backend"` }
MediaPlugin represents a plugin configuration for the media
Properties and configuration for a plugin used in the media ¶
swagger:model
type MediaPluginBackEnd ¶
type MediaPluginFrontEnd ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) ActivateHandler ¶
func (m *Service) ActivateHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias/{idMedia:[0-9]*}/activate ActivateHandler
If the media was deactivated (IsActive==false), backends for its plugins are started
Schemes: http, https
func (*Service) CreateHandler ¶
func (m *Service) CreateHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias CreateHandler
Gets information of all medias
Produces: - application/json Schemes: http, https
func (*Service) DeactivateHandler ¶
func (m *Service) DeactivateHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias/{idMedia:[0-9]*}/deactivate DeactivateHandler
If the media was activated (IsActive==true), backends for its plugins are stopped
func (*Service) DeleteAllHandler ¶
func (m *Service) DeleteAllHandler(w http.ResponseWriter, r *http.Request)
swagger:route DELETE /medias DeleteAllHandler
Delete all medias
func (*Service) DeleteHandler ¶
func (m *Service) DeleteHandler(w http.ResponseWriter, r *http.Request)
swagger:route DELETE /medias/{idMedia:[0-9]*} DeleteHandler
Delete this media
func (*Service) GetAllHandler ¶
func (m *Service) GetAllHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias GetAllHandler
Gets information of all medias
Produces: - application/json Schemes: http, https
func (*Service) GetConfigHandler ¶
func (m *Service) GetConfigHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias/config GetConfigHandler
Gets information of all medias
Produces: - application/json Schemes: http, https
func (*Service) GetHandler ¶
func (m *Service) GetHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias/{idMedia} GetHandler
Gets information of a media
Produces: - application/json Schemes: http, https
swagger:parameters idMedia
func (*Service) GetManager ¶
func (*Service) GetPluginFilesHandler ¶
func (m *Service) GetPluginFilesHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias{idMedia:[0-9]*}/plugins/{eltName}/{instanceId}/*
Serves static frontend files of the given plugin instance for the given media.
func (*Service) RestartHandler ¶
func (m *Service) RestartHandler(w http.ResponseWriter, r *http.Request)
swagger:route GET /medias/{idMedia:[0-9]*}/restart RestartHandler
restart backends for the plugins of this media
func (*Service) SaveHandler ¶
func (m *Service) SaveHandler(w http.ResponseWriter, r *http.Request)
swagger:route POST /medias SaveHandler
SaveIntoDB a media. If it's an update of an existing media, it will be first deactivated (all plugins stopped)
prior to be activated and saved.
By default, the media will be activated
Consumes: - application/json Schemes: http, https