grpc connection to filer add sw-client-id header
This commit is contained in:
@@ -92,7 +92,7 @@ func (r *Replicator) Replicate(ctx context.Context, key string, message *filer_p
|
||||
}
|
||||
|
||||
func ReadFilerSignature(grpcDialOption grpc.DialOption, filer pb.ServerAddress) (filerSignature int32, readErr error) {
|
||||
if readErr = pb.WithFilerClient(false, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
if readErr = pb.WithFilerClient(false, 0, filer, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
if resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{}); err != nil {
|
||||
return fmt.Errorf("GetFilerConfiguration %s: %v", filer, err)
|
||||
} else {
|
||||
|
||||
@@ -135,7 +135,7 @@ var _ = filer_pb.FilerClient(&FilerSink{})
|
||||
|
||||
func (fs *FilerSink) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
|
||||
return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {
|
||||
return pb.WithGrpcClient(streamingMode, fs.signature, func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
return fn(client)
|
||||
}, fs.grpcAddress, false, fs.grpcDialOption)
|
||||
|
||||
@@ -33,6 +33,7 @@ type FilerSink struct {
|
||||
writeChunkByFiler bool
|
||||
isIncremental bool
|
||||
executor *util.LimitedConcurrentExecutor
|
||||
signature int32
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -54,6 +55,7 @@ func (fs *FilerSink) IsIncremental() bool {
|
||||
func (fs *FilerSink) Initialize(configuration util.Configuration, prefix string) error {
|
||||
fs.isIncremental = configuration.GetBool(prefix + "is_incremental")
|
||||
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
||||
fs.signature = util.RandomInt32()
|
||||
return fs.DoInitialize(
|
||||
"",
|
||||
configuration.GetString(prefix+"grpcAddress"),
|
||||
|
||||
@@ -28,10 +28,12 @@ type FilerSource struct {
|
||||
address string
|
||||
proxyByFiler bool
|
||||
dataCenter string
|
||||
signature int32
|
||||
}
|
||||
|
||||
func (fs *FilerSource) Initialize(configuration util.Configuration, prefix string) error {
|
||||
fs.dataCenter = configuration.GetString(prefix + "dataCenter")
|
||||
fs.signature = util.RandomInt32()
|
||||
return fs.DoInitialize(
|
||||
"",
|
||||
configuration.GetString(prefix+"grpcAddress"),
|
||||
@@ -128,7 +130,7 @@ var _ = filer_pb.FilerClient(&FilerSource{})
|
||||
|
||||
func (fs *FilerSource) WithFilerClient(streamingMode bool, fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||
|
||||
return pb.WithGrpcClient(streamingMode, func(grpcConnection *grpc.ClientConn) error {
|
||||
return pb.WithGrpcClient(streamingMode, fs.signature, func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
return fn(client)
|
||||
}, fs.grpcAddress, false, fs.grpcDialOption)
|
||||
|
||||
Reference in New Issue
Block a user