Module: Semian::GRPC

Includes:
Adapter
Defined in:
lib/semian/grpc.rb

Defined Under Namespace

Classes: SemianConfigurationChangedError

Constant Summary collapse

ResourceBusyError =
::GRPC::ResourceBusyError
CircuitOpenError =
::GRPC::CircuitOpenError

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Adapter

#clear_semian_resource, #semian_resource

Class Attribute Details

.exceptionsObject

Returns the value of attribute exceptions.



38
39
40
# File 'lib/semian/grpc.rb', line 38

def exceptions
  @exceptions
end

.semian_configurationObject

Returns the value of attribute semian_configuration.



39
40
41
# File 'lib/semian/grpc.rb', line 39

def semian_configuration
  @semian_configuration
end

Instance Attribute Details

#raw_semian_optionsObject (readonly)

Returns the value of attribute raw_semian_options.



25
26
27
# File 'lib/semian/grpc.rb', line 25

def raw_semian_options
  @raw_semian_options
end

Class Method Details

.retrieve_semian_configuration(host) ⇒ Object



46
47
48
# File 'lib/semian/grpc.rb', line 46

def retrieve_semian_configuration(host)
  @semian_configuration.call(host) if @semian_configuration.respond_to?(:call)
end

Instance Method Details

#bidi_streamerObject



97
98
99
100
# File 'lib/semian/grpc.rb', line 97

def bidi_streamer(*, **)
  return super if disabled?
  acquire_semian_resource(adapter: :grpc, scope: :bidi_streamer) { super }
end

#client_streamerObject



87
88
89
90
# File 'lib/semian/grpc.rb', line 87

def client_streamer(*, **)
  return super if disabled?
  acquire_semian_resource(adapter: :grpc, scope: :client_streamer) { super }
end

#disabled?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'lib/semian/grpc.rb', line 78

def disabled?
  raw_semian_options.nil?
end

#request_responseObject



82
83
84
85
# File 'lib/semian/grpc.rb', line 82

def request_response(*, **)
  return super if disabled?
  acquire_semian_resource(adapter: :grpc, scope: :request_response) { super }
end

#resource_exceptionsObject



69
70
71
72
73
74
75
76
# File 'lib/semian/grpc.rb', line 69

def resource_exceptions
  [
    ::GRPC::DeadlineExceeded,
    ::GRPC::ResourceExhausted,
    ::GRPC::Unavailable,
    ::GRPC::Unknown,
  ]
end

#semian_identifierObject



65
66
67
# File 'lib/semian/grpc.rb', line 65

def semian_identifier
  @semian_identifier ||= raw_semian_options[:name]
end

#server_streamerObject



92
93
94
95
# File 'lib/semian/grpc.rb', line 92

def server_streamer(*, **)
  return super if disabled?
  acquire_semian_resource(adapter: :grpc, scope: :server_streamer) { super }
end