Raven.Storage.Esent.TransactionalStorage.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( IUuidGenerator uuidGenerator ) : bool
uuidGenerator IUuidGenerator
return bool
		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);
			}
		}

Usage Example

示例#1
0
        public static void ReportOn(string path, string tableName)
        {
            using (var transactionalStorage = new TransactionalStorage(new RavenConfiguration
            {
                DataDirectory = path,
                Settings =
                {
                    { Constants.Esent.LogFileSize, "1"}
                }
            }, () => { }, () => { }, () => { }, () => { }))
            {
                transactionalStorage.Initialize(new DummyUuidGenerator(), new OrderedPartCollection<AbstractDocumentCodec>());

                ReportOn(transactionalStorage, tableName, path);
            }
        }
All Usage Examples Of Raven.Storage.Esent.TransactionalStorage::Initialize