2 * 2011+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
30 #include <boost/shared_ptr.hpp>
32 #include <eblob/eblob.hpp>
33 #include <elliptics/cppdef.h>
39 eblob_gen(elliptics_log
&l
);
42 void add_remote(const char *addr
, const int port
, const int family
= AF_INET
);
43 void write(const std::string
&name
, const std::string
&data
, const struct timespec
&ts
);
50 class eblob_data_source
{
52 eblob_data_source() {};
53 virtual ~eblob_data_source() {};
55 void prepend_data(std::string
&data
, const size_t size
, struct timespec
*ts
= NULL
);
57 virtual bool next(const bool prepend
, const struct timespec
*ts
,
58 std::string
&name
, std::string
&data
) = 0;
61 #define BOOST_FILESYSTEM_VERSION 2
63 #include <boost/filesystem/operations.hpp>
64 namespace fs
= boost::filesystem
;
66 class eblob_dir_source
: public eblob_data_source
{
68 eblob_dir_source(const std::string
&path
);
69 virtual ~eblob_dir_source();
71 virtual bool next(const bool prepend
, const struct timespec
*ts
,
72 std::string
&name
, std::string
&data
);
74 fs::directory_iterator end_itr
, itr
;
77 class eblob_tar_source
: public eblob_data_source
{
79 eblob_tar_source(const std::string
&path
);
80 virtual ~eblob_tar_source();
82 virtual bool next(const bool prepend
, const struct timespec
*ts
,
83 std::string
&name
, std::string
&data
);
88 class eblob_processor
{
90 eblob_processor(const std::string
&log_file
, const bool prepend_data
,
91 std::vector
<int> &groups
, const std::string
&eblob_base
,
92 const struct eblob_config
&cfg
);
94 void process(elliptics_node
&node
, const std::string
&path
);
98 std::vector
<int> groups_
;
99 struct eblob_config eblob_cfg_
;
100 std::string eblob_base_
, log_file_
;
102 std::map
<std::string
, boost::shared_ptr
<eblob
> > blobs
;
105 #endif /* __EBLOB_GEN_H */