This commit is contained in:
2026-02-06 21:03:59 -03:00
commit 2b7ab5f570
267 changed files with 176026 additions and 0 deletions

44
src/p2p/types.zig Normal file
View File

@@ -0,0 +1,44 @@
//! P2P Core Types
//!
//! This module defines the fundamental types used throughout the P2P library,
//! including state enums.
const std = @import("std");
/// P2P library states
pub const P2PState = enum(u8) {
/// Library is not initialized
Uninitialized = 0,
/// Library is initialized but not running
Initialized = 1,
/// Library is starting up
Starting = 2,
/// Library is running and operational
Running = 3,
/// Library is stopping
Stopping = 4,
/// Library is stopped
Stopped = 5,
/// Library is in maintenance mode
Maintenance = 6,
/// Library has encountered an error
Error = 7,
};
// Tests
test "P2PState: all enum values" {
const states = [_]P2PState{
.Uninitialized,
.Initialized,
.Starting,
.Running,
.Stopping,
.Stopped,
.Maintenance,
.Error,
};
for (states) |state| {
try std.testing.expect(@intFromEnum(state) < 10);
}
}