Sha256: d26ade9b03a0dede79ad57c4c482c8922c3140a0ccd867f58f456eac5a1784aa

Contents?: true

Size: 1012 Bytes

Versions: 3

Compression:

Stored size: 1012 Bytes

Contents

class Norikra::RPC::Handler
  def initialize(engine)
    @engine = engine
  end

  def targets
    @engine.targets
  end

  def open(target, fields)
    r = @engine.open(target, fields)
    !!r
  end

  def close(target)
    r = @engine.close(target)
    !!r
  end

  def queries
    @engine.queries.map(&:to_hash)
  end

  def register(query_name, expression)
    r = @engine.register(Norikra::Query.new(:name => query_name, :expression => expression))
    !!r
  end

  def deregister(query_name)
    #TODO: write!
    raise NotImplementedError
  end

  def fields(target)
    @engine.typedef_manager.field_list(target)
  end

  def reserve(target, fieldname, type)
    r = @engine.reserve(target, fieldname, type)
    !!r
  end

  def send(target, events)
    r = @engine.send(target, events)
    !!r
  end

  def event(query_name)
    @engine.output_pool.pop(query_name)
  end

  def sweep
    @engine.output_pool.sweep
  end

  # post('/listen') # get all events as stream, during connection keepaliving
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
norikra-0.0.4-java lib/norikra/rpc/handler.rb
norikra-0.0.3-java lib/norikra/rpc/handler.rb
norikra-0.0.1-java lib/norikra/rpc/handler.rb