utils

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const AttributeAgentName = "lk.agent.name"

Variables

View Source
var ErrConnectionPoolNoConnect = errors.New("connection pool requires a connect callback")

Functions

func CamelToSnakeCase added in v0.0.15

func CamelToSnakeCase(name string) string

func IsCloud added in v0.0.15

func IsCloud(rawURL string) bool

func IsDevMode added in v0.0.15

func IsDevMode() bool

func IsHosted added in v0.0.15

func IsHosted() bool

func NodeName added in v0.0.15

func NodeName() string

func WaitForAgent

func WaitForAgent(ctx context.Context, room *lksdk.Room, agentName ...string) (*lksdk.RemoteParticipant, error)

func WaitForParticipant

func WaitForParticipant(ctx context.Context, room *lksdk.Room, identity string, kinds ...livekit.ParticipantInfo_Kind) (*lksdk.RemoteParticipant, error)

func WaitForParticipantAttribute added in v0.0.15

func WaitForParticipantAttribute(ctx context.Context, room *lksdk.Room, identity string, attribute string, value string) error

func WaitForTrackPublication

func WaitForTrackPublication(ctx context.Context, room *lksdk.Room, identity string, kinds ...livekit.TrackType) (*lksdk.RemoteTrackPublication, error)

func WaitForTrackPublicationWithOptions added in v0.0.15

func WaitForTrackPublicationWithOptions(ctx context.Context, room *lksdk.Room, options TrackPublicationWaitOptions) (*lksdk.RemoteTrackPublication, error)

Types

type BoundedDict

type BoundedDict[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewBoundedDict

func NewBoundedDict[K comparable, V any](maxSize int) *BoundedDict[K, V]

func (*BoundedDict[K, V]) Get

func (c *BoundedDict[K, V]) Get(key K) (V, bool)

func (*BoundedDict[K, V]) PopIf added in v0.0.15

func (c *BoundedDict[K, V]) PopIf(predicate func(V) bool) (K, V, bool)

func (*BoundedDict[K, V]) Set

func (c *BoundedDict[K, V]) Set(key K, value V)

func (*BoundedDict[K, V]) SetOrUpdate added in v0.0.15

func (c *BoundedDict[K, V]) SetOrUpdate(key K, factory func() V, update func(V) V) V

func (*BoundedDict[K, V]) UpdateValue added in v0.0.15

func (c *BoundedDict[K, V]) UpdateValue(key K, update func(V) V) (V, bool)

type ConnectionPool added in v0.0.15

type ConnectionPool[T comparable] struct {
	LastAcquireTime      time.Duration
	LastConnectionReused bool
	// contains filtered or unexported fields
}

func NewConnectionPool added in v0.0.15

func NewConnectionPool[T comparable](opts ConnectionPoolOptions[T]) *ConnectionPool[T]

func (*ConnectionPool[T]) Close added in v0.0.15

func (p *ConnectionPool[T]) Close(ctx context.Context) error

func (*ConnectionPool[T]) Get added in v0.0.15

func (p *ConnectionPool[T]) Get(ctx context.Context, timeout time.Duration) (T, error)

func (*ConnectionPool[T]) Invalidate added in v0.0.15

func (p *ConnectionPool[T]) Invalidate()

func (*ConnectionPool[T]) Prewarm added in v0.0.15

func (p *ConnectionPool[T]) Prewarm(ctx context.Context)

func (*ConnectionPool[T]) Put added in v0.0.15

func (p *ConnectionPool[T]) Put(conn T)

func (*ConnectionPool[T]) Remove added in v0.0.15

func (p *ConnectionPool[T]) Remove(conn T)

func (*ConnectionPool[T]) WithConnection added in v0.0.15

func (p *ConnectionPool[T]) WithConnection(ctx context.Context, timeout time.Duration, fn func(T) error) error

type ConnectionPoolOptions added in v0.0.15

type ConnectionPoolOptions[T comparable] struct {
	MaxSessionDuration time.Duration
	MarkRefreshedOnGet bool
	ConnectTimeout     time.Duration
	Connect            func(context.Context) (T, error)
	Close              func(context.Context, T) error
}

type TrackPublicationWaitOptions added in v0.0.15

type TrackPublicationWaitOptions struct {
	Identity            string
	Kinds               []livekit.TrackType
	WaitForSubscription bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL