DoxigAlpha

writeManifest

If want_shared_lock is true, this function automatically downgrades the lock from exclusive to shared.

Function parameters

Parameters

#
self:*Manifest

Type definitions in this namespace

Types

#

Functions in this namespace

Functions

#
obtain
Be sure to call `Manifest.deinit` after successful initialization.
readSmallFile
On operating systems that support symlinks, does a readlink.
writeSmallFile
On operating systems that support symlinks, does a symlink.

This is 128 bits - Even with 2^54 cache entries, the probably of a collision would be under 10^-6

Values

#
bin_digest_len
This is 128 bits - Even with 2^54 cache entries, the probably of a collision would be under 10^-6
hex_digest_len
= bin_digest_len * 2
hasher_init
Initial state with random bytes, that can be copied.

Source

Implementation

#
pub fn writeManifest(self: *Manifest) !void {
    assert(self.have_exclusive_lock);

    const manifest_file = self.manifest_file.?;
    if (self.manifest_dirty) {
        self.manifest_dirty = false;

        var buffer: [4000]u8 = undefined;
        var fw = manifest_file.writer(&buffer);
        writeDirtyManifestToStream(self, &fw) catch |err| switch (err) {
            error.WriteFailed => return fw.err.?,
            else => |e| return e,
        };
    }

    if (self.want_shared_lock) {
        try self.downgradeToSharedLock();
    }
}