Prepare global NetworkRuntime module

This commit is contained in:
Nikolay Govorov
2026-03-04 21:55:50 +00:00
parent 0e4a65efb7
commit 8e59ce9e9f
26 changed files with 985 additions and 981 deletions

View File

@@ -25,21 +25,19 @@ const Config = @import("Config.zig");
const Snapshot = @import("browser/js/Snapshot.zig");
const Platform = @import("browser/js/Platform.zig");
const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
const RobotStore = @import("browser/Robots.zig").RobotStore;
pub const Http = @import("http/Http.zig");
const Network = @import("network/Runtime.zig");
pub const ArenaPool = @import("ArenaPool.zig");
const App = @This();
http: Http,
network: Network,
config: *const Config,
platform: Platform,
snapshot: Snapshot,
telemetry: Telemetry,
allocator: Allocator,
arena_pool: ArenaPool,
robots: RobotStore,
app_dir_path: ?[]const u8,
shutdown: bool = false,
@@ -50,8 +48,7 @@ pub fn init(allocator: Allocator, config: *const Config) !*App {
app.* = .{
.config = config,
.allocator = allocator,
.robots = RobotStore.init(allocator),
.http = undefined,
.network = undefined,
.platform = undefined,
.snapshot = undefined,
.app_dir_path = undefined,
@@ -59,8 +56,8 @@ pub fn init(allocator: Allocator, config: *const Config) !*App {
.arena_pool = undefined,
};
app.http = try Http.init(allocator, &app.robots, config);
errdefer app.http.deinit();
app.network = try Network.init(allocator, config);
errdefer app.network.deinit();
app.platform = try Platform.init();
errdefer app.platform.deinit();
@@ -90,8 +87,7 @@ pub fn deinit(self: *App) void {
self.app_dir_path = null;
}
self.telemetry.deinit();
self.robots.deinit();
self.http.deinit();
self.network.deinit();
self.snapshot.deinit();
self.platform.deinit();
self.arena_pool.deinit();