Safe Haskell | None |
---|---|
Language | Haskell2010 |
B9 has a concept of SharedImaged
. Shared images can be pulled and
pushed to/from remote locations via rsync+ssh. B9 also maintains a local cache;
the whole thing is supposed to be build-server-safe, that means no two builds
shall interfere with each other. This is accomplished by refraining from
automatic cache updates from/to remote repositories.
Synopsis
- type RepoCacheReader = Reader RepoCache
- getRepoCache :: Member RepoCacheReader e => Eff e RepoCache
- withSelectedRemoteRepo :: (Member B9ConfigReader e, Member ExcB9 e) => Eff (SelectedRemoteRepoReader ': e) a -> Eff e a
- getSelectedRemoteRepo :: Member SelectedRemoteRepoReader e => Eff e SelectedRemoteRepo
- type SelectedRemoteRepoReader = Reader SelectedRemoteRepo
- data Repository
- type RepoImagesMap = Map Repository (Set SharedImage)
- toRemoteRepository :: RemoteRepo -> Repository
- newtype SelectedRemoteRepo = MkSelectedRemoteRepo {}
- remoteRepoCacheDir :: RepoCache -> String -> FilePath
- localRepoDir :: RepoCache -> FilePath
- lookupRemoteRepo :: [RemoteRepo] -> String -> Maybe RemoteRepo
- filterRepoImagesMap :: (Repository -> Bool) -> (SharedImage -> Bool) -> RepoImagesMap -> RepoImagesMap
- lookupCachedImages :: SharedImageName -> RepoImagesMap -> Set SharedImage
- allCachedSharedImages :: RepoImagesMap -> Set SharedImage
- allSharedImagesWithRepo :: RepoImagesMap -> Set (SharedImage, Repository)
- maxSharedImageOfAllRepos :: RepoImagesMap -> Maybe (SharedImage, Repository)
- allSharedImagesInRepo :: Repository -> RepoImagesMap -> Set SharedImage
- allSharedImages :: RepoImagesMap -> Set SharedImage
- allRepositories :: RepoImagesMap -> Set Repository
- groupBySharedImageName :: Set SharedImage -> Map SharedImageName (Set SharedImage)
- keepNLatestSharedImages :: Int -> Set SharedImage -> Set SharedImage
- dropAllButNLatestSharedImages :: Int -> Set SharedImage -> Set SharedImage
- module B9.B9Config.Repository
Documentation
type RepoCacheReader = Reader RepoCache Source #
Alias for a Reader
Eff
ect that reads a list of RemoteRepo
s.
Since: 0.5.65
getRepoCache :: Member RepoCacheReader e => Eff e RepoCache Source #
Ask for the RepoCache
initialized by withRemoteRepos
.
Since: 0.5.65
withSelectedRemoteRepo :: (Member B9ConfigReader e, Member ExcB9 e) => Eff (SelectedRemoteRepoReader ': e) a -> Eff e a Source #
Run a SelectedRemoteRepoReader
with the SelectedRemoteRepo
selected
in the B9Config
.
If the selected repo does not exist, and exception is thrown.
Since: 0.5.65
getSelectedRemoteRepo :: Member SelectedRemoteRepoReader e => Eff e SelectedRemoteRepo Source #
Ask for the RemoteRepo
selected by the B9Config
value _repository
. See withSelectedRemoteRepo
.
Since: 0.5.65
type SelectedRemoteRepoReader = Reader SelectedRemoteRepo Source #
Alias for a Reader
Eff
ect that reads the RemoteRepo
selected by the B9Config
value _repository
. See withSelectedRemoteRepo
.
Since: 0.5.65
data Repository Source #
Instances
type RepoImagesMap = Map Repository (Set SharedImage) Source #
A Map
that maps Repository
s to the SharedImage
s they hold.
Since: 1.1.0
toRemoteRepository :: RemoteRepo -> Repository Source #
Convert a RemoteRepo
down to a mere Repository
newtype SelectedRemoteRepo Source #
Contains the Just
the RemoteRepo
selected by the B9Config
value _repository
,
or Nothing
of no RemoteRepo
was selected in the B9Config
.
Since: 0.5.65
:: RepoCache | The repository cache directory |
-> String | Id of the repository |
-> FilePath | The existing, absolute path to the cache directory |
Return the cache directory for a remote repository relative to the root cache dir.
Return the local repository directory.
lookupRemoteRepo :: [RemoteRepo] -> String -> Maybe RemoteRepo Source #
Select the first RemoteRepo
with a given repoId
.
filterRepoImagesMap :: (Repository -> Bool) -> (SharedImage -> Bool) -> RepoImagesMap -> RepoImagesMap Source #
Filter the SharedImage
s returned by getSharedImages
using a Repository
-, and a SharedImage
predicate.
Since: 1.1.0
lookupCachedImages :: SharedImageName -> RepoImagesMap -> Set SharedImage Source #
Return the versions of a shared image named name
from the local cache.
Since: 1.1.0
allCachedSharedImages :: RepoImagesMap -> Set SharedImage Source #
Keep SharedImage
s that are in the Cache
Repository
.
Since: 1.1.0
allSharedImagesWithRepo :: RepoImagesMap -> Set (SharedImage, Repository) Source #
Fetch all SharedImage
s like allSharedImages
but attach
the Repository
that the image belongs to.
Usage example: In combination with filterRepoImagesMap
to find
the latest version of a certain image in all known repositories.
Since: 1.1.0
maxSharedImageOfAllRepos :: RepoImagesMap -> Maybe (SharedImage, Repository) Source #
Return the maximum with regard to the Ord
instance of SharedImage
from an RepoImagesMap
Since: 1.1.0
allSharedImagesInRepo :: Repository -> RepoImagesMap -> Set SharedImage Source #
Return the SharedImage
s, that are contained in a Repository
.
Since: 1.1.0
allSharedImages :: RepoImagesMap -> Set SharedImage Source #
Get a Set
of all SharedImage
s in all Repository
s.
Since: 1.1.0
allRepositories :: RepoImagesMap -> Set Repository Source #
Return a Set
of Repository
names from a RepoImagesMap
Since: 1.1.0
groupBySharedImageName :: Set SharedImage -> Map SharedImageName (Set SharedImage) Source #
Group by SharedImageName
.
Since: 1.1.0
keepNLatestSharedImages :: Int -> Set SharedImage -> Set SharedImage Source #
Take a subset that contains the n
latest versions of SharedImage
s with the same name.
For example, if the input contains:
@@
fromList
[ SharedImage "foo" "2020-07-07 13:34:31"
, SharedImage "foo" "2020-07-07 13:34:32"
, SharedImage "foo" "2020-07-07 13:34:33"
, SharedImage "bar" "2020-07-07 13:34:34"
, SharedImage "bar" "2020-07-07 13:34:35"
, SharedImage "bar" "2020-07-07 13:34:36"
]
@@
The output of keepNLatestSharedImages 2
will be:
@@
fromList
[ SharedImage "foo" "2020-07-07 13:34:32"
, SharedImage "foo" "2020-07-07 13:34:33"
, SharedImage "bar" "2020-07-07 13:34:35"
, SharedImage "bar" "2020-07-07 13:34:36"
]
@@
Since: 1.1.0
dropAllButNLatestSharedImages :: Int -> Set SharedImage -> Set SharedImage Source #
Take a subset that contains obsolete images.
Do the opposite of keepNLatestSharedImages
,
and return all **but** the n
latest versions of SharedImage
s with the same name.
For example, if the input contains:
@@
fromList
[ SharedImage "foo" "2020-07-07 13:34:31"
, SharedImage "foo" "2020-07-07 13:34:32"
, SharedImage "foo" "2020-07-07 13:34:33"
, SharedImage "bar" "2020-07-07 13:34:34"
, SharedImage "bar" "2020-07-07 13:34:35"
, SharedImage "bar" "2020-07-07 13:34:36"
]
@@
The output of keepNLatestSharedImages 2
will be:
@@
fromList
[ SharedImage "foo" "2020-07-07 13:34:31"
, SharedImage "bar" "2020-07-07 13:34:34"
]
@@
Since: 1.1.0
module B9.B9Config.Repository