Class: GrpcKit::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/grpc_kit/call.rb

Defined Under Namespace

Classes: Klass, Name, Reciver

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream:, config:, metadata:, timeout: nil) ⇒ Call

Returns a new instance of Call.

Parameters:



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/grpc_kit/call.rb', line 24

def initialize(stream:, config:, metadata:, timeout: nil)
  @config = config
  @metadata = 
  @method_name = @config.method_name
  @service_name = @config.service_name
  @codec = @config.codec
  @timeout = timeout
  @stream = stream

  # for compatible
  klass = Klass.new(@service_name)
  @method ||= Name.new(@method_name, Reciver.new(klass))
end

Instance Attribute Details

#metadataHash<String, String> (readonly)

Returns gRPC metadata.

Returns:

  • (Hash<String, String>)

    gRPC metadata



19
20
21
# File 'lib/grpc_kit/call.rb', line 19

def 
  @metadata
end

#methodGrpcKit::Call::Name (readonly)

Returns gRPC method object.

Returns:



10
11
12
# File 'lib/grpc_kit/call.rb', line 10

def method
  @method
end

#method_nameSymbol (readonly)

Returns gRPC method name.

Returns:

  • (Symbol)

    gRPC method name



13
14
15
# File 'lib/grpc_kit/call.rb', line 13

def method_name
  @method_name
end

#service_nameString (readonly)

Returns gRPC service name.

Returns:

  • (String)

    gRPC service name



16
17
18
# File 'lib/grpc_kit/call.rb', line 16

def service_name
  @service_name
end

Instance Method Details

#deadlineTime

Returns deadline of this rpc call.

Returns:

  • (Time)

    deadline of this rpc call



39
40
41
42
43
# File 'lib/grpc_kit/call.rb', line 39

def deadline
  return @deadline if instance_variable_defined?(:@deadline)

  @deadline = @timeout && @timeout.to_absolute_time
end