Class: RBarman::WalFile
- Inherits:
-
Object
- Object
- RBarman::WalFile
- Defined in:
- lib/rbarman/wal_file.rb
Overview
Represents a wal file
Instance Attribute Summary collapse
- #compression ⇒ Object
- #created ⇒ Object
- #segment ⇒ Object
- #size ⇒ Object
- #timeline ⇒ Object
- #xlog ⇒ Object
Class Method Summary collapse
-
.parse(name) ⇒ WalFile
Creates a new WalFile from the given argument.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Checks if other is equal to self by comparing timeline, xlog and segment.
-
#initialize ⇒ WalFile
constructor
Creates a new instance of WalFile.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ WalFile
Creates a new instance of RBarman::WalFile
60 61 |
# File 'lib/rbarman/wal_file.rb', line 60 def initialize end |
Instance Attribute Details
#compression ⇒ Symbol? #compression= ⇒ Object
49 50 51 |
# File 'lib/rbarman/wal_file.rb', line 49 def compression @compression end |
#created ⇒ Time? #created= ⇒ Object
41 42 43 |
# File 'lib/rbarman/wal_file.rb', line 41 def created @created end |
#segment ⇒ String? #segment= ⇒ Object
34 35 36 |
# File 'lib/rbarman/wal_file.rb', line 34 def segment @segment end |
#size ⇒ Integer? #size= ⇒ Object
57 58 59 |
# File 'lib/rbarman/wal_file.rb', line 57 def size @size end |
#timeline ⇒ String? #timeline= ⇒ Object
18 19 20 |
# File 'lib/rbarman/wal_file.rb', line 18 def timeline @timeline end |
#xlog ⇒ String? #xlog= ⇒ Object
26 27 28 |
# File 'lib/rbarman/wal_file.rb', line 26 def xlog @xlog end |
Class Method Details
.parse(name) ⇒ WalFile
Creates a new WalFile from the given argument
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/rbarman/wal_file.rb', line 108 def self.parse(name) raise(InvalidWalFileNameError, "name has to be exactly 24 chars") if !name.is_a? WalFile and name.to_s.size != 24 if name.is_a? WalFile wal_file = name else splitted = name.to_s.scan(/.{8}/) raise InvalidWalFileNameError if splitted.count != 3 wal_file = WalFile.new wal_file.timeline = splitted[0] wal_file.xlog = splitted[1] wal_file.segment = splitted[2] end return wal_file end |
Instance Method Details
#==(other) ⇒ Boolean
Checks if other is equal to self by comparing timeline, xlog and segment
129 130 131 132 133 |
# File 'lib/rbarman/wal_file.rb', line 129 def ==(other) o = other o = WalFile.parse(other.to_s) if !other.is_a? WalFile return o.timeline == @timeline && o.xlog == @xlog && o.segment == @segment end |
#to_s ⇒ Object
63 64 65 |
# File 'lib/rbarman/wal_file.rb', line 63 def to_s "#{timeline}#{xlog}#{segment}" end |