Class: Gemfire::Statistic

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

Overview

A statistic of a cache server

Instance Attribute Summary collapse

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client) ⇒ Statistic

Returns a new instance of Statistic.



39
40
41
42
43
44
45
46
# File 'lib/vas/gemfire/statistics.rb', line 39

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

  @path = details['path']

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

Instance Attribute Details

#instanceCacheServerNodeInstance (readonly)

Returns The statistic’s cache server node instance.

Returns:



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

def instance
  @instance
end

#pathString (readonly)

Returns the path of statistic.

Returns:

  • (String)

    the path of statistic



33
34
35
# File 'lib/vas/gemfire/statistics.rb', line 33

def path
  @path
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



63
64
65
# File 'lib/vas/gemfire/statistics.rb', line 63

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

#last_modifiedInteger

Returns the last modified stamp of the statistic.

Returns:

  • (Integer)

    the last modified stamp of the statistic



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

def last_modified
  client.get(location)['last-modified']
end

#sizeInteger

Returns the size of the statistic.

Returns:

  • (Integer)

    the size of the statistic



49
50
51
# File 'lib/vas/gemfire/statistics.rb', line 49

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

#to_sString

Returns a string representation of the statistic.

Returns:

  • (String)

    a string representation of the statistic



68
69
70
# File 'lib/vas/gemfire/statistics.rb', line 68

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