public bool Initialize(IUuidGenerator uuidGenerator)
{
try
{
generator = uuidGenerator;
var instanceParameters = new TransactionalStorageConfigurator(configuration).ConfigureInstance(instance, path);
if (configuration.RunInUnreliableYetFastModeThatIsNotSuitableForProduction)
{
instanceParameters = new InstanceParameters(instance)
{
CircularLog = true,
Recovery = false,
NoInformationEvent = false,
CreatePathIfNotExist = true,
TempDirectory = Path.Combine(path, "temp"),
SystemDirectory = Path.Combine(path, "system"),
LogFileDirectory = Path.Combine(path, "logs"),
MaxVerPages = 256,
BaseName = "RVN",
EventSource = "Raven",
LogBuffers = 8192,
LogFileSize = 256,
MaxSessions = TransactionalStorageConfigurator.MaxSessions,
MaxCursors = 1024,
DbExtensionSize = 128,
AlternateDatabaseRecoveryDirectory = path
};
}
log.Info(@"Esent Settings:
MaxVerPages = {0}
CacheSizeMax = {1}
DatabasePageSize = {2}", instanceParameters.MaxVerPages, SystemParameters.CacheSizeMax, SystemParameters.DatabasePageSize);
Api.JetInit(ref instance);
var newDb = EnsureDatabaseIsCreatedAndAttachToDatabase();
SetIdFromDb();
tableColumnsCache.InitColumDictionaries(instance, database);
return newDb;
}
catch (Exception e)
{
Dispose();
throw new InvalidOperationException("Could not open transactional storage: " + database, e);
}
}