Sha256: bc73ec035c7dfaa9cfe4920e590906473f1fd59d4dcd0cd9d5f32a6b9d37713d

Contents?: true

Size: 900 Bytes

Versions: 6

Compression:

Stored size: 900 Bytes

Contents

module Triglav::Agent
  module Base
    # An abstract class of Monitor.
    #
    # Monitor your storage and send messages to triglav.
    #
    # You have to implement following methods:
    #
    # * initialize
    # * process
    #
    # An instance is created per a `resource`.
    # Connection is shared among same `resource_uri_prefix`.
    #
    # Note that multiple instances would be created,
    # one instance for one parallel thread basically, and
    # `#process` is ran concurrently.
    class Monitor
      # @param [Triglav::Agent::Base::Connection] connection
      # @param [TriglavClient::ResourceResponse] resource
      def initialize(connection, resource)
        raise NotImplementedError
      end

      # @yield [events] Gives an array of events
      def process(&block)
        raise NotImplementedError
        # yield(events) if block_given?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
triglav-agent-1.0.0 lib/triglav/agent/base/monitor.rb
triglav-agent-1.0.0.rc3 lib/triglav/agent/base/monitor.rb
triglav-agent-1.0.0.rc2 lib/triglav/agent/base/monitor.rb
triglav-agent-1.0.0.rc1 lib/triglav/agent/base/monitor.rb
triglav-agent-1.0.0.pre2 lib/triglav/agent/base/monitor.rb
triglav-agent-1.0.0.pre1 lib/triglav/agent/base/monitor.rb