Skip to documentation
SLOP

tiny.sql.relationRoot

Reference tiny.sql relationRoot

Defined in version.

Called byCallsprivate sourcelib.sql.src.blamesnapshotCommitConnectionrelationViewtest sourcelib.sql.src.difftest: relation diff marks rows when s...test sourcelib.sql.src.difftest: relation diff reports added rem...test sourcelib.sql.src.difftest: relation diff skips equal table...+12 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.BuilderwriteU32+10 moreversionrelationRoot
Static calls · unresolved targets: 0 · external targets: 7.

Source

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

zig
pub fn relationRoot(allocator: Allocator, name: []const u8, catalog_schema: catalog_mod.Schema, handle: *const catalog_mod.RelationHandle, stats: ?*const catalog_mod.RelationStats) Error!RelationRoot {    const owned_name = try allocator.dupe(u8, name);    errdefer allocator.free(owned_name);    var table_root = try mapRoot(allocator, &handle.relation.table.rows);    errdefer table_root.deinit();    var schema_descriptor = try RelationSchema.init(allocator, handle.definitions, handle.index_definitions);    errdefer schema_descriptor.deinit();    const schema_hash = schemaHash(schema_descriptor.columns, schema_descriptor.indexes);    const stats_root = relationStatsRoot(stats);    const indexes = try allocator.alloc(IndexRoot, handle.specs.len);    var index_count: usize = 0;    errdefer {        for (indexes[0..index_count]) |*index| index.deinit();        allocator.free(indexes);    }    for (handle.specs, indexes) |spec, *target| {        var index_tree = try handle.relation.space.tree(spec.root_page);        var map = try mapRoot(allocator, &index_tree);        var map_assigned = false;        errdefer if (!map_assigned) map.deinit();        const index_stats = findIndexStats(stats, spec.root_page);        const index_stats_hash = indexStatsHash(index_stats);        target.* = .{            .fields = fieldsHash(spec.fields, spec.columns),            .map = map,            .stats = index_stats_hash,            .hash = indexHash(spec.fields, spec.columns, map.hash, index_stats_hash),        };        map_assigned = true;        index_count += 1;    }    var builder = Builder.init("sql.relation");    builder.writeU32(format_version);    builder.bytes(name);    builder.hash(schema_hash);    builder.hash(table_root.hash);    builder.hash(stats_root.hash);    builder.writeU64(indexes.len);    for (indexes) |index| builder.hash(index.hash);    return .{        .allocator = allocator,        .name = owned_name,        .catalog = .{            .format = catalog_schema.format,            .version = catalog_schema.version,        },        .schema = schema_hash,        .schema_descriptor = schema_descriptor,        .table = table_root,        .indexes = indexes,        .stats = stats_root,        .hash = builder.finish(),    };}

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

zig
pub const relationRoot = version.relationRoot;

Complete caller list

17 direct callers.

Complete call list

15 direct calls.

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433