<commit_before>
require "slimta"
require "ratchet.bus.samestate"

slimta.bus = {}

require "slimta.bus.server"
require "slimta.bus.client"

-- {{{ slimta.bus.new_local()
function slimta.bus.new_local(...)
    return ratchet.bus.new_local(...)
end
-- }}}

-- {{{ slimta.bus.new_server()
function slimta.bus.new_server(...)
    return slimta.bus.server.new(...)
end
-- }}}

-- {{{ slimta.bus.new_client()
function slimta.bus.new_client(...)
    return slimta.bus.client.new(...)
end
-- }}}

return slimta.bus

-- vim:foldmethod=marker:sw=4:ts=4:sts=4:et:<commit_msg>chain() convenience function<commit_after>
require "slimta"
require "ratchet"
require "ratchet.bus.samestate"

slimta.bus = {}

require "slimta.bus.server"
require "slimta.bus.client"

-- {{{ slimta.bus.new_local()
function slimta.bus.new_local(...)
    return ratchet.bus.new_local(...)
end
-- }}}

-- {{{ slimta.bus.new_server()
function slimta.bus.new_server(...)
    return slimta.bus.server.new(...)
end
-- }}}

-- {{{ slimta.bus.new_client()
function slimta.bus.new_client(...)
    return slimta.bus.client.new(...)
end
-- }}}

-- {{{ slimta.bus.chain()
function slimta.bus.chain(calls, from_bus)
    local call_stacks = {}
    local call_from_bus, call_to_bus, prev_from_bus

    for i, call in ipairs(calls) do
        call_from_bus, call_to_bus = slimta.bus.new_local()
        call_stacks[i] = {call, prev_from_bus, call_to_bus}
        prev_from_bus = call_from_bus
    end

    if call_stacks[1] then
        call_stacks[1][2] = from_bus
    end

    local final_to_bus
    for i, stack in ipairs(call_stacks) do
        ratchet.thread.attach(table.unpack(stack))
        final_to_bus = stack[3]
    end

    return final_to_bus
end
-- }}}

return slimta.bus

-- vim:foldmethod=marker:sw=4:ts=4:sts=4:et:
{'fraction_non_alphanumeric': 0.17134831460674158, 'fraction_numerical': 0.0056179775280898875, 'mean_word_length': 3.2709832134292567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4292718', 'n_tokens_mistral': 697, 'n_tokens_neox': 694, 'n_words': 112}