Class: Gemfire::DiskStore

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

Overview

A disk store in a cache server node instance

Instance Attribute Summary collapse

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client) ⇒ DiskStore

Returns a new instance of DiskStore.



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

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

  @name = details['name']
  @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 disk store’s cache server node instance.

Returns:



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

def instance
  @instance
end

#nameString (readonly)

Returns the name of the disk store.

Returns:

  • (String)

    the name of the disk store



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

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



52
53
54
# File 'lib/vas/gemfire/disk_stores.rb', line 52

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

#last_modifiedInteger

Returns the last modified stamp of the disk store.

Returns:

  • (Integer)

    the last modified stamp of the disk store



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

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

#sizeInteger

Returns the size of the disk store.

Returns:

  • (Integer)

    the size of the disk store



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

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

#to_sString

Returns a string representation of the disk store.

Returns:

  • (String)

    a string representation of the disk store



67
68
69
# File 'lib/vas/gemfire/disk_stores.rb', line 67

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