ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Cache

Description

One provider owns metadata retention. Local single-flight shares active requests. Public metadata and content-addressed responses follow the sharing policy in the web-layer architecture.

Synopsis

Configuration

data CacheConfig Source #

Retention bounds and the TTL for the local selected-version and assembled stores.

Constructors

CacheConfig 

Fields

Instances

Instances details
Show CacheConfig Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Eq CacheConfig Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

data StoreBudget Source #

Retention floors, used only to stop a store evicting its own live entries.

Constructors

StoreBudget 

Fields

  • sbMinEntries :: Int

    Eviction stops before the retained entry count falls below this floor.

  • sbMinBytes :: Int

    Eviction stops before accounted bytes fall below this floor.

Instances

Instances details
Show StoreBudget Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Eq StoreBudget Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

The cache handle

data MetadataCache Source #

One provider supplies every retention capability beside process-local request coalescing.

newMetadataCache :: CacheConfig -> IO MetadataCache Source #

Select the shipped local provider without an external service dependency.

newMetadataCacheWithProvider :: CacheProvider -> IO MetadataCache Source #

Create only transient flight state. The selected provider owns every retained representation.

Cache entries

newtype Source Source #

An upstream base URL partitions entries without carrying credentials.

Constructors

Source Text 

Instances

Instances details
Show Source Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Eq Source Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Methods

(==) :: Source -> Source -> Bool #

(/=) :: Source -> Source -> Bool #

Ord Source Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

data CacheEntry Source #

A typed view paired with its source representation and complete fetch digest.

Constructors

CacheEntry 

Fields

Instances

Instances details
Show CacheEntry Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Eq CacheEntry Source # 
Instance details

Defined in Ecluse.Core.Server.Cache.Types

Resolution

resolveMetadata :: MetricsPort -> MetadataCache -> Source -> PackageName -> IO (Either MetadataError CacheEntry) -> IO (Either MetadataError CacheEntry) Source #

Coalesce public metadata fetches. Failures reach all waiters and retain nothing.

metadataKey :: Source -> PackageName -> Text Source #

The key a full read of one package from one source is shared and retained under.

Single-version resolution

resolveVersion :: MetricsPort -> MetadataCache -> Source -> PackageName -> Version -> IO (Either MetadataError VersionRead) -> IO (Either MetadataError VersionRead) Source #

Cache a selectively decoded release or its absence. Oversized releases remain uncached.

prepareVersion :: MetricsPort -> MetadataCache -> Source -> PackageName -> Version -> IO (Either MetadataError VersionRead) -> IO (PreparedStore MetadataError VersionRead) Source #

Pin a selected local value, including absence, before any remote work.

Assembled-representation resolution

resolveAssembled :: MetricsPort -> MetadataCache -> Text -> IO ByteString -> IO ByteString Source #

Memoise a response under the content digest of this request's authorised inputs.