标签云

微信群

扫码加入我们

WeChat QR Code


s/persistant/persistent/g

2018年09月25日46分10秒

Checkout: PersistentDictionary class

2018年09月25日46分10秒

You're freaking kidding me. A question asked by Sam Saffron is closed as off topic? You people are freaking insane.

2018年09月25日46分10秒

Thanks for the tip, added them to my list of useful libraries.

2018年09月26日46分10秒

lubos From C5 docs: A persistent sorted collection implements interface IPersistentSorted<T> and is a sorted collection of which one can efficiently make a read-only snapshot, or a “copy” that is not affected by updates to the original collection. It describes a method Snapshot() that returns a sorted collection with exactly the same items as the persistent sorted collection. The TreeSet<T> and TreeBag<T> collection classes are persistent sorted collections; their Snapshot() methods take constant time, but sub- sequent updates to the given tree take more time and space - not what is required

2018年09月26日46分10秒

C5 data structures are not persistent in that way. See en.wikipedia.org/wiki/Persistent_data_structure

2018年09月25日46分10秒

lubos added akavache here, it seems like a good fit.

2018年09月26日46分10秒

I understand what you are saying, but the database part is just another implementation detail, for a drop in solution that depends on sqlite you need to have code that handles x64 vs x32 you need a repository and a bunch of other things, so though, yes an embedded db may be a solution...

2018年09月26日46分10秒

... the devil is in the detail, and there is not detail or code in this answer. I explicitly asked for an implementation of IDictionary

2018年09月25日46分10秒

I am now trying out the PersistentDictionary, but I keep getting the following exception when I instantiate the dictionary: Error TempPathInUse (JET_errTempPathInUse, Temp path already used by another database instance). The documentation does not say I need to use it as a singelton, nor does it say I have to dispose it properly. So something must clearly be wrong.

2018年09月25日46分10秒

See the discussion on the ManagedEsent codeplex site.

2018年09月25日46分10秒

For reference the discussion appears to be this thread managedesent.codeplex.com/discussions/217114

2018年09月25日46分10秒

ESE is good for this problem ... aynde has some wrappers for it.

2018年09月25日46分10秒

Theoretically this should work properly for the problem I have. Thanks

2018年09月26日46分10秒

Id be happy for only immutable data support (I could add an interface with an OnChanged for this kind of stuff, or perhaps proxy object which can get a bit yucky)

2018年09月25日46分10秒

+1 looks interesting

2018年09月25日46分10秒

MSSQL (and I'd assume other RDBMS) use a row offset table to track beginning of rows from a page.

2018年09月26日46分10秒

If you wanted to improve it, you could make it detect idle periods and only flush the full file then. I know you wanted a system that would only update the relevant parts of the file, but not only would that be quite difficult to write, I'm sure this will be more than enough for your needs!

2018年09月26日46分10秒

SQL Express is not a drop in solution, its a messy complex installer, sql ce may be a solution ...

2018年09月25日46分10秒

A reasonable concern.

2018年09月25日46分10秒

I'm accepting this, because this is a drop in solution to my problem. I will probably end ups writing my own framework for this and once I do I will amend this answer

1970年01月01日00分03秒

That will not give me the performance Im after

2018年09月26日46分10秒

You should edit the question to include your performance requirements.

2018年09月25日46分10秒

I did "When setting or clearing a value it should not re-write the entire underlying file, instead it should seek to the position in the file and update the value."

2018年09月25日46分10秒

Perhaps one can specify the max length in the ctor and have it throw when people add values that are greater?

2018年09月25日46分10秒

The whole point would be supporting dynamically sized types... SQL does it and uses a single file so I see no reason why this is not possible

2018年09月25日46分10秒

Use a database behind it then, instead of a file. I wouldn't go reinventing anything that's been done better before.

2018年09月25日46分10秒

SQL uses caching and multi-threaded tasks to perform the way it does. To do that all for a single dictionary object is insane. You're requirements are unrealistic.

2018年09月25日46分10秒

"Reinventing" something like this is a great way to learn lots of neat stuff. His stated performance does not need anything like multiple threads or caching logic... beyond just keeping the whole thing in memory while running.

2018年09月26日46分10秒

After all, that's how Dictionary works and he just wants it to persist.

2018年09月25日46分10秒

He didn't want to rewrite the entire file on updates.

2018年09月25日46分10秒

Oups, looks like I wasn't paying enough attention.

2018年09月26日46分10秒