addFileInner
Function parameters
Parameters
- self:*Manifest
- handle:?fs.File
- max_file_size:?usize
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
fn addFileInner(self: *Manifest, prefixed_path: PrefixedPath, handle: ?fs.File, max_file_size: ?usize) usize {
const gop = self.files.getOrPutAssumeCapacityAdapted(prefixed_path, FilesAdapter{});
if (gop.found_existing) {
self.cache.gpa.free(prefixed_path.sub_path);
gop.key_ptr.updateMaxSize(max_file_size);
gop.key_ptr.updateHandle(handle);
return gop.index;
}
gop.key_ptr.* = .{
.prefixed_path = prefixed_path,
.contents = null,
.max_file_size = max_file_size,
.stat = undefined,
.bin_digest = undefined,
.handle = handle,
};
self.hash.add(prefixed_path.prefix);
self.hash.addBytes(prefixed_path.sub_path);
return gop.index;
}