Skip to content

Commit

Permalink
clusterer: refactor topology related code into a new file
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Jan 12, 2021
1 parent 9ae8ca7 commit 0b7a94a
Show file tree
Hide file tree
Showing 8 changed files with 1,444 additions and 1,364 deletions.
1,366 changes: 5 additions & 1,361 deletions modules/clusterer/clusterer.c

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions modules/clusterer/clusterer.h
Expand Up @@ -57,7 +57,6 @@
#define CAP_SYNC_PENDING (1<<1)
#define CAP_PKT_BUFFERING (1<<2)


typedef enum { CLUSTERER_PING, CLUSTERER_PONG,
CLUSTERER_LS_UPDATE, CLUSTERER_FULL_TOP_UPDATE,
CLUSTERER_UNKNOWN_ID, CLUSTERER_NODE_DESCRIPTION,
Expand Down Expand Up @@ -131,25 +130,30 @@ struct node_search_info {
struct node_search_info *next; /* linker in queue */
};

#define TIME_DIFF(_start, _now) \
((_now).tv_sec*1000000 + (_now).tv_usec \
- (_start).tv_sec*1000000 - (_start).tv_usec)

extern enum sip_protos clusterer_proto;

extern str cl_internal_cap;
extern str cl_extra_cap;

void heartbeats_timer(void);
void seed_fb_check_timer(utime_t ticks, void *param);

void bin_rcv_cl_packets(bin_packet_t *packet, int packet_type,
struct receive_info *ri, void *att);
void bin_rcv_cl_extra_packets(bin_packet_t *packet, int packet_type,
struct receive_info *ri, void *att);

int get_next_hop(struct node_info *dest);
int msg_add_trailer(bin_packet_t *packet, int cluster_id, int dst_id);
enum clusterer_send_ret clusterer_send_msg(bin_packet_t *packet,
int cluster_id, int dst_id);
int send_single_cap_update(struct cluster_info *cluster, struct local_cap *cap,
int cap_state);
int send_cap_update(struct node_info *dest_node, int require_reply);
void do_actions_node_ev(struct cluster_info *clusters, int *select_cluster,
int no_clusters);

enum clusterer_send_ret send_gen_msg(int cluster_id, int node_id, str *gen_msg,
str *exchg_tag, int req_like);
Expand Down
1 change: 1 addition & 0 deletions modules/clusterer/clusterer_mod.c
Expand Up @@ -34,6 +34,7 @@

#include "api.h"
#include "node_info.h"
#include "topology.h"
#include "clusterer.h"
#include "sync.h"
#include "sharing_tags.h"
Expand Down
1 change: 1 addition & 0 deletions modules/clusterer/node_info.c
Expand Up @@ -34,6 +34,7 @@

#include "api.h"
#include "node_info.h"
#include "topology.h"
#include "clusterer.h"

/* DB */
Expand Down
1 change: 1 addition & 0 deletions modules/clusterer/node_info.h
Expand Up @@ -27,6 +27,7 @@
#define CL_NODE_INFO_H

#include "../../db/db.h"
#include "../../rw_locking.h"
#include "api.h"
#include "clusterer.h"

Expand Down
1 change: 1 addition & 0 deletions modules/clusterer/sync.c
Expand Up @@ -22,6 +22,7 @@

#include "api.h"
#include "node_info.h"
#include "topology.h"
#include "clusterer.h"
#include "sync.h"

Expand Down

0 comments on commit 0b7a94a

Please sign in to comment.