fork: retarget psrpc at github.com/hanzokv/go

PSRPC for Hanzo LiveKit, forked from livekit/psrpc (Apache-2.0). Two rewrites:

  github.com/livekit/psrpc      -> github.com/hanzoai/psrpc
  github.com/redis/go-redis/v9  -> github.com/hanzokv/go/v9

psrpc's message bus (bus.go, internal/bus/bus_redis.go, internal/bus/bustest)
speaks to a KV over go-redis. After hanzoai/livekit moved to our client, psrpc
was the one remaining edge pulling upstream go-redis into that binary — not our
code, but our dependency, the same shape redsync had for hanzoai/git.

The other livekit/* modules (protocol, mediatransportutil, mageutil) are NOT
forked and should not be: none of them touch a KV client, so they are ordinary
external dependencies and their names are addresses.
This commit is contained in:
2026-07-26 08:12:46 -07:00
parent ed3af892dd
commit 24eca416c1
63 changed files with 164 additions and 161 deletions
+7 -7
View File
@@ -112,19 +112,19 @@ message MyServerMessage {}
### Generation
Install `protoc-gen-psrpc` by running `go install github.com/livekit/psrpc/protoc-gen-psrpc`.
Install `protoc-gen-psrpc` by running `go install github.com/hanzoai/psrpc/protoc-gen-psrpc`.
If using the custom options above, you'll also need to include [options.proto](protoc-gen-psrpc/options/options.proto).
The simplest way to do this is to include psrpc in your project, then run
```shell
go list -json -m github.com/livekit/psrpc
go list -json -m github.com/hanzoai/psrpc
{
"Path": "github.com/livekit/psrpc",
"Path": "github.com/hanzoai/psrpc",
"Version": "v0.2.2",
"Time": "2022-12-27T21:40:05Z",
"Dir": "/Users/dc/go/pkg/mod/github.com/livekit/[email protected]",
"GoMod": "/Users/dc/go/pkg/mod/cache/download/github.com/livekit/psrpc/@v/v0.2.2.mod",
"Dir": "/Users/dc/go/pkg/mod/github.com/hanzoai/[email protected]",
"GoMod": "/Users/dc/go/pkg/mod/cache/download/github.com/hanzoai/psrpc/@v/v0.2.2.mod",
"GoVersion": "1.20"
}
```
@@ -135,7 +135,7 @@ Use the `--psrpc_out` with `protoc` and include the options directory.
protoc \
--go_out=paths=source_relative:. \
--psrpc_out=paths=source_relative:. \
-I /Users/dc/go/pkg/mod/github.com/livekit/[email protected]/protoc-gen-psrpc/options \
-I /Users/dc/go/pkg/mod/github.com/hanzoai/[email protected]/protoc-gen-psrpc/options \
-I=. my_service.proto
```
@@ -322,7 +322,7 @@ func NewError(code ErrorCode, err error) Error
```
The `code` parameter provides more context about the cause of the error.
A [variety of codes](https://github.com/livekit/psrpc/blob/main/errors.go#L39) are defined for common error conditions.
A [variety of codes](https://github.com/hanzoai/psrpc/blob/main/errors.go#L39) are defined for common error conditions.
PSRPC errors are serialized by the PSRPC server implementation, and unmarshalled (with the original error code) on the client.
By retrieving the code using the `Code()` method, the client can determine if the error was caused by a server failure,
or a client error, such as a bad parameter. This can be used as an input to the retry logic, or success rate metrics.
+2 -2
View File
@@ -16,9 +16,9 @@ package psrpc
import (
"github.com/nats-io/nats.go"
"github.com/redis/go-redis/v9"
"github.com/hanzokv/go/v9"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
type Channel = bus.Channel
+4 -3
View File
@@ -1,16 +1,16 @@
module github.com/livekit/psrpc
module github.com/hanzoai/psrpc
go 1.25.5
go 1.26
require (
github.com/frostbyte73/core v0.1.1
github.com/gammazero/deque v1.2.1
github.com/go-logr/logr v1.4.3
github.com/hanzokv/go/v9 v9.21.1
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
github.com/nats-io/nats.go v1.52.0
github.com/ory/dockertest/v4 v4.0.0
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.20.0
github.com/stretchr/testify v1.11.1
github.com/twitchtv/twirp v8.1.3+incompatible
github.com/zeebo/xxh3 v1.1.0
@@ -32,6 +32,7 @@ require (
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/go-connections v0.7.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
+4 -2
View File
@@ -14,6 +14,8 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
github.com/docker/go-connections v0.7.0 h1:6SsRfJddP22WMrCkj19x9WKjEDTB+ahsdiGYf0mN39c=
@@ -37,6 +39,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hanzokv/go/v9 v9.21.1 h1:MUIAJTV1pI4pkKWSzrgJRzKA7W3aHUJ1WO0mtZRhhPc=
github.com/hanzokv/go/v9 v9.21.1/go.mod h1:GV+nw+jX60sIrJ7LBkmOQw2WASXzkMstt52blcwNw6w=
github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao=
github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
@@ -69,8 +73,6 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.20.0 h1:WnQYxLkgO2xiXTCJY0ldIiI8dNqCDlQAG+AtaH7a2a0=
github.com/redis/go-redis/v9 v9.20.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+2 -2
View File
@@ -23,14 +23,14 @@ import (
"time"
"github.com/gammazero/deque"
"github.com/redis/go-redis/v9"
"github.com/hanzokv/go/v9"
"github.com/zeebo/xxh3"
"go.uber.org/multierr"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc/internal/logger"
"github.com/hanzoai/psrpc/internal/logger"
)
const (
+2 -2
View File
@@ -25,8 +25,8 @@ import (
"go.uber.org/atomic"
"google.golang.org/protobuf/types/known/wrapperspb"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/bus/bustest"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus/bustest"
)
func redisTestChannel(channel string) bus.Channel {
+4 -4
View File
@@ -21,10 +21,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/bus/bustest"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus/bustest"
"github.com/hanzoai/psrpc/pkg/rand"
)
const defaultClientTimeout = time.Second * 3
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"github.com/ory/dockertest/v4"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
var (
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"github.com/ory/dockertest/v4"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
func init() {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"github.com/nats-io/nats.go"
"github.com/ory/dockertest/v4"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
func init() {
+2 -2
View File
@@ -8,9 +8,9 @@ import (
"time"
"github.com/ory/dockertest/v4"
"github.com/redis/go-redis/v9"
"github.com/hanzokv/go/v9"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
func init() {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/anypb"
"github.com/livekit/psrpc/internal"
"github.com/hanzoai/psrpc/internal"
)
func serialize(msg proto.Message, channel string) ([]byte, error) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc/internal"
"github.com/hanzoai/psrpc/internal"
)
func TestSerialization(t *testing.T) {
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/info"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/pkg/info"
)
func ChainClientInterceptors[HandlerType any, InterceptorType ~func(psrpc.RPCInfo, HandlerType) HandlerType](
+4 -4
View File
@@ -23,10 +23,10 @@ import (
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/middleware"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/middleware"
)
func TestInterceptors(t *testing.T) {
+1 -1
View File
@@ -15,7 +15,7 @@
syntax = "proto3";
package internal;
option go_package = "github.com/livekit/psrpc/internal";
option go_package = "github.com/hanzoai/psrpc/internal";
import "google/protobuf/any.proto";
+1 -1
View File
@@ -15,7 +15,7 @@
package stream
import (
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
func getStreamOpts(options psrpc.StreamOpts, opts ...psrpc.StreamOption) psrpc.StreamOpts {
+7 -7
View File
@@ -22,13 +22,13 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/interceptors"
"github.com/livekit/psrpc/internal/logger"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/interceptors"
"github.com/hanzoai/psrpc/internal/logger"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/rand"
)
type Stream[SendType, RecvType proto.Message] interface {
+4 -4
View File
@@ -23,10 +23,10 @@ import (
"go.uber.org/atomic"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/rand"
)
func TestClosePendingSend(t *testing.T) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/twitchtv/twirp"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
func TestAs(t *testing.T) {
+1 -1
View File
@@ -16,7 +16,7 @@ syntax = "proto3";
// Test to make sure that importing other packages doesnt break
package psrpc.internal.test.importable;
option go_package = "github.com/livekit/psrpc/internal/test/importable";
option go_package = "github.com/hanzoai/psrpc/internal/test/importable";
message Msg {}
+1 -1
View File
@@ -23,7 +23,7 @@
package importer
import (
importable "github.com/livekit/psrpc/internal/test/importable"
importable "github.com/hanzoai/psrpc/internal/test/importable"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
+1 -1
View File
@@ -16,7 +16,7 @@ syntax = "proto3";
// Test to make sure that importing other packages doesnt break
package psrpc.internal.test.importer;
option go_package = "github.com/livekit/psrpc/internal/test/importer";
option go_package = "github.com/hanzoai/psrpc/internal/test/importer";
import "importable.proto";
@@ -15,7 +15,7 @@
syntax = "proto3";
package psrpc.internal.test.importer_local;
option go_package = "github.com/livekit/psrpc/internal/test/importer_local";
option go_package = "github.com/hanzoai/psrpc/internal/test/importer_local";
import "importer_local_msgdef.proto";
@@ -15,6 +15,6 @@
syntax = "proto3";
package psrpc.internal.test.importer_local;
option go_package = "github.com/livekit/psrpc/internal/test/importer_local";
option go_package = "github.com/hanzoai/psrpc/internal/test/importer_local";
message Msg {}
+6 -6
View File
@@ -17,16 +17,16 @@ set -euo pipefail
protoc --go_out=. --psrpc_out=. \
--go_opt=paths=source_relative \
--go_opt=My/y.proto=github.com/livekit/psrpc/internal/test/importmapping/y \
--go_opt=My/y.proto=github.com/hanzoai/psrpc/internal/test/importmapping/y \
--psrpc_opt=paths=source_relative \
--psrpc_opt=My/y.proto=github.com/livekit/psrpc/internal/test/importmapping/y \
--psrpc_opt=My/y.proto=github.com/hanzoai/psrpc/internal/test/importmapping/y \
y/y.proto
protoc --go_out=. --psrpc_out=. \
--go_opt=paths=source_relative \
--go_opt=My/y.proto=github.com/livekit/psrpc/internal/test/importmapping/y \
--go_opt=Mx/x.proto=github.com/livekit/psrpc/internal/test/importmapping/x \
--go_opt=My/y.proto=github.com/hanzoai/psrpc/internal/test/importmapping/y \
--go_opt=Mx/x.proto=github.com/hanzoai/psrpc/internal/test/importmapping/x \
--psrpc_opt=paths=source_relative \
--psrpc_opt=My/y.proto=github.com/livekit/psrpc/internal/test/importmapping/y \
--psrpc_opt=Mx/x.proto=github.com/livekit/psrpc/internal/test/importmapping/x \
--psrpc_opt=My/y.proto=github.com/hanzoai/psrpc/internal/test/importmapping/y \
--psrpc_opt=Mx/x.proto=github.com/hanzoai/psrpc/internal/test/importmapping/x \
x/x.proto
+1 -1
View File
@@ -17,7 +17,7 @@
set -euo pipefail
# Pull into variable since both protoc-gen-go and protoc-gen-psrpc need the map.
Y_IMPORT_MAPPING="y/y.proto=github.com/livekit/psrpc/internal/test/importmapping/y"
Y_IMPORT_MAPPING="y/y.proto=github.com/hanzoai/psrpc/internal/test/importmapping/y"
PROTOC_GEN_GO_PARAMS="M${Y_IMPORT_MAPPING}" \
PROTOC_GEN_PSRPC_PARAMS="go_import_mapping@${Y_IMPORT_MAPPING}" \
+1 -1
View File
@@ -21,7 +21,7 @@
package x
import (
y "github.com/livekit/psrpc/internal/test/importmapping/y"
y "github.com/hanzoai/psrpc/internal/test/importmapping/y"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
+1 -1
View File
@@ -21,7 +21,7 @@
package my_service
import (
_ "github.com/livekit/psrpc/protoc-gen-psrpc/options"
_ "github.com/hanzoai/psrpc/protoc-gen-psrpc/options"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
+3 -3
View File
@@ -27,9 +27,9 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/bus/bustest"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus/bustest"
)
func TestGeneratedService(t *testing.T) {
+1 -1
View File
@@ -13,4 +13,4 @@
package no_package_name
//go:generate protoc --go_out=module=github.com/livekit/psrpc/internal/test/no_package_name:. --psrpc_out=module=github.com/livekit/psrpc/internal/test/no_package_name:. no_package_name.proto
//go:generate protoc --go_out=module=github.com/hanzoai/psrpc/internal/test/no_package_name:. --psrpc_out=module=github.com/hanzoai/psrpc/internal/test/no_package_name:. no_package_name.proto
@@ -16,7 +16,7 @@ syntax = "proto3";
// No package name
option go_package = "github.com/livekit/psrpc/internal/test/no_package_name";
option go_package = "github.com/hanzoai/psrpc/internal/test/no_package_name";
message Msg {}
@@ -13,4 +13,4 @@
package no_package_name_importer
//go:generate protoc --proto_path=../ --go_out=module=github.com/livekit/psrpc/internal/test:../ --psrpc_out=module=github.com/livekit/psrpc/internal/test:../ ../no_package_name_importer/no_package_name_importer.proto
//go:generate protoc --proto_path=../ --go_out=module=github.com/hanzoai/psrpc/internal/test:../ --psrpc_out=module=github.com/hanzoai/psrpc/internal/test:../ ../no_package_name_importer/no_package_name_importer.proto
@@ -21,7 +21,7 @@
package no_package_name_importer
import (
no_package_name "github.com/livekit/psrpc/internal/test/no_package_name"
no_package_name "github.com/hanzoai/psrpc/internal/test/no_package_name"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
@@ -18,7 +18,7 @@ syntax = "proto3";
import "no_package_name/no_package_name.proto"; // import is relative to protoc's option --proto_path
option go_package = "github.com/livekit/psrpc/internal/test/no_package_name_importer";
option go_package = "github.com/hanzoai/psrpc/internal/test/no_package_name_importer";
service Svc2 {
rpc Method(Msg) returns (Msg);
+8 -8
View File
@@ -22,14 +22,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/bus/bustest"
"github.com/livekit/psrpc/pkg/client"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/rand"
"github.com/livekit/psrpc/pkg/server"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus/bustest"
"github.com/hanzoai/psrpc/pkg/client"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/rand"
"github.com/hanzoai/psrpc/pkg/server"
)
func TestRPC(t *testing.T) {
+1 -1
View File
@@ -17,7 +17,7 @@ package psrpc
import (
"github.com/go-logr/logr"
"github.com/livekit/psrpc/internal/logger"
"github.com/hanzoai/psrpc/internal/logger"
)
func SetLogger(l logr.Logger) {
+4 -4
View File
@@ -20,10 +20,10 @@ import (
"github.com/frostbyte73/core"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/pkg/info"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/pkg/info"
)
type RPCClient struct {
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
)
func TestAffinity(t *testing.T) {
+7 -7
View File
@@ -20,13 +20,13 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/interceptors"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/interceptors"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc/pkg/rand"
)
func RequestMulti[ResponseType proto.Message](
+3 -3
View File
@@ -19,9 +19,9 @@ import (
"fmt"
"time"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/pkg/info"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/pkg/info"
)
func withStreams() psrpc.ClientOption {
+7 -7
View File
@@ -21,13 +21,13 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/interceptors"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/interceptors"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc/pkg/rand"
)
func RequestSingle[ResponseType proto.Message](
+7 -7
View File
@@ -21,13 +21,13 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/logger"
"github.com/livekit/psrpc/internal/stream"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/livekit/psrpc/pkg/rand"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/logger"
"github.com/hanzoai/psrpc/internal/stream"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc/pkg/rand"
)
func OpenStream[SendType, RecvType proto.Message](
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
)
func Join[ResponseType proto.Message](
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"sync"
"unicode"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
const lowerHex = "0123456789abcdef"
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
func TestChannelFormatters(t *testing.T) {
+1 -1
View File
@@ -17,7 +17,7 @@ package info
import (
"sync"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
type ServiceDefinition struct {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"go.uber.org/atomic"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
type MetricRole int
+4 -4
View File
@@ -13,9 +13,9 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/livekit/psrpc/version"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc/version"
)
type Config struct {
@@ -34,7 +34,7 @@ func (c *Config) defaults() {
func (c *Config) getTracer() trace.Tracer {
return c.TracerProvider.Tracer(
"github.com/livekit/psrpc",
"github.com/hanzoai/psrpc",
trace.WithInstrumentationVersion(version.Version),
)
}
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
// Recover from server panics. Should always be the last interceptor
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
type RetryOptions struct {
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/hanzoai/psrpc"
)
func TestIsTimeout(t *testing.T) {
+3 -3
View File
@@ -15,9 +15,9 @@
package server
import (
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/interceptors"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/interceptors"
)
func getServerOpts(opts ...psrpc.ServerOption) psrpc.ServerOpts {
+6 -6
View File
@@ -24,12 +24,12 @@ import (
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/logger"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/logger"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/metadata"
)
type AffinityFunc[RequestType proto.Message] func(context.Context, RequestType) float32
+3 -3
View File
@@ -23,9 +23,9 @@ import (
"golang.org/x/exp/maps"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/pkg/info"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/pkg/info"
)
type rpcHandler interface {
+7 -7
View File
@@ -23,13 +23,13 @@ import (
"golang.org/x/exp/maps"
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal"
"github.com/livekit/psrpc/internal/bus"
"github.com/livekit/psrpc/internal/logger"
"github.com/livekit/psrpc/internal/stream"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/metadata"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal"
"github.com/hanzoai/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/logger"
"github.com/hanzoai/psrpc/internal/stream"
"github.com/hanzoai/psrpc/pkg/info"
"github.com/hanzoai/psrpc/pkg/metadata"
)
type StreamAffinityFunc func(ctx context.Context) float32
+11 -11
View File
@@ -34,11 +34,11 @@ import (
descriptor "google.golang.org/protobuf/types/descriptorpb"
plugin "google.golang.org/protobuf/types/pluginpb"
"github.com/livekit/psrpc/protoc-gen-psrpc/internal/gen"
"github.com/livekit/psrpc/protoc-gen-psrpc/internal/gen/stringutils"
"github.com/livekit/psrpc/protoc-gen-psrpc/internal/gen/typemap"
"github.com/livekit/psrpc/protoc-gen-psrpc/options"
"github.com/livekit/psrpc/version"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/internal/gen"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/internal/gen/stringutils"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/internal/gen/typemap"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/options"
"github.com/hanzoai/psrpc/version"
)
type psrpc struct {
@@ -276,12 +276,12 @@ func (t *psrpc) generateImports(file *descriptor.FileDescriptorProto) {
}
// dependency imports
t.P(` "github.com/livekit/psrpc"`)
t.P(` "github.com/livekit/psrpc/pkg/client"`)
t.P(` "github.com/livekit/psrpc/pkg/info"`)
t.P(` "github.com/livekit/psrpc/pkg/rand"`)
t.P(` "github.com/livekit/psrpc/pkg/server"`)
t.P(` "github.com/livekit/psrpc/version"`)
t.P(` "github.com/hanzoai/psrpc"`)
t.P(` "github.com/hanzoai/psrpc/pkg/client"`)
t.P(` "github.com/hanzoai/psrpc/pkg/info"`)
t.P(` "github.com/hanzoai/psrpc/pkg/rand"`)
t.P(` "github.com/hanzoai/psrpc/pkg/server"`)
t.P(` "github.com/hanzoai/psrpc/version"`)
t.P(`)`)
// It's legal to import a message and use it as an input or output for a
+1 -1
View File
@@ -19,7 +19,7 @@ import (
descriptor "google.golang.org/protobuf/types/descriptorpb"
"github.com/livekit/psrpc/protoc-gen-psrpc/internal/gen/stringutils"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/internal/gen/stringutils"
)
// goPackageOption interprets the file's go_package option.
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"fmt"
"os"
"github.com/livekit/psrpc/protoc-gen-psrpc/internal/gen"
"github.com/livekit/psrpc/version"
"github.com/hanzoai/psrpc/protoc-gen-psrpc/internal/gen"
"github.com/hanzoai/psrpc/version"
)
func main() {
+1 -1
View File
@@ -15,7 +15,7 @@
syntax = "proto3";
package psrpc;
option go_package = "github.com/livekit/psrpc/protoc-gen-psrpc/options";
option go_package = "github.com/hanzoai/psrpc/protoc-gen-psrpc/options";
import "google/protobuf/descriptor.proto";
+2 -2
View File
@@ -15,8 +15,8 @@
package testutils
import (
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc"
"github.com/hanzoai/psrpc/internal/bus"
)
type Channel = bus.Channel
+1 -1
View File
@@ -15,7 +15,7 @@
syntax = "proto3";
package testutils;
option go_package = "github.com/livekit/psrpc/testutils";
option go_package = "github.com/hanzoai/psrpc/testutils";
message LaggyMessage {
string origin = 1;
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"google.golang.org/protobuf/proto"
"github.com/livekit/psrpc/internal/bus"
"github.com/hanzoai/psrpc/internal/bus"
)
type Subscription[MessageType proto.Message] bus.Subscription[MessageType]