<commit_before>//  Copyright 2010 <NAME>
//
//  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.

#ifndef ZIPPYLOG_ZIPPYLOGD_UTIL_HPP_
#define ZIPPYLOG_ZIPPYLOGD_UTIL_HPP_

#include <zippylog/zippylog.hpp>
#include <zippylog/lua.hpp>

#include <iostream>
#include <string>
#include <vector>

namespace zippylog {
namespace zippylogd {

class ZIPPYLOG_EXPORT ZippylogdStartParams {
public:
    ZippylogdStartParams() :
        mode_piped(false),
        mode_server(false),
        piped_lua_max_size(1024)
    { }

    bool mode_piped;
    bool mode_server;
    ::std::string server_config_file;
    ::std::string piped_lua_file;
    uint32 piped_lua_max_size;

};

/// An instance of zippylogd
///
/// zippylogd is a rather complex beast. it can have a number of modes of
/// operation. It might be best to read up on ZippylogdStartParams to see
/// how you can launch zippylogd instances.
class ZIPPYLOG_EXPORT Zippylogd {
public:
    /// Construct a new zippylogd instance from parameters
    ///
    /// Constructor just sets up zippylogd for execution. It doesn't
    /// actually start processing anything.
    Zippylogd(ZippylogdStartParams &params);

    ~Zippylogd();

    /// Runs the zippylogd instance
    ///
    /// Function will block until ...
    bool Run();

protected:
    bool run_piped;
    bool run_server;
    ::std::string server_config_file;
    ::std::istream *inpipe;
<commit_msg>add more parameters<commit_after>//  Copyright 2010 <NAME>
//
//  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.

#ifndef ZIPPYLOG_ZIPPYLOGD_UTIL_HPP_
#define ZIPPYLOG_ZIPPYLOGD_UTIL_HPP_

#include <zippylog/zippylog.hpp>
#include <zippylog/lua.hpp>

#include <iostream>
#include <string>
#include <vector>

namespace zippylog {
namespace zippylogd {

class ZIPPYLOG_EXPORT ZippylogdStartParams {
public:
    ZippylogdStartParams() :
        mode_piped(false),
        mode_server(false),
        piped_lua_max_size(1024)
    { }

    // whether we read input from a pipe
    bool mode_piped;

    // whether to run a server
    bool mode_server;

    // if running a server, where its config file is
    ::std::string server_config_file;

    // if running in piped mode, file that defines Lua code to be loaded for
    // input processing
    ::std::string piped_lua_file;

    // if running Lua code, the max memory usage the Lua interpreter is allowed
    // to grow to
    uint32 piped_lua_max_size;

    // mask that says where to send output when in piped mode
    enum PipedDestination {
        // send to stdout
        STDOUT   = 0x00000001;

        // send to a configured store
        STORE    = 0x00000002;

        // send to a file opened from a path
        FILEPATH = 0x00000004;
    };

    // if outputting to a store, this is the path to the store
    ::std::string piped_store_root_path;

    // if outputting to a store, the path within the store. e.g. "/bucket/set"
    ::std::string piped_store_store_path;

    // if outputting to a file path, the path to open
    ::std::string piped_output_path;

};

/// An instance of zippylogd
///
/// zippylogd is a rather complex beast. it can have a number of modes of
/// operation. It might be best to read up on ZippylogdStartParams to see
/// how you can launch zippylogd instances.
class ZIPPYLOG_EXPORT Zippylogd {
public:
    /// Construct a new zippylogd instance from parameters
    ///
    /// Constructor just sets up zippylogd for execution. It doesn't
    /// actually start processing anything.
    Zippylogd(ZippylogdStartParams &params);

    ~Zippylogd();

    /// Runs the zippylogd instance
    ///
    /// Function will block until ...
    bool Run();

protected:
    bool run_piped;
    bool run_server;
    ::std::string server_config_file;
    ::std::istream *inpipe;

{'fraction_non_alphanumeric': 0.08870799415570862, 'fraction_numerical': 0.011479858067209352, 'mean_word_length': 2.9472817133443163, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 3, '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': '2953058', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1487, 'n_words': 530}