Class: Shared::Log
- Includes:
- Deletable
- Defined in:
- lib/vas/shared/logs.rb
Overview
abstract A log file in a node instance
Direct Known Subclasses
Gemfire::AgentLog, Gemfire::CacheServerLog, Gemfire::LocatorLog, RabbitMq::Log, Sqlfire::AgentLog, Sqlfire::LocatorLog, Sqlfire::ServerLog, TcServer::Log, WebServer::Log
Instance Attribute Summary collapse
-
#last_modified ⇒ Integer
readonly
The last modified stamp of the log.
-
#name ⇒ String
readonly
The name of the log.
-
#size ⇒ Integer
readonly
The size of the log.
Attributes included from Deletable
Attributes inherited from Resource
Instance Method Summary collapse
-
#content(options = {}) {|chunk| ... } ⇒ void
Retrieves the content of the log from the server.
-
#initialize(location, client, instance_type, instance_class) ⇒ Log
constructor
A new instance of Log.
-
#instance ⇒ NodeInstance
The node instance that the log belongs to.
-
#reload ⇒ void
Reloads the log’s details from the server.
-
#to_s ⇒ String
A string representation of the log.
Methods included from Deletable
Constructor Details
#initialize(location, client, instance_type, instance_class) ⇒ Log
Returns a new instance of Log.
44 45 46 47 48 49 50 51 |
# File 'lib/vas/shared/logs.rb', line 44 def initialize(location, client, instance_type, instance_class) super(location, client) @content_location = Util::LinkUtils.get_link_href(details, 'content') @instance_location = Util::LinkUtils.get_link_href(details, instance_type) @instance_class = instance_class end |
Instance Attribute Details
#last_modified ⇒ Integer (readonly)
Returns the last modified stamp of the log.
41 42 43 |
# File 'lib/vas/shared/logs.rb', line 41 def last_modified @last_modified end |
#name ⇒ String (readonly)
Returns the name of the log.
35 36 37 |
# File 'lib/vas/shared/logs.rb', line 35 def name @name end |
#size ⇒ Integer (readonly)
Returns the size of the log.
38 39 40 |
# File 'lib/vas/shared/logs.rb', line 38 def size @size end |
Instance Method Details
#content(options = {}) {|chunk| ... } ⇒ void
This method returns an undefined value.
Retrieves the content of the log from the server
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/vas/shared/logs.rb', line 82 def content( = {}, &block) query="" if (![:start_line].nil?) query << "start-line=#{[:start_line]}" end if (![:end_line].nil?) if (query.length > 0) query << '&' end query << "end-line=#{[:end_line]}" end if (query.length > 0) client.get_stream("#{@content_location}?#{query}", &block) else client.get_stream(@content_location, &block) end end |
#instance ⇒ NodeInstance
Returns the node instance that the log belongs to.
102 103 104 |
# File 'lib/vas/shared/logs.rb', line 102 def instance @instance ||= @instance_class.new(@instance_location, client) end |
#reload ⇒ void
This method returns an undefined value.
Reloads the log’s details from the server
56 57 58 59 60 61 62 |
# File 'lib/vas/shared/logs.rb', line 56 def reload super @name = details['name'] @size = details['size'] @last_modified = details['last-modified'] @instance = nil end |
#to_s ⇒ String
Returns a string representation of the log.
107 108 109 |
# File 'lib/vas/shared/logs.rb', line 107 def to_s "#<#{self.class} name='#@name' size='#@size' last_modified='#@last_modified'>" end |