Class: Sqlfire::LocatorInstance

Inherits:
Shared::Instance show all
Defined in:
lib/vas/sqlfire/locator_instances.rb

Overview

A locator instance

Instance Attribute Summary collapse

Attributes inherited from Shared::Instance

#name

Attributes included from Shared::Deletable

#collection

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods inherited from Shared::Instance

#group, #installation, #live_configurations, #node_instances, #pending_configurations, #start, #stop

Methods included from Shared::Deletable

#delete

Methods inherited from Shared::StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client) ⇒ LocatorInstance

Returns a new instance of LocatorInstance.



140
141
142
# File 'lib/vas/sqlfire/locator_instances.rb', line 140

def initialize(location, client)
  super(location, client, Group, Installation, LocatorLiveConfigurations, LocatorPendingConfigurations, LocatorNodeInstance, 'locator-node-instance')
end

Instance Attribute Details

#bind_addressString (readonly)

Returns the property in a node’s metadata used to determine the address that the locator binds to for peer-to-peer communication. If nil, the locator uses the value derived from peer_discovery_address.

Returns:

  • (String)

    the property in a node’s metadata used to determine the address that the locator binds to for peer-to-peer communication. If nil, the locator uses the value derived from peer_discovery_address



104
105
106
# File 'lib/vas/sqlfire/locator_instances.rb', line 104

def bind_address
  @bind_address
end

#client_bind_addressString (readonly)

Returns the property in a node’s metadata used to determine the address that the locator binds to for client communication. If nil, the locator uses the node’s hostname. Only takes effect if run_netserver is true.

Returns:

  • (String)

    the property in a node’s metadata used to determine the address that the locator binds to for client communication. If nil, the locator uses the node’s hostname. Only takes effect if run_netserver is true



109
110
111
# File 'lib/vas/sqlfire/locator_instances.rb', line 109

def client_bind_address
  @client_bind_address
end

#client_portInteger (readonly)

run_netserver is true

Returns:

  • (Integer)

    The port that the locator listens on for client connections. Only takes effect if



113
114
115
# File 'lib/vas/sqlfire/locator_instances.rb', line 113

def client_port
  @client_port
end

#initial_heapString (readonly)

Returns The initial heap size of the locator’s JVM. nil if the default is used.

Returns:

  • (String)

    The initial heap size of the locator’s JVM. nil if the default is used



116
117
118
# File 'lib/vas/sqlfire/locator_instances.rb', line 116

def initial_heap
  @initial_heap
end

#jvm_optionsString[] (readonly)

Returns The JVM options that are passed to the locator’s JVM when it is started.

Returns:

  • (String[])

    The JVM options that are passed to the locator’s JVM when it is started



120
121
122
# File 'lib/vas/sqlfire/locator_instances.rb', line 120

def jvm_options
  @jvm_options
end

#max_heapString (readonly)

Returns The max heap size of the locator’s JVM. nil if the default is used.

Returns:

  • (String)

    The max heap size of the locator’s JVM. nil if the default is used



124
125
126
# File 'lib/vas/sqlfire/locator_instances.rb', line 124

def max_heap
  @max_heap
end

#peer_discovery_addressString (readonly)

Returns the property in a node’s metadata used to determine the address that the locator binds to for peer-discovery communication. If nil, the locator uses 0.0.0.0.

Returns:

  • (String)

    the property in a node’s metadata used to determine the address that the locator binds to for peer-discovery communication. If nil, the locator uses 0.0.0.0



129
130
131
# File 'lib/vas/sqlfire/locator_instances.rb', line 129

def peer_discovery_address
  @peer_discovery_address
end

#peer_discovery_portInteger (readonly)

Returns The port that the locator listens of for peer-discovery connections.

Returns:

  • (Integer)

    The port that the locator listens of for peer-discovery connections



133
134
135
# File 'lib/vas/sqlfire/locator_instances.rb', line 133

def peer_discovery_port
  @peer_discovery_port
end

#run_netserverBoolean (readonly)

Returns true if the locator runs a netserver that can service thin clients, otherwise false.

Returns:

  • (Boolean)

    true if the locator runs a netserver that can service thin clients, otherwise false



137
138
139
# File 'lib/vas/sqlfire/locator_instances.rb', line 137

def run_netserver
  @run_netserver
end

Instance Method Details

#reloadObject



190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/vas/sqlfire/locator_instances.rb', line 190

def reload
  super
  @bind_address = details['bind-address']
  @client_bind_address = details['client-bind-address']
  @client_port = details['client-port']
  @initial_heap = details['initial-heap']
  @jvm_options = details['jvm-options']
  @max_heap = details['max-heap']
  @peer_discovery_address = details['peer-discovery-address']
  @peer_discovery_port = details['peer-discovery-port']
  @run_netserver = details['run-netserver']
end

#to_sString

Returns a string representation of the instance.

Returns:

  • (String)

    a string representation of the instance



204
205
206
# File 'lib/vas/sqlfire/locator_instances.rb', line 204

def to_s
  "#<#{self.class} name='#{name}' bind_address='#@bind_address' client_bind_address='#@client_bind_address' client_port='#@client_port' initial_heap='#@initial_heap' jvm_options='#@jvm_options' max_heap='#@max_heap' peer_discovery_address='#@peer_discovery_address' peer_discovery_port='#@peer_discovery_port' run_netserver='#@run_netserver'>"
end

#update(options) ⇒ void

This method returns an undefined value.

Updates the instance using the supplied options.

Parameters:

  • options (Hash)

    optional configuration for the instance

Options Hash (options):

  • The ('bind-address'String)

    property in a node’s metadata to use to determine the address that the locator binds to for peer-to-peer communication. If omitted or nil, the configuration will not be changed. If set to an empty string the locator will use the value derived from peer-discovery-address.

  • The ('client-bind-address'String)

    property in a node’s metadata to use to determine the address that the locator binds to for client communication. If omitted or nil, the configuration will not be changed. If set to an empty string the locator will use its node’s hostname

  • The ('client-port'Integer)

    port that the locator listens on for client connections. If omitted or nil, the configuration will not be changed

  • The ('initial-heap'String)

    intial heap size to be used by the locator’s JVM. If omitted or nil, the configuration will not be changed. If set to an empty string the JVM’s default is used

  • :installation (String)

    The installation to be used by the instance. If omitted or nil, the configuration will not be changed.

  • The ('jvm-options'String[])

    JVM options that are passed to the locator’s JVM when it is started. If omitted or nil, the configuration will not be changed

  • The ('max-heap'String)

    maximum heap size to be used by the locator’s JVM. If omitted or nil, the configuration will not be changed. If set to an empty string the JVM’s default is used

  • The ('peer-discovery-address'String)

    property in a node’s metadata to use to determine the address that the locator binds to for peer-discovery communication. If omitted or nil, the configuration will not be changed. If set to an empty string the locator will use 0.0.0.0

  • The ('peer-discovery-port'Integer)

    port that the locator listens on for peer-discovery connections. If omitted or nil, the configuration will not be changed

  • Whether ('run-netserver'Boolean)

    the locator should run a netserver that can service thin clients. If omitted or nil, the configuration will not be changed



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/vas/sqlfire/locator_instances.rb', line 173

def update(options)
  payload = {}

  options.each { |key, value|
    if (UPDATE_PAYLOAD_KEYS.include?(key))
      payload[key] = value
    end
  }

  if (options.has_key? :installation)
    payload[:installation] = options[:installation].location
  end

  client.post(location, payload)
  reload
end