From: PHO Date: Fri, 29 May 2009 04:03:53 +0000 (+0900) Subject: Replaced FunctionalZone with DynamicZone. X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=haskell-dns.git;a=commitdiff_plain;h=dbb3426a4ece9ca6ed398d016a5c0090a2e51c30 Replaced FunctionalZone with DynamicZone. --- diff --git a/Network/DNS/Named/Zone.hs b/Network/DNS/Named/Zone.hs index 302fe66..bada0d0 100644 --- a/Network/DNS/Named/Zone.hs +++ b/Network/DNS/Named/Zone.hs @@ -5,7 +5,7 @@ module Network.DNS.Named.Zone , Zone(zoneName) , SomeZone(..) , ExternalZone(..) - , FunctionalZone(..) + , DynamicZone(..) , StaticZone(..) , fromRecords , isInZone @@ -42,9 +42,6 @@ instance ZoneFinder (DomainMap (IO SomeZone)) where Just getZone -> liftM Just getZone Nothing -> return Nothing -instance ZoneFinder (DomainName -> Maybe SomeZone) where - findZone = (return .) - instance ZoneFinder (DomainName -> IO (Maybe SomeZone)) where findZone = id @@ -81,16 +78,15 @@ instance Zone ExternalZone where getRecordsForName = ezRecordsForName -data FunctionalZone - = FunctionalZone { - fzName :: !DomainName - , fzRecordNames :: ![DomainName] - , fzRecordsForName :: !(DomainName -> [SomeRR]) +data DynamicZone + = DynamicZone { + dzName :: !DomainName + , dzRecords :: !(IO (Map DomainName [SomeRR])) } -instance Zone FunctionalZone where - zoneName = fzName - getRecordNames = return . fzRecordNames - getRecordsForName = (return .) . fzRecordsForName +instance Zone DynamicZone where + zoneName = dzName + getRecordNames = liftM M.keys . dzRecords + getRecordsForName = flip (fmap . (fromMaybe [] .) . M.lookup) . dzRecords data StaticZone