tiny.sql.FileReadLease
Defined in tiny.sql.
API (6)
Actions
Public operations.
Fields and members
Public fields and members.
Source
Source: lib/sql/src/file.zig:3177
zig
pub const ReadLease = struct { database: *Database, index: u8, serial: u64, /// Releases one hold on this read lease. A lease of a database that /// publishes through lanes keeps its own handle on the base file, and that /// handle closes when the last hold is released. Other leases share the /// database's handle. Every snapshot taken from the lease stops being /// usable once the last hold is gone. pub fn deinit(self: *ReadLease) void { self.database.read_leases.release( self.database.io, self.index, self.serial, ); self.* = undefined; } pub fn retain(self: *const ReadLease) Error!ReadLease { try self.database.read_leases.retain(self.index, self.serial); return self.*; } pub fn snapshot(self: *const ReadLease) Snapshot { const slot = self.database.read_leases.live( self.index, self.serial, ) catch unreachable; const base_file = if (slot.base_file) |*value| value.file() else unreachable; return .{ .source = .{ .durable = .{ .io = self.database.io, .base_file = base_file, .pager = &self.database.pager, .read_cache = &self.database.read_cache, .recovery_required = &self.database.recovery_required, .guard = .{ .database = self.database, .index = self.index, .serial = self.serial, }, } }, .view = slot.view, }; }};Source: lib/sql/src/root.zig:190
zig
pub const FileReadLease = file.ReadLease;Audit
| Definitions | 4 |
|---|---|
| Public names | 4 |
| Members | 3 |
| Version | 26.7.0 |
| Revision | daab053ee433 |