Esempio n. 1
0
            public Future <LockedData> LockData(long?minimumSize = null)
            {
                if (Tangle.Version != Version)
                {
                    throw new TangleModifiedException();
                }

                return(Tangle.QueueWorkItem(new LockDataThunk(NodeIndex, ValueIndex, minimumSize)));
            }
Esempio n. 2
0
        /// <summary>
        /// Reads multiple values from the tangle, looking them up based on a provided sequence of keys,
        ///  and then uses those values to perform a lookup within a second tangle.
        /// </summary>
        /// <param name="keys">The keys to look up in this tangle.</param>
        /// <param name="right">The tangle to join against.</param>
        /// <param name="keySelector">A delegate that takes a key/value pair from this tangle and produces a key to use for a lookup in the other tangle.</param>
        /// <param name="valueSelector">A delegate that takes key/value pairs from both tangles and produces a result for the join.</param>
        /// <returns>A future that will contain the join results.</returns>
        public Future <TOut[]> Join <TLeftKey, TRightKey, TRight, TOut> (
            Tangle <TRight> right, IEnumerable <TLeftKey> keys,
            JoinKeySelector <TLeftKey, T, TRightKey> keySelector,
            JoinValueSelector <TLeftKey, T, TRightKey, TRight, TOut> valueSelector
            )
        {
            Tangle <TRight> .JoinBarrierThunk rightBarrier = null;
            if (!Object.Equals(right, this))
            {
                rightBarrier = new Tangle <TRight> .JoinBarrierThunk();

                right.QueueWorkItem(rightBarrier);
            }

            return(QueueWorkItem(new JoinThunk <TLeftKey, TRightKey, TRight, TOut>(
                                     rightBarrier, right, keys, keySelector, valueSelector
                                     )));
        }
Esempio n. 3
0
        public Future <TangleKey> FindOne(TIndexKey value)
        {
            var key = KeyConverter(value);

            return(Tangle.QueueWorkItem(new FindOneThunk(this, key)));
        }
Esempio n. 4
0
 public static Future <Index <TIndexKey, TValue> > Create(Tangle <TValue> tangle, string name, IndexMultipleFunc <TIndexKey, TValue> function)
 {
     return(tangle.QueueWorkItem(new CreateThunk(name, function)));
 }
Esempio n. 5
0
 /// <summary>
 /// Adds the batch to the Tangle's work queue.
 /// </summary>
 /// <returns>A future that becomes completed once all the work items in the batch have completed.</returns>
 public Future <int> Execute()
 {
     return(Tangle.QueueWorkItem(new Tangle <T> .BatchThunk(this)));
 }
Esempio n. 6
0
 internal Barrier(Tangle <T> tangle, bool opened)
 {
     OpenSignal  = new ManualResetEventSlim(opened);
     ThunkSignal = tangle.QueueWorkItem(this);
 }