Class: Gemfire::DiskStore

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

Overview

A disk store in a cache server node instance

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) ⇒ DiskStore

Returns a new instance of DiskStore.



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

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

  @name = details['name']

  @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 disk store.

Returns:

  • (Integer)

    the last modified stamp of the disk store



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

def last_modified
  @last_modified
end

#nameString (readonly)

Returns the name of the disk store.

Returns:

  • (String)

    the name of the disk store



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

def name
  @name
end

#sizeInteger (readonly)

Returns the size of the disk store.

Returns:

  • (Integer)

    the size of the disk store



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

def size
  @size
end

Instance Method Details

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

This method returns an undefined value.

Retrieves the disk store’s content

Yields:

  • (chunk)

    a chunk of the disk store’s content



58
59
60
# File 'lib/vas/gemfire/disk_stores.rb', line 58

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

#instanceCacheServerNodeInstance

Returns the disk store’s cache server node instance.

Returns:



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

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

#reloadObject

Reloads the disk store’s details from the server



68
69
70
71
72
# File 'lib/vas/gemfire/disk_stores.rb', line 68

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

#to_sString

Returns a string representation of the disk store.

Returns:

  • (String)

    a string representation of the disk store



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

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