X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=haskell-dns.git;a=blobdiff_plain;f=Network%2FDNS%2FNamed%2FZone.hs;h=bada0d0fbb644a6a0f4bc06d104be563a4c3c0c3;hp=302fe661441f7d150f1597dcd5883a94d92e14c0;hb=dbb3426a4ece9ca6ed398d016a5c0090a2e51c30;hpb=e4ee321871e4ffed54d1378db5080389d76032c1 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