ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
topology.h
Go to the documentation of this file.
2#include <ascii-chat/common.h>
8
9#pragma once
10
11#include "metrics.h"
13#include <stdbool.h>
14#include <stddef.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
24
38 consensus_topology_t **out_topology);
39
46
54
62
73
84
93
103
104#ifdef __cplusplus
105}
106#endif
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
unsigned char uint8_t
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
#define MAX_SESSION_PARTICIPANTS
#define SESSION_ID_SIZE
⚙️ Common definitions, error codes, macros, and types shared throughout the application
Ring consensus metrics collection and wire protocol.
Ring topology for consensus participants.
Definition topology.c:22
uint8_t participant_ids[MAX_SESSION_PARTICIPANTS][SESSION_ID_SIZE]
Participant UUIDs in sorted order.
Definition topology.c:23
int num_participants
Total number of participants.
Definition topology.c:24
struct consensus_topology consensus_topology_t
Ring topology for consensus participants.
int consensus_topology_get_position(const consensus_topology_t *topology)
Get my position in ring (0 = first).
Definition topology.c:76
asciichat_error_t consensus_topology_get_next(const consensus_topology_t *topology, uint8_t out_id[SESSION_ID_SIZE])
Get next participant ID in ring.
Definition topology.c:88
asciichat_error_t consensus_topology_get_prev(const consensus_topology_t *topology, uint8_t out_id[SESSION_ID_SIZE])
Get previous participant ID in ring.
Definition topology.c:98
asciichat_error_t consensus_topology_get_all(const consensus_topology_t *topology, uint8_t out_ids[MAX_SESSION_PARTICIPANTS][SESSION_ID_SIZE], int *out_count)
Get all participant IDs in ring order.
Definition topology.c:117
void consensus_topology_destroy(consensus_topology_t *topology)
Destroy topology.
Definition topology.c:70
asciichat_error_t consensus_topology_create(const uint8_t participant_ids[MAX_SESSION_PARTICIPANTS][SESSION_ID_SIZE], int num_participants, const uint8_t my_id[SESSION_ID_SIZE], consensus_topology_t **out_topology)
Create new ring topology from participant list.
Definition topology.c:43
bool consensus_topology_am_leader(const consensus_topology_t *topology)
Check if I am the ring leader (last position).
Definition topology.c:82
asciichat_error_t consensus_topology_get_leader(const consensus_topology_t *topology, uint8_t out_id[SESSION_ID_SIZE])
Get ring leader ID (last participant).
Definition topology.c:108