TCache 0.10.0.9 → 0.10.0.10
raw patch · 3 files changed
+29/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/TCache/IndexQuery.hs +11/−4
- Data/TCache/IndexText.hs +14/−3
- TCache.cabal +4/−2
Data/TCache/IndexQuery.hs view
@@ -185,11 +185,14 @@ index :: (Queriable reg a) => (reg -> a) -> IO ()-index sel=+index sel= do let [one, two]= typeRepArgs $! typeOf sel rindex= getDBRef $! keyIndex one two- in addTrigger $ selectorIndex sel rindex-+ addTrigger $ selectorIndex sel rindex+ withResources [] $ const [ (Index M.empty `asTypeOf` indexsel sel )]+ where+ indexsel :: (reg-> a) -> Index reg a+ indexsel= undefined -- | implement the relational-like operators, operating on record fields class RelationOps field1 field2 res | field1 field2 -> res where (.==.) :: field1 -> field2 -> STM res@@ -289,7 +292,11 @@ let [one, two]= typeRepArgs $! typeOf selector let rindex= getDBRef $! keyIndex one two mindex <- readDBRef rindex- case mindex of Just (Index index) -> return $ M.toList index; _ -> return []+ case mindex of+ Just (Index index) -> return $ M.toList index;+ _ -> do+ let fields= show $ typeOf selector+ error $ "the index for "++ fields ++" do not exist. At main, use \"Data.TCache.IdexQuery.index\" to start indexing this field" retrieve :: Queriable reg a => (reg -> a) -> a -> (a -> a -> Bool) -> STM[DBRef reg] retrieve field value op= do
Data/TCache/IndexText.hs view
@@ -141,7 +141,11 @@ => (a -> b) -- ^ field to index -> (b -> T.Text) -- ^ method to convert the field content to lazy Text (for example `pack` in case of String fields). This permits to index non Textual fields -> IO ()-indexText sel convert= addTrigger (indext sel (words1 . convert))+indexText sel convert= do+ addTrigger (indext sel (words1 . convert))+ let [t1,t2]= typeRepArgs $! typeOf sel+ t= show t1 ++ show t2+ withResources [] $ const [IndexText t 0 M.empty M.empty M.empty] -- | trigger the indexation of list fields with elements convertible to Text indexList@@ -149,9 +153,14 @@ => (a -> b) -- ^ field to index -> (b -> [T.Text]) -- ^ method to convert a field element to Text (for example `pack . show` in case of elemets with Show instances) -> IO ()-indexList sel convert= addTrigger (indext sel convert)+indexList sel convert= do+ addTrigger (indext sel convert)+ let [t1,t2]= typeRepArgs $! typeOf sel+ t= show t1 ++ show t2+ withResources [] $ const [IndexText t 0 M.empty M.empty M.empty] + indext :: (IResource a, Typeable a,Typeable b) => (a -> b) -> (b -> [T.Text]) -> DBRef a -> Maybe a -> STM() indext sel convert dbref mreg= f1 -- unsafeIOToSTM $! f@@ -191,7 +200,9 @@ mr <- withSTMResources [IndexText t u u u u] $ \[r] -> resources{toReturn= r} case mr of- Nothing -> return []+ Nothing -> do+ let fields= show $ typeOf sel+ error $ "the index for "++ fields ++" do not exist. At main, use \"Data.TCache.IdexQuery.index\" to start indexing this field" Just (IndexText t n _ mmapIntString map1) -> case M.lookup w map1 of Nothing -> return []
TCache.cabal view
@@ -1,5 +1,5 @@ name: TCache-version: 0.10.0.9+version: 0.10.0.10 cabal-version: >= 1.6 build-type: Simple license: BSD3@@ -17,11 +17,13 @@ . 0.10.0.8 subversion add cachedByKeySTM .+ 0.10.0.9 fixed an error in clearSyncChacheProc and SynWrite Asyncronous that checked the cache continuously+ . See "Data.TCache" for details . In this release: .- fixed an error in clearSyncChacheProc and SynWrite Asyncronous that checked the cache continuously+ error message in IndexQuery an IndexText queries when the data has not been indexed