Class: Cuboid::OptionGroups::RPC

Inherits:
Cuboid::OptionGroup show all
Defined in:
lib/cuboid/option_groups/rpc.rb

Overview

Holds Engine::RPC::Client and Engine::RPC::Server options.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Cuboid::OptionGroup

#==, attr_accessor, attributes, #attributes, #defaults, defaults, #hash, inherited, #initialize, #merge, set_defaults, #to_h, #to_hash, #to_rpc_data, #update, #validate

Constructor Details

This class inherits a constructor from Cuboid::OptionGroup

Instance Attribute Details

#client_max_retriesInteger

Returns Maximum retries for failed RPC calls.

Returns:

  • (Integer)

    Maximum retries for failed RPC calls.

See Also:



65
66
67
# File 'lib/cuboid/option_groups/rpc.rb', line 65

def client_max_retries
  @client_max_retries
end

#client_ssl_certificateString

Returns Path to client SSL certificate in PEM format.

Returns:

  • (String)

    Path to client SSL certificate in PEM format.

See Also:



59
60
61
# File 'lib/cuboid/option_groups/rpc.rb', line 59

def client_ssl_certificate
  @client_ssl_certificate
end

#client_ssl_private_keyString

Returns Path to a client SSL private key in PEM format.

Returns:

  • (String)

    Path to a client SSL private key in PEM format.

See Also:



53
54
55
# File 'lib/cuboid/option_groups/rpc.rb', line 53

def client_ssl_private_key
  @client_ssl_private_key
end

#connection_pool_sizeInteger

Note:

This should be permanently set to ‘1`, otherwise it will cause issues with the scheduling of the workload distribution of multi-Instance scans.

Returns Amount of concurrently open connections for each RPC client.

Returns:

  • (Integer)

    Amount of concurrently open connections for each RPC client.

See Also:



74
75
76
# File 'lib/cuboid/option_groups/rpc.rb', line 74

def connection_pool_size
  @connection_pool_size
end

#server_addressString

Returns Hostname or IP address for the RPC server.

Returns:

  • (String)

    Hostname or IP address for the RPC server.

See Also:



18
19
20
# File 'lib/cuboid/option_groups/rpc.rb', line 18

def server_address
  @server_address
end

#server_external_addressString

Returns External (hostname or IP) address for the RPC server to advertise.

Returns:

  • (String)

    External (hostname or IP) address for the RPC server to advertise.



22
23
24
# File 'lib/cuboid/option_groups/rpc.rb', line 22

def server_external_address
  @server_external_address
end

#server_portInteger

Returns RPC server port.

Returns:

  • (Integer)

    RPC server port.

See Also:



28
29
30
# File 'lib/cuboid/option_groups/rpc.rb', line 28

def server_port
  @server_port
end

#server_socketString

Returns Path to the UNIX socket to use for RPC communication.

Returns:

  • (String)

    Path to the UNIX socket to use for RPC communication.

See Also:



12
13
14
# File 'lib/cuboid/option_groups/rpc.rb', line 12

def server_socket
  @server_socket
end

#server_ssl_certificateString

Returns Path to server SSL certificate in PEM format.

Returns:

  • (String)

    Path to server SSL certificate in PEM format.

See Also:



47
48
49
# File 'lib/cuboid/option_groups/rpc.rb', line 47

def server_ssl_certificate
  @server_ssl_certificate
end

#server_ssl_private_keyString

Returns Path to a server SSL private key in PEM format.

Returns:

  • (String)

    Path to a server SSL private key in PEM format.

See Also:



41
42
43
# File 'lib/cuboid/option_groups/rpc.rb', line 41

def server_ssl_private_key
  @server_ssl_private_key
end

#ssl_caString

Returns Path to an SSL certificate authority file in PEM format.

Returns:

  • (String)

    Path to an SSL certificate authority file in PEM format.

See Also:



35
36
37
# File 'lib/cuboid/option_groups/rpc.rb', line 35

def ssl_ca
  @ssl_ca
end

Instance Method Details

#to_client_optionsObject



86
87
88
89
90
91
92
93
94
# File 'lib/cuboid/option_groups/rpc.rb', line 86

def to_client_options
    {
        connection_pool_size: connection_pool_size,
        max_retries:          client_max_retries,
        ssl_ca:               ssl_ca,
        ssl_pkey:             client_ssl_private_key,
        ssl_cert:             client_ssl_certificate
    }
end

#to_server_optionsObject



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/cuboid/option_groups/rpc.rb', line 96

def to_server_options
    {
        host:             server_address,
        external_address: server_external_address,
        port:             server_port,
        socket:           server_socket,
        ssl_ca:           ssl_ca,
        ssl_pkey:         server_ssl_private_key,
        ssl_cert:         server_ssl_certificate
    }
end

#urlObject



82
83
84
# File 'lib/cuboid/option_groups/rpc.rb', line 82

def url
    "#{server_address}:#{server_port}"
end