public PersistedEventsStorage(PersistedOptions options)
		{
			cache = new JsonDataCache<PersistedEvent>(options);
			this.options = options;
			streamSource = options.StreamSource;
			file = streamSource.OpenReadWrite(dataPath);

			ReadAllFromDisk();

			binaryWriter = new BinaryWriter(file, Encoding.UTF8, leaveOpen: true);

			writerTask = Task.Factory.StartNew(() =>
				{
					try
					{
						WriteToDisk();
					}
					catch (Exception e)
					{
						corruptingException = e;
					}
				});
		}
Example #2
0
		public Scribe(PersistedOptions options)
		{
			Serializer = new JsonSerializer();
			FindClrType = s => Type.GetType(s, throwOnError: true);
			eventsStorage = new PersistedEventsStorage(options);
		}