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; }
private SynchronizingFileStream(ITransactionalStorage transactionalStorage, string fileName, StorageStreamAccess storageStreamAccess, RavenJObject metadata, IndexStorage indexStorage, StorageOperationsTask operations) : base(transactionalStorage, fileName, storageStreamAccess, metadata, indexStorage, operations) { md5Hasher = Encryptor.Current.CreateHash(); }
protected StorageStream(ITransactionalStorage transactionalStorage, string fileName, StorageStreamAccess storageStreamAccess, RavenJObject metadata, IndexStorage indexStorage, StorageOperationsTask operations) { TransactionalStorage = transactionalStorage; StorageStreamAccess = storageStreamAccess; Name = fileName; switch (storageStreamAccess) { case StorageStreamAccess.Read: TransactionalStorage.Batch(accessor => fileHeader = accessor.ReadFile(fileName)); if (fileHeader.TotalSize == null) { throw new FileNotFoundException("File is not uploaded yet"); } Metadata = fileHeader.Metadata; Seek(0, SeekOrigin.Begin); break; case StorageStreamAccess.CreateAndWrite: TransactionalStorage.Batch(accessor => { operations.IndicateFileToDelete(fileName); accessor.PutFile(fileName, null, metadata); indexStorage.Index(fileName, metadata); }); Metadata = metadata; break; default: throw new ArgumentOutOfRangeException("storageStreamAccess", storageStreamAccess, "Unknown value"); } }
public RavenFileSystem(InMemoryRavenConfiguration systemConfiguration, string name, TransportState recievedTransportState = null) { this.Name = name; this.systemConfiguration = systemConfiguration; storage = CreateTransactionalStorage(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; }
public StorageOperationsTask(ITransactionalStorage storage, IndexStorage search, INotificationPublisher notificationPublisher) { this.storage = storage; this.search = search; this.notificationPublisher = notificationPublisher; InitializeTimer(); }
public StorageOperationsTask(ITransactionalStorage storage, OrderedPartCollection<AbstractFileDeleteTrigger> deleteTriggers, IndexStorage search, INotificationPublisher notificationPublisher) { this.storage = storage; this.deleteTriggers = deleteTriggers; this.search = search; this.notificationPublisher = notificationPublisher; InitializeTimer(); }
public static StorageStream CreatingNewAndWritting(ITransactionalStorage transactionalStorage, IndexStorage indexStorage, StorageOperationsTask operations, string fileName, RavenJObject metadata) { if (indexStorage == null) throw new ArgumentNullException("indexStorage", "indexStorage == null"); return new StorageStream(transactionalStorage, fileName, StorageStreamAccess.CreateAndWrite, metadata, indexStorage, operations); }
public ConflictArtifactManager(ITransactionalStorage storage, IndexStorage index) { this.storage = storage; this.index = index; }
public RavenFileSystem(InMemoryRavenConfiguration config, string name, TransportState receivedTransportState = null) { ExtensionsState = new AtomicDictionary<object>(); Name = name; ResourceName = string.Concat(Abstractions.Data.Constants.FileSystem.UrlPrefix, "/", name); configuration = config; try { ValidateStorage(); configuration.Container.SatisfyImportsOnce(this); transportState = receivedTransportState ?? new TransportState(); storage = CreateTransactionalStorage(configuration); sigGenerator = new SigGenerator(); fileLockManager = new FileLockManager(); BufferPool = new BufferPool(1024 * 1024 * 1024, 65 * 1024); conflictDetector = new ConflictDetector(); conflictResolver = new ConflictResolver(storage, new CompositionContainer(configuration.Catalog)); notificationPublisher = new NotificationPublisher(transportState); synchronizationTask = new SynchronizationTask(storage, sigGenerator, notificationPublisher, configuration); metricsCounters = new MetricsCountersManager(); search = new IndexStorage(name, configuration); conflictArtifactManager = new ConflictArtifactManager(storage, search); Tasks = new TaskActions(this, Log); Files = new FileActions(this, Log); Synchronizations = new SynchronizationActions(this, Log); AppDomain.CurrentDomain.ProcessExit += ShouldDispose; AppDomain.CurrentDomain.DomainUnload += ShouldDispose; } catch (Exception e) { Log.ErrorException(string.Format("Could not create file system '{0}'", Name ?? "unknown name"), e); try { Dispose(); } catch (Exception ex) { Log.FatalException("Failed to dispose when already getting an error in file system ctor", ex); } throw; } }
public static SynchronizingFileStream CreatingOrOpeningAndWriting(ITransactionalStorage storage, IndexStorage search, StorageOperationsTask operationsTask, string fileName, RavenJObject metadata) { return new SynchronizingFileStream(storage, fileName, StorageStreamAccess.CreateAndWrite, metadata, search, operationsTask) { PreventUploadComplete = true }; }