Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Spago.GlobalCache
Synopsis
- newtype CommitHash = CommitHash Text
- newtype Tag = Tag Text
- data RepoMetadataV1 = RepoMetadataV1 {}
- type ReposMetadataV1 = Map PackageName RepoMetadataV1
- globallyCache :: HasLogFunc env => (PackageName, Repo, Text) -> FilePath -> ReposMetadataV1 -> (FilePath -> RIO env ()) -> RIO env () -> RIO env ()
- getMetadata :: (HasLogFunc env, HasGlobalCache env) => RIO env ReposMetadataV1
- getGlobalCacheDir :: (MonadUnliftIO m, HasLogFunc env, MonadReader env m) => m FilePath
- fetchTarball :: HasLogFunc env => FilePath -> Text -> RIO env ()
Documentation
newtype CommitHash #
Constructors
CommitHash Text |
Instances
Instances
FromJSON Tag # | |
Defined in Spago.GlobalCache | |
FromJSONKey Tag # | |
Defined in Spago.GlobalCache | |
ToJSON Tag # | |
ToJSONKey Tag # | |
Defined in Spago.GlobalCache | |
Data Tag # | |
Defined in Spago.GlobalCache Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Tag -> c Tag # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Tag # dataTypeOf :: Tag -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Tag) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Tag) # gmapT :: (forall b. Data b => b -> b) -> Tag -> Tag # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Tag -> r # gmapQ :: (forall d. Data d => d -> u) -> Tag -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Tag -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Tag -> m Tag # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Tag -> m Tag # | |
Generic Tag # | |
Read Tag # | |
Show Tag # | |
Eq Tag # | |
Ord Tag # | |
type Rep Tag # | |
data RepoMetadataV1 #
Constructors
RepoMetadataV1 | |
Instances
FromJSON RepoMetadataV1 # | |
Defined in Spago.GlobalCache Methods parseJSON :: Value -> Parser RepoMetadataV1 # parseJSONList :: Value -> Parser [RepoMetadataV1] # | |
ToJSON RepoMetadataV1 # | |
Defined in Spago.GlobalCache Methods toJSON :: RepoMetadataV1 -> Value # toEncoding :: RepoMetadataV1 -> Encoding # toJSONList :: [RepoMetadataV1] -> Value # toEncodingList :: [RepoMetadataV1] -> Encoding # omitField :: RepoMetadataV1 -> Bool # | |
Generic RepoMetadataV1 # | |
Defined in Spago.GlobalCache Associated Types type Rep RepoMetadataV1 :: Type -> Type # Methods from :: RepoMetadataV1 -> Rep RepoMetadataV1 x # to :: Rep RepoMetadataV1 x -> RepoMetadataV1 # | |
Show RepoMetadataV1 # | |
Defined in Spago.GlobalCache Methods showsPrec :: Int -> RepoMetadataV1 -> ShowS # show :: RepoMetadataV1 -> String # showList :: [RepoMetadataV1] -> ShowS # | |
type Rep RepoMetadataV1 # | |
Defined in Spago.GlobalCache type Rep RepoMetadataV1 = D1 ('MetaData "RepoMetadataV1" "Spago.GlobalCache" "spago-0.21.0-wuq2Fsi0665WDIPyS8qRJ" 'False) (C1 ('MetaCons "RepoMetadataV1" 'PrefixI 'True) ((S1 ('MetaSel ('Just "commits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [CommitHash]) :*: S1 ('MetaSel ('Just "latest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Tag))) :*: (S1 ('MetaSel ('Just "owner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "tags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Tag CommitHash))))) |
type ReposMetadataV1 = Map PackageName RepoMetadataV1 #
globallyCache :: HasLogFunc env => (PackageName, Repo, Text) -> FilePath -> ReposMetadataV1 -> (FilePath -> RIO env ()) -> RIO env () -> RIO env () #
A package is "globally cacheable" if: * it's a GitHub repo * the ref we have is a commit or a tag -- i.e. "immutable enough", so e.g. not a branch
So here we check that one of the two is true, and if so we run the callback with the URL of the .tar.gz archive on GitHub, otherwise another callback for when it's not
getMetadata :: (HasLogFunc env, HasGlobalCache env) => RIO env ReposMetadataV1 #
Download the GitHub Index cache from the `package-sets-metadata` repo
getGlobalCacheDir :: (MonadUnliftIO m, HasLogFunc env, MonadReader env m) => m FilePath #
Directory in which spago will put its global cache
`getXdgDirectory XdgCache` tries to find the folder pointed by
`$XDG_CACHE_HOME`, otherwise it uses:
- (on LinuxMacOS) the folder pointed by `$HOME.cache`, or
- (on Windows) the folder pointed by LocalAppData
fetchTarball :: HasLogFunc env => FilePath -> Text -> RIO env () #
Fetch the tarball at archiveUrl
and unpack it into destination