本文整理汇总了C#中InMemoryRavenConfiguration类的典型用法代码示例。如果您正苦于以下问题:C# InMemoryRavenConfiguration类的具体用法?C# InMemoryRavenConfiguration怎么用?C# InMemoryRavenConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InMemoryRavenConfiguration类属于命名空间,在下文中一共展示了InMemoryRavenConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: IndexStorage
public IndexStorage(IndexDefinitionStorage indexDefinitionStorage, InMemoryRavenConfiguration configuration, DocumentDatabase documentDatabase)
{
this.indexDefinitionStorage = indexDefinitionStorage;
this.configuration = configuration;
path = configuration.IndexStoragePath;
if (Directory.Exists(path) == false && configuration.RunInMemory == false)
Directory.CreateDirectory(path);
if (configuration.RunInMemory == false)
{
var crashMarkerPath = Path.Combine(path, "indexing.crash-marker");
if (File.Exists(crashMarkerPath))
{
// the only way this can happen is if we crashed because of a power outage
// in this case, we consider all open indexes to be corrupt and force them
// to be reset. This is because to get better perf, we don't flush the files to disk,
// so in the case of a power outage, we can't be sure that there wasn't still stuff in
// the OS buffer that wasn't written yet.
configuration.ResetIndexOnUncleanShutdown = true;
}
// The delete on close ensures that the only way this file will exists is if there was
// a power outage while the server was running.
crashMarker = File.Create(crashMarkerPath, 16, FileOptions.DeleteOnClose);
}
foreach (var indexName in indexDefinitionStorage.IndexNames)
{
OpenIndexOnStartup(documentDatabase, indexName);
}
}
开发者ID:paultyng,项目名称:ravendb,代码行数:34,代码来源:IndexStorage.cs
示例2: RavenFileSystem
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState receivedTransportState = null)
{
ExtensionsState = new AtomicDictionary<object>();
Name = name;
this.systemConfiguration = systemConfiguration;
systemConfiguration.Container.SatisfyImportsOnce(this);
transportState = receivedTransportState ?? new TransportState();
storage = CreateTransactionalStorage(systemConfiguration);
sigGenerator = new SigGenerator();
fileLockManager = new FileLockManager();
BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
conflictDetector = new ConflictDetector();
conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog));
notificationPublisher = new NotificationPublisher(transportState);
synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
metricsCounters = new MetricsCountersManager();
search = new IndexStorage(name, systemConfiguration);
conflictArtifactManager = new ConflictArtifactManager(storage, search);
storageOperationsTask = new StorageOperationsTask(storage, DeleteTriggers, search, notificationPublisher);
AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
}
开发者ID:felipeleusin,项目名称:ravendb,代码行数:33,代码来源:RavenFileSystem.cs
示例3: EnableHttpServer
public void EnableHttpServer(InMemoryRavenConfiguration config)
{
if(server != null)
throw new InvalidOperationException("Http server is already running");
var schema = config.Encryption.UseSsl ? "https" : "http";
server = WebApp.Start(schema + "://+:" + config.Port, app => //TODO DH: configuration.ServerUrl doesn't bind properly
{
var listener = (HttpListener) app.Properties["System.Net.HttpListener"];
if (listener != null)
new WindowsAuthConfigureHttpListener().Configure(listener, config);
startup.Configuration(app);
if (listener != null && config.Http.AuthenticationSchemes.HasValue)
listener.AuthenticationSchemes = config.Http.AuthenticationSchemes.Value;
app.Use(async (context, _) =>
{
context.Response.StatusCode = 404;
context.Response.ReasonPhrase = "Not Found";
await context.Response.Body.WriteAsync(NotFoundBody, 0, NotFoundBody.Length);
});
});
}
开发者ID:nuvotex,项目名称:ravendb,代码行数:26,代码来源:OwinHttpServer.cs
示例4: RavenDBOptions
public RavenDBOptions(InMemoryRavenConfiguration configuration, DocumentDatabase db = null)
{
if (configuration == null)
throw new ArgumentNullException("configuration");
try
{
HttpEndpointRegistration.RegisterHttpEndpointTarget();
HttpEndpointRegistration.RegisterAdminLogsTarget();
if (db == null)
{
configuration.UpdateDataDirForLegacySystemDb();
systemDatabase = new DocumentDatabase(configuration);
systemDatabase.SpinBackgroundWorkers();
}
else
{
systemDatabase = db;
}
fileSystemLandlord = new FileSystemsLandlord(systemDatabase);
databasesLandlord = new DatabasesLandlord(systemDatabase);
countersLandlord = new CountersLandlord(systemDatabase);
requestManager = new RequestManager(databasesLandlord);
mixedModeRequestAuthorizer = new MixedModeRequestAuthorizer();
mixedModeRequestAuthorizer.Initialize(systemDatabase, new RavenServer(databasesLandlord.SystemDatabase, configuration));
}
catch
{
if (systemDatabase != null)
systemDatabase.Dispose();
throw;
}
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:33,代码来源:RavenDBOptions.cs
示例5: TryGetOrCreateResourceStore
protected override bool TryGetOrCreateResourceStore(string tenantId, out IResourceStore database)
{
if (ResourcesStoresCache.TryGetValue(tenantId, out database))
return true;
var jsonDocument = DefaultDatabase.Get("Raven/Databases/" + tenantId, null);
if (jsonDocument == null)
return false;
var document = jsonDocument.DataAsJson.JsonDeserialization<DatabaseDocument>();
database = ResourcesStoresCache.GetOrAdd(tenantId, s =>
{
var config = new InMemoryRavenConfiguration
{
Settings = DefaultConfiguration.Settings,
};
config.Settings["Raven/VirtualDir"] = config.Settings["Raven/VirtualDir"] + "/" + tenantId;
foreach (var setting in document.Settings)
{
config.Settings[setting.Key] = setting.Value;
}
config.Initialize();
return new DocumentDatabase(config);
});
return true;
}
开发者ID:plasmaboyer,项目名称:ravendb,代码行数:30,代码来源:RavenDbHttpServer.cs
示例6: ExecuteInternal
private void ExecuteInternal(InMemoryRavenConfiguration config)
{
var licensePath = GetLicensePath(config);
var licenseText = GetLicenseText(config);
if (TryLoadLicense(licenseText) == false)
return;
try
{
licenseValidator.AssertValidLicense(() =>
{
string value;
LicenseAttributes = licenseValidator.LicenseAttributes;
AssertForV2(licenseValidator.LicenseAttributes);
if (licenseValidator.LicenseAttributes.TryGetValue("OEM", out value) &&
"true".Equals(value, StringComparison.InvariantCultureIgnoreCase))
{
licenseValidator.MultipleLicenseUsageBehavior = AbstractLicenseValidator.MultipleLicenseUsage.AllowSameLicense;
}
});
CurrentLicense = new LicensingStatus
{
Status = "Commercial - " + licenseValidator.LicenseType,
Error = false,
Message = "Valid license at " + licensePath,
Attributes = licenseValidator.LicenseAttributes
};
}
catch (Exception e)
{
logger.ErrorException("Could not validate license at " + licensePath + ", " + licenseText, e);
try
{
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml(licensePath);
var sig = xmlDocument.SelectSingleNode("/license/Signature");
if (sig != null && sig.ParentNode != null)
sig.ParentNode.RemoveChild(sig);
var stringBuilder = new StringBuilder();
xmlDocument.WriteTo(XmlWriter.Create(stringBuilder));
licenseText = stringBuilder.ToString();
}
catch (Exception)
{
// couldn't remove the signature, maybe not XML?
}
CurrentLicense = new LicensingStatus
{
Status = "AGPL - Open Source",
Error = true,
Message = "Could not validate license: " + licensePath + ", " + licenseText + Environment.NewLine + e
};
}
}
开发者ID:denno-secqtinstien,项目名称:ravendb,代码行数:60,代码来源:ValidateLicense.cs
示例7: Configure
public void Configure(HttpListener listener, InMemoryRavenConfiguration config)
{
if (string.Equals(config.AuthenticationMode, "Windows",StringComparison.InvariantCultureIgnoreCase) == false)
return;
switch (config.AnonymousUserAccessMode)
{
case AnonymousUserAccessMode.None:
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;
break;
case AnonymousUserAccessMode.All:
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication |
AuthenticationSchemes.Anonymous;
listener.AuthenticationSchemeSelectorDelegate = request =>
{
if (request.RawUrl.StartsWith("/admin", StringComparison.InvariantCultureIgnoreCase))
return AuthenticationSchemes.IntegratedWindowsAuthentication;
return AuthenticationSchemes.Anonymous;
};
break;
case AnonymousUserAccessMode.Get:
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication |
AuthenticationSchemes.Anonymous;
listener.AuthenticationSchemeSelectorDelegate = request =>
{
return AbstractRequestAuthorizer.IsGetRequest(request.HttpMethod, request.Url.AbsolutePath) ?
AuthenticationSchemes.Anonymous | AuthenticationSchemes.IntegratedWindowsAuthentication :
AuthenticationSchemes.IntegratedWindowsAuthentication;
};
break;
default:
throw new ArgumentException("Cannot understand access mode: " + config.AnonymousUserAccessMode);
}
}
开发者ID:nicolasgarfinkiel,项目名称:ravendb,代码行数:35,代码来源:WindowsAuthConfigureHttpListener.cs
示例8: OwinHttpServer
public OwinHttpServer(InMemoryRavenConfiguration config, DocumentDatabase db = null, bool useHttpServer = true, Action<RavenDBOptions> configure = null)
{
startup = new Startup(config, db);
if (configure != null)
configure(startup.Options);
owinEmbeddedHost = OwinEmbeddedHost.Create(app => startup.Configuration(app));
if (!useHttpServer)
{
return;
}
server = WebApp.Start("http://+:" + config.Port, app => //TODO DH: configuration.ServerUrl doesn't bind properly
{
var listener = (HttpListener) app.Properties["System.Net.HttpListener"];
if (listener != null)
{
new WindowsAuthConfigureHttpListener().Configure(listener, config);
}
startup.Configuration(app);
app.Use(async (context, _) =>
{
context.Response.StatusCode = 404;
context.Response.ReasonPhrase = "Not Found";
await context.Response.Body.WriteAsync(NotFoundBody, 0, NotFoundBody.Length);
});
});
}
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:27,代码来源:OwinHttpServer.cs
示例9: TransactionalStorage
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit)
{
this.configuration = configuration;
this.onCommit = onCommit;
documentCacher = new DocumentCacher(configuration);
exitLockDisposable = new DisposableAction(() => Monitor.Exit(this));
}
开发者ID:nzaugg,项目名称:ravendb,代码行数:7,代码来源:TransactionalStorage.cs
示例10: Execute
public void Execute(InMemoryRavenConfiguration config)
{
//We defer GettingNewLeaseSubscription the first time we run, we will run again with 1 minute so not to delay startup.
timer = new Timer(state => ExecuteInternal(config), null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(15));
ExecuteInternal(config,true);
}
开发者ID:IdanHaim,项目名称:ravendb,代码行数:7,代码来源:ValidateLicense.cs
示例11: DocumentCacher
public DocumentCacher(InMemoryRavenConfiguration configuration)
{
this.configuration = configuration;
cachedSerializedDocuments = CreateCache();
MemoryStatistics.RegisterLowMemoryHandler(this);
}
开发者ID:IdanHaim,项目名称:ravendb,代码行数:7,代码来源:DocumentCacher.cs
示例12: RavenFileSystem
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState recievedTransportState = null)
{
this.Name = name;
this.systemConfiguration = systemConfiguration;
var storageType = systemConfiguration.FileSystem.DefaultStorageTypeName;
storage = CreateTransactionalStorage(storageType, systemConfiguration);
search = new IndexStorage(systemConfiguration.FileSystem.IndexStoragePath, systemConfiguration.Settings);
sigGenerator = new SigGenerator();
var replicationHiLo = new SynchronizationHiLo(storage);
var sequenceActions = new SequenceActions(storage);
transportState = recievedTransportState ?? new TransportState();
notificationPublisher = new NotificationPublisher(transportState);
fileLockManager = new FileLockManager();
storage.Initialize();
search.Initialize();
var uuidGenerator = new UuidGenerator(sequenceActions);
historian = new Historian(storage, replicationHiLo, uuidGenerator);
BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024);
conflictArtifactManager = new ConflictArtifactManager(storage, search);
conflictDetector = new ConflictDetector();
conflictResolver = new ConflictResolver(storage, new CompositionContainer(systemConfiguration.Catalog));
synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, systemConfiguration);
storageOperationsTask = new StorageOperationsTask(storage, search, notificationPublisher);
metricsCounters = new MetricsCountersManager();
AppDomain.CurrentDomain.ProcessExit += ShouldDispose;
AppDomain.CurrentDomain.DomainUnload += ShouldDispose;
}
开发者ID:jesuslpm,项目名称:ravendb,代码行数:30,代码来源:RavenFileSystem.cs
示例13: RestoreOperation
public RestoreOperation(string backupLocation, InMemoryRavenConfiguration configuration, Action<string> output, bool defrag)
{
this.output = output;
this.defrag = defrag;
this.backupLocation = backupLocation.ToFullPath();
this.configuration = configuration;
}
开发者ID:ToshB,项目名称:ravendb,代码行数:7,代码来源:RestoreOperation.cs
示例14: CreateIndexConfiguration
private InMemoryRavenConfiguration CreateIndexConfiguration ()
{
var configuration = new InMemoryRavenConfiguration();
configuration.FileSystem.IndexStoragePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
return configuration;
}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:7,代码来源:StorageStreamTest.cs
示例15: NewTransactionalStorage
protected ITransactionalStorage NewTransactionalStorage(string requestedStorage, bool runInMemory = true, string path = null)
{
path = path ?? NewDataPath();
var configuration = new InMemoryRavenConfiguration
{
FileSystem =
{
DataDirectory = path
},
Settings = new NameValueCollection
{
{ Constants.RunInMemory, runInMemory.ToString() }
}
};
ITransactionalStorage storage;
switch (requestedStorage)
{
case "esent":
storage = new Raven.Database.FileSystem.Storage.Esent.TransactionalStorage(configuration);
break;
case "voron":
storage = new Raven.Database.FileSystem.Storage.Voron.TransactionalStorage(configuration);
break;
default:
throw new NotSupportedException(string.Format("Given storage type ({0}) is not supported.", requestedStorage));
}
storages.Add(storage);
storage.Initialize(new OrderedPartCollection<AbstractFileCodec>());
return storage;
}
开发者ID:felipeleusin,项目名称:ravendb,代码行数:35,代码来源:StorageAccessorTestBase.cs
示例16: ModifyConfiguration
protected override void ModifyConfiguration(InMemoryRavenConfiguration configuration)
{
configuration.Settings["Raven/Esent/CircularLog"] = "false";
configuration.Settings["Raven/Voron/AllowIncrementalBackups"] = "true";
configuration.RunInUnreliableYetFastModeThatIsNotSuitableForProduction = false;
configuration.Initialize();
}
开发者ID:cocytus,项目名称:ravendb,代码行数:7,代码来源:IncrementalBackupTest.cs
示例17: TransactionalStorage
public TransactionalStorage(InMemoryRavenConfiguration configuration)
{
this.configuration = configuration;
path = configuration.FileSystemDataDirectory.ToFullPath();
settings = configuration.Settings;
bufferPool = new BufferPool(2L * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
}
开发者ID:paulcbetts,项目名称:ravendb,代码行数:8,代码来源:TransactionalStorage.cs
示例18: SchemaCreator
public SchemaCreator(InMemoryRavenConfiguration configuration, TableStorage storage, Action<string> output, ILog log)
{
this.storage = storage;
this.output = output;
this.log = log;
configuration.Container.SatisfyImportsOnce(this);
}
开发者ID:jrusbatch,项目名称:ravendb,代码行数:8,代码来源:SchemaCreator.cs
示例19: TransactionalStorage
public TransactionalStorage(InMemoryRavenConfiguration configuration, Action onCommit)
{
this.configuration = configuration;
this.onCommit = onCommit;
documentCacher = new DocumentCacher(configuration);
exitLockDisposable = new DisposableAction(() => Monitor.Exit(this));
bufferPool = new BufferPool(configuration.Storage.Voron.MaxBufferPoolSize * 1024 * 1024 * 1024, int.MaxValue); // 2GB max buffer size (voron limit)
}
开发者ID:mdavis,项目名称:ravendb,代码行数:8,代码来源:TransactionalStorage.cs
示例20: HandleRequest
private void HandleRequest(GetRequest[] requests, GetResponse[] results, int i, IHttpContext context, InMemoryRavenConfiguration ravenHttpConfiguration, MultiGetHttpContext[] contexts)
{
var request = requests[i];
if (request == null)
return;
server.HandleActualRequest(contexts[i]);
results[i] = contexts[i].Complete();
}
开发者ID:samueldjack,项目名称:ravendb,代码行数:8,代码来源:MultiGet.cs
注:本文中的InMemoryRavenConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论