ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
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
20
35 consensus_topology_t **out_topology);
36
43
51
59
70
81
90
101 int *out_count);
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
⚙️ Common definitions, error codes, macros, and types shared throughout the application
unsigned char uint8_t
Definition common.h:60
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
#define MAX_SESSION_PARTICIPANTS
#define SESSION_ID_SIZE
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:79
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:91
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:101
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:120
void consensus_topology_destroy(consensus_topology_t *topology)
Destroy topology.
Definition topology.c:73
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:44
bool consensus_topology_am_leader(const consensus_topology_t *topology)
Check if I am the ring leader (last position).
Definition topology.c:85
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:111