use per-remote metadata storage for S3 version ID

Since the same key can be stored in a versioned S3 bucket multiple times
with different version IDs, this allows tracking them all. Not currently
needed, but if we ever want to drop from a versioned S3 bucket, we'll
need to know them all.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2018-08-31 13:12:58 -04:00
parent 5c99f6247e
commit b3d42283ad
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 33 additions and 20 deletions

View file

@ -37,7 +37,7 @@ module Types.MetaData (
ModMeta(..),
modMeta,
RemoteMetaData(..),
mkRemoteMetaData,
extractRemoteMetaData,
fromRemoteMetaData,
prop_metadata_sane,
prop_metadata_serialize
@ -291,8 +291,8 @@ data RemoteMetaData = RemoteMetaData UUID MetaData
{- Extracts only the fields prefixed with "uuid:", which belong to that
- remote. -}
mkRemoteMetaData :: UUID -> MetaData -> RemoteMetaData
mkRemoteMetaData u (MetaData m) = RemoteMetaData u $ MetaData $
extractRemoteMetaData :: UUID -> MetaData -> RemoteMetaData
extractRemoteMetaData u (MetaData m) = RemoteMetaData u $ MetaData $
M.mapKeys removeprefix $ M.filterWithKey belongsremote m
where
belongsremote (MetaField f) _v = prefix `isPrefixOf` CI.original f