These are chat archives for DevrexLabs/OrigoDB

Oct 2015
Jon Z
Oct 27 2015 14:47
@rofr Thanks.. Sorry for the delay getting back to you... they decided to block this chat site at work.. making it a bit harder to respond. So I made my clean up code.. It works.. I will past it below .. But to explain .. I get the engine from the config.. then I get the list of all the files in the folder.. this is important, I want all the files before I make the snapshot.. Then I found a sorta bug.. That is.. after the snapshot Origo does not release the last journal file at least fast enough.. That is why I was asking for a event before,I was wondering if I was deleting files too fast.. So... note that is code is in my repository class.. The next step, and I will do this if I get some time is to put this in the Origo FileSnapshot and FileJournal Store... probably want to update the interface too :)
private void CleanData()
        var engineId = typeof(FlowModel).Name;
        if (Config.Engines.HasEngine(engineId))
            var engine = Config.Engines.GetEngine<FlowModel>(Configuration.JournalPath);
            var fileList = GetFiles(Configuration.JournalPath,".journal", ".snapshot");
            //Now Delete files

            var lastJournal = fileList.FindLast(x => x.Extension == ".journal");

            foreach (var fileInfo in fileList)

    public static List<FileInfo> GetFiles(string path, params string[] extensions)
        List<FileInfo> list = new List<FileInfo>();
        foreach (string ext in extensions)
            list.AddRange(new DirectoryInfo(path).GetFiles("*" + ext).Where(p =>
                  p.Extension.Equals(ext, StringComparison.CurrentCultureIgnoreCase))
        return list.OrderBy(x => x.CreationTime).ToList();