public StreamPartition(
                string id,
                Func <IStreamQuery <TCursor>, IStreamQueryPartition <TPartition>,
                      Task <IStreamBatch <TData> > > fetch,
                IStreamQueryPartition <TPartition> partition,
                Action <IStreamQuery <TCursor>, IStreamBatch <TData> > advanceCursor = null,
                Func <ICursor <TCursor> > newCursor = null) : base(advanceCursor, newCursor)
            {
                if (id == null)
                {
                    throw new ArgumentNullException("id");
                }

                if (fetch == null)
                {
                    throw new ArgumentNullException("fetch");
                }
                if (partition == null)
                {
                    throw new ArgumentNullException("partition");
                }

                this.id        = id;
                this.fetch     = fetch;
                this.partition = partition;
            }
 public async Task <IStream <TData, TCursor> > GetStream(IStreamQueryPartition <TPartition> partition)
 {
     return(await getStream(partition));
 }
 private string PartitionIdFor(IStreamQueryPartition <TPartition> partition)
 {
     return(string.Format("{0}/{1}", id, partition));
 }
 /// <summary>
 /// Determines whether a value is within the specified partition.
 /// </summary>
 /// <typeparam name="TPartition">The type of the partition.</typeparam>
 /// <param name="value">The value.</param>
 /// <param name="partition">The partition.</param>
 public static bool IsWithinPartition <TPartition>(
     this TPartition value, IStreamQueryPartition <TPartition> partition)
 {
     return(partition.Contains(value));
 }