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()
|
||||
|
||||
srv, err := mediaserver.NewActor(ctx, mediaserver.StartActorParams{
|
||||
srv, err := mediaserver.NewActor(ctx, mediaserver.NewActorParams{
|
||||
StreamKey: mediaserver.StreamKey(cfg.Sources.RTMP.StreamKey),
|
||||
ContainerClient: containerClient,
|
||||
Logger: logger.With("component", "mediaserver"),
|
||||
@ -74,7 +74,7 @@ func Run(ctx context.Context, params RunParams) error {
|
||||
}
|
||||
defer srv.Close()
|
||||
|
||||
repl := replicator.StartActor(ctx, replicator.NewActorParams{
|
||||
repl := replicator.StartActor(ctx, replicator.StartActorParams{
|
||||
SourceURL: srv.RTMPInternalURL(),
|
||||
ContainerClient: containerClient,
|
||||
Logger: logger.With("component", "replicator"),
|
||||
|
@ -59,9 +59,9 @@ type Actor struct {
|
||||
state *domain.Source
|
||||
}
|
||||
|
||||
// StartActorParams contains the parameters for starting a new media server
|
||||
// NewActorParams contains the parameters for building a new media server
|
||||
// actor.
|
||||
type StartActorParams struct {
|
||||
type NewActorParams struct {
|
||||
APIPort int // defaults to 9997
|
||||
RTMPPort int // defaults to 1935
|
||||
StreamKey StreamKey // defaults to "live"
|
||||
@ -74,7 +74,7 @@ type StartActorParams struct {
|
||||
// NewActor creates a new media server actor.
|
||||
//
|
||||
// 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()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("generate TLS cert: %w", err)
|
||||
|
@ -43,12 +43,13 @@ type Actor struct {
|
||||
stateC chan State
|
||||
|
||||
// mutable state
|
||||
|
||||
currURLs map[string]struct{}
|
||||
nextIndex int
|
||||
}
|
||||
|
||||
// NewActorParams contains the parameters for starting a new replicator actor.
|
||||
type NewActorParams struct {
|
||||
// StartActorParams contains the parameters for starting a new replicator actor.
|
||||
type StartActorParams struct {
|
||||
SourceURL string
|
||||
ChanSize int
|
||||
ContainerClient *container.Client
|
||||
@ -58,7 +59,7 @@ type NewActorParams struct {
|
||||
// StartActor starts a new replicator actor.
|
||||
//
|
||||
// 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)
|
||||
|
||||
actor := &Actor{
|
||||
|
Loading…
x
Reference in New Issue
Block a user