X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frgw%2Frgw_es_main.cc;fp=src%2Fceph%2Fsrc%2Frgw%2Frgw_es_main.cc;h=0000000000000000000000000000000000000000;hb=7da45d65be36d36b880cc55c5036e96c24b53f00;hp=43145835b5831161f4592b0e3bf54a80f92e0978;hpb=691462d09d0987b47e112d6ee8740375df3c51b2;p=stor4nfv.git diff --git a/src/ceph/src/rgw/rgw_es_main.cc b/src/ceph/src/rgw/rgw_es_main.cc deleted file mode 100644 index 4314583..0000000 --- a/src/ceph/src/rgw/rgw_es_main.cc +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include - -#include "global/global_init.h" -#include "global/global_context.h" - -#include "common/ceph_argparse.h" -#include "common/ceph_json.h" -#include "rgw_es_query.h" - -using namespace std; - -int main(int argc, char *argv[]) -{ - vector args; - argv_to_vec(argc, (const char **)argv, args); - env_to_vec(args); - - auto cct = global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, - CODE_ENVIRONMENT_UTILITY, 0); - - common_init_finish(g_ceph_context); - - string expr; - - if (argc > 1) { - expr = argv[1]; - } else { - expr = "age >= 30"; - } - - ESQueryCompiler es_query(expr, nullptr, "x-amz-meta-"); - - map aliases = { { "key", "name" }, - { "etag", "meta.etag" }, - { "size", "meta.size" }, - { "mtime", "meta.mtime" }, - { "lastmodified", "meta.mtime" }, - { "contenttype", "meta.contenttype" }, - }; - es_query.set_field_aliases(&aliases); - - map generic_map = { {"bucket", ESEntityTypeMap::ES_ENTITY_STR}, - {"name", ESEntityTypeMap::ES_ENTITY_STR}, - {"instance", ESEntityTypeMap::ES_ENTITY_STR}, - {"meta.etag", ESEntityTypeMap::ES_ENTITY_STR}, - {"meta.contenttype", ESEntityTypeMap::ES_ENTITY_STR}, - {"meta.mtime", ESEntityTypeMap::ES_ENTITY_DATE}, - {"meta.size", ESEntityTypeMap::ES_ENTITY_INT} }; - ESEntityTypeMap gm(generic_map); - es_query.set_generic_type_map(&gm); - - map custom_map = { {"str", ESEntityTypeMap::ES_ENTITY_STR}, - {"int", ESEntityTypeMap::ES_ENTITY_INT}, - {"date", ESEntityTypeMap::ES_ENTITY_DATE} }; - ESEntityTypeMap em(custom_map); - es_query.set_custom_type_map(&em); - - string err; - - bool valid = es_query.compile(&err); - if (!valid) { - cout << "failed to compile query: " << err << std::endl; - return EINVAL; - } - - JSONFormatter f; - encode_json("root", es_query, &f); - - f.flush(cout); - - return 0; -} -