Exemplo n.º 1
0
 /// <summary>Encode a batch of keys, each one composed of eight values extracted from each elements</summary>
 public                                       Slice[] EncodeMany <TItem, T1, T2, T3, T4, T5, T6, T7, T8>(IEnumerable <TItem> items, Func <TItem, T1> selector1, Func <TItem, T2> selector2, Func <TItem, T3> selector3, Func <TItem, T4> selector4, Func <TItem, T5> selector5, Func <TItem, T6> selector6, Func <TItem, T7> selector7, Func <TItem, T8> selector8)
 {
     return(Batched <TItem, IDynamicKeyEncoder> .Convert(
                this.Subspace.GetWriter(),
                items,
                (ref SliceWriter writer, TItem item, IDynamicKeyEncoder encoder) => encoder.EncodeKey <T1, T2, T3, T4, T5, T6, T7, T8>(ref writer, selector1(item), selector2(item), selector3(item), selector4(item), selector5(item), selector6(item), selector7(item), selector8(item)),
                this.Encoder
                ));
 }
Exemplo n.º 2
0
 /// <summary>Encode a batch of keys, each one composed of a single value extracted from each elements</summary>
 public                                       Slice[] EncodeMany <TSource, T>(IEnumerable <TSource> items, Func <TSource, T> selector)
 {
     return(Batched <TSource, IDynamicKeyEncoder> .Convert(
                this.Subspace.GetWriter(),
                items,
                (ref SliceWriter writer, TSource item, IDynamicKeyEncoder encoder) => encoder.EncodeKey <T>(ref writer, selector(item)),
                this.Encoder
                ));
 }
Exemplo n.º 3
0
 /// <summary>Encode a batch of keys, each one composed of three values extracted from each elements</summary>
 public                                       Slice[] EncodeMany <TItem, T1, T2, T3>(IEnumerable <TItem> items, Func <TItem, T1> selector1, Func <TItem, T2> selector2, Func <TItem, T3> selector3)
 {
     return(Batched <TItem, IDynamicKeyEncoder> .Convert(
                this.Subspace.GetWriter(),
                items,
                (ref SliceWriter writer, TItem item, IDynamicKeyEncoder encoder) => encoder.EncodeKey <T1, T2, T3>(ref writer, selector1(item), selector2(item), selector3(item)),
                this.Encoder
                ));
 }
Exemplo n.º 4
0
 /// <summary>Encode a batch of keys, each one composed of a single element</summary>
 public                                       Slice[] EncodeMany <T>(IEnumerable <T> items)
 {
     return(Batched <T, IDynamicKeyEncoder> .Convert(
                this.Subspace.GetWriter(),
                items,
                (ref SliceWriter writer, T item, IDynamicKeyEncoder encoder) => encoder.EncodeKey <T>(ref writer, item),
                this.Encoder
                ));
 }
Exemplo n.º 5
0
 public Slice[] Encode <TSource>([NotNull] IEnumerable <TSource> values, [NotNull] Func <TSource, T1> selector1, [NotNull] Func <TSource, T2> selector2)
 {
     Contract.NotNull(values, nameof(values));
     return(Batched <TSource, ICompositeKeyEncoder <T1, T2> > .Convert(
                this.Subspace.GetWriter(),
                values,
                (ref SliceWriter writer, TSource value, ICompositeKeyEncoder <T1, T2> encoder) => writer.WriteBytes(encoder.EncodeKey(selector1(value), selector2(value))),
                this.Encoder
                ));
 }
 public Slice[] Encode <TSource>([NotNull] IEnumerable <TSource> values, [NotNull] Func <TSource, T1> selector1, [NotNull] Func <TSource, T2> selector2, [NotNull] Func <TSource, T3> selector3)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     return(Batched <TSource, ICompositeKeyEncoder <T1, T2, T3> > .Convert(
                this.Subspace.GetWriter(),
                values,
                (ref SliceWriter writer, TSource value, ICompositeKeyEncoder <T1, T2, T3> encoder) => writer.WriteBytes(encoder.EncodeKey(selector1(value), selector2(value), selector3(value))),
                this.Encoder
                ));
 }
 public Slice[] Encode([NotNull] IEnumerable <T> values)
 {
     if (values == null)
     {
         throw new ArgumentNullException("values");
     }
     return(Batched <T, IKeyEncoder <T> > .Convert(
                this.Subspace.GetWriter(),
                values,
                (ref SliceWriter writer, T value, IKeyEncoder <T> encoder) => { writer.WriteBytes(encoder.EncodeKey(value)); },
                this.Encoder
                ));
 }
Exemplo n.º 8
0
        /// <summary>Convert a batch of items into keys of this subspace, in an optimized way.</summary>
        /// <param name="items">Sequence of convertible items that will be packed and appended to the subspace prefix</param>
        public                                       Slice[] PackMany([NotNull, ItemNotNull] IEnumerable <ITupleFormattable> items)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            return(Batched <ITuple, IDynamicKeyEncoder> .Convert(
                       this.Subspace.GetWriter(),
                       items.Select(item => item.ToTuple()),
                       (ref SliceWriter writer, ITuple tuple, IDynamicKeyEncoder encoder) => encoder.PackKey(ref writer, tuple),
                       this.Encoder
                       ));
        }
Exemplo n.º 9
0
        /// <summary>Convert a batch of tuples into keys of this subspace, in an optimized way.</summary>
        /// <param name="tuples">Sequence of tuple that will be packed and appended to the subspace prefix</param>
        public                                       Slice[] PackMany([NotNull, ItemNotNull] IEnumerable <ITuple> tuples)
        {
            if (tuples == null)
            {
                throw new ArgumentNullException("tuples");
            }

            return(Batched <ITuple, IDynamicKeyEncoder> .Convert(
                       this.Subspace.GetWriter(),
                       tuples,
                       (ref SliceWriter writer, ITuple tuple, IDynamicKeyEncoder encoder) => encoder.PackKey(ref writer, tuple),
                       this.Encoder
                       ));
        }