summaryrefslogtreecommitdiff
path: root/src/host/Host.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/host/Host.zig')
-rw-r--r--src/host/Host.zig24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/host/Host.zig b/src/host/Host.zig
index 05d08f7..75b49b3 100644
--- a/src/host/Host.zig
+++ b/src/host/Host.zig
@@ -74,7 +74,6 @@ state: memory.StateFile,
session: memory.Session,
/// A failed resource setup disables app callbacks while keeping host controls alive.
session_ready: bool = false,
-store: memory.StoreFile,
/// Images and buffers the sketch made (`newImage`, `decodeImage`,
/// `newBuffer`): Session holds their handles, so they go when it resets.
made: struct { images: std.ArrayList(abi.Image) = .empty, buffers: std.ArrayList(abi.Buffer) = .empty } = .{},
@@ -184,12 +183,6 @@ pub fn init(self: *Host, gpa: std.mem.Allocator, io: std.Io, environ: *const std
if (state_path.len > 0) options.state = state_path;
var state = try memory.StateFile.open(gpa, options.state);
errdefer state.close();
- var store_buf: [std.fs.max_path_bytes]u8 = undefined;
- var store = memory.StoreFile.open(gpa, try std.mem.print(&store_buf, "{s}.store", .{options.state}), options.fresh) catch |err| {
- if (err == error.StoreInUse) std.log.err("{s}.store is open in another process", .{options.state});
- return err;
- };
- errdefer store.close();
self.* = .{
.gpa = gpa,
@@ -204,7 +197,6 @@ pub fn init(self: *Host, gpa: std.mem.Allocator, io: std.Io, environ: *const std
.audio = .{ .gpa = gpa },
.state = state,
.session = .init(gpa),
- .store = store,
.timeline = undefined,
.sessions = .{ .gpa = gpa, .io = io },
.sketch = sketch,
@@ -267,7 +259,6 @@ pub fn deinit(self: *Host) void {
self.written.deinit(self.gpa);
self.timeline.deinit();
self.session.deinit(self.gpa);
- self.store.close();
self.made.images.deinit(self.gpa);
self.made.buffers.deinit(self.gpa);
self.state.close();
@@ -658,9 +649,7 @@ fn context(self: *Host) abi.Context {
.input = &self.input,
.scratch = self.frame_arena.allocator(),
.session = self.session.heap.allocator(),
- .store = self.store.allocator(),
.session_root = self.session.bytes.ptr,
- .store_root = self.store.root(),
.commands = &self.commands,
};
}
@@ -774,7 +763,6 @@ fn adopt(self: *Host, sketch: abi.Sketch) !void {
const adoption = try self.state.adopt(self.gpa, info.state, sketch.defaults);
const session_reset = try self.session.adopt(self.gpa, info.session, sketch.defaults);
if (session_reset) self.releaseMade();
- const stored = try self.store.adopt(self.gpa, info.store, sketch.defaults);
_ = self.info_arena.reset(.retain_capacity);
const arena = self.info_arena.allocator();
self.name = try arena.dupe(u8, info.name);
@@ -797,10 +785,6 @@ fn adopt(self: *Host, sketch: abi.Sketch) !void {
if (!self.session_ready) self.console.visible = true;
}
if (session_reset and self.reloads > 0) self.print("session layout changed: session reset", .{});
- switch (stored) {
- .unchanged, .created => {},
- .migrated => |m| self.print("store layout changed: kept {d} fields, reset {d} to defaults", .{ m.kept, m.reset }),
- }
}
/// Frees what the old Session made: its handles are gone with it.
@@ -1155,11 +1139,10 @@ test "session setup runs for restored state and layout reset, not same-layout re
const State = extern struct { value: u32 = 1 };
const Session1 = extern struct { ready: u32 = 0 };
const Session2 = extern struct { ready: u32 = 0, extra: u32 = 0 };
- const Store = struct {};
var setup_calls: usize = 0;
var init_calls: usize = 0;
var fail_setup = false;
- const description: abi.Info = .{ .abi = abi.hash, .name = "setup-test", .width = 1, .height = 1, .state = abi.layout.of(State, .state), .session = abi.layout.of(Session1, .session), .store = abi.layout.of(Store, .store) };
+ const description: abi.Info = .{ .abi = abi.hash, .name = "setup-test", .width = 1, .height = 1, .state = abi.layout.of(State, .state), .session = abi.layout.of(Session1, .session) };
const changed: abi.Info = blk: {
var value = description;
value.session = abi.layout.of(Session2, .session);
@@ -1175,7 +1158,6 @@ test "session setup runs for restored state and layout reset, not same-layout re
switch (kind) {
.state => @as(*State, @ptrCast(@alignCast(ptr))).* = .{},
.session => @as(*Session1, @ptrCast(@alignCast(ptr))).* = .{},
- .store => {},
}
}
fn defaults2(kind: abi.Memory, ptr: [*]u8) callconv(.c) void {
@@ -1203,9 +1185,7 @@ test "session setup runs for restored state and layout reset, not same-layout re
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
var state_buf: [std.fs.max_path_bytes]u8 = undefined;
- var store_buf: [std.fs.max_path_bytes]u8 = undefined;
const state_path = try std.mem.print(&state_buf, ".zig-cache/tmp/{s}/setup.state", .{&tmp.sub_path});
- const store_path = try std.mem.print(&store_buf, ".zig-cache/tmp/{s}/setup.store", .{&tmp.sub_path});
{
var state = try memory.StateFile.open(a, state_path);
defer state.close();
@@ -1218,8 +1198,6 @@ test "session setup runs for restored state and layout reset, not same-layout re
host.gpa = a;
host.state = try memory.StateFile.open(a, state_path);
defer host.state.close();
- host.store = try memory.StoreFile.open(a, store_path, false);
- defer host.store.close();
host.session = .init(a);
defer host.session.deinit(a);
host.info_arena = .init(a);