[Haskell-cafe] help with safecopy + acid-state

Antoine Latter aslatter at gmail.com
Tue Jan 31 15:32:22 CET 2012


On Tue, Jan 31, 2012 at 8:27 AM, Johannes Waldmann
<waldmann at imn.htwk-leipzig.de> wrote:
>
>> > Can I really rename  old.T => new.T_orig ?
>> > It looks as if then tries to load the wrong acid-state snapshot.
>>
>> The name of your data type doesn't matter as acid-state doesn't store
>> that on the disk.
>
> I think it does - because file names are  state/T/*.log   and so on?
>

The function 'openLocalState' in AcidState uses the name of the passed
in state type to locate the log files on disk.

So as long as you always call 'openLocalState' with types of the same
name to represent the same state you'll be fine - this is why it is
safe to rename your old type, because you call 'openLocalState' with
the new type.

Alternatively, you can call 'openLocalStateFrom', which doesn't base
anything on names of types (you can tell because there is no
'Typeable' constraint on its arguments).

Antoine

> J.W.
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list