These are chat archives for DevrexLabs/OrigoDB

23rd
Oct 2015
Jon Z
@jzoss
Oct 23 2015 03:19
Yea.. I saw that... I can't seem to find that method.. my engine does not had the snap shot method.. Am I missing something.. So what I am trying to use this for is a limited middle term storage.. Think sorta like session state for webapi.. I will add and delete a bunch of things.. and they may be in the memory anywhere from 10 minutes to 24 hours.. After that I will either ship it off to long term storage, or dump it.. I just want to make sure that if I get to a point where I say delete everything.. my hard drive usage goes back to basically nothing..
Robert Friberg
@rofr
Oct 23 2015 03:53
@devlead spot on :)
Robert Friberg
@rofr
Oct 23 2015 04:06
@jzoss The snapshot method is not on the IEngine interface, so you will have to type cast and dig out the actual Engine object. But the journal won't be truncated automatically, we usually do this manually or as a separate maintenance task. We'll add a feature to the next release to automatically truncate the log during snapshots.
Robert Friberg
@rofr
Oct 23 2015 04:30
But it sounds more like you want to drop the entire database (journal files AND snapshots) at some point in time. In this case you could just Close() the engine and then do a Directory.Delete
Jon Z
@jzoss
Oct 23 2015 14:52
Cool.. Thanks.. Any tips on truncating the journal or code on how you do it now?
Jon Z
@jzoss
Oct 23 2015 15:14
Also any tips on how you pull the engine of of the IEngine .. Not been able to figure that out ywt
Yet
Jon Z
@jzoss
Oct 23 2015 15:20
Also.. Sorta a best practice question.. Say i am using ef6 or something.. I would wrap the context in a using statement for each call.. What do you recomend for this, and singlton IEngine or a new one for each call?
Mattias Karlsson
@devlead
Oct 23 2015 16:08
Tried var engine = theIEngine as Engine?
Not sure I'm following, your using EF6 how in context of origodb?
Robert Friberg
@rofr
Oct 23 2015 17:19
This should answer some of your questions: http://dev.origodb.com/docs/core-0.18/client-api/basics/
Robert Friberg
@rofr
Oct 23 2015 17:25
@jzoss I noticed now that the markup on the page is not rendering correctly, hope you can make some sense of it.
Robert Friberg
@rofr
Oct 23 2015 17:37
I assume you're calling Engine.For<T>(), which will return a LocalEngineClient. This is a lightweight object so no need to dispose or pass around a single instance. Just grab a new one per request
Jon Z
@jzoss
Oct 23 2015 17:41
No sorry.. Im not using EF .. I ment to say..
I did not mean to hit enter on that last chat but thanks you answered my question.
Robert Friberg
@rofr
Oct 23 2015 17:46
You can create an Engine directly by calling Engine.Create, Engine.Load or Engine.LoadOrCreate, but can only have a single instance per backing store. Engine.For manages this behind the scenes for you by keeping a dictionary of engines keyed by connection string
Jon Z
@jzoss
Oct 23 2015 18:28
Yes.. I saw that in the source.. I think i have that figured out.. Next question.. Is there anyway to get an event when the snapshot creation is complete?
Robert Friberg
@rofr
Oct 23 2015 20:08
CreateSnapshot is a blocking call
It will hold a read lock on the model blocking writes (commands) but not other readers (queries)
so no, no events or callbacks, just proceed on the next line of code.