Skip to content

Commit

Permalink
Add annotion & Code Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Yi-Eaaa committed Oct 14, 2024
1 parent c065dd0 commit ce3cc2f
Show file tree
Hide file tree
Showing 29 changed files with 3,061 additions and 2,447 deletions.
48 changes: 24 additions & 24 deletions analytical_engine/apps/flash/flash_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,32 +182,32 @@ void reduce_vec(std::vector<T>& src, std::vector<T>& rst,
}
}

#define ReduceVec3(src, rst, F) \
reduce_vec( \
src, rst, \
[](void* la, void* lb, int* lens, MPI_Datatype* dtype) { \
using T = decltype(src.data()); \
int len; \
memcpy(&len, la, sizeof(int)); \
memcpy(lb, &len, sizeof(int)); \
T src = (T)((reinterpret_cast<char*>(la)) + sizeof(int)); \
T rst = (T)((reinterpret_cast<char*>(lb)) + sizeof(int)); \
F; \
}, \
#define ReduceVec3(src, rst, F) \
reduce_vec( \
src, rst, \
[](void* la, void* lb, int* lens, MPI_Datatype* dtype) { \
using T = decltype(src.data()); \
int len; \
memcpy(&len, la, sizeof(int)); \
memcpy(lb, &len, sizeof(int)); \
T src = (T) ((reinterpret_cast<char*>(la)) + sizeof(int)); \
T rst = (T) ((reinterpret_cast<char*>(lb)) + sizeof(int)); \
F; \
}, \
true);

#define ReduceVec4(src, rst, F, bcast) \
reduce_vec( \
src, rst, \
[](void* la, void* lb, int* lens, MPI_Datatype* dtype) { \
using T = decltype(src.data()); \
int len; \
memcpy(&len, la, sizeof(int)); \
memcpy(lb, &len, sizeof(int)); \
T src = (T)((reinterpret_cast<char*>(la)) + sizeof(int)); \
T rst = (T)((reinterpret_cast<char*>(lb)) + sizeof(int)); \
F; \
}, \
#define ReduceVec4(src, rst, F, bcast) \
reduce_vec( \
src, rst, \
[](void* la, void* lb, int* lens, MPI_Datatype* dtype) { \
using T = decltype(src.data()); \
int len; \
memcpy(&len, la, sizeof(int)); \
memcpy(lb, &len, sizeof(int)); \
T src = (T) ((reinterpret_cast<char*>(la)) + sizeof(int)); \
T rst = (T) ((reinterpret_cast<char*>(lb)) + sizeof(int)); \
F; \
}, \
bcast);

#define GetReduceVec(_1, _2, _3, _4, NAME, ...) NAME
Expand Down
2 changes: 1 addition & 1 deletion analytical_engine/apps/sampling_path/sampling_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SamplingPath
auto level = pair.first;
auto& path = pair.second;

if ((size_t)(level + 2) < ctx.path_pattern.size()) {
if ((size_t) (level + 2) < ctx.path_pattern.size()) {
vertex_t u;
auto curr_e_label = ctx.path_pattern[level + 1];
auto curr_v_label = ctx.path_pattern[level + 2];
Expand Down
4 changes: 2 additions & 2 deletions analytical_engine/apps/sssp/sssp_average_length.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class SSSPAverageLength
updated_map[src_vid].Insert(v);
}
} else { // sum msg
fid_t fid = (fid_t)(std::get<0>(msg.second));
fid_t fid = (fid_t) (std::get<0>(msg.second));
ctx.all_sums[fid] = std::get<2>(msg.second);
}
msg_cnt++;
Expand Down Expand Up @@ -185,7 +185,7 @@ class SSSPAverageLength
else
messages.SendToFragment(
0, pair_msg_t(false,
tuple_t((vid_t)(fid), (vid_t)(fid), ctx.inner_sum)));
tuple_t((vid_t) (fid), (vid_t) (fid), ctx.inner_sum)));
}

