Skip to documentation
SLOP

tiny.smg.storage.database.read

Reference tiny.smg storage database read

Defined in storage.database.

API (11)

Actions

Public operations.

Types and contracts

Public types and contracts.

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

Source

Called byCallsNo direct callsconceptspublishstorage.database.readdatabaseConceptDocuments
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest; no linktools.smg.src.storage.database.lifecycletest: smg database round-trips nodes ...test; no linktools.smg.src.storage.synctest: graph replacement streams store...storage.database.readdatabaseEdges
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest; no linktools.smg.src.storage.database.lifecycletest: smg database rebuilds unreadabl...test; no linktools.smg.src.storage.database.lifecycletest: smg database round-trips nodes ...test; no linktools.smg.src.storage.database.lifecycletest: smg database updates and delete...test; no linktools.smg.src.storage.synctest: graph edits commit in bounded b...test; no linktools.smg.src.storage.synctest: graph replacement streams store...storage.database.readdatabaseNodes
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsstorage.syncreplaceGraphObservedprivate; no linktools.smg.src.storage.database.readcatalogGraphCountsstorage.database.readgraphCounts
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsconceptsloadFromReaderstorage.database.readreaderConceptDocuments
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callersprivate; no linktools.smg.src.storage.database.readcatalogGraphCountsstorage.database.readreaderGraphCounts
Static calls · unresolved targets: 0 · external targets: 0.

Source: tools/smg/src/storage/database/read.zig

zig
const std = @import("std");const storage = @import("../root.zig");const database = @import("root.zig");const rows = storage.rows;pub const GraphCounts = struct {    nodes: usize,    edges: usize,};pub fn graphCounts(opened: *database.Database) database.Error!GraphCounts {    return try catalogGraphCounts(&opened.connection.catalog, opened.allocator);}pub fn readerGraphCounts(reader: *database.Reader) database.Error!GraphCounts {    return try catalogGraphCounts(&reader.catalog, reader.allocator);}pub fn databaseNodes(opened: *database.Database, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.NodeRow {    return try rows.scanNodeRows(&opened.connection.catalog, opened.allocator, row_allocator, value_allocator);}pub fn databaseEdges(opened: *database.Database, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.EdgeRow {    return try rows.scanEdgeRows(&opened.connection.catalog, opened.allocator, row_allocator, value_allocator);}pub fn databaseConceptDocuments(opened: *database.Database, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.ConceptDocumentRow {    return try rows.scanConceptDocumentRows(&opened.connection.catalog, opened.allocator, row_allocator, value_allocator);}pub fn readerNodes(reader: *database.Reader, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.NodeRow {    return try rows.scanNodeRows(&reader.catalog, reader.allocator, row_allocator, value_allocator);}pub fn readerEdges(reader: *database.Reader, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.EdgeRow {    return try rows.scanEdgeRows(&reader.catalog, reader.allocator, row_allocator, value_allocator);}pub fn readerConceptDocuments(reader: *database.Reader, row_allocator: std.mem.Allocator, value_allocator: std.mem.Allocator) database.Error![]rows.ConceptDocumentRow {    return try rows.scanConceptDocumentRows(&reader.catalog, reader.allocator, row_allocator, value_allocator);}pub fn readerNodesInto(reader: *database.Reader, value_allocator: std.mem.Allocator, out: []rows.NodeRow) database.Error!void {    try rows.scanNodeRowsInto(&reader.catalog, reader.allocator, value_allocator, out);}pub fn readerEdgesInto(reader: *database.Reader, value_allocator: std.mem.Allocator, out: []rows.EdgeRow) database.Error!void {    try rows.scanEdgeRowsInto(&reader.catalog, reader.allocator, value_allocator, out);}fn catalogGraphCounts(catalog: anytype, allocator: std.mem.Allocator) database.Error!GraphCounts {    return .{        .nodes = try relationCount(            catalog,            allocator,            rows.nodes_relation,        ),        .edges = try relationCount(            catalog,            allocator,            rows.edges_relation,        ),    };}fn relationCount(    catalog: anytype,    allocator: std.mem.Allocator,    name: []const u8,) database.Error!usize {    var handle = catalog.openRelation(allocator, name) catch |err| switch (err) {        error.RelationNotFound => return 0,        else => return err,    };    defer handle.deinit();    return try handle.relation.table.count();}

Source: tools/smg/src/storage/database/root.zig:3

zig
pub const read = @import("read.zig");

Audit

Definitions12
Public names12
Members2
Version26.7.0
Revisiondaab053ee433