Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulwe committed Sep 21, 2024
1 parent e467087 commit 0f2dd35
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions rpc/typed_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils/must"
"github.com/livekit/protocol/utils/options"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/middleware"
)
Expand Down Expand Up @@ -84,26 +83,18 @@ func (p *ClientParams) Options() []psrpc.ClientOption {
}

func (p *ClientParams) Args() (psrpc.MessageBus, psrpc.ClientOption) {
return p.Bus, WithClientOptions(p.Options()...)
}

func WithClientOptions(opts ...psrpc.ClientOption) psrpc.ClientOption {
return func(o *psrpc.ClientOpts) { options.Apply(o, opts) }
}

func WithServerOptions(opts ...psrpc.ServerOption) psrpc.ServerOption {
return func(o *psrpc.ServerOpts) { options.Apply(o, opts) }
return p.Bus, psrpc.WithClientOptions(p.Options()...)
}

func WithServerObservability(logger logger.Logger) psrpc.ServerOption {
return WithServerOptions(
return psrpc.WithServerOptions(
middleware.WithServerMetrics(PSRPCMetricsObserver{}),
WithServerLogger(logger),
)
}

func WithDefaultServerOptions(psrpcConfig PSRPCConfig, logger logger.Logger) psrpc.ServerOption {
return WithServerOptions(
return psrpc.WithServerOptions(
psrpc.WithServerChannelSize(psrpcConfig.BufferSize),
WithServerObservability(logger),
)
Expand Down

0 comments on commit 0f2dd35

Please sign in to comment.