Project restructure (#18)
* First pass at restructuring the project; untested but it does compile * Restructure builds and runs 🎉 * Add the dist folder to the gitignore * Update core/playlist/monitor.go * golint and reorganize the monitor.go file Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
16
models/chatMessage.go
Normal file
16
models/chatMessage.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
//ChatMessage represents a single chat message
|
||||
type ChatMessage struct {
|
||||
Author string `json:"author"`
|
||||
Body string `json:"body"`
|
||||
Image string `json:"image"`
|
||||
ID string `json:"id"`
|
||||
MessageType string `json:"type"`
|
||||
}
|
||||
|
||||
//String converts the chat message to string
|
||||
//TODO: is this required? or can we remove it
|
||||
func (s ChatMessage) String() string {
|
||||
return s.Author + " says " + s.Body
|
||||
}
|
||||
6
models/pingMessage.go
Normal file
6
models/pingMessage.go
Normal file
@@ -0,0 +1,6 @@
|
||||
package models
|
||||
|
||||
//PingMessage represents a ping message between the client and server
|
||||
type PingMessage struct {
|
||||
MessageType string `json:"type"`
|
||||
}
|
||||
20
models/playlist.go
Normal file
20
models/playlist.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package models
|
||||
|
||||
//Segment represents a segment of the live stream
|
||||
type Segment struct {
|
||||
VariantIndex int // The bitrate variant
|
||||
FullDiskPath string // Where it lives on disk
|
||||
RelativeUploadPath string // Path it should have remotely
|
||||
RemoteID string // Used for IPFS
|
||||
}
|
||||
|
||||
//Variant represents a single bitrate variant and the segments that make it up
|
||||
type Variant struct {
|
||||
VariantIndex int
|
||||
Segments map[string]*Segment
|
||||
}
|
||||
|
||||
//GetSegmentForFilename gets the segment for the provided filename
|
||||
func (v *Variant) GetSegmentForFilename(filename string) *Segment {
|
||||
return v.Segments[filename]
|
||||
}
|
||||
16
models/stats.go
Normal file
16
models/stats.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//Stats holds the stats for the system
|
||||
type Stats struct {
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
LastDisconnectTime time.Time `json:"lastDisconnectTime"`
|
||||
|
||||
StreamConnected bool `json:"-"`
|
||||
LastConnectTime time.Time `json:"-"`
|
||||
Clients map[string]time.Time `json:"-"`
|
||||
}
|
||||
9
models/status.go
Normal file
9
models/status.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package models
|
||||
|
||||
//Status represents the status of the system
|
||||
type Status struct {
|
||||
Online bool `json:"online"`
|
||||
ViewerCount int `json:"viewerCount"`
|
||||
OverallMaxViewerCount int `json:"overallMaxViewerCount"`
|
||||
SessionMaxViewerCount int `json:"sessionMaxViewerCount"`
|
||||
}
|
||||
8
models/storageProvider.go
Normal file
8
models/storageProvider.go
Normal file
@@ -0,0 +1,8 @@
|
||||
package models
|
||||
|
||||
//ChunkStorageProvider is how a chunk storage provider should be implemented
|
||||
type ChunkStorageProvider interface {
|
||||
Setup() error
|
||||
Save(filePath string, retryCount int) (string, error)
|
||||
GenerateRemotePlaylist(playlist string, variant Variant) string
|
||||
}
|
||||
Reference in New Issue
Block a user