Class: GrpcKit::Calls::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/grpc_kit/calls.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:


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

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

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

Instance Attribute Details

#metadataHash<String, String> (readonly)

Returns gRPC metadata

Returns:

  • (Hash<String, String>)

    gRPC metadata


20
21
22
# File 'lib/grpc_kit/calls.rb', line 20

def 
  @metadata
end

#methodGrpcKit::Calls::Call::Name (readonly)

Returns gRPC method object

Returns:


11
12
13
# File 'lib/grpc_kit/calls.rb', line 11

def method
  @method
end

#method_nameSymbol (readonly)

Returns gRPC method name

Returns:

  • (Symbol)

    gRPC method name


14
15
16
# File 'lib/grpc_kit/calls.rb', line 14

def method_name
  @method_name
end

#service_nameString (readonly)

Returns gRPC service name

Returns:

  • (String)

    gRPC service name


17
18
19
# File 'lib/grpc_kit/calls.rb', line 17

def service_name
  @service_name
end

Instance Method Details

#deadlineTime

Returns deadline of this rpc call

Returns:

  • (Time)

    deadline of this rpc call


51
52
53
54
55
# File 'lib/grpc_kit/calls.rb', line 51

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

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

#normal_modevoid

This method returns an undefined value.


46
47
48
# File 'lib/grpc_kit/calls.rb', line 46

def normal_mode
  @restrict = false
end

#restrict_modevoid

This method returns an undefined value.


41
42
43
# File 'lib/grpc_kit/calls.rb', line 41

def restrict_mode
  @restrict = true
end