New: Main DB is compressed on app start

This commit is contained in:
kayone
2013-11-27 23:11:05 -08:00
committed by Mark McDowall
parent ca22ee3af3
commit 9370de0cc0
7 changed files with 94 additions and 35 deletions

View File

@@ -27,7 +27,7 @@ namespace NzbDrone.Core.Datastore
void InsertMany(IList<TModel> model);
void UpdateMany(IList<TModel> model);
void DeleteMany(List<TModel> model);
void Purge();
void Purge(bool vacuum = false);
bool HasItems();
void DeleteMany(IEnumerable<int> ids);
void SetFields(TModel model, params Expression<Func<TModel, object>>[] properties);
@@ -216,9 +216,18 @@ namespace NzbDrone.Core.Datastore
}
}
public void Purge()
public void Purge(bool vacuum = false)
{
DataMapper.Delete<TModel>(c => c.Id > -1);
if (vacuum)
{
Vacuum();
}
}
protected void Vacuum()
{
_database.Vacuum();
}
public bool HasItems()
@@ -258,11 +267,6 @@ namespace NzbDrone.Core.Datastore
.Take(pagingSpec.PageSize);
}
public void DeleteAll()
{
DataMapper.Delete<TModel>(c => c.Id > 0);
}
protected void ModelCreated(TModel model)
{
PublishModelEvent(model, ModelAction.Created);