Paste: hackage-server data structures

Author: Matt
Mode: haskell
Date: Tue, 25 May 2010 21:39:26
Plain Text |
-- collated from hackage-server, see its license/authors/etc.

type Dependencies HackageEntryPoint = PackagesState :+: Documentation :+: Permissions :+: Distros :+: TarIndexMap :+: End

data PackagesState = PackagesState { packageList :: !(PackageIndex.PackageIndex PkgInfo), buildReports :: !BuildReports, userDb :: !Users }

    newtype Package pkg => PackageIndex pkg = PackageIndex (Map PackageName [pkg])    

    data PkgInfo = PkgInfo { pkgInfoId :: PackageIdentifier, pkgDesc   :: GenericPackageDescription,
                             pkgData :: ByteString, pkgTarball :: Maybe BlobId,
                             pkgUploadTime :: UTCTime, pkgUploadUser :: UserId, pkgUploadOld :: [(UTCTime, UserId)]  }

    data BuildReports = BuildReports { reports :: !(Map.Map BuildReportId BuildReport), logs :: !(Map.Map BuildReportId BuildLog),
                                       index :: !(Map.Map PackageIdentifier [(BuildReportId, BuildReport)]), nextId :: !BuildReportId }
            
        newtype BuildReportId = BuildReportId Int

        newtype BuildLog = BuildLog BlobStorage.BlobId

    data Users = Users { userIdMap :: !(IntMap.IntMap UserInfo), userNameMap :: !(Map.Map UserName UserId), nextId :: !UserId }

        newtype UserId = UserId Int

        newtype UserName  = UserName String

        data UserInfo = UserInfo { userName :: UserName, userStatus :: AccountStatus }

        data AccountStatus = Deleted | Disabled UserAuth | Enabled UserAuth

        type UserAuth = PasswdHash (newtype PasswdHash = String)

data Documentation = Documentation { documentation :: Map.Map PackageIdentifier BlobId }

    newtype BlobId = BlobId MD5Digest (from Data.Digest.Pure.MD5)

data Permissions = Permissions { permissions :: Map.Map GroupName UserGroup }

    data GroupName = Administrator | Trustee | PackageMaintainer PackageName | DistroMaintainer DistroName

    newtype UserGroup = UserGroup IntSet.IntSet

data Distros = Distros { dist_distros  :: !Distributions, dist_versions :: !DistroVersions }

    data Distributions = Distributions { name_map :: !(Set.Set DistroName) }

        newtype DistroName = DistroName String

    data DistroVersions = DistroVersions { package_map :: !(Map.Map PackageName (Map.Map DistroName DistroPackageInfo)),
                                           distro_map :: !(Map.Map DistroName (Set.Set PackageName)) }

    data DistroPackageInfo = DistroPackageInfo { distro_version :: Version.Version, distro_url :: String }

data TarIndexMap = M {indexMap :: Map.Map BlobId TarIndex}

    data TarIndex = TarIndex !(StringTable PathComponentId) !(IntTrie PathComponentId TarEntryOffset)

        newtype PathComponentId = PathComponentId Int

        type TarEntryOffset = Int

New Annotation

Summary:
Author:
Mode:
Body: