Class: Gemfire::Statistic

Inherits:
Shared::Resource show all
Includes:
Shared::Deletable
Defined in:
lib/vas/gemfire/statistics.rb

Overview

A statistic of a cache server

Instance Attribute Summary collapse

Attributes included from Shared::Deletable

#collection

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods included from Shared::Deletable

#delete

Constructor Details

#initialize(location, client) ⇒ Statistic

Returns a new instance of Statistic.



44
45
46
47
48
49
50
51
# File 'lib/vas/gemfire/statistics.rb', line 44

def initialize(location, client)
  super(location, client)

  @path = details['path']

  @instance_location = Util::LinkUtils.get_link_href(details, 'cache-server-node-instance')
  @content_location = Util::LinkUtils.get_link_href(details, 'content')
end

Instance Attribute Details

#last_modifiedInteger (readonly)

Returns the last modified stamp of the statistic.

Returns:

  • (Integer)

    the last modified stamp of the statistic



41
42
43
# File 'lib/vas/gemfire/statistics.rb', line 41

def last_modified
  @last_modified
end

#pathString (readonly)

Returns the path of statistic.

Returns:

  • (String)

    the path of statistic



35
36
37
# File 'lib/vas/gemfire/statistics.rb', line 35

def path
  @path
end

#sizeInteger (readonly)

Returns the size of the statistic.

Returns:

  • (Integer)

    the size of the statistic



38
39
40
# File 'lib/vas/gemfire/statistics.rb', line 38

def size
  @size
end

Instance Method Details

#content {|chunk| ... } ⇒ void

This method returns an undefined value.

Retrieves the statistic’s content

Yields:

  • (chunk)

    a chunk of the statistic’s content



70
71
72
# File 'lib/vas/gemfire/statistics.rb', line 70

def content(&block)
  client.get_stream(@content_location, &block)
end

#instanceCacheServerNodeInstance

Returns The statistic’s cache server node instance.

Returns:



61
62
63
# File 'lib/vas/gemfire/statistics.rb', line 61

def instance
  @instance ||= CacheServerNodeInstance.new(@instance_location, client)
end

#reloadObject

Reloads the statistic’s details from the server



54
55
56
57
58
# File 'lib/vas/gemfire/statistics.rb', line 54

def reload
  super
  @size = details['size']
  @last_modified = details['last-modified']
end

#to_sString

Returns a string representation of the statistic.

Returns:

  • (String)

    a string representation of the statistic



75
76
77
# File 'lib/vas/gemfire/statistics.rb', line 75

def to_s
  "#<#{self.class} path='#@path' size='#@size' last_modified='#@last_modified'>"
end