Sha256: 71bcc8521a33bf8d8f396f3041879928b8eef65ce1de14a9398bf5bf2246d707
Contents?: true
Size: 1.48 KB
Versions: 53
Compression:
Stored size: 1.48 KB
Contents
# # Fluent # # Copyright (C) 2011 FURUHASHI Sadayuki # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # module Fluent class ZFileBufferChunk < FileBufferChunk def initialize(path) super(path) @z = Zlib::Deflate.new end def <<(data) zdata = @z.deflate(data, Z_NO_FLUSH) unless zdata.empty? super(zdata) end end def close_write zdata = @z.flush unless zdata.empty? @file.write(zdata) @size += zdata.bytesize end super end def close @z.close super end def purge @z.close super end # TODO #def open(&block) #end end class ZFileBuffer < FileBuffer # TODO #Plugin.register_buffer('zfile', self) def initialize require 'zlib' super end def resume_queue queue = resume_queue_paths.map {|path| ZFileBufferChunk.new(path) } top = new_chunk return queue, top end def new_chunk path = new_chunk_path ZFileBufferChunk.new(path) end end end
Version data entries
53 entries across 53 versions & 1 rubygems