mirror of
https://github.com/hanzoai/livekit.git
synced 2026-10-30 18:29:34 +00:00
livekit cannot use github.com/hanzokv/go, for a structural reason rather than a
stylistic one: the client type flows through two upstream libraries we do not
fork. livekit/protocol/redis.GetRedisClient PRODUCES a
github.com/redis/go-redis/v9.UniversalClient and livekit/psrpc CONSUMES one, so
substituting the client in the middle fails to type-check at both seams:
cannot use redis2.GetRedisClient(&conf.Redis) (go-redis UniversalClient)
as kv.UniversalClient in return statement
cannot use rc (kv.UniversalClient)
as go-redis UniversalClient in argument to psrpc.NewRedisMessageBus
Forking psrpc made it worse rather than better: livekit/protocol/rpc demands
livekit/psrpc's OWN types, so pointing at hanzoai/psrpc broke pkg/agent, which
had compiled. Verified by building pkg/agent at the commit before the fork
(compiles) and after (2 type errors) with a working SDKROOT — an earlier check
of mine reported "compiles in both" and was simply wrong.
So this repo keeps upstream go-redis and upstream psrpc (v0.7.1). That is the
honest consequence of livekit/protocol being unforkable: you cannot substitute a
client library inside a module whose upstream dependencies both produce and
consume that library's types.
What stays, because it is correct and independent: the module path
(github.com/hanzoai/livekit, which this fork now actually declares) and the
luxfi/metric repair in the parent commit that made this repo build at all.
152 lines
4.5 KiB
Go
152 lines
4.5 KiB
Go
// Code generated by counterfeiter. DO NOT EDIT.
|
|
package routingfakes
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
|
|
"github.com/hanzoai/livekit/pkg/routing"
|
|
"github.com/livekit/protocol/livekit"
|
|
"github.com/livekit/psrpc"
|
|
)
|
|
|
|
type FakeRoomManagerClient struct {
|
|
CloseStub func()
|
|
closeMutex sync.RWMutex
|
|
closeArgsForCall []struct {
|
|
}
|
|
CreateRoomStub func(context.Context, livekit.NodeID, *livekit.CreateRoomRequest, ...psrpc.RequestOption) (*livekit.Room, error)
|
|
createRoomMutex sync.RWMutex
|
|
createRoomArgsForCall []struct {
|
|
arg1 context.Context
|
|
arg2 livekit.NodeID
|
|
arg3 *livekit.CreateRoomRequest
|
|
arg4 []psrpc.RequestOption
|
|
}
|
|
createRoomReturns struct {
|
|
result1 *livekit.Room
|
|
result2 error
|
|
}
|
|
createRoomReturnsOnCall map[int]struct {
|
|
result1 *livekit.Room
|
|
result2 error
|
|
}
|
|
invocations map[string][][]interface{}
|
|
invocationsMutex sync.RWMutex
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) Close() {
|
|
fake.closeMutex.Lock()
|
|
fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
|
|
}{})
|
|
stub := fake.CloseStub
|
|
fake.recordInvocation("Close", []interface{}{})
|
|
fake.closeMutex.Unlock()
|
|
if stub != nil {
|
|
fake.CloseStub()
|
|
}
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CloseCallCount() int {
|
|
fake.closeMutex.RLock()
|
|
defer fake.closeMutex.RUnlock()
|
|
return len(fake.closeArgsForCall)
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CloseCalls(stub func()) {
|
|
fake.closeMutex.Lock()
|
|
defer fake.closeMutex.Unlock()
|
|
fake.CloseStub = stub
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoom(arg1 context.Context, arg2 livekit.NodeID, arg3 *livekit.CreateRoomRequest, arg4 ...psrpc.RequestOption) (*livekit.Room, error) {
|
|
fake.createRoomMutex.Lock()
|
|
ret, specificReturn := fake.createRoomReturnsOnCall[len(fake.createRoomArgsForCall)]
|
|
fake.createRoomArgsForCall = append(fake.createRoomArgsForCall, struct {
|
|
arg1 context.Context
|
|
arg2 livekit.NodeID
|
|
arg3 *livekit.CreateRoomRequest
|
|
arg4 []psrpc.RequestOption
|
|
}{arg1, arg2, arg3, arg4})
|
|
stub := fake.CreateRoomStub
|
|
fakeReturns := fake.createRoomReturns
|
|
fake.recordInvocation("CreateRoom", []interface{}{arg1, arg2, arg3, arg4})
|
|
fake.createRoomMutex.Unlock()
|
|
if stub != nil {
|
|
return stub(arg1, arg2, arg3, arg4...)
|
|
}
|
|
if specificReturn {
|
|
return ret.result1, ret.result2
|
|
}
|
|
return fakeReturns.result1, fakeReturns.result2
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoomCallCount() int {
|
|
fake.createRoomMutex.RLock()
|
|
defer fake.createRoomMutex.RUnlock()
|
|
return len(fake.createRoomArgsForCall)
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoomCalls(stub func(context.Context, livekit.NodeID, *livekit.CreateRoomRequest, ...psrpc.RequestOption) (*livekit.Room, error)) {
|
|
fake.createRoomMutex.Lock()
|
|
defer fake.createRoomMutex.Unlock()
|
|
fake.CreateRoomStub = stub
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoomArgsForCall(i int) (context.Context, livekit.NodeID, *livekit.CreateRoomRequest, []psrpc.RequestOption) {
|
|
fake.createRoomMutex.RLock()
|
|
defer fake.createRoomMutex.RUnlock()
|
|
argsForCall := fake.createRoomArgsForCall[i]
|
|
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoomReturns(result1 *livekit.Room, result2 error) {
|
|
fake.createRoomMutex.Lock()
|
|
defer fake.createRoomMutex.Unlock()
|
|
fake.CreateRoomStub = nil
|
|
fake.createRoomReturns = struct {
|
|
result1 *livekit.Room
|
|
result2 error
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) CreateRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
|
fake.createRoomMutex.Lock()
|
|
defer fake.createRoomMutex.Unlock()
|
|
fake.CreateRoomStub = nil
|
|
if fake.createRoomReturnsOnCall == nil {
|
|
fake.createRoomReturnsOnCall = make(map[int]struct {
|
|
result1 *livekit.Room
|
|
result2 error
|
|
})
|
|
}
|
|
fake.createRoomReturnsOnCall[i] = struct {
|
|
result1 *livekit.Room
|
|
result2 error
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) Invocations() map[string][][]interface{} {
|
|
fake.invocationsMutex.RLock()
|
|
defer fake.invocationsMutex.RUnlock()
|
|
copiedInvocations := map[string][][]interface{}{}
|
|
for key, value := range fake.invocations {
|
|
copiedInvocations[key] = value
|
|
}
|
|
return copiedInvocations
|
|
}
|
|
|
|
func (fake *FakeRoomManagerClient) recordInvocation(key string, args []interface{}) {
|
|
fake.invocationsMutex.Lock()
|
|
defer fake.invocationsMutex.Unlock()
|
|
if fake.invocations == nil {
|
|
fake.invocations = map[string][][]interface{}{}
|
|
}
|
|
if fake.invocations[key] == nil {
|
|
fake.invocations[key] = [][]interface{}{}
|
|
}
|
|
fake.invocations[key] = append(fake.invocations[key], args)
|
|
}
|
|
|
|
var _ routing.RoomManagerClient = new(FakeRoomManagerClient)
|