Class: Gemfire::LocatorInstance

Inherits:
Shared::Instance show all
Defined in:
lib/vas/gemfire/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.



83
84
85
# File 'lib/vas/gemfire/locator_instances.rb', line 83

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

Instance Attribute Details

#addressString? (readonly)

Returns the property in a node’s metadata used to determine the address of the network card on which the locator will listen. If nil the locator will listen on the address of the default network card.

Returns:

  • (String, nil)

    the property in a node’s metadata used to determine the address of the network card on which the locator will listen. If nil the locator will listen on the address of the default network card



71
72
73
# File 'lib/vas/gemfire/locator_instances.rb', line 71

def address
  @address
end

#peerBoolean (readonly)

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



77
78
79
# File 'lib/vas/gemfire/locator_instances.rb', line 77

def peer
  @peer
end

#portInteger (readonly)

Returns the port that the locator will listen on.

Returns:

  • (Integer)

    the port that the locator will listen on



74
75
76
# File 'lib/vas/gemfire/locator_instances.rb', line 74

def port
  @port
end

#serverBoolean (readonly)

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



80
81
82
# File 'lib/vas/gemfire/locator_instances.rb', line 80

def server
  @server
end

Instance Method Details

#reloadvoid

This method returns an undefined value.

Reloads the instance’s details from the server



133
134
135
136
137
138
139
# File 'lib/vas/gemfire/locator_instances.rb', line 133

def reload
  super
  @port = details['port']
  @peer = details['peer']
  @server = details['server']
  @address = details['address']
end

#to_sString

Returns a string representation of the instance.

Returns:

  • (String)

    a string representation of the instance



142
143
144
# File 'lib/vas/gemfire/locator_instances.rb', line 142

def to_s
  "#<#{self.class} name=#{name} address='#@address' port='#@port' peer='#@peer' server='#@server'>"
end

#update(options) ⇒ Object

Updates the instance using the supplied options.

Parameters:

  • options (Hash)

    optional configuration for the instance

Options Hash (options):

  • :address (String)

    the property in a node’s metadata to use to determine the address that the locator instance will bind to. If omitted or nil, the configuration will not be changed. If an empty string is specified, the locator instance will bind to the default network address

  • :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



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/vas/gemfire/locator_instances.rb', line 104

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

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

  client.post(location, payload)
  reload
end