Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing additional options directly to GRPC clients #139

Merged
merged 1 commit into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/etcdv3/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Auth
}

def initialize(hostname, credentials, timeout, metadata = {})
@stub = Etcdserverpb::Auth::Stub.new(hostname, credentials)
@stub = Etcdserverpb::Auth::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@metadata = metadata
end
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/kv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class KV
include GRPC::Core::TimeConsts

def initialize(hostname, credentials, timeout, metadata={})
@stub = Etcdserverpb::KV::Stub.new(hostname, credentials)
@stub = Etcdserverpb::KV::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@metadata = metadata
end
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/lease.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Lease
include GRPC::Core::TimeConsts

def initialize(hostname, credentials, timeout, metadata={})
@stub = Etcdserverpb::Lease::Stub.new(hostname, credentials)
@stub = Etcdserverpb::Lease::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@metadata = metadata
end
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Lock
include GRPC::Core::TimeConsts

def initialize(hostname, credentials, timeout, metadata = {})
@stub = V3lockpb::Lock::Stub.new(hostname, credentials)
@stub = V3lockpb::Lock::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@metadata = metadata
end
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/maintenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Maintenance
}

def initialize(hostname, credentials, _timeout, metadata = {})
@stub = Etcdserverpb::Maintenance::Stub.new(hostname, credentials)
@stub = Etcdserverpb::Maintenance::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@metadata = metadata
end

Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/namespace/kv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class KV
include GRPC::Core::TimeConsts

def initialize(hostname, credentials, timeout, namespace, metadata={})
@stub = Etcdserverpb::KV::Stub.new(hostname, credentials)
@stub = Etcdserverpb::KV::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@namespace = namespace
@metadata = metadata
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/namespace/lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Lock
include Etcdv3::Namespace::Utilities

def initialize(hostname, credentials, timeout, namespace, metadata = {})
@stub = V3lockpb::Lock::Stub.new(hostname, credentials)
@stub = V3lockpb::Lock::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@namespace = namespace
@metadata = metadata
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/namespace/watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Watch
include Etcdv3::Namespace::Utilities

def initialize(hostname, credentials, timeout, namespace, metadata = {})
@stub = Etcdserverpb::Watch::Stub.new(hostname, credentials)
@stub = Etcdserverpb::Watch::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@namespace = namespace
@metadata = metadata
Expand Down
2 changes: 1 addition & 1 deletion lib/etcdv3/watch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Watch
include GRPC::Core::TimeConsts

def initialize(hostname, credentials, timeout, metadata = {})
@stub = Etcdserverpb::Watch::Stub.new(hostname, credentials)
@stub = Etcdserverpb::Watch::Stub.new(hostname, credentials, **metadata.delete(:client_options) || {})
@timeout = timeout
@metadata = metadata
end
Expand Down