milestone 18: collapse duplicated infrastructure into shared listener core, crud list helper, resource shells, transport race, name and line helpers, ui modules
This commit is contained in:
@@ -281,10 +281,7 @@ pub fn applyPut(
|
||||
arena: Allocator,
|
||||
patch: Patch,
|
||||
) error{OutOfMemory}!union(enum) { config: model.Config, fail: Failure } {
|
||||
const database = switch (mutations.configDb(state)) {
|
||||
.database => |value| value,
|
||||
.fail => |failure| return .{ .fail = failure },
|
||||
};
|
||||
const database = mutations.requireConfigDb(state) catch return .{ .fail = mutations.no_config_db };
|
||||
|
||||
// Ruling 18 of milestone 16: argon2id at m=19 MiB is the longest thing this
|
||||
// handler does, and its input is the parsed patch alone — nothing under the
|
||||
@@ -449,10 +446,8 @@ pub const hash_stall_control = if (builtin.is_test) struct {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
pub fn get(state: *server.WebState, io: std.Io, request: *Request) HandlerError!void {
|
||||
const database = switch (mutations.configDb(state)) {
|
||||
.database => |value| value,
|
||||
.fail => |failure| return mutations.respondFailure(request, failure, "reading the settings"),
|
||||
};
|
||||
const database = mutations.requireConfigDb(state) catch
|
||||
return mutations.respondFailure(request, mutations.no_config_db, "reading the settings");
|
||||
|
||||
// Under the same lock the mutation handlers hold: a PUT rewrites every
|
||||
// settings row in one transaction on this shared connection, and SQLite's
|
||||
|
||||
Reference in New Issue
Block a user