Class: Gemfire::LocatorInstance

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

Overview

A locator instance

Instance Attribute Summary

Attributes inherited from Shared::Instance

#group, #live_configurations, #name, #pending_configurations

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods inherited from Shared::Instance

#installation, #node_instances, #to_s

Methods inherited from Shared::StateResource

#start, #state, #stop

Constructor Details

#initialize(location, client) ⇒ LocatorInstance

Returns a new instance of LocatorInstance.



59
60
61
# File 'lib/vas/gemfire/locator_instances.rb', line 59

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

Instance Method Details

#peerBoolean

Returns true if the locator will act as a peer, false if it will not.

Returns:

  • (Boolean)

    true if the locator will act as a peer, false if it will not



103
104
105
# File 'lib/vas/gemfire/locator_instances.rb', line 103

def peer
  client.get(location)['peer']
end

#portInteger

Returns the port that the locator will listen on.

Returns:

  • (Integer)

    the port that the locator will listen on



98
99
100
# File 'lib/vas/gemfire/locator_instances.rb', line 98

def port
  client.get(location)['port']
end

#serverBoolean

Returns true if the locator will act as a server, false if it will not.

Returns:

  • (Boolean)

    true if the locator will act as a server, false if it will not



108
109
110
# File 'lib/vas/gemfire/locator_instances.rb', line 108

def server
  client.get(location)['server']
end

#update(options) ⇒ Object

Updates the instance using the supplied options.

Parameters:

  • options (Hash)

    optional configuration for the instance

Options Hash (options):

  • :installation (Installation)

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

  • :peer (Object)

    true if the locator should act as a peer, otherwise false. If omitted or nil, the installation configuration will not be changed

  • :port (Integer)

    the port that the locator will listen on. If omitted or nil, the installation configuration will not be changed

  • :server (Object)

    true if the locator should act as a server, otherwise false. If omitted or nil, the installation configuration will not be changed



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/vas/gemfire/locator_instances.rb', line 75

def update(options)
  payload = {}

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

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

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

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

  client.post(location, payload)
end