/// <summary> /// Dispose of remote importer. /// </summary> public void Dispose() { this.disposed = true; this.metaClientThread = null; this.dataClientThread = null; this.storeWriter.Dispose(); this.storeWriter = null; this.connected.Dispose(); }
private RemoteImporter(Func <string, Importer> importerThunk, TimeInterval replay, bool replayRemoteLatestStart, string host, int port, string name, string path, bool allowSequenceRestart) { this.importerThunk = importerThunk; this.replayStart = replay.Left.Ticks; this.replayEnd = replay.Right.Ticks; this.replayRemoteLatestStart = replayRemoteLatestStart; this.host = host; this.port = port; this.allowSequenceRestart = allowSequenceRestart; this.storeWriter = new PsiStoreWriter(name, path); this.StartMetaClient(); }
/// <summary> /// Initializes a new instance of the <see cref="Exporter"/> class. /// </summary> /// <param name="pipeline">The pipeline to add the component to.</param> /// <param name="name">The name of the application that generated the persisted files, or the root name of the files.</param> /// <param name="path">The directory in which the main persisted file resides or will reside, or null to create a volatile data store.</param> /// <param name="createSubdirectory">If true, a numbered sub-directory is created for this store.</param> /// <param name="serializers"> /// A collection of known serializers, or null to infer it from the data being written to the store. /// The known serializer set can be accessed and modified afterwards via the <see cref="Serializers"/> property. /// </param> protected internal Exporter(Pipeline pipeline, string name, string path, bool createSubdirectory = true, KnownSerializers serializers = null) : base(pipeline, $"{nameof(Exporter)}[{name}]") { this.pipeline = pipeline; this.serializers = serializers ?? new KnownSerializers(); this.writer = new PsiStoreWriter(name, path, createSubdirectory); // write the version info this.writer.WriteToCatalog(this.serializers.RuntimeVersion); // copy the schemas present so far and also make sure the catalog captures schemas added in the future this.serializers.SchemaAdded += (o, e) => this.writer.WriteToCatalog(e); foreach (var schema in this.serializers.Schemas.Values) { this.writer.WriteToCatalog(schema); } this.merger = new Merger <Message <BufferReader>, string>(this, (_, m) => { this.Throttle.WaitOne(); this.writer.Write(m.Data.Data, m.Data.Envelope); }); }