implement cluster.log
Not used yet. (Or tested.) I did consider making the log start with the uuid of the node, followed by the cluster uuid (or uuids). That would perhaps mean a smaller write to the git-annex branch when adding a node, but overall the log file would be larger, and it will be read and cached near to startup on most git-annex runs.
This commit is contained in:
parent
01f5015f30
commit
aa56d433d5
6 changed files with 135 additions and 7 deletions
29
Types/Cluster.hs
Normal file
29
Types/Cluster.hs
Normal file
|
@ -0,0 +1,29 @@
|
|||
{- git-annex cluster types
|
||||
-
|
||||
- Copyright 2024 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Types.Cluster where
|
||||
|
||||
import Types.UUID
|
||||
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.Map as M
|
||||
|
||||
-- The UUID of a cluster as a whole.
|
||||
newtype ClusterUUID = ClusterUUID { fromClusterUUID :: UUID }
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
-- The UUID of a node in a cluster. The UUID can be either the UUID of a
|
||||
-- repository, or of another cluster.
|
||||
newtype ClusterNodeUUID = ClusterNodeUUID { fromClusterNodeUUID :: UUID }
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
-- The same information is indexed two ways to allow fast lookups in either
|
||||
-- direction.
|
||||
data Clusters = Clusters
|
||||
{ clusterUUIDs :: M.Map ClusterUUID (S.Set ClusterNodeUUID)
|
||||
, clusterNodeUUIDs :: M.Map ClusterNodeUUID (S.Set ClusterUUID)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue