Skip to documentation
SLOP

tiny.sql.DatabaseRoot

Reference tiny.sql DatabaseRoot

Defined in version.

API (11)

Actions

Public operations.

Fields and members

Public fields and members.

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

Source

Source: lib/sql/src/version.zig:313

zig
pub const DatabaseRoot = struct {    allocator: ?Allocator = null,    format: u32 = format_version,    feature: u32 = 0,    entries: []const RelationEntry = &.{},    conflicts: Hash,    hash: Hash,    pub fn init(entries: []const RelationEntry, conflicts: ConflictRoot) DatabaseRoot {        var builder = Builder.init("sql.database");        builder.writeU32(format_version);        builder.writeU32(0);        builder.hash(conflicts.hash);        builder.writeU64(entries.len);        for (entries) |entry| {            builder.bytes(entry.name);            builder.hash(entry.hash);        }        return .{            .entries = entries,            .conflicts = conflicts.hash,            .hash = builder.finish(),        };    }    pub fn initSorted(allocator: Allocator, entries: []const RelationEntry, conflicts: ConflictRoot) Allocator.Error!DatabaseRoot {        const sorted = try allocator.alloc(RelationEntry, entries.len);        var copied: usize = 0;        errdefer {            for (sorted[0..copied]) |entry| allocator.free(entry.name);            allocator.free(sorted);        }        for (entries, sorted) |entry, *target| {            target.* = .{                .name = try allocator.dupe(u8, entry.name),                .hash = entry.hash,            };            copied += 1;        }        std.mem.sort(RelationEntry, sorted, {}, relationEntryLessThan);        var root = init(sorted, conflicts);        root.allocator = allocator;        return root;    }    pub fn clone(self: *const DatabaseRoot, allocator: Allocator) Allocator.Error!DatabaseRoot {        return try self.withConflicts(allocator, self.conflicts);    }    pub fn withConflicts(        self: *const DatabaseRoot,        allocator: Allocator,        conflicts: Hash,    ) Allocator.Error!DatabaseRoot {        return try initSorted(allocator, self.entries, .{ .hash = conflicts });    }    pub fn deinit(self: *DatabaseRoot) void {        if (self.allocator) |allocator| {            for (self.entries) |entry| allocator.free(entry.name);            allocator.free(self.entries);        }        self.* = undefined;    }};

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

zig
pub const DatabaseRoot = version.DatabaseRoot;
Called byCallsDatabaseValuecloneDatabaseRootwithConflictsDatabaseRootclone
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.sql.src.history.record.DatabaseRootRecorddeinittest sourcelib.sql.src.history.resolvertest: history resolver typed keys agr...private sourcelib.sql.src.session.database.DatabaseSessionadoptWorkingRootDatabaseSessiondeinitDatabaseValuedeinitDatabaseRootdeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsprivate sourcelib.sql.src.connection.DatabaseMaterializationvalidateValuehistory.identityeachprivate sourcelib.sql.src.history.refsdatabaseRootIdentitytest sourcelib.sql.src.history.refstest: refs advance rejects a hash-val...test sourcelib.sql.src.history.refstest: refs advance rejects a ref befo...+4 moreprivate sourcelib.sql.src.version.Builderbytesprivate sourcelib.sql.src.version.Builderfinishprivate sourcelib.sql.src.version.Builderhashprivate sourcelib.sql.src.version.Builderinitprivate sourcelib.sql.src.version.BuilderwriteU32private sourcelib.sql.src.version.BuilderwriteU64DatabaseRootinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsprivate sourcelib.sql.src.blamesnapshotCommitprivate sourcelib.sql.src.connection.ConnectionreplaceConflictRootprivate sourcelib.sql.src.history.packimportDatabaseRootPayloadprivate sourcelib.sql.src.history.recordreadDatabaseRootValueprivate sourcelib.sql.src.history.recoverapplyDatabaseRootPayload+12 moreDatabaseRootinitSorted
Static calls · unresolved targets: 1 · external targets: 3.
Called byCallsNo direct callsDatabaseRootcloneDatabaseRootwithConflicts
Static calls · unresolved targets: 1 · external targets: 0.

Complete caller list for DatabaseRoot.init

9 direct callers.

Complete caller list for DatabaseRoot.initSorted

17 direct callers.

Audit

Definitions6
Public names12
Members6
Version26.7.0
Revisiondaab053ee433