mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +08:00

Commits (Ingo Oppermann): - Add experimental SRT connection stats and logs - Hide /config/reload endpoint in reade-only mode - Add SRT server - Create v16 in go.mod - Fix data races, tests, lint, and update dependencies - Add trailing slash for routed directories (datarhei/restreamer#340) - Allow relative URLs in content in static routes Co-Authored-By: Ingo Oppermann <57445+ioppermann@users.noreply.github.com>
50 lines
891 B
Go
50 lines
891 B
Go
package store
|
|
|
|
import (
|
|
"github.com/datarhei/core/v16/restream/app"
|
|
)
|
|
|
|
type StoreData struct {
|
|
Version uint64 `json:"version"`
|
|
|
|
Process map[string]*app.Process `json:"process"`
|
|
Metadata struct {
|
|
System map[string]interface{} `json:"system"`
|
|
Process map[string]map[string]interface{} `json:"process"`
|
|
} `json:"metadata"`
|
|
}
|
|
|
|
func NewStoreData() StoreData {
|
|
c := StoreData{
|
|
Version: 4,
|
|
}
|
|
|
|
c.Process = make(map[string]*app.Process)
|
|
c.Metadata.System = make(map[string]interface{})
|
|
c.Metadata.Process = make(map[string]map[string]interface{})
|
|
|
|
return c
|
|
}
|
|
|
|
func (c *StoreData) IsEmpty() bool {
|
|
if len(c.Process) != 0 {
|
|
return false
|
|
}
|
|
|
|
if len(c.Metadata.Process) != 0 {
|
|
return false
|
|
}
|
|
|
|
if len(c.Metadata.System) != 0 {
|
|
return false
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func (c *StoreData) sanitize() {
|
|
if c.Process == nil {
|
|
c.Process = make(map[string]*app.Process)
|
|
}
|
|
}
|