go is now enforcing that internal packages must stay internal, so we need a nodep version of //grpc's client functionality for ephs libs
importpath = "go.fuhry.dev/runtime/ephs",
visibility = ["//visibility:public"],
deps = [
- "//grpc/internal/client",
- "//grpc/internal/common",
+ "//grpc/client_nodep",
"//mtls",
"//proto/service/ephs",
"//utils/context",
"time"
"github.com/quic-go/quic-go"
- grpc "go.fuhry.dev/runtime/grpc/internal/client"
- grpc_common "go.fuhry.dev/runtime/grpc/internal/common"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/status"
+
+ grpc "go.fuhry.dev/runtime/grpc/client_nodep"
"go.fuhry.dev/runtime/mtls"
ephs_pb "go.fuhry.dev/runtime/proto/service/ephs"
"go.fuhry.dev/runtime/utils/context"
"go.fuhry.dev/runtime/utils/log"
"go.fuhry.dev/runtime/utils/option"
- "google.golang.org/grpc/codes"
- "google.golang.org/grpc/status"
)
-const KeyPrefix = "/ephs/"
-const PathSeparator = "/"
-const ChunkSize = 262144
+const (
+ KeyPrefix = "/ephs/"
+ PathSeparator = "/"
+ ChunkSize = 262144
+)
const formatEntryDateFormat = "Monday, 2 Jan 2006 15:04:05 -0700"
var defaultClientAddr string
-var defaultClient Client
-var defaultClientMu sync.Mutex
+var (
+ defaultClient Client
+ defaultClientMu sync.Mutex
+)
type notFoundError struct {
ephsPath string
defaultTimeout: 15 * time.Second,
id: localId,
grpcOpts: []grpc.ClientOption{
- grpc.WithConnectionFactory(&grpc_common.QUICConnectionFactory{
+ grpc.WithConnectionFactory(&grpc.QUICConnectionFactory{
QUICConfig: ephsQuicConfig.Clone(),
}),
},
--- /dev/null
+load("//bazel:go.bzl", "go_multi_library")
+
+go_multi_library(
+ name = "client_nodep",
+ srcs = ["imports.go"],
+ importpath = "go.fuhry.dev/runtime/grpc/client_nodep",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//grpc/internal/client",
+ "//grpc/internal/common",
+ ],
+)
--- /dev/null
+package client_nodep
+
+import (
+ "go.fuhry.dev/runtime/grpc/internal/client"
+ "go.fuhry.dev/runtime/grpc/internal/common"
+)
+
+// type aliases: common
+type (
+ ConnectionFactory = common.ConnectionFactory
+ ContextDialer = common.ContextDialer
+ QUICConnectionFactory = common.QUICConnectionFactory
+ TCPConnectionFactory = common.TCPConnectionFactory
+)
+
+// type aliases: client
+type (
+ Client = client.Client
+ ClientOption = client.ClientOption
+ AddressProvider = client.AddressProvider
+ ClientConn = client.ClientConn
+)
+
+// function aliases: common
+var (
+ NewDefaultConnectionFactory = common.NewDefaultConnectionFactory
+ RegisterTransport = common.RegisterTransport
+)
+
+// function aliases: client
+var (
+ WithConnectionFactory = client.WithConnectionFactory
+ WithAddressProvider = client.WithAddressProvider
+ WithStaticAddress = client.WithStaticAddress
+ WithDNSSRV = client.WithDNSSRV
+)
+
+var NewGrpcClient = client.NewGrpcClient