module Logux
Constants
- PROTOCOL_VERSION
- ParameterMissingError
- UnknownActionError
- UnknownChannelError
Public Class Methods
action_watcher()
click to toggle source
# File lib/logux/rack.rb, line 121 def action_watcher configuration.action_watcher.new(configuration.action_watcher_options) end
add(action, meta = Meta.new)
click to toggle source
# File lib/logux/rack.rb, line 83 def add(action, meta = Meta.new) Logux::Add.new.call([[action, meta]]) end
add_batch(commands)
click to toggle source
# File lib/logux/rack.rb, line 87 def add_batch(commands) Logux::Add.new.call(commands) end
application()
click to toggle source
# File lib/logux/rack.rb, line 129 def application Logux::Rack::App end
generate_action_id()
click to toggle source
# File lib/logux/rack.rb, line 113 def generate_action_id Logux::Node.instance.generate_action_id end
logger()
click to toggle source
# File lib/logux/rack.rb, line 117 def logger configuration.logger end
process_batch(stream:, batch:)
click to toggle source
# File lib/logux/rack.rb, line 109 def process_batch(stream:, batch:) Logux::Process::Batch.new(stream: stream, batch: batch).call end
undo(meta, reason: nil, data: {})
click to toggle source
# File lib/logux/rack.rb, line 91 def undo(meta, reason: nil, data: {}) add( data.merge(type: 'logux/undo', id: meta.id, reason: reason), Logux::Meta.new(clients: [meta.client_id]) ) end
verify_request_meta_data(meta_params)
click to toggle source
# File lib/logux/rack.rb, line 98 def verify_request_meta_data(meta_params) if configuration.password.nil? logger.warn(%(Please, add password for logux server: Logux.configure do |c| c.password = 'your-password' end)) end auth = configuration.password == meta_params&.dig('password') raise UnauthorizedError, 'Incorrect password' unless auth end
watch_action() { || ... }
click to toggle source
# File lib/logux/rack.rb, line 125 def watch_action action_watcher.call { yield } end