writeVersion method
Implementation
Future<void> writeVersion(String version, String path, String html) async {
final normPath = _normalizePath(path);
final hash = sha256.convert(utf8.encode(html)).toString();
await _objectsDir.create(recursive: true);
final objFile = File(
'${_objectsDir.path}${Platform.pathSeparator}$hash.html',
);
if (!await objFile.exists()) {
await _writeFile(objFile, html);
}
final draft = _versionDir(version);
// Write direct path file for this specific route for concurrency and fast read
await _writeFile(_artifactFile(draft, normPath), html);
// Write sharded route entry
final entry = RouteArtifactEntry(
path: normPath,
objectHash: hash,
contentLength: utf8.encode(html).length,
generatedAt: DateTime.now().toUtc(),
);
await _saveRouteArtifactShard(draft, normPath, entry);
}