Beispiel #1
0
 /// <inheritdoc />
 protected override void OnOpenStream()
 {
     this.Data = DataManager.Instance.ReadStream <AnnotatedEvent>(this.Configuration.StreamBinding, DateTime.MinValue, DateTime.MaxValue);
     using (var reader = DataManager.Instance.GetReader(this.Configuration.StreamBinding))
     {
         this.metadata   = reader.AvailableStreams.First(s => s.Name == this.Configuration.StreamBinding.StreamName) as JsonStreamMetadata;
         this.definition = (reader as AnnotationSimpleReader).Definition;
         this.RaisePropertyChanged(nameof(this.Definition));
     }
 }
Beispiel #2
0
        public void Initialize()
        {
            this.booleanSchema = new AnnotationSchema("Boolean");
            this.booleanSchema.AddSchemaValue(null, Color.Gray);
            this.booleanSchema.AddSchemaValue("false", Color.Red);
            this.booleanSchema.AddSchemaValue("true", Color.Green);

            this.definition = new AnnotatedEventDefinition("Definition");
            this.definition.AddSchema(this.booleanSchema);

            this.metadata = new JsonStreamMetadata("Range", 1, typeof(AnnotatedEvent).AssemblyQualifiedName, this.name, this.path);
        }
Beispiel #3
0
 /// <summary>
 /// Creates a new Annotation store and returns an <see cref="AnnotationExporter"/> instance which can be used to write streams to this store.
 /// </summary>
 /// <param name="pipeline">The <see cref="Pipeline"/> that owns the <see cref="AnnotationExporter"/>.</param>
 /// <param name="name">The name of the store to create.</param>
 /// <param name="path">The path to use. If null, an in-memory store is created.</param>
 /// <param name="definition">The annotated event definition used to create and validate annotated events for this store.</param>
 /// <param name="createSubdirectory">Indicates whether to create a numbered subdirectory for each execution of the pipeline.</param>
 /// <returns>An <see cref="AnnotationExporter"/> instance that can be used to write streams.</returns>
 public static AnnotationExporter Create(Pipeline pipeline, string name, string path, AnnotatedEventDefinition definition, bool createSubdirectory = true)
 {
     return(new AnnotationExporter(pipeline, name, path, definition, createSubdirectory));
 }
        /// <summary>
        /// Creates a new annotation partition given the specified parameters.
        /// </summary>
        /// <param name="session">The session that this partition belongs to.</param>
        /// <param name="storeName">The store name of this partition.</param>
        /// <param name="storePath">The store path of this partition.</param>
        /// <param name="definition">The annotated event definition to use when creating new annotated events in this partition.</param>
        /// <param name="name">The partition name.</param>
        /// <returns>The newly created annotation partition.</returns>
        public static AnnotationPartition Create(Session session, string storeName, string storePath, AnnotatedEventDefinition definition, string name = null)
        {
            using (var writer = new AnnotationSimpleWriter(definition))
            {
                writer.CreateStore(storeName, storePath);
                writer.CreateStream(new JsonStreamMetadata(definition.Name, 0, typeof(AnnotatedEvent).AssemblyQualifiedName, storeName, storePath), new List <Message <AnnotatedEvent> >());
                writer.WriteAll(ReplayDescriptor.ReplayAll);
            }

            return(new AnnotationPartition(session, storeName, storePath, name));
        }
Beispiel #5
0
        /// <summary>
        /// Creates and adds an new annotation partition.
        /// </summary>
        /// <param name="storeName">The name of the annotation store.</param>
        /// <param name="storePath">The path of the annotation store.</param>
        /// <param name="definition">The annotated event definition to use when creating new annoted events in the newly created annotation partition.</param>
        /// <param name="partitionName">The partition name. Default is null.</param>
        /// <returns>The newly added annotation partition.</returns>
        public AnnotationPartition CreateAnnotationPartition(string storeName, string storePath, AnnotatedEventDefinition definition, string partitionName = null)
        {
            var partition = AnnotationPartition.Create(this, storeName, storePath, definition, partitionName);

            this.AddPartition(partition);
            return(partition);
        }