BookArtifactService Pennington.Book
Single source of truth for every book artifact, behind the artifact-tier façade BookArtifactContentService (which serves dev requests and enumerates the PDFs for the static build) — the same shape as SearchArtifactService.
The projection fold (post-pipeline HTML per page) and the static-asset map are computed once, lazily; each book's composed HTML is cached per (book, locale); PDF bytes are rendered on demand through the singleton ChromiumBrowserProvider and cached until a file change drops the whole service. EnumerateArtifacts is deliberately cheap — pure options × locales, no projection, no Chromium — so build enumeration and link verification never trigger a render.
Constructors
BookArtifactService
#public BookArtifactService(BookOptions options, PenningtonOptions penn, LocalizationOptions localization, ISiteProjection projection, IEnumerable<IContentService> contentServices, NavigationBuilder navigationBuilder, BookComposer composer, AssetInliner assetInliner, ChromiumBrowserProvider chromium, TimeProvider clock, ILogger<BookArtifactService> logger)
Creates the service; all artifacts are computed lazily on first request.
Parameters
optionsBookOptionspennPenningtonOptionslocalizationLocalizationOptionsprojectionISiteProjectioncontentServicesIEnumerable<IContentService>navigationBuilderNavigationBuildercomposerBookComposerassetInlinerAssetInlinerchromiumChromiumBrowserProviderclockTimeProviderloggerILogger<BookArtifactService>
Methods
GetPdfAsync
#public Task<byte[]> GetPdfAsync(string pdfPath)
Renders the PDF for the artifact at pdfPath (e.g. pdf/tutorials.pdf), or null when no book matches.
Parameters
pdfPathstring
Returns
Task<byte[]>GetPreviewHtmlAsync
#public Task<string> GetPreviewHtmlAsync(string previewPath)
Returns the composed HTML for the preview route at previewPath, or null when no book matches.
Parameters
previewPathstring
Returns
Task<string>OnFileChanged
#public FileWatchResponse OnFileChanged(FileChangeNotification change)
Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
Parameters
changeFileChangeNotification
Returns
FileWatchResponsePennington.Book.BookArtifactService
namespace Pennington.Book;
/// Single source of truth for every book artifact, behind the artifact-tier façade BookArtifactContentService (which serves dev requests and enumerates the PDFs for the static build) — the same shape as SearchArtifactService. The projection fold (post-pipeline HTML per page) and the static-asset map are computed once, lazily; each book's composed HTML is cached per (book, locale); PDF bytes are rendered on demand through the singleton ChromiumBrowserProvider and cached until a file change drops the whole service. EnumerateArtifacts is deliberately cheap — pure options × locales, no projection, no Chromium — so build enumeration and link verification never trigger a render.
public class BookArtifactService
{
/// Creates the service; all artifacts are computed lazily on first request.
public BookArtifactService(BookOptions options, PenningtonOptions penn, LocalizationOptions localization, ISiteProjection projection, IEnumerable<IContentService> contentServices, NavigationBuilder navigationBuilder, BookComposer composer, AssetInliner assetInliner, ChromiumBrowserProvider chromium, TimeProvider clock, ILogger<BookArtifactService> logger)
;
/// Renders the PDF for the artifact at pdfPath (e.g. pdf/tutorials.pdf), or null when no book matches.
public Task<byte[]> GetPdfAsync(string pdfPath)
;
/// Returns the composed HTML for the preview route at previewPath, or null when no book matches.
public Task<string> GetPreviewHtmlAsync(string previewPath)
;
/// Called on the file-watcher thread for every watched change. Must be quick and thread-safe.
public FileWatchResponse OnFileChanged(FileChangeNotification change)
;
}