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;
                }
            });
        }
Esempio n. 2
0
 public JsonDataCache(PersistedOptions options)
 {
     this.options = options;
 }
Esempio n. 3
0
 public Scribe(PersistedOptions options)
 {
     Serializer    = new JsonSerializer();
     FindClrType   = s => Type.GetType(s, throwOnError: true);
     eventsStorage = new PersistedEventsStorage(options);
 }