mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-07-30 09:16:07 -04:00
remove Storage and FsCache
This commit is contained in:
@@ -24,7 +24,6 @@ const Snapshot = @import("browser/js/Snapshot.zig");
|
||||
const Platform = @import("browser/js/Platform.zig");
|
||||
const Telemetry = @import("telemetry/telemetry.zig").Telemetry;
|
||||
|
||||
const Storage = @import("storage/Storage.zig");
|
||||
const Network = @import("network/Network.zig");
|
||||
const Watchdog = @import("Watchdog.zig");
|
||||
pub const ArenaPool = @import("ArenaPool.zig");
|
||||
@@ -36,7 +35,6 @@ const App = @This();
|
||||
|
||||
network: Network,
|
||||
config: *const Config,
|
||||
storage: Storage,
|
||||
platform: Platform,
|
||||
snapshot: Snapshot,
|
||||
telemetry: Telemetry,
|
||||
@@ -52,9 +50,6 @@ pub fn init(allocator: Allocator, config: *const Config) !*App {
|
||||
const snapshot = try Snapshot.load();
|
||||
errdefer snapshot.deinit();
|
||||
|
||||
var storage = try Storage.init(allocator, config);
|
||||
errdefer storage.deinit(allocator);
|
||||
|
||||
const app = try allocator.create(App);
|
||||
errdefer allocator.destroy(app);
|
||||
|
||||
@@ -63,7 +58,6 @@ pub fn init(allocator: Allocator, config: *const Config) !*App {
|
||||
.allocator = allocator,
|
||||
.platform = platform,
|
||||
.snapshot = snapshot,
|
||||
.storage = storage,
|
||||
.network = undefined,
|
||||
.app_dir_path = undefined,
|
||||
.telemetry = undefined,
|
||||
@@ -105,7 +99,6 @@ pub fn deinit(self: *App) void {
|
||||
self.snapshot.deinit();
|
||||
self.platform.deinit();
|
||||
self.arena_pool.deinit();
|
||||
self.storage.deinit(allocator);
|
||||
|
||||
allocator.destroy(self);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ const builtin = @import("builtin");
|
||||
const cli = @import("cli.zig");
|
||||
const dump = @import("browser/dump.zig");
|
||||
|
||||
const Storage = @import("storage/Storage.zig");
|
||||
const WebBotAuthConfig = @import("network/WebBotAuth.zig").Config;
|
||||
|
||||
const log = lp.log;
|
||||
@@ -202,8 +201,6 @@ const CommonOptions = .{
|
||||
.{ .name = "block_urls", .type = ?[]const u8 },
|
||||
.{ .name = "cookie", .type = ?[]const u8 },
|
||||
.{ .name = "cookie_jar", .type = ?[]const u8 },
|
||||
.{ .name = "storage_engine", .type = ?Storage.EngineType },
|
||||
.{ .name = "storage_sqlite_path", .type = ?[:0]const u8 },
|
||||
.{ .name = "disable_subframes", .type = bool },
|
||||
.{ .name = "disable_workers", .type = bool },
|
||||
.{ .name = "enable_external_stylesheets", .type = bool },
|
||||
@@ -743,20 +740,6 @@ pub fn cdpMaxHTTPMessageSize(self: *const Config) u14 {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn storageEngine(self: *const Config) ?Storage.EngineType {
|
||||
return switch (self.mode) {
|
||||
inline .serve, .fetch, .mcp, .agent => |opts| opts.storage_engine,
|
||||
else => unreachable,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn storageSqlitePath(self: *const Config) ?[:0]const u8 {
|
||||
return switch (self.mode) {
|
||||
inline .serve, .fetch, .mcp, .agent => |opts| opts.storage_sqlite_path,
|
||||
else => unreachable,
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the user-supplied certificate store (`--ca-cert`/`--ca-path`),
|
||||
/// if any was loaded during argument parsing. The caller takes ownership.
|
||||
pub fn customCertStore(self: *const Config) ?*crypto.X509_STORE {
|
||||
|
||||
1000
src/network/cache/FsCache.zig
vendored
1000
src/network/cache/FsCache.zig
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,24 +0,0 @@
|
||||
// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
|
||||
//
|
||||
// Francis Bouvier <francis@lightpanda.io>
|
||||
// Pierre Tachoire <pierre@lightpanda.io>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const std = @import("std");
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
const Blackhole = @This();
|
||||
|
||||
pub fn deinit(_: *Blackhole, _: Allocator) void {}
|
||||
@@ -1,61 +0,0 @@
|
||||
// Copyright (C) 2023-2026 Lightpanda (Selecy SAS)
|
||||
//
|
||||
// Francis Bouvier <francis@lightpanda.io>
|
||||
// Pierre Tachoire <pierre@lightpanda.io>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
const std = @import("std");
|
||||
const log = @import("../log.zig");
|
||||
const Config = @import("../Config.zig");
|
||||
const Blackhole = @import("Blackhole.zig");
|
||||
const Sqlite = @import("sqlite/Sqlite.zig");
|
||||
|
||||
const Allocator = std.mem.Allocator;
|
||||
|
||||
const Storage = @This();
|
||||
|
||||
pub const EngineType = enum {
|
||||
none,
|
||||
};
|
||||
|
||||
const Engine = union(EngineType) {
|
||||
none: Blackhole,
|
||||
};
|
||||
|
||||
engine: Engine,
|
||||
|
||||
pub fn init(allocator: Allocator, config: *const Config) !Storage {
|
||||
const engine_type = config.storageEngine() orelse .none;
|
||||
const engine = initEngine(allocator, engine_type, config) catch |err| {
|
||||
log.fatal(.storage, "storage setup", .{ .engine = engine_type, .err = err });
|
||||
return err;
|
||||
};
|
||||
|
||||
return .{
|
||||
.engine = engine,
|
||||
};
|
||||
}
|
||||
|
||||
fn initEngine(_: Allocator, engine_type: EngineType, _: *const Config) !Engine {
|
||||
switch (engine_type) {
|
||||
.none => return .{ .none = Blackhole{} },
|
||||
}
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Storage, allocator: Allocator) void {
|
||||
switch (self.engine) {
|
||||
inline else => |*engine| engine.deinit(allocator),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user