inline void syncUpdated(vid_t src_vid, const fragment_t& frag, context_t& ctx,
Expand Down
4 changes: 1 addition & 3 deletions flex/codegen/src/building_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ struct TagIndMapping {
tag_id_2_tag_inds_[tag_id] != -1;
}

int32_t GetMaxTagId() const {
return tag_id_2_tag_inds_.size() - 1;
}
int32_t GetMaxTagId() const { return tag_id_2_tag_inds_.size() - 1; }

// convert tag_ind (us) to tag ids
std::vector<int32_t> tag_ind_2_tag_ids_;
Expand Down
1 change: 0 additions & 1 deletion flex/codegen/src/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ std::string res_alias_to_append_opt(int res_alias, int in_alias) {
}
}


template <typename LabelIdT>
std::string ensure_label_id(LabelIdT label_id) {
return std::string(LABEL_ID_T_CASTER) + std::string(" ") +
Expand Down
1 change: 0 additions & 1 deletion flex/engines/graph_db/runtime/common/operators/dedup.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace gs {

namespace runtime {


class Dedup {
public:
static void dedup(const ReadTransaction& txn, Context& ctx,
Expand Down
5 changes: 2 additions & 3 deletions flex/engines/hqps_db/core/operator/sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ void template_set_value(common::Value* value, T v) {
}

template <typename T,
typename std::enable_if<
(std::is_same_v<T, uint64_t>) &&
(!std::is_same_v<uint64_t, unsigned long>)>::type* = nullptr>
typename std::enable_if<(std::is_same_v<T, uint64_t>) &&(
!std::is_same_v<uint64_t, unsigned long>)>::type* = nullptr>
void template_set_value(common::Value* value, T v) {
value->set_i64(v);
}
Expand Down
4 changes: 1 addition & 3 deletions flex/engines/hqps_db/structures/collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,7 @@ class CountBuilder {
return true;
}

Collection<int64_t> Build() {
return Collection<int64_t>(std::move(vec_));
}
Collection<int64_t> Build() { return Collection<int64_t>(std::move(vec_)); }

private:
std::vector<int64_t> vec_;
Expand Down
84 changes: 62 additions & 22 deletions flex/engines/http_server/actor/admin_actor.act.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#ifndef ENGINES_HTTP_SERVER_ACTOR_ADMIN_ACT_H_
#define ENGINES_HTTP_SERVER_ACTOR_ADMIN_ACT_H_

#include "flex/engines/http_server/types.h"
#include "flex/engines/graph_db/database/graph_db.h"
#include "flex/engines/http_server/types.h"

#include "flex/storages/metadata/graph_meta_store.h"

Expand All @@ -29,50 +29,90 @@

namespace server {

class ANNOTATION(actor:impl) admin_actor : public hiactor::actor {
class ANNOTATION(actor : impl) admin_actor : public hiactor::actor {
public:
admin_actor(hiactor::actor_base* exec_ctx, const hiactor::byte_t* addr);
~admin_actor() override;

seastar::future<admin_query_result> ANNOTATION(actor:method) run_create_graph(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_create_graph(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_get_graph_schema(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_get_graph_schema(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_get_graph_meta(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_get_graph_meta(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_list_graphs(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_list_graphs(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_delete_graph(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_delete_graph(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_graph_loading(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_graph_loading(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) start_service(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
start_service(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) stop_service(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
stop_service(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) service_status(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
service_status(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) get_procedure_by_procedure_name(procedure_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
get_procedure_by_procedure_name(procedure_query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) get_procedures_by_graph_name(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
get_procedures_by_graph_name(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) create_procedure(create_procedure_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
create_procedure(create_procedure_query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) delete_procedure(procedure_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
delete_procedure(procedure_query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) update_procedure(update_procedure_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
update_procedure(update_procedure_query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) node_status(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
node_status(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) get_job(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
get_job(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) list_jobs(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
list_jobs(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) cancel_job(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
cancel_job(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) run_get_graph_statistic(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
run_get_graph_statistic(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) upload_file(query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
upload_file(query_param&& param);

// DECLARE_RUN_QUERIES;
/// Declare `do_work` func here, no need to implement.
Expand Down
6 changes: 4 additions & 2 deletions flex/engines/http_server/actor/codegen_actor.act.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@

namespace server {

class ANNOTATION(actor:impl) codegen_actor : public hiactor::actor {
class ANNOTATION(actor : impl) codegen_actor : public hiactor::actor {
public:
codegen_actor(hiactor::actor_base* exec_ctx, const hiactor::byte_t* addr);
~codegen_actor() override;

seastar::future<query_result> ANNOTATION(actor:method) do_codegen(query_param&& param);
seastar::future<query_result> ANNOTATION(actor
: method)
do_codegen(query_param&& param);

// DECLARE_RUN_QUERIES;
/// Declare `do_work` func here, no need to implement.
Expand Down
39 changes: 28 additions & 11 deletions flex/engines/http_server/actor/executor.act.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,46 @@

namespace server {

class ANNOTATION(actor:impl) executor : public hiactor::actor {
class ANNOTATION(actor : impl) executor : public hiactor::actor {
public:
executor(hiactor::actor_base* exec_ctx, const hiactor::byte_t* addr);
~executor() override;

seastar::future<query_result> ANNOTATION(actor:method) run_graph_db_query(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) create_vertex(graph_management_param&& param);
seastar::future<query_result> ANNOTATION(actor
: method)
run_graph_db_query(query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) create_edge(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
create_vertex(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) delete_vertex(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
create_edge(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) delete_edge(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
delete_vertex(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) update_vertex(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
delete_edge(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) update_edge(graph_management_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
update_vertex(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) get_vertex(graph_management_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
update_edge(graph_management_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor:method) get_edge(graph_management_query_param&& param);
seastar::future<admin_query_result> ANNOTATION(actor
: method)
get_vertex(graph_management_query_param&& param);

seastar::future<admin_query_result> ANNOTATION(actor
: method)
get_edge(graph_management_query_param&& param);

// DECLARE_RUN_QUERIES;
/// Declare `do_work` func here, no need to implement.
Expand Down
4 changes: 3 additions & 1 deletion flex/engines/http_server/executor_group.actg.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

namespace server {

class ANNOTATION(actor:group) executor_group : public hiactor::schedulable_actor_group {
class ANNOTATION(actor
: group) executor_group
: public hiactor::schedulable_actor_group {
public:
executor_group(hiactor::actor_base* exec_ctx, const hiactor::byte_t* addr)
: hiactor::schedulable_actor_group(exec_ctx, addr) {}
Expand Down
3 changes: 2 additions & 1 deletion flex/engines/http_server/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ using admin_query_result = payload<gs::Result<seastar::sstring>>;
using graph_management_param =
payload<std::pair<seastar::sstring, seastar::sstring>>;
using graph_management_query_param =
payload<std::pair<seastar::sstring, std::unordered_map<seastar::sstring, seastar::sstring>>>;
payload<std::pair<seastar::sstring,
std::unordered_map<seastar::sstring, seastar::sstring>>>;
using procedure_query_param =
payload<std::pair<seastar::sstring, seastar::sstring>>;
using create_procedure_query_param =
Expand Down
2 changes: 1 addition & 1 deletion flex/storages/metadata/metadata_store_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#define FLEX_STORAGES_METADATA_METADATA_STORE_FACTORY_H_

#include <string>
#include "flex/storages/metadata/local_file_metadata_store.h"
#include "flex/storages/metadata/default_graph_meta_store.h"
#include "flex/storages/metadata/graph_meta_store.h"
#include "flex/storages/metadata/local_file_metadata_store.h"

namespace gs {

Expand Down
Loading

0 comments on commit ce3cc2f

Please sign in to comment.