Documentation
¶
Index ¶
- func ConfigDir() string
- func FetchDocumentURLsWithCache(ctx context.Context, client *http.Client, store *Store, doc psrt.Document, ...) (map[string]compileasset.Asset, error)
- func FetchURLsWithCache(ctx context.Context, client *http.Client, store *Store, urls []string) (map[string]compileasset.Asset, error)
- func LoadMap(path string) (map[string]string, error)
- func SaveMap(path, psrtBase string, m map[string]string) error
- func URLPageLabels(doc psrt.Document) map[string]string
- type Store
- func (s *Store) EnsureCached(ctx context.Context, client *http.Client, url, pageLabel string) error
- func (s *Store) EnsureDocument(ctx context.Context, client *http.Client, doc psrt.Document) error
- func (s *Store) ReadAsset(url string) (compileasset.Asset, bool, error)
- func (s *Store) RefreshAsset(ctx context.Context, client *http.Client, url, pageLabel string) error
- func (s *Store) ResolveAbsolute(url string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the PSRT config root (PSRT_CONFIG_DIR or OS default).
func FetchDocumentURLsWithCache ¶
func FetchDocumentURLsWithCache(ctx context.Context, client *http.Client, store *Store, doc psrt.Document, urls []string) (map[string]compileasset.Asset, error)
FetchDocumentURLsWithCache uses page labels from doc for any missing cache entries.
func FetchURLsWithCache ¶
func FetchURLsWithCache(ctx context.Context, client *http.Client, store *Store, urls []string) (map[string]compileasset.Asset, error)
FetchURLsWithCache loads assets from disk when mapped; otherwise downloads and caches.
Types ¶
type Store ¶
type Store struct {
RootDir string
MapPath string
ImagesDir string
PsrtBase string
PsrtDir string
// contains filtered or unexported fields
}
Store manages on-disk cache for one PSRT file's remote assets.
func (*Store) EnsureCached ¶
EnsureCached downloads or copies url if not cached locally.
func (*Store) EnsureDocument ¶
EnsureDocument warms cache for all HTTP URLs in doc.
func (*Store) RefreshAsset ¶
RefreshAsset forces re-download or re-read from disk and updates the map.
Click to show internal directories.
Click to hide internal directories.