Sha256: 5a83f746184503167a388a3336c58d4576ef23e6539d06f18f14860ce3404207

Contents?: true

Size: 1.83 KB

Versions: 271

Compression:

Stored size: 1.83 KB

Contents

#
# Fluentd
#
#    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.
#

require 'fluent/plugin/output'

module Fluent::Plugin
  class NullOutput < Output
    # This plugin is for tests of non-buffered/buffered plugins
    Fluent::Plugin.register_output('null', self)

    desc "The parameter for testing to simulate output plugin which never succeed to flush."
    config_param :never_flush, :bool, default: false

    config_section :buffer do
      config_set_default :chunk_keys, ['tag']
      config_set_default :flush_at_shutdown, true
      config_set_default :chunk_limit_size, 10 * 1024
    end

    def prefer_buffered_processing
      false
    end

    def prefer_delayed_commit
      @delayed
    end

    attr_accessor :feed_proc, :delayed

    def initialize
      super
      @delayed = false
      @feed_proc = nil
    end

    def multi_workers_ready?
      true
    end

    def process(tag, es)
      raise "failed to flush" if @never_flush
      # Do nothing
    end

    def write(chunk)
      raise "failed to flush" if @never_flush
      if @feed_proc
        @feed_proc.call(chunk)
      end
    end

    def try_write(chunk)
      raise "failed to flush" if @never_flush
      if @feed_proc
        @feed_proc.call(chunk)
      end
      # not to commit chunks for testing
      # commit_write(chunk.unique_id)
    end
  end
end

Version data entries

271 entries across 271 versions & 8 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/lib/fluent/plugin/out_null.rb
fluentd-1.16.6-x86-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.16.6-x64-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.16.6-x64-mingw-ucrt lib/fluent/plugin/out_null.rb
fluentd-1.16.6 lib/fluent/plugin/out_null.rb
fluentd-1.17.1-x86-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.17.1-x64-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.17.1-x64-mingw-ucrt lib/fluent/plugin/out_null.rb
fluentd-1.17.1 lib/fluent/plugin/out_null.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/lib/fluent/plugin/out_null.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/lib/fluent/plugin/out_null.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/fluentd-1.17.0-x64-mingw-ucrt/lib/fluent/plugin/out_null.rb
fluentd-1.17.0-x86-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.17.0-x64-mingw-ucrt lib/fluent/plugin/out_null.rb
fluentd-1.17.0-x64-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.17.0 lib/fluent/plugin/out_null.rb
fluentd-1.16.5-x64-mingw-ucrt lib/fluent/plugin/out_null.rb
fluentd-1.16.5-x86-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.16.5-x64-mingw32 lib/fluent/plugin/out_null.rb
fluentd-1.16.5 lib/fluent/plugin/out_null.rb