Class Importer
Component that reads messages via a specified IStreamReader and publishes them on streams.
Inherited Members
Namespace: Microsoft.Psi.Data
Assembly: Microsoft.Psi.dll
Syntax
public class Importer : Subpipeline, ISourceComponent
Remarks
Reads either at the full speed allowed by available resources or at the desired rate specified by the Pipeline. The store metadata is available immediately after open (before the pipeline is running) via the AvailableStreams property.
Constructors
View SourceImporter(Pipeline, IStreamReader, Boolean)
Initializes a new instance of the Importer class.
Declaration
public Importer(Pipeline pipeline, IStreamReader streamReader, bool usePerStreamReaders)
Parameters
Type | Name | Description |
---|---|---|
Pipeline | pipeline | The pipeline to add the component to. |
IStreamReader | streamReader | Stream reader. |
System.Boolean | usePerStreamReaders | Flag indicating whether to use per-stream readers. |
Properties
View SourceAvailableStreams
Gets the metadata of all the streams in this store.
Declaration
public IEnumerable<IStreamMetadata> AvailableStreams { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IStreamMetadata> |
MessageCreationTimeInterval
Gets the interval between the creation times of the first and last messages written to this store, across all streams.
Declaration
public TimeInterval MessageCreationTimeInterval { get; }
Property Value
Type | Description |
---|---|
TimeInterval |
MessageOriginatingTimeInterval
Gets the interval between the originating times of the first and last messages written to this store, across all streams.
Declaration
public TimeInterval MessageOriginatingTimeInterval { get; }
Property Value
Type | Description |
---|---|
TimeInterval |
Serializers
Gets the set of types that this Importer can deserialize. Types can be added or re-mapped using the Register<T>(String, CloningFlags) method.
Declaration
public KnownSerializers Serializers { get; }
Property Value
Type | Description |
---|---|
KnownSerializers |
StoreName
Gets the name of the store, or null if this is a volatile store.
Declaration
public string StoreName { get; }
Property Value
Type | Description |
---|---|
String |
StorePath
Gets the path of the store, or null if this is a volatile store.
Declaration
public string StorePath { get; }
Property Value
Type | Description |
---|---|
String |
StreamTimeInterval
Gets the interval between the opened times and closed times, across all streams.
Declaration
public TimeInterval StreamTimeInterval { get; }
Property Value
Type | Description |
---|---|
TimeInterval |
Methods
View SourceContains(String)
Indicates whether the store contains the specified stream.
Declaration
public bool Contains(string streamName)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream. |
Returns
Type | Description |
---|---|
System.Boolean | True if the store contains a stream with the specified name, false otherwise. |
CopyStream(String, Exporter, DeliveryPolicy<Message<BufferReader>>)
Copies the specified stream to an exporter without deserializing the data.
Declaration
public void CopyStream(string streamName, Exporter writer, DeliveryPolicy<Message<BufferReader>> deliveryPolicy = null)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream to copy. |
Exporter | writer | The store to copy to. |
DeliveryPolicy<Message<BufferReader>> | deliveryPolicy | An optional delivery policy. |
Dispose()
Declaration
public override void Dispose()
Overrides
View SourceGetMetadata(String)
Returns the metadata for a specified stream.
Declaration
public IStreamMetadata GetMetadata(string streamName)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream. |
Returns
Type | Description |
---|---|
IStreamMetadata | The metadata associated with the stream. |
GetSupplementalMetadata<T>(String)
Returns the supplemental metadata for a specified stream.
Declaration
public T GetSupplementalMetadata<T>(string streamName)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream. |
Returns
Type | Description |
---|---|
T | The metadata associated with the stream. |
Type Parameters
Name | Description |
---|---|
T | Type of supplemental metadata. |
OpenDynamicStream(String, Func<Object>, Action<Object>)
Opens the specified stream as dynamic for reading and returns a stream instance that can be used to consume the messages. The returned stream will publish data read from the store once the pipeline is running.
Declaration
public IProducer<dynamic> OpenDynamicStream(string streamName, Func<dynamic> allocator = null, Action<dynamic> deallocator = null)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream to open. |
Func<Object> | allocator | An optional allocator of messages. |
Action<Object> | deallocator | An optional deallocator to use after the messages have been sent out (defaults to disposing |
Returns
Type | Description |
---|---|
IProducer<Object> | A stream of dynamic that publishes the data read from the store. |
Remarks
Messages are deserialized as dynamic primitives and/or ExpandoObject of dynamic.
OpenStream<T>(String, Func<T>, Action<T>)
Opens the specified stream for reading and returns a stream instance that can be used to consume the messages.
Declaration
public IProducer<T> OpenStream<T>(string streamName, Func<T> allocator = null, Action<T> deallocator = null)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream to open. |
Func<T> | allocator | An optional allocator of messages. |
Action<T> | deallocator | An optional deallocator to use after the messages have been sent out (defaults to disposing |
Returns
Type | Description |
---|---|
IProducer<T> | A stream that publishes the data read from the store. |
Type Parameters
Name | Description |
---|---|
T | The expected type of the stream to open. This type will be used to deserialize the stream messages. |
OpenStreamOrDefault<T>(String, Func<T>, Action<T>)
Opens the specified stream for reading if the stream exists, and returns a stream instance that can be used to consume the messages.
Declaration
public IProducer<T> OpenStreamOrDefault<T>(string streamName, Func<T> allocator = null, Action<T> deallocator = null)
Parameters
Type | Name | Description |
---|---|---|
String | streamName | The name of the stream to open. |
Func<T> | allocator | An optional allocator of messages. |
Action<T> | deallocator | An optional deallocator to use after the messages have been sent out (defaults to disposing |
Returns
Type | Description |
---|---|
IProducer<T> | A stream that publishes the data read from the store, or null if the stream does not exist. |
Type Parameters
Name | Description |
---|---|
T | The expected type of the stream to open. This type will be used to deserialize the stream messages. |