Skip to documentation
SLOP

tiny.sql.LazyHistory

Reference tiny.sql LazyHistory

Defined in lifecycle.

API (11)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callslifecycleLazyHistory
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/sql/src/lifecycle.zig:162

zig
pub const LazyHistory = struct {    allocator: Allocator,    io: std.Io,    dir: std.Io.Dir,    path: []u8,    state: State,    retired: ?history_mod.refs.Snapshot = null,    read_only: bool = false,    const State = union(enum) {        deferred: history_mod.refs.Snapshot,        open: history_mod.History,    };    pub fn full(self: *LazyHistory) Error!*history_mod.History {        switch (self.state) {            .open => {},            .deferred => |snapshot| {                std.debug.assert(self.retired == null);                const opened = try history_mod.History.open(self.allocator, self.dir, .{                    .io = self.io,                    .path = self.path,                    .recovery = .reject,                    .create = !self.read_only,                    .read_only = self.read_only,                });                self.retired = snapshot;                self.state = .{ .open = opened };            },        }        return &self.state.open;    }    pub fn replayed(self: *const LazyHistory) bool {        return self.state == .open;    }    pub fn checkoutBranch(self: *const LazyHistory, name: []const u8) Error!branch.Checkout {        return switch (self.state) {            .open => |*history| try history.checkoutBranch(name),            .deferred => |*snapshot| checkout: {                const entry = snapshot.find(name) orelse return error.RefNotFound;                break :checkout branch.Checkout.init(                    .{ .name = entry.name, .target = entry.head },                    entry.root,                );            },        };    }    pub fn deinit(self: *LazyHistory) void {        switch (self.state) {            .open => |*history| history.deinit(),            .deferred => |*snapshot| snapshot.deinit(),        }        if (self.retired) |*snapshot| snapshot.deinit();        self.dir.close(self.io);        self.allocator.free(self.path);        self.* = undefined;    }};

Source: lib/sql/src/root.zig:101

zig
pub const LazyHistory = lifecycle.LazyHistory;
Called byCallsNo direct callersBranchCheckoutinitLazyHistorycheckoutBranch
Static calls · unresolved targets: 0 · external targets: 2.

Audit

Definitions5
Public names10
Members7
Version26.7.0
Revisiondaab053ee433