Class: Wukong::Store::ChhChunkedFlatFileStore
- Inherits:
-
FlatFileStore
- Object
- Base
- FlatFileStore
- Wukong::Store::ChhChunkedFlatFileStore
- Defined in:
- lib/wukong/store/chh_chunked_flat_file_store.rb
Instance Attribute Summary collapse
-
#filename_pattern ⇒ Object
Returns the value of attribute filename_pattern.
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#rootdir ⇒ Object
Returns the value of attribute rootdir.
Attributes inherited from FlatFileStore
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ChhChunkedFlatFileStore
constructor
Note that filemode is inherited from flat_file.
- #new_chunk ⇒ Object
Methods inherited from FlatFileStore
#<<, #close, #each, #file, #flush, #mkdir!, #save, #size, #skip!
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ ChhChunkedFlatFileStore
Note that filemode is inherited from flat_file
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wukong/store/chh_chunked_flat_file_store.rb', line 12 def initialize ={} # super wants a :filename in the options or it will fail. We need to get the initial filename # set up before we call super, so we need all of the parts of the pattern set up. self.rootdir = [:rootdir] || Settings[:chunk_file_rootdir] self.handle = [:handle] pattern = [:pattern] || Settings[:chunk_file_pattern] self.filename_pattern = FilenamePattern.new(pattern, :handle => handle, :rootdir => self.rootdir) [:filename] = filename_pattern.make() super self.mkdir! end |
Instance Attribute Details
#filename_pattern ⇒ Object
Returns the value of attribute filename_pattern.
4 5 6 |
# File 'lib/wukong/store/chh_chunked_flat_file_store.rb', line 4 def filename_pattern @filename_pattern end |
#handle ⇒ Object
Returns the value of attribute handle.
4 5 6 |
# File 'lib/wukong/store/chh_chunked_flat_file_store.rb', line 4 def handle @handle end |
#rootdir ⇒ Object
Returns the value of attribute rootdir.
4 5 6 |
# File 'lib/wukong/store/chh_chunked_flat_file_store.rb', line 4 def rootdir @rootdir end |
Instance Method Details
#new_chunk ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/wukong/store/chh_chunked_flat_file_store.rb', line 26 def new_chunk new_filename = filename_pattern.make() Log.info "Rotating chunked file #{filename} into #{new_filename}" self.flush self.close @filename = new_filename self.mkdir! end |