开发者

HappStack event files

开发者 https://www.devze.com 2023-04-08 15:02 出处:网络
I am developing a game and chose Happstack for the persistence part. I find it quite easy to use, i made a quick example for myself to understand it:

I am developing a game and chose Happstack for the persistence part. I find it quite easy to use, i made a quick example for myself to understand it:

getAllObjects :: MonadIO m => m [Thing]
getAllObjects = do
            elems <- query GetObjects           
            return elems
addAnObject :: (MonadIO m) => Thing -> m ()
addAnObject thing = do  update $ AddObject thing
test command = do
                control <- startSystemState macidProxy
                result  <- command
                shutdownSystem contro开发者_C百科l
                return result
checkpoint = do
        control <- startSystemState macidProxy
        createCheckpoint control
        shutdownSystem control

and everytime i 'test' it, it create an event.file. then i 'checkpoint' and creates a new checkpoint file, it is ok for me, the problem is that the old events files keep growing! i manualy delete everyfile (except last checkpoint and current). Is there some code im missing from happstack to do the 'delete old things'?


There is no built-in mechanism for purging old event files. Lemmih has talked about adding such facilities to acid-state at some point in time.

EDIT: The darcs version of acid-state now has a function 'createArchive' to archive old log files that are no longer needed to restore the current state.

0

精彩评论

暂无评论...
验证码 换一张
取 消