refactor: consistent naming
This commit is contained in:
parent
0fbbe25e1b
commit
5735b2d73a
@ -64,7 +64,7 @@ func Run(ctx context.Context, params RunParams) error {
|
|||||||
updateUI := func() { ui.SetState(*state) }
|
updateUI := func() { ui.SetState(*state) }
|
||||||
updateUI()
|
updateUI()
|
||||||
|
|
||||||
srv, err := mediaserver.NewActor(ctx, mediaserver.StartActorParams{
|
srv, err := mediaserver.NewActor(ctx, mediaserver.NewActorParams{
|
||||||
StreamKey: mediaserver.StreamKey(cfg.Sources.RTMP.StreamKey),
|
StreamKey: mediaserver.StreamKey(cfg.Sources.RTMP.StreamKey),
|
||||||
ContainerClient: containerClient,
|
ContainerClient: containerClient,
|
||||||
Logger: logger.With("component", "mediaserver"),
|
Logger: logger.With("component", "mediaserver"),
|
||||||
@ -74,7 +74,7 @@ func Run(ctx context.Context, params RunParams) error {
|
|||||||
}
|
}
|
||||||
defer srv.Close()
|
defer srv.Close()
|
||||||
|
|
||||||
repl := replicator.StartActor(ctx, replicator.NewActorParams{
|
repl := replicator.StartActor(ctx, replicator.StartActorParams{
|
||||||
SourceURL: srv.RTMPInternalURL(),
|
SourceURL: srv.RTMPInternalURL(),
|
||||||
ContainerClient: containerClient,
|
ContainerClient: containerClient,
|
||||||
Logger: logger.With("component", "replicator"),
|
Logger: logger.With("component", "replicator"),
|
||||||
|
@ -59,9 +59,9 @@ type Actor struct {
|
|||||||
state *domain.Source
|
state *domain.Source
|
||||||
}
|
}
|
||||||
|
|
||||||
// StartActorParams contains the parameters for starting a new media server
|
// NewActorParams contains the parameters for building a new media server
|
||||||
// actor.
|
// actor.
|
||||||
type StartActorParams struct {
|
type NewActorParams struct {
|
||||||
APIPort int // defaults to 9997
|
APIPort int // defaults to 9997
|
||||||
RTMPPort int // defaults to 1935
|
RTMPPort int // defaults to 1935
|
||||||
StreamKey StreamKey // defaults to "live"
|
StreamKey StreamKey // defaults to "live"
|
||||||
@ -74,7 +74,7 @@ type StartActorParams struct {
|
|||||||
// NewActor creates a new media server actor.
|
// NewActor creates a new media server actor.
|
||||||
//
|
//
|
||||||
// Callers must consume the state channel exposed via [C].
|
// Callers must consume the state channel exposed via [C].
|
||||||
func NewActor(ctx context.Context, params StartActorParams) (_ *Actor, err error) {
|
func NewActor(ctx context.Context, params NewActorParams) (_ *Actor, err error) {
|
||||||
tlsCert, tlsKey, err := generateTLSCert()
|
tlsCert, tlsKey, err := generateTLSCert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("generate TLS cert: %w", err)
|
return nil, fmt.Errorf("generate TLS cert: %w", err)
|
||||||
|
@ -43,12 +43,13 @@ type Actor struct {
|
|||||||
stateC chan State
|
stateC chan State
|
||||||
|
|
||||||
// mutable state
|
// mutable state
|
||||||
|
|
||||||
currURLs map[string]struct{}
|
currURLs map[string]struct{}
|
||||||
nextIndex int
|
nextIndex int
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewActorParams contains the parameters for starting a new replicator actor.
|
// StartActorParams contains the parameters for starting a new replicator actor.
|
||||||
type NewActorParams struct {
|
type StartActorParams struct {
|
||||||
SourceURL string
|
SourceURL string
|
||||||
ChanSize int
|
ChanSize int
|
||||||
ContainerClient *container.Client
|
ContainerClient *container.Client
|
||||||
@ -58,7 +59,7 @@ type NewActorParams struct {
|
|||||||
// StartActor starts a new replicator actor.
|
// StartActor starts a new replicator actor.
|
||||||
//
|
//
|
||||||
// The channel exposed by [C] must be consumed by the caller.
|
// The channel exposed by [C] must be consumed by the caller.
|
||||||
func StartActor(ctx context.Context, params NewActorParams) *Actor {
|
func StartActor(ctx context.Context, params StartActorParams) *Actor {
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
|
|
||||||
actor := &Actor{
|
actor := &Actor{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user